relative path to absolute path

   13430   2   1
User Avatar
Member
617 posts
Joined: Aug. 2008
Offline
I created a spare parm in one node, an operator path, so I can point to another node in the scene.

now that I have that and I point to this node as relative path,
../geo1/file1

with python how can I get the absolute path like /obj/geo1/file1


I try
grabbing the parm and using unexpandedString() or I thought that might be a type of .eval()

do we have a method for it?
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
You can ask your node with the parameter on it to give you the node the parm points to, then get the path from there. hou.Node.node() will accept a relative path so you can look for the node relative to the main node.
node = hou.node(“/obj/nodewithparm”)
relPath = node.evalParm(“path”)
relNode = node.node(relPath)
fullpath = relNode.path()
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
617 posts
Joined: Aug. 2008
Offline
cool! I thought the
node.node()
only worked if you keep diving inside.

you can also do your_parm.parmsReferencingThis() and then do parm.node() and will give you the node of that parm

then you can do a_node.relativePathTo(other_node)
Edited by pelos - Dec. 25, 2017 01:27:00
  • Quick Links