How to track the rendering progress programmatically

automation.msi
Explorer

How to track the rendering progress programmatically

automation.msi
Explorer
Explorer

Hi,

Within my automation I launch rendering with python.(Open MAX, open project, start rendering, close MAX).

 

Is there a way to see/track progress of rendering programmatically? Or does MAX store somewhere in file system an accessible progress information or rendering(image) preview? Thanks

0 Likes
Reply
574 Views
3 Replies
Replies (3)

drew.avis
Autodesk
Autodesk

You could attach a calback to #preRenderFrame or #postRenderFrame and calculate progress based on the total number of frames.  See https://help.autodesk.com/view/MAXDEV/2022/ENU/?guid=GUID-E5BE0058-2216-4E0B-88AF-680CA58AAC73 for some details.

 

Hope that helps,

Drew



Drew Avis
Content Experience Designer
0 Likes

automation.msi
Explorer
Explorer

Hi Drew,

thanks for your answer. Can you please help me out how to implement your advice in to my snippet?

Let's say loop every 2 minutes and get values you suggested (#preRenderFrame)

import pymxs
import codecs

pymxs.runtime.loadMaxFile(project_path)
bmp = pymxs.runtime.render(outputFile=output_path)
pymxs.runtime.save
pymxs.runtime.quitMax()

thank a lot!

0 Likes

drew.avis
Autodesk
Autodesk

Something like this will print the time for each frame processed during rendering, it might give you a starting point:

 

from pymxs import runtime as mxs

def renderCallback(): 
	a = mxs.callbacks.notificationParam()
	print (f"we're on frame: {a[12]}"
)

mxs.callbacks.removeScripts( id=mxs.name('render_test'))
mxs.callbacks.addScript(mxs.name('preRenderFrame'), renderCallback, id=mxs.name('render_test'))


Drew Avis
Content Experience Designer
0 Likes