Substance Painter
In this start to finish texturing project within Substance Painter we cover all the techniques you need to texture the robot character.
# 1 08-04-2019 , 07:43 PM
Registered User
Join Date: Mar 2007
Posts: 1

Current Time goes to selected Key frame?

Hello Script Wizards!

I'm looking for a script that will change the current time to whatever key frame I have selected.

For example, in the graph editor, I'm on frame 30. I select a key on a curve on frame 50, run the script, and it will change the current time from 30 to 50.

I'm trying to write the script myself but I don't know how to query the time from a selected key frame. My scripting skills are weak! Any help will be appreciated.

THANK YOU!

# 2 05-09-2019 , 11:21 PM
Registered User
Join Date: Sep 2019
Posts: 2
You can do this pretty easy.

you can use the keyframe mel command to do a query.

keyframe -query -lastSelected -timeChange;

Whatever keyframe you last select in the graph editor the mel command above will report the frame number as the result.

Then there is a basic mel command which sets the current time.

currentTime 105;

The "105" entered above is just an example that will set the current frame to frame 105. But you can make it any frame you want.

So in order to script this you'll want to save the result of the first query into a variable.
Perhaps a float variable since you are saving a numeric value.
Use a variable name that matches what you are doing so you know what the variable is for.
Like $grabTime.
Tnen use that variable as the input for currentTime.

So like this. Copy paste the lines below this one.

// select keyframe in graph editor then run this.
float $grabTime[]=`keyframe -query -lastSelected -timeChange`;
//set currentTime to result saved in variable.
currentTime $grabTime[0];

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads