Created
September 4, 2020 05:56
-
-
Save baku89/0fc5eed410a18c33d624fd21bf56b330 to your computer and use it in GitHub Desktop.
Refit all of selected keyframes as a difference FPS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Houdini | |
import hou | |
def main(): | |
# find any pane tab that is a Channel Editor | |
channel_editor = hou.ui.paneTabOfType(hou.paneTabType.ChannelEditor) | |
if not channel_editor: | |
hou.ui.displayMessage("No channel editor pane is displayed") | |
return | |
graph = channel_editor.graph() | |
# get the graph's selected keyframes in a dict called keyframes | |
if not graph: | |
hou.ui.displayMessage("No Graph Editor is displayed") | |
return | |
keyframes = graph.selectedKeyframes() | |
for parm in keyframes.keys(): | |
kfs = list(keyframes[parm]) | |
for (i, key) in enumerate(kfs): | |
parm.deleteKeyframeAtFrame(key.frame()) | |
frame = key.time() * 25 + 1.0 | |
time = hou.frameToTime(frame) | |
key.setTime(time) | |
kfs[i] = key | |
parm.setKeyframes(kfs) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment