salik Posted November 24, 2016 Share Posted November 24, 2016 (edited) Suppose this node full path is "/obj/some_group/..../items/my_item" For example, after some coding here and there, I got its partial path instead - "/acc/items/my_item" Is there any way that I can use this partial path to obtain its full path? I tried using hou.node("/acc/items/my_item").path() and I got an error stating that `AttributeError: 'NoneType' object has no attribute 'path'` Edited November 24, 2016 by salik Quote Link to comment Share on other sites More sharing options...
f1480187 Posted November 24, 2016 Share Posted November 24, 2016 worknode = hou.node('/obj') relnode = worknode.node('./geo1/file1') # 'geo1/file1' will also work. print(relnode.path()) Houdini will interpret paths starting from slash as absolute (full). Quote Link to comment Share on other sites More sharing options...
salik Posted November 24, 2016 Author Share Posted November 24, 2016 Thanks for the reply. Can I ask is worknode the 'starting' level for the code to transverse from? I asked that because when I tried using your method, again, I am getting the same error as I mentioned in my first post. Only when I change the path from '/obj' to '/obj/some_group/', then it seems to be working. I guess it is not that versatile though this method is usable... Quote Link to comment Share on other sites More sharing options...
f1480187 Posted November 24, 2016 Share Posted November 24, 2016 (edited) Yes, worknode here is where relative paths will start from, if node(), evalParm() or any such method with path will be invoked. In your case, some_group node will be the starting point. For example, if /obj/some_group is a subnet node, you can access node some_node inside it by calling some_group.node('./some_node'), where some_group is a node instance, same as worknode in my example. Edited November 24, 2016 by f1480187 Quote Link to comment Share on other sites More sharing options...
salik Posted November 25, 2016 Author Share Posted November 25, 2016 1 hour ago, f1480187 said: s node some_node inside it by calling some_group.node('./some_node'), where some_group is a node instance, same as worknode in my example. Edited 59 minutes ago by f1480187 Hmm, okay.. I will try to get my head around this. Thanks again! 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.