Python command

Python command

Anonymous
Not applicable
1,343 Views
4 Replies
Message 1 of 5

Python command

Anonymous
Not applicable

Hey everyone,

 

I'm trying to create a menu in python to control the turn table I made. I made the turn table in the curve editor then created a block and put into a clip "Jeep TT Master".  I've got the play, pause/stop, and reset functions working. However, I can't seem to locate any information/naming conventions to continue the animation from where it's stopped. I've tried the continueAnimation, CAnimation options... is there an option under the same naming convention as the playAnim, stopAnim, resetAnim to continue the animation? 

 

Thanks!


Clay

 

this is what I have so far: the blue text is what I'm having trouble with.. 

###########################################################################################

def startAnimation():
playAnim("Jeep TT Master")

menuAnimation2 = vrMenu(1.25, 10, 7)
menuAnimation2.setPosition2D(800, 0)
menuAnimation2.addPushButton("Play", "playAnim('Jeep TT Master')")
menuAnimation2.setAlpha(1)
menuAnimation2.show()

 

def pauseAnimation():
stopAnim("Jeep TT Master")

menuAnimation3 = vrMenu(1.25, 10, 7)
menuAnimation3.setPosition2D(1000, 0)
menuAnimation3.addPushButton("Pause", "stopAnim('Jeep TT Master')")
menuAnimation3.setAlpha(1)
menuAnimation3.show()

 

def resumeAnimation():
startAnim("Jeep TT Master")

menuAnimation5 = vrMenu(1.25, 10, 7)
menuAnimation5.setPosition2D(1150, 0)
menuAnimation5.addPushButton("Continue", "startAnim('Jeep TT Master')")
menuAnimation5.setAlpha(1)
menuAnimation5.show()

 

def resetAnimation():

resetAnim("Jeep TT Master")

menuAnimation4 = vrMenu(1.25, 10, 7)
menuAnimation4.setPosition2D(1300, 0)
menuAnimation4.addPushButton("Reset", "resetAnim('Jeep TT Master')")
menuAnimation4.setAlpha(1)
menuAnimation4.show()

 

############################################################################################

0 Likes
Accepted solutions (1)
1,344 Views
4 Replies
Replies (4)
Message 2 of 5

Christian_Garimberti
Advisor
Advisor

Hi,

in script editor, to work with touchsensors, i used these functions:

 

##Reset the animation to the Frame 0
resetCAnimation("Animation_01")

##Play the animation
playCAnimation("Animation_01", startframe, endframe)

##Pause the animation
pauseCAnimation("Animation_01", True)

##resume from where you paused the animation
pauseCAnimation("Animation_01", False)

Hope this helps you

Chris

Christian Garimberti
Technical Manager and Visualization Enthusiast
Qs Informatica S.r.l. | Qs Infor S.r.l. | My Website
Facebook | Instagram | Youtube | LinkedIn

EESignature

0 Likes
Message 3 of 5

Anonymous
Not applicable

Hey Chris,

 

Thanks for responding back. I tried replacing the code with what you suggested but I keep getting this error:

 

Traceback (most recent call last):

File "<string>", line 1, in <module>

Boost.Python.ArgumentError: Python argument types in

vrAnimWidgets.pauseCAnimation(str)

did not match C++ signature:

pauseCAnimation(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > name, bool value)

 

I'm assuming the error is from mixing two types of code? 

 

I believe using that code in the script section of the variant sets will work, but I'm trying to have it work through creating a menu with vrMenu instead of having a plane with a touch sensor on it. 

Capture.PNG

 

 

 

0 Likes
Message 4 of 5

Christian_Garimberti
Advisor
Advisor
Accepted solution

i used the commands in script editor and they worked

 

Be sure to write it correct, see the help to check the code.

file:///C:/Program%20Files/Autodesk/VREDPro-11.2/doc/vrAnimWidgets-module.html#pauseCAnimation

 

it need 2 parameters: 1° is the animation name, 2° True or False (True = Pause, False = Resume)

 

pauseCAnimation("Animation_02", True)

pauseCAnimation("Animation_02", False)

 

In your script the error could be that you use it with only 1 parameter, "str"

"vrAnimWidgets.pauseCAnimation(str)"

 

Chris

 

Chris

 

 

Christian Garimberti
Technical Manager and Visualization Enthusiast
Qs Informatica S.r.l. | Qs Infor S.r.l. | My Website
Facebook | Instagram | Youtube | LinkedIn

EESignature

0 Likes
Message 5 of 5

Anonymous
Not applicable

Hey Chris,

 

I just had a chance to double check what you said to do. You were correct! Thank you! I needed to add the rest of the code with the CAnimation command into the button config as well.

 

Thanks!


Clay 

0 Likes