Hey there, this may be a silly question but I can't find any information about it online. I'd love to be able to set slope and angle of selected keyframes using either a shelf tool or python panel, but I can't seem to find out how to get the selected keyframes in the Python Shell. hou.SelectedNodes() seems to only return the selected node in the Network Editor.
Any help on how to proceed would be appreciated!
Jake
Querying Selected Keyframes in Python
2687 2 1- jakemadeathing
- Member
- 3 posts
- Joined: Nov. 2013
- Offline
- jakemadeathing
- Member
- 3 posts
- Joined: Nov. 2013
- Offline
Just bumping this topic because I ran into the same idea again and found a solution this time in the help files, in case anyone else would like to know. You just have to find the Channel Editor (Animation Editor) using python, and once there the Channel Editor has a graph() function to give you the current graph as an object. The channel graph lets you run selectedKeyframes() to query the currently selected keyframes.
The help files have a good code example to get you started: [www.sidefx.com]
Anyways hope this helps folks figure out some python scripting options in Houdini!
The help files have a good code example to get you started: [www.sidefx.com]
channel_editor = hou.ui.paneTabOfType(hou.paneTabType.ChannelEditor) # find any pane tab that is a Channel Editor keyframes = channel_editor.graph().selectedKeyframes() # get the graph's selected keyframes in a dict called keyframes for parm in keyframes.keys(): for key in keyframes[parm]: key.setValue(2 * key.value()) # this can be anything, like setExpression("bezier()") parm.setKeyframe(key)
Anyways hope this helps folks figure out some python scripting options in Houdini!
Edited by jakemadeathing - Nov. 1, 2018 12:05:06
- mike.battcock
- Member
- 22 posts
- Joined: Oct. 2018
- Offline
-
- Quick Links