ScriptSpot home

Pre-Render Script over network - Working method!

3ds Max compatibility
Unknown
Report a problem
Community reviewsNo reviews yet.

Listing details

Listing created
How compatibility works

Compatibility comes from the author’s supported range or requirements in the original listing. A tested version records what the author tried.

“2020 unconfirmed” in the catalog means support for 3ds Max 2020 is still unknown.

Community reports record successful tests on specific releases.

Posted by

hummus

More by this author

Description

For my specific reason I needed to send a render of a selected object. I've been trying unsuccessfully to send a job to render over the network using the "setRenderType #selected" active to render a selected item only.
(in combination with VRay's "renderers.current.imageSampler_renderMask_type = 2")

Problem is - once it gets to the network, my object is no longer selected.

So I delved into the Pre-Render script. However, even though I managed to create a small single-line script that selects my object and set it to run before the render (pre-render) - Max would constantly ignore it:


preRendScript = @"\\server\PreRender_selectNet.ms"
usePreRendScript = true

It would always come up saying that it cannot render because no object is selected. It was trying to render in "selected" mode before actually making a selection.

So I tried using a preRender callbacks script:


callbacks.removescripts id:#net_select
txt = "for n in objects do if matchpattern n.name pattern:\"Net*\" == true do select n\n"
callbacks.addscript #preRender txt id:#net_select

That too failed to start before the render.

So - here's the solution:
Use a callbacks that would call a script when the file opens instead of before it renders. This method did the job:


callbacks.removescripts id:#net_select
txt = "for n in objects do if matchpattern n.name pattern:\"Net*\" == true do select n\n"
callbacks.addScript #filePostOpen txt id:#net_select persistent:true

Now I can properly run Pre-Render scripts that would be embedded in the file and would be distributed with the file over a network render farm and run properly.

Enjoy.

Comments (2)
Dariusz

Script location

Hey

Where in the scene did you put that script that it remained in the file?

Regards
Dariusz

Reply to Dariusz
hummus

Seeing this only two years later

Sorry - for some reason I wasn't notified about this message. Seeing this only two years later.
As to your question - read about callbacks. It enables you to add scripts into the files that can then be accessed in different ways - when the file opens, closes, renders, etc.