MEL scripting


hi…i have a doubt related to MEL sctript…i created a button and if i click it, the timeslider should go to first frame in the animation…whatever the frame number is…
for example if the animation is starting in 80th frame,but for that animation it is the first frame…so if i click the button it should shift to 80th frame…


the MEL command currentTime is how maya moves the animation slider position.


You just want to make a script that queries the min slider value and puts that into a variable (float) and then use the currentTime MEL command to = whatever that variable value is.

Like this.

// Use to send slider to min playback range value

float $startTime=playbackOptions -q -minTime;
currentTime $startTime;

// use to set slider to animation start

float $startTime=playbackOptions -q -ast;
currentTime $startTime;{code/]

This should set the current time to whatever the min Time slider is set to OR the Animation Start is. Even if the min slider is beyond it.

NOTE there are two buttons here. One for Min Slider… One for Animation start. Don’t run at same time. Make two separate buttons.

NOTE 2. Since the forums don’t format properly for code now it drops the little ` in front of the playbackOptions command… I’m linking a direct file for the mel code.