evaluating relative ref to abs ref with python

   2885   2   0
User Avatar
Member
17 posts
Joined: July 2012
Offline
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!
User Avatar
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'
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
17 posts
Joined: July 2012
Offline
Excellent. Thank you Graham!
  • Quick Links