<?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: Get current frame in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12959387#M564</link>
    <description>&lt;P&gt;&lt;A href="https://help.autodesk.com/view/MAXDEV/2024/ENU/?guid=GUID-51429B01-2FC6-4746-9E88-5EB5D93056CC" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/MAXDEV/2024/ENU/?guid=GUID-51429B01-2FC6-4746-9E88-5EB5D93056CC&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Aug 2024 21:20:46 GMT</pubDate>
    <dc:creator>istan</dc:creator>
    <dc:date>2024-08-14T21:20:46Z</dc:date>
    <item>
      <title>Get current frame</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12958309#M563</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have a question about the current frame and pre-render script.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Basically, I would like to have the output file named by the scene material (VraySwitchMtl), which is animated. So, the output file name would be something like:&lt;BR /&gt;“Chair” + &amp;lt;VraySwitchMtl.index[currentFrame]&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This setup only works for the current frame that is shown in the timeline. I would like to read the current render frame number to achieve full functionality.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions would be appreciated.&lt;/P&gt;&lt;P&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Tom&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 13:52:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12958309#M563</guid>
      <dc:creator>mislavto_bargra</dc:creator>
      <dc:date>2024-08-14T13:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get current frame</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12959387#M564</link>
      <description>&lt;P&gt;&lt;A href="https://help.autodesk.com/view/MAXDEV/2024/ENU/?guid=GUID-51429B01-2FC6-4746-9E88-5EB5D93056CC" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/MAXDEV/2024/ENU/?guid=GUID-51429B01-2FC6-4746-9E88-5EB5D93056CC&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 21:20:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12959387#M564</guid>
      <dc:creator>istan</dc:creator>
      <dc:date>2024-08-14T21:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: Get current frame</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12962321#M565</link>
      <description>&lt;P&gt;If you are referencing the currentTime.frame value, it won't work as expected. This is because currentTime.frame returns the frame that is active on the time slider, and you need the frame number that is currently rendering.&lt;BR /&gt;&lt;BR /&gt;Here is code that I am using as Pre-render script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;mat = sceneMaterials["myMat"] /*Material to get names*/
matNo = (mat.switchNum as integer)
matObj = mat.switchMtl
f = currentTime.frame /*??? want to get frame number that is currently rendering*/
matName =  matObj[f+1].name

rendSaveFile = true
fileLoc = "C:/Users/xyz/Desktop/"
fileExt = ".png"
rendOutputFilename = fileLoc + matName + fileExt&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Edit:&lt;BR /&gt;Found solution to read out which frame number is rendering, but still&amp;nbsp;&lt;SPAN&gt;can't get that value into Pre-render script.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;fn myCallback = currentTime.frame as integer
callbacks.addScript #prerenderframe myCallback id:#myCtCallback&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 11:01:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12962321#M565</guid>
      <dc:creator>tgrabar</dc:creator>
      <dc:date>2024-08-16T11:01:35Z</dc:date>
    </item>
    <item>
      <title>Betreff: Get current frame</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12963510#M566</link>
      <description>&lt;P&gt;The MXS help for "#prerenderframe" says: "&lt;SPAN&gt;The current frame being rendered is set into the MAXScript currentTime context and system global"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I just tried this test and it seems to work correctly:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;callbacks.removeScripts id:#myCtCallback
fn myCallback = (
	local t = currentTime.frame as integer
	format "Rendering frame %\n" t
)
callbacks.addScript #prerenderframe myCallback id:#myCtCallback&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Evaluating this code and then rendering either a single frame or a range of frames will print the rendered frame numbers to the listener...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 16:25:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12963510#M566</guid>
      <dc:creator>MartinBeh</dc:creator>
      <dc:date>2024-08-16T16:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Get current frame</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12964415#M567</link>
      <description>&lt;P&gt;it sounds like you need only the currently rendering time... so the easiest way to get is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;callbacks.removescripts id:#my_render_monitor


fn on_preRenderEval = 
(
        t = int (callbacks.notificationParam())
	format "frame: %\n" t
)

callbacks.addscript #preRenderEval "on_preRenderEval()" id:#my_render_monitor&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just know -&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;#preRenderEval&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;is the last render notification, after which you will not be able to change anything in the scene.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 17 Aug 2024 08:30:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12964415#M567</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2024-08-17T08:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Get current frame</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12966764#M568</link>
      <description>&lt;P&gt;Thank you for the responses. They helped me better understand the entire rendering process.&lt;BR /&gt;&lt;BR /&gt;Both methods, &lt;STRONG&gt;#preRenderEval&lt;/STRONG&gt; and &lt;STRONG&gt;#prerenderframe&lt;/STRONG&gt;, return values as expected.&lt;/P&gt;&lt;P&gt;However, I'm still having trouble saving the image using the &lt;STRONG&gt;rendOutputFilename&lt;/STRONG&gt; function.&lt;BR /&gt;I can't set name of output file based on the material switch ID.&amp;nbsp;&lt;BR /&gt;I tried incorporating the lines of code into the &lt;STRONG&gt;preRenderEval&lt;/STRONG&gt; , but without success.&lt;BR /&gt;&lt;BR /&gt;Is it even possible to control &lt;STRONG&gt;rendOutputFilename&lt;/STRONG&gt; during the pre-render phases?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 07:26:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12966764#M568</guid>
      <dc:creator>tgrabar</dc:creator>
      <dc:date>2024-08-19T07:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: Get current frame</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12978071#M569</link>
      <description>&lt;BLOCKQUOTE&gt;Is it even possible to control &lt;STRONG&gt;rendOutputFilename&lt;/STRONG&gt; during the pre-render phases?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You might want to consider using the render() method in MAXScript directly - that will return a bitmap which you can save, or it can directly be called with an outputfile: argument with the filename to save to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 21:23:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-current-frame/m-p/12978071#M569</guid>
      <dc:creator>MartinBeh</dc:creator>
      <dc:date>2024-08-23T21:23:30Z</dc:date>
    </item>
  </channel>
</rss>

