MotionBuilder Forum
Welcome to Autodesk’s MotionBuilder Forums. Share your knowledge, ask questions, and explore popular MotionBuilder topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Simulate a keypress to activate relational constraint?

1 REPLY 1
Reply
Message 1 of 2
dlincol1
475 Views, 1 Reply

Simulate a keypress to activate relational constraint?

Trying to simulate a keypress from another terminal using telnet to activate a relational constraint.

 

I've got the telnet and keypress code worked out (using SendKeys module) but the constraint with a keyboard device does not react to the sendkey command.

 

Is there another way to activate a constraint remotely?

 

 

Regards,
Dan
1 REPLY 1
Message 2 of 2
dlincol1
in reply to: dlincol1

Ok, I've found a method but I'm not sure it's the most efficient.

 

1. Add a Script Device to the scene.

2. Add 33 Action Properties to the Script Device (using same names from a Keyboard device).

3. Make them Animatable.

4. Replace actual Keyboard Device and connections in Constraint with Script (Keyboard) device.

 

Then using this script, I can toggle on/off the action state.

I still don't understand why I can't toggle the state within the same script so I call the script twice.

Once to activate and again to deactivate.

 

# Usage: ToggleActionState.py [propertyname] [ON/OFF]

from pyfbsdk import *
import sys

propertyName = sys.argv[0]
    
for device in FBSystem().Scene.Devices:
    if device.Name == 'Script Keyboard':
        
        pState = device.PropertyList.Find(propertyName)
        
        if sys.argv[1] == 'ON':
            pState.Data = True
        elif sys.argv[1] == 'OFF':
            pState.Data = False

 

 

 

Regards,
Dan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report