Images clés (Keyframes)#
In Houdini, keyframing parameters using Python can be accomplished with the hou module, which provides an interface to the Houdini API.
Définir / Lire / Supprimer des images clés#
import hou
mynode = hou.selectedNodes()[0]
myparm = mynode.parm("tx")
# display code
print(myparm.asCode())
# set keyframe 1
key1 = hou.Keyframe()
key1.setFrame(1)
key1.setValue(1)
# set keyframe 2
key2 = hou.Keyframe()
key2.setFrame(100)
key2.setValue(4)
myparm.setKeyframe(key1)
myparm.setKeyframe(key2)
# get info about keyframes
print(myparm.keyframes()[0].value())
print(myparm.keyframes()[1].value())
# delete keyframes
myparm.deleteKeyframeAtFrame(20)
# delete all keyframes
myparm.deleteAllKeyframes()