Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

How to make a calculation inside of set current time?

How to make a calculation inside of set current time?

amaterasu-qbb
Collaborator Collaborator
1,158 Views
5 Replies
Message 1 of 6

How to make a calculation inside of set current time?

amaterasu-qbb
Collaborator
Collaborator

Calculate +, -, /, * inside of set current time

無題.png

For example 24 frame*2=48>move to 48 frame on time slider.

I know in script editor can do like in example.

But I don’t want to do that way.

 

So Is there any good idea or tools?

0 Likes
Accepted solutions (2)
1,159 Views
5 Replies
Replies (5)
Message 2 of 6

Abdulla-Qaladzay
Collaborator
Collaborator

Hi @amaterasu-qbb 

I don't think setCurrentTime have math functionality like some other attributes.

 

that is the way we can use math in attributes :

operation = number 

 

and here is a little script that might suit your need :

 

mathCurrentTime.gif

 

string $text;
string $result = `promptDialog
-title "math the current time"
-message "Enter math(only the operation and the number):"
-button "OK" -button "Cancel"
-defaultButton "OK" -cancelButton "Cancel"
-dismissString "Cancel"`;

if ($result == "OK") {
$text = `promptDialog -query -text`;

string $forEval = "`currentTime -q`" + $text;
float $evaRes =`eval("$tempHolder=" + $forEval)`;
currentTime ($evaRes);
}else {print ("math operation canceled");}

 

Message 3 of 6

amaterasu-qbb
Collaborator
Collaborator

NICE!
But could you make the window keep opening when the script works? it'd be wonderful!
(I'm bad at the script, please forgive me.)

0 Likes
Message 4 of 6

Abdulla-Qaladzay
Collaborator
Collaborator
Accepted solution

🤍

sure, here is the script:

 

proc qwe(){
string $newMath = `textField -q -text mathField`;
string $forEval = "`currentTime -q`" + $newMath;
float $evaRes =`eval("$tempHolder=" + $forEval)`;
currentTime ($evaRes);}
global proc createCustomWorkspaceControlUI(){
rowColumnLayout;
text -l "only type the operation and the number";
textField mathField;
button -l "apply" -command "qwe()";}
workspaceControl -retain false -floating true -uiScript "createCustomWorkspaceControlUI();" mathCurrentTime;

 

mathCurrentTime.gif

Message 5 of 6

amaterasu-qbb
Collaborator
Collaborator

It's amazing! This is a really good script! it's really useful for the project too.

 

Do you sharing or have other scripts like that?
whatever, You make me motivated to learn more about the script!
thank you very much!
The question is resolved!

0 Likes
Message 6 of 6

Abdulla-Qaladzay
Collaborator
Collaborator
Accepted solution

you are very welcome I’m happy to help 🤍😊

learning script saves a lot of our time, and it make us to think creative and look further .