How to delete/replace a String parameter reference in python

   3164   1   0
User Avatar
Member
3 posts
Joined: May 2016
Offline
Hi,

When a string parm is set with a hscript reference to another parameter, how can we delete or replace this reference?

If I simply do set, it will change the value of the referenced parameter and deleteAllKeyframes() does nothing…

The only solution I found at this time is the next:

p = hou.parm('/obj2/geo2/file1/file')
if p.getReferencedParm() != p:
    p.revertToDefaults()
p.set('`chs("../../geo/file1/file")`')

Or change this to an expression…

Am I wrong or there is no other way?

Thanks
Edited by ppiche - July 9, 2019 18:09:05
User Avatar
Member
899 posts
Joined: Feb. 2016
Offline
I guess in this case you need to use the setExpression() function, instead of the regular set().
it's documented here: https://www.sidefx.com/docs/houdini/hom/hou/Parm.html [www.sidefx.com]

cheers
  • Quick Links