How set and remove keyframes in python ?

   8729   4   1
User Avatar
Member
11 posts
Joined: Nov. 2013
Offline
Hi,

I do not know how set and remove keyframes in python ?

I have found nothing in the documentation.

Theratos.
User Avatar
Member
11 posts
Joined: Nov. 2013
Offline
Thanks for your reply.

in fact, I would like for example a box :

keyframe to 0 with a translate (0, 0, 0)
keyframe to 24 with a translate (1,0,0)

I have tried this :
hou.setFrame(24)
node = hou.node(“/obj/box_object1”)
parm_tuple = node.parmTuple(“t”)
parm_tuple.set((1, 0, 0))


It works in part, but I do not see too much how to do really.

Moreover, in the docu I have this feature is not yet documented and/or implemented… :cry:

Theratos.
User Avatar
Member
443 posts
Joined: Sept. 2012
Offline
To delete keyframes:

node = hou.node(“/obj/box_object1”)
parm_tuple = node.parmTuple(“t”)
parm_tuple.deleteAllKeyframes()
User Avatar
Member
606 posts
Joined: May 2007
Offline
theratos
Thanks for your reply.



It works in part, but I do not see too much how to do really.

Moreover, in the docu I have this feature is not yet documented and/or implemented… :cry:

The links posted by mandrake show you how to do it.
You need to 1) create a keyframe 2) set its time 3) set its value 4) add it to the parameter.

All relevant methods are implemented and documented via the link above.
  • Quick Links