Jump to content

Get node full path from a partial path


salik

Recommended Posts

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 by salik
Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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 by f1480187
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...