[Closed] #preRenderEval
#preRenderEval isn’t working correctly for me.
What I’m doing is hiding objects and unhiding objects on a per frame basis at rendertime via a callback.
So at frame 1 I want only the object “Sphere01” visible where as at frame 2 I want “Sphere01” and “Box01” visible, and frame 3 the all of the objects visible (box, sphere, plane).
This sounds easy and using registerTimeCallback() it executes flawlessly in the viewport, but at rendertime, it prints out everything correctly including the current frame, the object nodes and the sort It’s not hiding or unhiding them.
Am I missing an updateObject() function or something?
To recreate:
Create a scene with a plane, box, and sphere (all named default Sphere01…Box01…Plane01)
execute the following script:
global setRenderCallback
fn setRenderCallback = (
local curTimeInt = ((currentTime as integer)/TicksPerFrame)
format "Frame: %
" curTimeInt
for o in objects do (
format " hiding: %
" o.name
)
case curTimeInt of (
1: unhide $Sphere01
2: unhide $Box01
3: unhide $Plane01
)
)
callbacks.removeScripts id:#helpMePlease
callbacks.addScript #preRenderEval "setRenderCallback()" id:#helpMePlease
the current frame and object name is listed in the listener window, but nothing happens.
Thanks for your help,
Colin
before scene rendering the renderer makes “scene snapshot” and renders this “snapshot” (it includes render states, render parameters, scene geometry, animation, lighting, materials, etc.). So any scene changes during rendering don’t effect the result. Use visibility track (you can script it if you want) to achieve hide/unhide node behavior.