I have some code in a python node that now actually does what I need with no problems.
However in understanding what I have there is one part which I can't figure out why.
I happened to come across a reference of using node.path()and this was a part that I needed to make what I want work.
To understand node.path() I tried looking in the Docs to see if there was some reference to it.
Because with Python and Houdini I know there's all kinds of functions, methods, etc. and that we are dealing classes and such,
but I couldn't even figure out how even looking at the different parts of the docs that I would have figured out why and how I would use node.path() - based on the doc explanations/catagories available.
Anyone well versed i using docs might be able to shed light on what parts would give the information that would have led me to using node.path() to give me the absolute path of the current node?
Python - node.path() - In documentation
4551 3 1- BabaJ
- Member
- 2123 posts
- Joined: Sept. 2015
- Offline
- Jikian
- Member
- 144 posts
- Joined: Aug. 2012
- Online
The Python documentation for Houdini can be found here [www.sidefx.com]
Specifically, node.path() is a method from the Node class [www.sidefx.com], inherited from hou.NetworkMovableItem [www.sidefx.com]. This method gives the full path of the node.
I realize I didn't answer your question properly: Figuring out which method(s) to use can start with a little trial and error - you could try to search for something like "houdini node path in python", or "houdini node directory python", which will likely bring you to the hou.Node Python documentation page. Then, experimenting with the methods found on the page, you could test what inputs a method requires, and what data is output from them. In the case of node.path(), it outputs a string. If you have familiarity with Python, you can use other methods like split() to convert the string into a list of directories, e.g. /obj/geo1/box1 ->, so you can do things like searching for other nodes on the same level or checking that you're in the right subnetwork.
Specifically, node.path() is a method from the Node class [www.sidefx.com], inherited from hou.NetworkMovableItem [www.sidefx.com]. This method gives the full path of the node.
I realize I didn't answer your question properly: Figuring out which method(s) to use can start with a little trial and error - you could try to search for something like "houdini node path in python", or "houdini node directory python", which will likely bring you to the hou.Node Python documentation page. Then, experimenting with the methods found on the page, you could test what inputs a method requires, and what data is output from them. In the case of node.path(), it outputs a string. If you have familiarity with Python, you can use other methods like split() to convert the string into a list of directories, e.g. /obj/geo1/box1 ->
[obj, geo1, box1]
Edited by Jikian - April 10, 2022 15:48:48
- BabaJ
- Member
- 2123 posts
- Joined: Sept. 2015
- Offline
- edward
- Member
- 7871 posts
- Joined: July 2005
- Offline
-
- Quick Links