Is there a way to convert absolute references to relative references automatically?

   2213   1   1
User Avatar
Member
11 posts
Joined: Jan. 2019
Offline
I am working on a fully groomed and rigged creature, which should function as HDA at some point.

I used many of the shelf grooming tools and realised too late that they all create absolute channel references.


Is there a good way to convert all these references to relative ones without doing it manually?

As far as I'm aware i would only have to switch “/obj/red_panda/” with “../../” at the beginning of each path.



Thanks in advance!

J

Attachments:
Screenshot_3.png (330.9 KB)

User Avatar
Member
106 posts
Joined: June 2011
Offline
Assuming (from the screenshot) you want to replace path in object merge nodes, something like this might work.
root_node = hou.node("/obj/name_of_subnet")
for n in node.allSubChildren():
    if n.parmTuple('objpath1'):
        obj_path = n.evalParm('objpath1')
        if obj_path.startswith('/obj/red_panda'):
            new_path = obj_path.replace('/obj/red_panda/', '../../')
            n.parm('objpath1').set(new_path)

Hope it helps
-J
Edited by jjayakumar - July 4, 2019 23:55:54
  • Quick Links