ikoon Posted July 10, 2019 Share Posted July 10, 2019 Please, do you have any complete solution to convert from or to relative references? - sometimes I need to convert the expressions, e.g. chs("../name") or ch("../transform1/rx") or chs("/obj/geo1/name1/attribname") - sometimes it is just a node reference, e.g. object_merge this node: ../OUT_data1 - it could also be object_merge many nodes: /obj/geo/OUT_data2 /obj/geo/OUT_data3 /obj/geo/OUT_data4 I usually do it manually. But sometimes it would be useful to convert some (or all) references on the node with a script. E.g after creating the Reference copy (Ctrl+Alt+Shift drag). Quote Link to comment Share on other sites More sharing options...
ikoon Posted July 13, 2019 Author Share Posted July 13, 2019 This seems to work for converting simple expressions ... I have tried also the "getReferencedParm()" ... but this "brute force replace" seemed easier now. Still it is only a partial solution: def parm_relative_to_absolute_all(node) : for parm in node.parms() : parm_raw = parm.rawValue() try: path = re.findall('[\"\'](.*?)[\"\']',parm_raw)[0] path = path[:path.rindex('/')] path_abs = node.node(path).path() parm_raw_abs = parm_raw.replace(path,path_abs) parm.setExpression(parm_raw_abs, replace_expression=True) except: # probably it was not referenced pass Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.