Notifications
Clear all
[Closed] Pre-Render Script – What Frame am I rendering?
May 22, 2009 2:00 am
How can I, using a pre-render script determin what frame is being rendered.
I want to say something along the lines of…
If currentframe == 0 then *do something
If currentframe == 1 then *do something else.
1 Reply
May 22, 2009 2:00 am
Hi David,
you need a preRender callback. The first render frame time value is stored in its 23th notification parameter. Here is a sample script that checks if current render starts at frame 0f or 1f and toss in some geometry accordingly.
rollout rolTest "PreRender Test"
(
checkButton cbtTest "Set Check" width:98 align:#left offset:[-10, -2]
function frameCheck =
(
local aCallbackParam = callbacks.notificationParam()
local tFirstFrame = undefined
if (aCallbackParam != undefined) then
tFirstFrame = aCallbackParam[23]
case tFirstFrame of
(
0f: ( format "This is Frame 0f, let's make a Box!
"; Box() )
1f: ( format "This is Frame 1f, let's make a Sphere!
"; Sphere() )
default: ( format "This is Frame %, I don't know what to do...
" tFirstFrame )
)
)
on cbtTest changed bState do
(
if (bState == true) then
callbacks.addScript #preRender "rolTest.frameCheck()" id:#cbRender
else
callbacks.removeScripts id:#cbRender
)
on rolTest close do
callbacks.removeScripts id:#cbRender
) -- End Rollout
createDialog rolTest 104 27 style:#(#style_toolwindow, #style_border, #style_sysmenu)
- Enrico