vbk!!! Posted June 17, 2014 Share Posted June 17, 2014 Hi, I am coming to python in Houdini to modify a mocap rigs. I would like to add Null between the bones. If I discovered the input and output methods in the hou.Node, it's still a bit frustrating since it takes the in account the connections and not the hierarchy. So ... is there a way to get all the child nodes from a selected one ( i mean to selected the master null and get all the bone in a tuple) ? Thanks for your help Vincent Quote Link to comment Share on other sites More sharing options...
fragmentzero Posted June 17, 2014 Share Posted June 17, 2014 You can use the code below in Python source editor. allChildren = [] def getChildrenFromSelected(): selectedNodes = hou.selectedNodes() for node in selectedNodes: getChildren(node) print allChildren # Process All Children Nodes def getChildren(node): for child in node.children(): allChildren.append(child) getChildren(child) Then select your parent node and call, hou.session.getChildrenFromSelected() Hope it helps. Quote Link to comment Share on other sites More sharing options...
vbk!!! Posted June 17, 2014 Author Share Posted June 17, 2014 sorry but i don't want to dive in a node to get what is inside. to quote the documentation : "Using the file system analogy, a node’s children are like the contents of a folder/directory." I don't want that Using a selected node in Scene Level I would like to get all the childrens of this node ( not its content but its "network"). Sorry if I am not clear ... but in Houdini, children means 2 different things Vincent Quote Link to comment Share on other sites More sharing options...
fragmentzero Posted June 18, 2014 Share Posted June 18, 2014 Hi, I think I understand what do you mean by "children". e.g. Below is a hierarchy of nodes at /obj level. I checked various node methods in python but so far only variations of input/output methods are able to access the hierarchy above. Do you have a mix of connection nodes & hierarchy nodes you are after? (And that's why you want to isolate the children?) Quote Link to comment Share on other sites More sharing options...
pezetko Posted June 18, 2014 Share Posted June 18, 2014 You can traverse the tree with node.outputs() import hou def goDownTree(oNodes): """Recursively travel on output nodes""" for oNode in oNodes: print(oNode.name()) goDownTree(oNode.outputs()) print("----") oSel = hou.selectedNodes() for oNode in oSel: print("selected: "+ str(oNode)) print("children: ") goDownTree(oNode.outputs()) 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.