LC #42 Pipers Alley

View Full Version : Check current frame number during playblast

11-27-2012, 07:21 AM

How check current frame number during playblast because the currentTime -q is not work correctly during playblast

I want to writing if statement during playblast like

if current frame is 50 , do this action

11-27-2012, 12:39 PM
you can try temporary scriptJob or scriptNode, which will call your procedure during timeChange, and remove it at the end of procedure

or maybe script your own playblast as for loop:
* set new frame
* check frame number -> call procedure
* take snapshot
if you want really only playblast

11-27-2012, 01:36 PM
or use "frame" via expression?

11-27-2012, 03:18 PM
I write now this code but not work

scriptJob -timeChange "CurrTime()";
global proc CurrTime()
$startFrame=`currentTime -q`;
int $currentFrame=$startFrame;
if($currentFrame == 0)
setAttr "dress1.visibility" 0;
setAttr "Skirt3_a.visibility" 0;
setAttr "Skirt3_b.visibility" 0;
setAttr "dress2.visibility" 0;
setAttr "Jeans1_a.visibility" 1;
setAttr "Jeans1_b.visibility" 1;
setAttr "Jeans1_c.visibility" 1;

I want during playblast if reach frame 0 do action

Can you correct it, please

Thanks in advance

11-27-2012, 03:50 PM
its long time i have worked with scriptJob
please try this:

scriptNode -st 7 -beforeScript "CurrTime()" -name "timeChangeNodeScript";

11-27-2012, 08:00 PM
you can also read the value from the global time node in maya( there can only be one in a scene)

most of the time its named time...
getAttr time1.outTime

this will give you the current frame number: be aware that this is a double value: in most case its a whole number but in reality its valid to have 3.25 as a time value.

11-27-2012, 10:15 PM
Very thanks for all ^________^

It work well with scriptNode :)

CGTalk Moderation
11-27-2012, 10:15 PM
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.