setting key with Python in APEX Animate state?

   433   4   2
User Avatar
Member
12 posts
Joined: 7月 2005
オフライン
Hi Everyone ,

Is there a way to set key with Python in APEX Animate state on an AbstractController (also is there a way to select them)?

Thanks in advance,

Ashraf
User Avatar
Member
8115 posts
Joined: 7月 2005
オフライン
There's no docs yet for this but you can use apex.ui.statecommandutils.updateControls()for that.
User Avatar
Member
288 posts
Joined: 3月 2011
オンライン
edward
There's no docs yet for this but you can use apex.ui.statecommandutils.updateControls()for that.

Hey Edward, can you elaborate a bit more on that?
User Avatar
Member
8115 posts
Joined: 7月 2005
オフライン
Here's an example. Load the attached hip file and then enter the animate state on the "sceneanimate1" node. Then create a Shelf Tool with this code to play with:
import hou
import apex

# Select the controller so that it brings it up in the animation editor
controls = ['/box.char/Base.rig/slider']
apex.ui.selectionmanager.utils.sendControlSelection(controls, controls_in_tree_format=False)

# Sets a value on the controller
vals = apex.ParmDict()
vals['x'] = hou.frame() # change this to see different values
apex.ui.statecommandutils.updateControls({'/box.char/Base.rig': vals}, controls)

# Tell the playbar to set a key on the scoped channels
hou.hscript("chcommit")

You can basically just to go different frames and click on the shelf tool to add keys.
Edited by edward - 2026年2月23日 22:38:20

Attachments:
apexCustomSet.hip (202.6 KB)

User Avatar
Member
12 posts
Joined: 7月 2005
オフライン
Hi Edward !
Thank you for your help and for the example file!
  • Quick Links