Maybe try node.children instead of node.dependents?
This is what I use to return children of a node.
defchildrenOfNode(node,filter):# Return nodes of type matching the filter (i.e. geo etc...).result=[]ifnode!=None:forninnode.children():t=str(n.type())ift!=None:forfilter_iteminfilter:if(t.find(filter_item)!=-1):# Filter nodes based upon passed list of strings.result.append('%s~%s'%(n.name(),t))result+=childrenOfNode(n,filter)returnresult
And a usage case...
# Export geo based objects as OBJ files.lst_geo_objs=[]#nodes = childrenOfNode(hou.node(node_path),["envlight"])#nodes = childrenOfNode(hou.node(node_path),["hlight", "ambient"])nodes=childrenOfNode(hou.node(node_path),["Object geo"])#Other valid filters are Sop, Object, cam.fornodeinnodes:ary=node.split("~")iflen(ary)>0:node_candidate="%s/%s"%(node_path,ary[0])n=hou.node(node_candidate)ifn!=None:ifn.isDisplayFlagSet():exportAsRIB(node_candidate,geo_dir)lst_geo_objs.append(node_candidate)
Edited by Enivob - April 19, 2024 08:05:14
Using Houdini Indie 20.0 Windows 11 64GB Ryzen 16 core. nVidia 3050RTX 8BG RAM.