PDA

View Full Version : Pre-Render Script - What Frame am I rendering?


DaveWortley
05-22-2009, 02: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.

SyncViewS
05-22-2009, 07:56 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!\n"; Box() )
1f: ( format "This is Frame 1f, let's make a Sphere!\n"; Sphere() )
default: ( format "This is Frame %, I don't know what to do...\n" 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

CGTalk Moderation
05-22-2009, 07:56 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.