jukka.alander
09-09-2008, 04:40 PM
Hello !
I'm trying to create a script that runs before each frame is rendered in an animation that would be rendered on a farm.
Script checks through all lights and sets them on/off depending on a visibility of their parents. It does work when used manually (not as callback).
Here's the code for manual usage:
for i = 1 to lights.count do (
lights[i].on = off
if lights[i].parent.visibility == true then
(
lights[i].on = on
)
)
Problem I'm facing is that it does not work when used as #preRenderFrame callback. The lights do set correctly before the first frame rendered, but not during the animation (thousands of frames) as multiple frames are rendered on a single machine.
This is what I have in prerender script:
callbacks.removescripts id:#swl
skripti = "print currentTime \n"
skripti += "for i = 1 to lights.count do ( \n"
skripti +="lights[i].on = off\n"
skripti +=" if lights[i].parent.visibility == true then (lights[i].on = on) ) \n"
callbacks.addScript #preRenderFrame skripti id:#swl
Besides #preRenderFrame I've tried #preRenderEval. #preRender cannot be used as it is only executed in the beginning of the animation..
I use VRay 1.5 and Max 2009 64-bit.
Any help would be great to have :)
Jukka
I'm trying to create a script that runs before each frame is rendered in an animation that would be rendered on a farm.
Script checks through all lights and sets them on/off depending on a visibility of their parents. It does work when used manually (not as callback).
Here's the code for manual usage:
for i = 1 to lights.count do (
lights[i].on = off
if lights[i].parent.visibility == true then
(
lights[i].on = on
)
)
Problem I'm facing is that it does not work when used as #preRenderFrame callback. The lights do set correctly before the first frame rendered, but not during the animation (thousands of frames) as multiple frames are rendered on a single machine.
This is what I have in prerender script:
callbacks.removescripts id:#swl
skripti = "print currentTime \n"
skripti += "for i = 1 to lights.count do ( \n"
skripti +="lights[i].on = off\n"
skripti +=" if lights[i].parent.visibility == true then (lights[i].on = on) ) \n"
callbacks.addScript #preRenderFrame skripti id:#swl
Besides #preRenderFrame I've tried #preRenderEval. #preRender cannot be used as it is only executed in the beginning of the animation..
I use VRay 1.5 and Max 2009 64-bit.
Any help would be great to have :)
Jukka
