Please, I tried to use these methods to update certain Keyframe value and frame:
setValue()
setFrame()
But it seems, that it cannot be done directly like this. Do we have to delete the old one and create a new one in order to "modify" a Keyframe?
deleteKeyframeAtFrame()
setKeyframe()
Python modify Keyframe (vs. delete old and create new one)
1678 4 2-
- ikoon
- Member
- 214 posts
- Joined: Jan. 2016
- Offline
-
- krueger
- Member
- 192 posts
- Joined: Oct. 2018
- Offline
-
- ikoon
- Member
- 214 posts
- Joined: Jan. 2016
- Offline
Hello Krueger, thank you very much.
You are right, as long as you don't change the setFrame()
The code below creates a duplicate Keyframe. I assume that we have to delete the original Keyframe.
You are right, as long as you don't change the setFrame()
The code below creates a duplicate Keyframe. I assume that we have to delete the original Keyframe.
p = hou.parm( "/obj/null1/scale" ) keys = p.keyframesInRange( 48, 48 ) # Find the keyframe on frame 48 k = keys[0] # Get the first entry from the keys list k.setFrame( 24 ) p.setKeyframe( k )
-
- tamte
- Member
- 9058 posts
- Joined: July 2007
- Offline
ikoondoing it one by one can get tedious
The code below creates a duplicate Keyframe. I assume that we have to delete the original Keyframe.
I usually get a copy of all keys on the parm, modify them, then delete all parm keys and set to modified keys
keys = p.keyframes() for key in keys: key.setFrame(key.frame()+10) p.deleteAllKeyframes() p.setKeyframes(keys)
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
-
- ikoon
- Member
- 214 posts
- Joined: Jan. 2016
- Offline
-
- Quick Links