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
4621 5 1- ahkim
- Member
- 27 posts
- Joined: 11月 2008
- Offline
- awong
- Member
- 818 posts
- Joined: 9月 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 - 2015年9月4日 15:14:50
Andrew / アンドリュー
- ahkim
- Member
- 27 posts
- Joined: 11月 2008
- Offline
- eoyilmaz
- Member
- 4 posts
- Joined: 7月 2009
- Offline
- swSharkBoy_02
- Member
- 10 posts
- Joined: 9月 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 - 2023年1月13日 03:11:12
- sggvideo
- Member
- 5 posts
- Joined: 7月 2016
- Offline
-
- Quick Links