Methods ¶
selectedKeyframes()
→ dict
of hou.Parm to tuple
of hou.BaseKeyframe
Returns a dictionary of (hou.Parm, keyframes) which are currently selected in the graph.
For example, to scale the selected key values by 2:
channel_editor = hou.ui.paneTabOfType(hou.paneTabType.ChannelEditor) keyframes = channel_editor.graph().selectedKeyframes() for parm in keyframes.keys(): for key in keyframes[parm]: key.setValue(2 * key.value()) parm.setKeyframe(key)
selection()
→ tuple
of hou.ChannelGraphSelection
Returns a copy of the current channel graph selection.
setSelection(chan_graph_selections)
Sets the current channel graph selection to the given sequence of hou.ChannelGraphSelection objects.
selectionMode()
→ hou.channelGraphSelectionMode enum value
Returns the current graph selection mode.
See hou.channelGraphSelectionMode for the available modes.
setSelectionMode(mode)
Sets the graph selection mode.
mode
A hou.channelGraphSelectionMode value.
graph = hou.ui.paneTabOfType(hou.paneTabType.ChannelEditor).graph() graph.setSelectionMode(hou.channelGraphSelectionMode.Retime)
Retime Tool ¶
These methods manipulate the Retime Tool. The graph must be in hou.channelGraphSelectionMode.Retime mode for markers to be visible.
Note
-
Markers are referred to by their zero-based index in the sorted list of all current markers.
-
The active selection is always a contiguous
[min, max](inclusive) index range.
Selection ¶
retimeMarkers()
→ tuple
of float
Returns the time position (in seconds) of each retime marker, in sorted order.
retimeMarkerSelection()
→ tuple
of int
or None
Returns the selected marker index range as a (min, max) tuple (inclusive), or None if no markers are selected.
setRetimeMarkerSelection(range)
Sets the retime marker selection to the given index range. Pass None to deselect all markers.
range
The index range of markers to select, given as a list or tuple of 2 integers [min, max] (inclusive), or None.
Insertion/Deletion ¶
insertRetimeMarker(time)
Inserts a retime marker at time (in seconds). The graph must be in hou.channelGraphSelectionMode.Retime mode for markers to be visible.
graph = hou.ui.paneTabOfType(hou.paneTabType.ChannelEditor).graph() graph.setSelectionMode(hou.channelGraphSelectionMode.Retime) graph.insertRetimeMarker(hou.frameToTime(42))
deleteRetimeMarker(index)
Removes the retime marker at index.
deleteRetimeMarkers(range)
Removes all markers whose indices fall within range (inclusive).
range
The index range of markers to delete, given as a list or tuple of 2 integers [min, max] (inclusive).
Warning
The range parameter does not accept None. Check the result of retimeMarkerSelection before passing it directly to this function. deleteSelectedRetimeMarkers is provided for convenience.
deleteSelectedRetimeMarkers()
Removes the currently selected retime markers. Does nothing if no markers are selected.
clearRetimeMarkers()
Removes all retime markers.
Movement ¶
moveRetimeMarkers(range, delta, with_keys)
Moves the markers in range by delta seconds. Each marker is clamped to prevent it from crossing its neighbors.
range
The index range of markers to move, given as a list or tuple of 2 integers [min, max] (inclusive).
Warning
The range parameter does not accept None. Check the result of retimeMarkerSelection before passing it directly to this function. moveSelectedRetimeMarkers is provided for convenience.
delta
The amount to move the markers, in seconds.
with_keys
If True, keyframes are retimed to fit the new marker positions.
If False, keyframes are unaffected.
graph = hou.ui.paneTabOfType(hou.paneTabType.ChannelEditor).graph() graph.setSelectionMode(hou.channelGraphSelectionMode.Retime) # Move markers 2 through 5 forward by half a second, retiming keys graph.moveRetimeMarkers((2, 5), 0.5, True)
moveSelectedRetimeMarkers(delta, with_keys)
Moves the currently selected retime markers by delta seconds. Does nothing if no markers are selected. See moveRetimeMarkers for parameter details.