[Closed] Timer not ticking
I’m implementing some detail reporting in one of my batch rendering scripts that displays information about the last rendered frame and about all frames rendered in the current batch. I’m using a timer to calculate average render times and some progressbars to display current frame completion. Here’s what I’m doing:
secondsVal = 0
minutesVal = 0
rollout renderProgress "Rendering Progress"
(
label taskLabel "Task Complete"
progressBar taskComplete color:(color 200 200 200)
label compLabel "Composite Complete"
progressBar compComplete color:(color 200 200 200)
timer clock "renderClock"
label timeElapsed "This Frame:" pos:[110,90]
label timeLabel "" pos:[200,90]
label avgTime "Avg Frame:" pos:[110,115]
label avgTimeLabel "" pos:[200,115]
on clock tick do
(
secondsVal += 1
if secondsVal == 60 then
(
secondsVal = 0
minutesVal += 1
)
if minutesVal > 0 then
(
timeLabel.caption = (minutesVal as string)+"m "+(secondsVal as string)+"s"
)
else
(
timeLabel.caption = (secondsVal as string)+"s"
)
)
)
createDialog renderProgress style:#(#style_border, #style_titlebar) pos:[45,88] width:300 height:110
The script makes 4 render() calls, and after each has returned a frame, compComplete is updated to reflect the progress. taskComplete is used for showing progress of each of the 3 composites made from the renders, and compComplete is incremented accordingly.
Here’s the code that updates the dialog’s labels after each comp of 4 passes is made:
totalSeconds += (minutesVal*60+secondsVal)
avgVal = totalSeconds/compCount
avgSecondsVal = ((mod avgVal 60) as integer)
avgMinutesVal = avgVal/60
renderProgress.avgTimeLabel.text = (avgMinutesVal as string)+"m"+(avgSecondsVal as string)+"s"
Here’s the problem: my timer isn’t ticking like it should be. If I run this in a test script that just creates the dialog, it works just fine, updating the minutesVal and secondsVal appropriately. I’m guessing that the render() and compositing operations (which iterate through 1574×1250 pixel bitmaps) are causing the problems, but I don’t know a way around it. In the end, the timer gets out 2 ticks every ~15 minutes, and updates the dialog accordingly, so I know it’s not a problem with getting the values there, it’s a problem with the values themselves. Any help would be greatly appreciated.
Have u tried lowering the interval of timer to something less than 1 second (by default it is 1 seconds). Your renders maybe taking all of the time.
See if this helps
Mobeen
I’ll try that out this morning, thanks for the idea.
edit: At a tick speed of 1/10s, the timer still locks when render() is called. I even tried a 1/100s tick, but for some reason that makes it become completely inaccurate; probably something to do with the test expressions and assignments required in that time frame.
What exactly have others used the timer for? If it locks during calculations, I don’t see why it’s even implemented.