I’ve been working on implementing metadas in my exrs recently.
Since i’m not using the Vrayframe Buffer, i can’t use the Vray OptionRE render element to add custom metadatas to the actual exrs, so i’m working with a pre-render script.
Basically, the scripts generates a new preRenderFrame callback that evaluates assets in my scene (particularly, the camera) and modifies the EXR metadata attributes before saving.
For some reason, this callback was not evaluated between each frame, so I had to use a trick: i’m generating another exr, of 1x1 px in the same folder ans my render output. this Exr inherits my exr attributes and saves properly between each frame.
The scripts works perfectly locally when i add it to the pre-render script option in the render settings window, but when i submit it with deadline, it gets ignored.
I saw in the deadline submitter script window, under the “scripts” tab , that you can add pre-render scripts here, but even then, it still doesn’t get evaluated.
I feel like it has to do with how 3dsmax is launched in “slave” mode on the farm, and being limited, doesn"t want to evaluate my script, but i’m not sure…
I am attaching the script to this post, for you guys to take a look at. i tried to comment it properly for you to follow
I have not tried running your script yet, I just took a peek into its content.
When 3ds Max is running on Deadline in slave mode, it has no UI whatsoever, so any MAXScript functionality relying on the UI being there won’t be executed. In your case, things like renderSceneDialog.close(), viewport.getCamera() or viewport.activeViewport won’t do anything because neither a Render Dialog nor a Viewport exist in Slave mode.
Since 3ds Max in slave mode runs without a license, Autodesk has also added a few other limitations to MAXScript execution to prevent any saving operations. So it would not be possible to save or export a MAX scene out of a running slave session (but this does not affect you).
In addition, for a script to be run by Deadline at one of the supported callback events, it must simply contain the code to be executed, and return a boolean value (True for success, False to fail). So even if your script was able to run correctly in Slave mode, your current code would require some modifications - you would extract the body of the add_metadata_to_exr() function into a plain new script, and add the line TRUE to the end of it to signal Deadline that it is done.
However, given the way your script works, it might require some rethinking of the way you acquire the data.
I will have a closer look and let you know if I figure out something.
Oh hi Bobo !
It’s great to get a reply from you hehe
Ok … that’s what i thought: i’m hitting a limitation of the slave mode hmm
So based on your input, i’m going to try the following code, in the "preframe script’ option, in deadline.
Instead of creating a callback, i’ll rely on deadline to evaluate the script before each frame (i’m guessing it’s actually adding the callback itself?)
For now, i’ve simplified the camera issue by picking the first physical camera it finds in the scene (i’ll deal with the issue of picking the proper one later)
I also got rid of the renderdialog hacks
I hope the callbacks.notificationParam() works cause i’m not sure how else i can gather the current_rendering_frame information to put in my filename…
EDIT: so as i feared, the notificationParam didn’t work… but after reading a bit i found a way to fix this !
local du = DeadlineUtil
local myframe = du.currentFrame
EDIT: I’m updating the attached file
It looks like it now works - i need to check and make sure the metadata are transferred, but i definitely have a file with the proper name created in my folder, so this is clearly a step forward hehe
Not quite. When run by the Slave, 3ds Max is actually being controlled by the “lightning.dlx” plugin, and there is a Python plugin file that defines the order of operations the plugin will perform, including the various scripts. But the effect is the same, just the mechanism is different.
The good news is that the DeadlineUtil interface exposed by the lightning.dlx lets you access all submission parameters (including the name of the current camera, which the user can also modify through the Deadline Monitor > Job Properties dialog), as well as the current time (so you can get the frame number you need). Take a look at the MAXScript Job default template inside the Submit Max To Deadline dialog. Or check out the MAXScript Job tutorial on the Deadline website: deadline.thinkboxsoftware.com/su … -maxscript