Remove chs() from parameter via python command

   1755   3   1
User Avatar
Member
13 posts
Joined: 12月 2012
オフライン
Hey


I have an issue with a parameter set to a channel reference.
I cannot get rid of it.


/out/geometry1.sopoutput is set to `chs("test")`.
Now I want to change /out/geometry1.sopoutput to some value.

No matter what I try, it always changes /out/geometry1.test instead.
I tried:
hou.node( "/out/geometry1" ).parm("sopoutput").deleteAllKeyframes()
hou.node( "/out/geometry1" ).parm("sopoutput").set("MyOutputA")

hou.node( "/out/geometry1" ).parm("sopoutput").set("MyOutputB", follow_parm_reference=False)

hou.node( "/out/geometry1" ).parm("sopoutput").set("MyOutputC", None, False)


https://www.sidefx.com/docs/houdini/hom/hou/Parm.html [www.sidefx.com]
states that deleteAllKeyframes() or follow_parm_reference=False should solve my problem.

"If this parameter currently contains a channel reference to another parameter, then this method will follow channel references and change the value of the referenced parameter. If this is not the desired behavior, then first delete the channel reference with hou.Parm.deleteAllKeyframes(). Alternatively if you are setting the value to another parameter and do not want to follow existing channel references then set the optional follow_parm_reference argument to False."

Any idea what I am doing wrong?
User Avatar
Member
8 posts
Joined: 10月 2013
オフライン
I'm having the same issue. you ever solve this?
User Avatar
Member
1 posts
Joined: 6月 2020
オンライン
13 years later, I'm having the same issue
User Avatar
スタッフ
450 posts
Joined: 2月 2008
オフライン
`chs("test")` isn't an expression, it's a string literal that happens to be wrapped in back ticks (special case), so deleteAllKeyframes() won't help here.
parm.revertToDefaults() should clear it (as long as the default isn't a channel reference wrapped in back ticks!) and parm.set() after that will behave as expected.

If that fails due to the default being for example `chs("test")`, you could try parm.setExpression("foo") followed by a parm.deleteAllKeyframes() followed by parm.set()...
  • Quick Links