Pre-Render Script over network - Working method!

0 votes

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Dariusz's picture

Script location

Hey

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

Regards
Dariusz

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.