PDA

View Full Version : Problem with time in process loop



walfridson
02-22-2008, 12:49 PM
Got a problem here which ruins my script...

process: ma, frame, time
{
info(lasttime);

if(time!=0)
lasttime=time;
}
Ok, using the arrows keys to move the timeslider - no problem. lasttime is showed correctly.

But, when playing(exact playrate is off) or scrubbing with the mouse:
When the timeslider is above frame 62 'lasttime' goes back to 0.08.

Am I missunderstanding something here? The reset only takes place on that frame.

Please help..

Tested with 9.0 also, the correct and the fault value flickers.. so this shows only the fault one

process: ma, frame, time
{
if(lasttime<2)
info(lasttime);

if(time!=0)
lasttime=time;
}

I'm very confussed right now...

edit: is a motion script and the first one was tested on 9.3.1

walfridson
02-22-2008, 02:48 PM
Here's the script, hope someone has time to test this.
Thanks in advance

evenflcw
02-22-2008, 07:42 PM
Worked fine here. No anomalies above frame 62.

However if I turn on Show Motion Path the info message flickers. Show Motion Path is really nasty as it needs to evaluate each frame it finds something to draw. With Motion Paths off you usually have 2 "evaluation passes" per frame (or it's just one evaluation pass that calls your plugin twice; might matter what type of plugin it is). With Motion Paths on and an item keyed over 10 frames, LW Motion Path adds >10 passes. Keyed over 100 frames, it adds >100 passes. During these extra passes it is calling your script which explains the info message flickering and also explains why some 3rd party developers recommend to turn them off. They may cause plugins/scripts to seemingly stop working (they only worked in the first 2 regular passes) or cause jittering. Master plugins receive event codes which might provide some assistance in these issues. I never examined them closer or tried them myself though.

Btw, I know it was just a test, and you might do it differently when it isn't. But, in any case... you should initialize lasttime in the create method by assigning Scene().currentframe to it. That will make sure your plugin works from the getgo.


counter;

create: obj {
counter = 0;
}

process: ma, frame, time {
info( counter );
counter++;
}

An "evaluation pass"-counter is an easy way to peak inside LW alittle and see how your plugin might impact LW.

walfridson
02-23-2008, 04:47 AM
Thanks for spotting and explaining!
Turning motion path off worked indeed.