PDA

View Full Version : Action in specific frame


asah
11-13-2012, 07:46 PM
Hi :)

I want during animation, determine while reaching specific current time (frame) do specific action

How do this ???

Nyro
11-14-2012, 09:53 AM
No idea what your asking, honestly, so here's a wild stab at a solution:

if(`currentTime -q` == 39) {

// statement what action to occur on frame 39

}

asah
11-14-2012, 03:29 PM
Thanks alot :)
but your slution work well if character not during animation

I want Like this but using mel not python

import maya.cmds as mc

startFrame=mc.playbackOptions(query=True,minTime=True)
endFrame=mc.playbackOptions(query=True,maxTime=True)
currentFrame=startFrame
while(currentFrame<endFrame):
print "The current frame is %d" % currentFrame
mc.currentTime(currentFrame)
currentFrame+=1

Help me plzzzzzzz

Nyro
11-14-2012, 04:36 PM
I still have no idea what you want.

The example you posted simply starts at frame 1 and steps through each frame, printing the current frame number.

My own example does exactly what you specified, as far as I understood:

on reaching a specific frame, in my example frame 39, it will do whatever you put inside the if-clause (between the curly brackets {}).

If you place that code in an expression or in a scriptNode with its scriptType set to 7 then it will work as you playback your scene during an animation.

Here's the Python example in MEL:

I still have no idea what you want.

The example you posted simply starts at frame 1 and steps through each frame, printing the current frame number.

My own example does exactly what you specified, as far as I understood:

on reaching a specific frame, in my example frame 39, it will do whatever you put inside the if-clause (between the curly brackets {}).

If you place that code in an expression or in a scriptNode with its scriptType set to 7 then it will work as you playback your scene during an animation.

Here's the Python example in MEL:

$startFrame = `playbackOptions -q -min`;
$endFrame = `playbackOptions -q -max`;
$now = `currentTime -q`;
while($now <= $endFrame) {
print("Currently at frame: " + $now +"\n");
$now++;
currentTime -e $now;
}

It will disregard playback speed and simply step through each frame as fast as the CPU can execute the code (which is instant nowadays).

asah
11-14-2012, 07:51 PM
Very Tanks :)

The code work well but I have problem

$startFrame=`currentTime -q`;
int $currentFrame=$startFrame;
while($currentFrame !=0){
print ($currentFrame + ",,");
currentTime $currentFrame;
$currentFrame+=1;
if($currentFrame>471)
$currentFrame=0;
}
remaining code

when apply this code , the character animation very slow in frames within while loop and when reach frame 0 start animated well

So, how speed up while loop (means between currentTime $currentFrame; in loop) or any other solution

asah
11-27-2012, 05:16 AM
Is there any other solution because the while loop make project too slow

How check current frame during playblast ?????????????????????????

djx
11-27-2012, 07:48 AM
Have you considered using trax with clips and/or the camera sequencer? Both of these offer some non-linear capabilities, which seems to be where you are heading in all these various questions.

Many people would simply playblast the bits they need and then put them together in a compositor or editor app.

David

CGTalk Moderation
11-27-2012, 07:48 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.