hi,
i'm trying to mimc the behavior of “paste copied channels” operator in python.
So regardless of whether parameter contains value, expression, animation, etc, i want to copy the content to a different parameter.
can someone help with how i might do this please?
thanks,
mimic "paste copied channels" behavior in python
4582 5 1- ahkim
- Member
- 27 posts
- Joined: Nov. 2008
- Offline
- awong
- Member
- 818 posts
- Joined: Sept. 2013
- Offline
You have to loop through the keyframes and set it There seems to be an issue with setting the right acceleration (slope) value. It seems like you can workaround it by setting it twice:
p = hou.parm(“/obj/geo1/tx”)
q = hou.parm(“/obj/geo1/ty”)
q.deleteAllKeyframes()
for k in p.keyframes():
q.setKeyframe(k)
for k in p.keyframes():
q.setKeyframe(k)
Note that if the parameter is driven by an expression, you can do the same to copy the expression.
You can also setup channel reference this way:
p = hou.parm(“/obj/geo1/tx”)
q = hou.parm(“/obj/geo1/ty”)
q.set(p)
p = hou.parm(“/obj/geo1/tx”)
q = hou.parm(“/obj/geo1/ty”)
q.deleteAllKeyframes()
for k in p.keyframes():
q.setKeyframe(k)
for k in p.keyframes():
q.setKeyframe(k)
Note that if the parameter is driven by an expression, you can do the same to copy the expression.
You can also setup channel reference this way:
p = hou.parm(“/obj/geo1/tx”)
q = hou.parm(“/obj/geo1/ty”)
q.set(p)
Edited by - Sept. 4, 2015 15:14:50
Andrew / アンドリュー
- ahkim
- Member
- 27 posts
- Joined: Nov. 2008
- Offline
- eoyilmaz
- Member
- 4 posts
- Joined: July 2009
- Offline
- swSharkBoy_02
- Member
- 10 posts
- Joined: Sept. 2019
- Offline
Hello,
I have an additional question about copy-pasting ramps:
if I copy-paste a ramp in the editor all key/values get automatically referenced, if I create new key/values in the pasted-in ramp they appear in the target ramp.
But if I do the same thing in python I need to manually loop over every key/value and paste in a reference, if there is a new value in the pasted-in ramp a new reference needs to be created in python.
How does Houdini do this under the hood in the editor? must I also create a callback and then trigger the key/value reference every time a new one is created?
I have an additional question about copy-pasting ramps:
if I copy-paste a ramp in the editor all key/values get automatically referenced, if I create new key/values in the pasted-in ramp they appear in the target ramp.
But if I do the same thing in python I need to manually loop over every key/value and paste in a reference, if there is a new value in the pasted-in ramp a new reference needs to be created in python.
How does Houdini do this under the hood in the editor? must I also create a callback and then trigger the key/value reference every time a new one is created?
Edited by swSharkBoy_02 - Jan. 13, 2023 03:11:12
- sggvideo
- Member
- 5 posts
- Joined: July 2016
- Offline
-
- Quick Links