Is it possible to change the Render Region using a PreFrame maxscript?
Good question. If you have specified a region render in the Deadline submitter, we will pass the region information directly to the “Render” function that tells Max to render. Theoretically, if the pre-frame script is called by this “Render” function, you might be able to override the region.
Have you tested it yet yourself?
I’m not sure the variables are exposed to maxscript, or it might have already been passed to the render process.
Doesn’t seem to be anything in the DeadlineUtil interface to change anything there, it’s beyond the SMTDSettings and you can’t set a viewport region in RenderSlave Mode.
I’m trying to make a clever auto-region renderer to void the need to set it up manually for different passes, but I can’t set it before I send it to Deadline, it has to be at the PreFrame stage.
I don’t think it will work then. If you can’t set the viewport region, then there really is no way to override the region settings that Deadline is passing to the “Render” function in a preframe script (it’s too late by then). The only way I could see if working is if the preframe script modifies the region directly, which I guess only works in workstation mode.
The other way I was thinking about was the render region auto-selected option that is in max,but doesn’t seem like deadline supports this at all?
Heh, I’m not actually familiar with that option. Is that something you can set via maxscript?
Just back on this again… I’m trying to work out how deadline works and when the region values get set with the render command, and whether we can intercept it.
And just for clarification this would be on a postLoad script not PreFrame.
I don’t think a post-load script would work either. We call the render command after the scene is loaded, so even if you set the region post-load, the region settings we pass to the render command afterwards will override it.
I was wondering when the actual render command is called, because I guess you’re not doing a standard commandline render. If so at the post-load point would it be theoretically possible (with a new feature perhaps) to be able to pass a new set of region values to Deadline, or have they already been sent to max.
You’re right, it’s not a standard command line render. We actually hook into the Max SDK using our Lightning plugin that we get Max to load at startup. The 3dsmax.py script in our 3dsmax plugin communicates with Lighting over a socket connection to tell Max what to do.
We make separate commands to load the scene file and then execute the customize.ms maxscript. After that, the region rendering settings are passed on. You can see this in the LoadMaxFile function in 3dsmax.py. So I think to do what you want, you would have to figure out the region you want to render in 3dsmax.py and alter the values passed with the region rendering settings.
Ok so what I need to be able to do is pass from a maxscript postLoad script, 4 integer values to the 3dsmax.py RenderFrame function.
I guess the easiest thing would be for my maxscript to write these 4 values to a temporary file, and then change the 3dsmax.py file to check for this files existence, if so, grab the values, then delete it.
For the first time it looks like this is going to be possible!
Things would be a lot simpler if it accepted ‘Selected’ as the RegionType… I wonder if that can work or not…
Indeed, the override of the region settings in 3ds max complicate things. We cannot do “Auto Region Selected” for example. It seems it is not supported by Deadline. For efficiency, it’s really important. Please, any pointer as to how we can deactivate the region override in 3dsmax.py? @rrussell