Python: is node's flag set to Render?

   3304   2   0
User Avatar
Member
407 posts
Joined: Aug. 2015
Offline
Hi
I want to find a node (in children of a geometry) that it's flag is set to “Render Flag”.
So, according to these doc pages :
http://www.sidefx.com/docs/houdini/hom/hou/Node.html#findNetworkBox [www.sidefx.com]
and
http://www.sidefx.com/docs/houdini/hom/hou/nodeFlag.html [www.sidefx.com]

I put these codes in my Python script but it doesn't work :

Attachments:
1.JPG (105.4 KB)

Masoud Saadatmand (MSDVFX)
User Avatar
Member
69 posts
Joined: Nov. 2016
Offline
You cannot directly iterate a tuple/list with the children() method. Instead you need to process it again with a loop.

import hou

a = hou.selectedNodes()

for each in a:    
    c = each.children()
  
    for n in c:
        p = n.path()
        node = hou.node(p)
        
        type = hou.nodeFlag.Render
        flag = node.isGenericFlagSet(type)
        
        print (p + " Render Flag is " + str(flag))

Not very elegant but does the job.

/obj/geo2/sphere1 Render Flag is False
/obj/geo2/tube1 Render Flag is True
/obj/geo2/box1 Render Flag is False
/obj/geo1/sphere1 Render Flag is True
/obj/geo1/tube1 Render Flag is False
/obj/geo1/box1 Render Flag is False
User Avatar
Member
407 posts
Joined: Aug. 2015
Offline
Thank you “huey-yeng”, very helpful…
Masoud Saadatmand (MSDVFX)
  • Quick Links