<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Script to Rename Each Frame to Custom Prefix? in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12667583#M496</link>
    <description>Ahh I see, ok I'll give that a try, thanks!</description>
    <pubDate>Tue, 26 Mar 2024 21:27:30 GMT</pubDate>
    <dc:creator>andymc4997</dc:creator>
    <dc:date>2024-03-26T21:27:30Z</dc:date>
    <item>
      <title>Script to Rename Each Frame to Custom Prefix?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12571207#M488</link>
      <description>&lt;P&gt;Hey Maya programmers,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Per the title, I was wondering if it's possible to output each frame of my scene with a custom prefix in the filename. I assume this would be done via the "Pre render frame MEL:" section in Render Options? I would like this functionality because instead of creating multiple cameras/render layers for my still renders, I prefer to keyframe positions and visibility for various parts. Of course then I have to manually rename each outputted frame.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully I'm clearly explaining what I'm looking for, so any help would be greatly appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 13:09:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12571207#M488</guid>
      <dc:creator>andymc4997</dc:creator>
      <dc:date>2024-02-20T13:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Rename Each Frame to Custom Prefix?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12571759#M489</link>
      <description>&lt;P&gt;you would have to somehow provide a list for each custom prefix you wanted, so if your render sequence was 20 frames, you'd have to have a list of 20 custom prefix names, right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not super au-fait with rendering, and certainly not with using preRender MEL functions, so there may be a much better way to do this, but here is one very simple approach that at least shows you what you want can be done.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you create a &lt;STRONG&gt;preRender&lt;/STRONG&gt; global MEL proc (called whatever) and generate your list of prefixes, like so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;global proc preRender()
{
    global string $gPrefixNames[] = {
        "Homer",
        "Bart",
        "Lisa",
        "Maggie",
        "Marge"
    };
    setAttr defaultRenderGlobals.imageFilePrefix -type "string" $gPrefixNames[0];
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This example assumes we have a render sequence of FIVE frames: 0,1,2,3,4 and the fives names listed represent the prefixes for each frame. (We also set the first one here, as the PreRenderFrame doesn't actuallty seem to run before the first frame is rendered?&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt; ).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then we create a second MEL proc for &lt;STRONG&gt;preRenderFrame&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;global proc preRenderFrame()
{
    global string $gPrefixNames[];
    int $frame = `currentTime -q`;
    string $prefix = $gPrefixNames[$frame];
    setAttr defaultRenderGlobals.imageFilePrefix -type "string" $prefix;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;enter both of these functions into the relevant &lt;STRONG&gt;Render Options&lt;/STRONG&gt; fields:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FirespriteNate_0-1708449414372.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1328284i115619F283C6FD61/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FirespriteNate_0-1708449414372.png" alt="FirespriteNate_0-1708449414372.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and then the results after executing a Render Sequence should be something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Starting Render Sequence with Maya Software
Rendering masterLayer from frame 1 to frame 5
Rendering Frame: 1 (1/5)  Camera: persp  Layer: masterLayer
	D:/test_proj/images/tmp/Homer.0001.png
Rendering Frame: 2 (2/5)  Camera: persp  Layer: masterLayer
	D:/test_proj/images/tmp/Bart.0002.png
Rendering Frame: 3 (3/5)  Camera: persp  Layer: masterLayer
	D:/test_proj/images/tmp/Lisa.0003.png
Rendering Frame: 4 (4/5)  Camera: persp  Layer: masterLayer
	D:/test_proj/images/tmp/Maggie.0004.png
Rendering Frame: 5 (5/5)  Camera: persp  Layer: masterLayer
	D:/test_proj/images/tmp/Marge.0005.png

Sequence rendering completed&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe this is some help until you get any better answers&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 17:27:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12571759#M489</guid>
      <dc:creator>FirespriteNate</dc:creator>
      <dc:date>2024-02-20T17:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Rename Each Frame to Custom Prefix?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12643724#M490</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4515326"&gt;@FirespriteNate&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry it's been so long since responding to this. Thanks for your reply, but unfortunately, nothing happened after entering your code in their respective fields in Render Settings.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I doing something wrong? Do I need to point to external MEL files?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andymc4997_0-1710523852295.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1337705iCCA0A81FF08A8D81/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andymc4997_0-1710523852295.png" alt="andymc4997_0-1710523852295.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 17:30:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12643724#M490</guid>
      <dc:creator>andymc4997</dc:creator>
      <dc:date>2024-03-15T17:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Rename Each Frame to Custom Prefix?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12644226#M491</link>
      <description>&lt;P&gt;defining a global procedure doesn't actually run it. What you have done there is simply &lt;EM&gt;define&lt;/EM&gt; a MEL function in each case. My suggestion was you define those global procs &lt;EM&gt;first&lt;/EM&gt; in MEL (e.g. in a Script Editor MEL tab) and then you just&amp;nbsp;&lt;STRONG&gt;call&lt;/STRONG&gt; the function names (i.e. run that proc) in the render callback.&lt;/P&gt;&lt;P&gt;Basically, the text/code you type into those &lt;STRONG&gt;RenderOptions&amp;nbsp;&lt;/STRONG&gt;fields should be only a MEL command (proc) name.&lt;/P&gt;&lt;P&gt;There are a couple of different ways to achieve this, but for simplicity sake, my suggestion would be to save both of those procs into individual text files in your &lt;STRONG&gt;Documents\maya\scripts&lt;/STRONG&gt; folder and call them the SAME name as their global proc name.. so if you have:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;global proc preRenderCode()
{
    // blah, blah, blah...
}&lt;/LI-CODE&gt;&lt;P&gt;you save that as&amp;nbsp;&lt;STRONG&gt;preRenderCode.mel&amp;nbsp;&lt;/STRONG&gt;&lt;EM&gt;(notice how the mel file name is EXACTLY the same as the proc name)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;then in your pre render field you just input:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;preRenderCode&lt;/LI-CODE&gt;&lt;P&gt;to run that MEL proc. same for post render and whatever other callbacks you want to supply.&lt;/P&gt;&lt;P&gt;Don't try to actually define a function in those fields.&lt;/P&gt;&lt;P&gt;Hopefully that should fix it.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 22:32:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12644226#M491</guid>
      <dc:creator>FirespriteNate</dc:creator>
      <dc:date>2024-03-15T22:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Rename Each Frame to Custom Prefix?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12653527#M492</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4515326"&gt;@FirespriteNate&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok so it sort of worked.. lol&lt;BR /&gt;&lt;BR /&gt;A couple issues:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The script skips over the first name and starts applying them at the second. Here are how my naming is set in the preRender MEL:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andymc4997_0-1710941228231.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1339461iFEF5223A19CE3AAD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andymc4997_0-1710941228231.png" alt="andymc4997_0-1710941228231.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I ran a 3 frame test render sequence, it gave me this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andymc4997_1-1710941270822.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1339462iADCD5334D097D26E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andymc4997_1-1710941270822.png" alt="andymc4997_1-1710941270822.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The naming should actually be, "Front", "34_Left", and "34_Right". Could this possibly be because my frames don't start from 0? I don't like that Maya does this, so I always start with 1 as my first frame.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It also inserts a "_1" into the first two frames, but not the 3rd? Would you know why this is happening?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks so much!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 13:33:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12653527#M492</guid>
      <dc:creator>andymc4997</dc:creator>
      <dc:date>2024-03-20T13:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Rename Each Frame to Custom Prefix?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12654448#M493</link>
      <description>&lt;P&gt;Hey Andy, yeah, I guess not starting at frame 0 could have this effect, if so, you could probably just fix that by simply adding a null first entry in the &lt;STRONG&gt;$gPrefixNames&amp;nbsp;&lt;/STRONG&gt;list (i.e. just insert "", before "Front" in your array).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have no idea where the _1 is coming from though, I don't know how you've set the numbering/suffix options, but it could also be due to the filename "&lt;SPAN&gt;34_Left&lt;/SPAN&gt;" already exising from an earlier aborted test or something maybe?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 20:22:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12654448#M493</guid>
      <dc:creator>FirespriteNate</dc:creator>
      <dc:date>2024-03-20T20:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Rename Each Frame to Custom Prefix?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12666515#M494</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4515326"&gt;@FirespriteNate&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I tried entering the null, and it apparently broke the script, as nothing happens now when outputting the frames.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's how I edited it:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andymc4997_0-1711461091461.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1341998i2B06FA69F7650AD0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andymc4997_0-1711461091461.png" alt="andymc4997_0-1711461091461.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 13:51:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12666515#M494</guid>
      <dc:creator>andymc4997</dc:creator>
      <dc:date>2024-03-26T13:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Rename Each Frame to Custom Prefix?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12666923#M495</link>
      <description>&lt;P&gt;You've added a new "element zero" to that array, which is an empty value, but at the end of that bit of code, you are still setting the &lt;STRONG&gt;.imageFilePrefix&lt;/STRONG&gt; to the &lt;EM&gt;first&lt;/EM&gt; entry in the array (&lt;STRONG&gt;$gPrefixNames[0])&lt;/STRONG&gt;, which is now nothing.&lt;/P&gt;&lt;P&gt;You probably want to update this to the correct index, i.e.&amp;nbsp;&lt;STRONG&gt;$gPrefixNames[1]&lt;/STRONG&gt; to match the desired frame 1.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 16:33:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12666923#M495</guid>
      <dc:creator>FirespriteNate</dc:creator>
      <dc:date>2024-03-26T16:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Rename Each Frame to Custom Prefix?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12667583#M496</link>
      <description>Ahh I see, ok I'll give that a try, thanks!</description>
      <pubDate>Tue, 26 Mar 2024 21:27:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-to-rename-each-frame-to-custom-prefix/m-p/12667583#M496</guid>
      <dc:creator>andymc4997</dc:creator>
      <dc:date>2024-03-26T21:27:30Z</dc:date>
    </item>
  </channel>
</rss>

