Say I have a relative reference in a node parm like this:-
ch(“../../geo2/box/sizex”)
What's the easiest/most efficient way to get the absolute path to the parm and/or node the relative ref is pointing to using python?
Thanks!
evaluating relative ref to abs ref with python
2884 2 0- pip31
- Member
- 17 posts
- Joined: July 2012
- Offline
- graham
- Member
- 1908 posts
- Joined: Nov. 2006
- Offline
You can use hou.Parm.getReferencedParm(). It will report the parameter the channel reference points to.
>>> p=hou.parm('/obj/geo1/tx')
>>> p.expression()
'ch(“../geo2/tx”)'
>>> p.getReferencedParm()
<hou.Parm tx in /obj/geo2>
>>> p.getReferencedParm().path()
'/obj/geo2/tx'
>>> p=hou.parm('/obj/geo1/tx')
>>> p.expression()
'ch(“../geo2/tx”)'
>>> p.getReferencedParm()
<hou.Parm tx in /obj/geo2>
>>> p.getReferencedParm().path()
'/obj/geo2/tx'
Graham Thompson, Technical Artist @ Rockstar Games
- pip31
- Member
- 17 posts
- Joined: July 2012
- Offline
-
- Quick Links