Jump to content

recursively select all 'visible' node in subnetwork ?


SciMunk

Recommended Posts

Hi, 

 

I need to be able to select all visible node in a subnetwork (which himself have other subnetwork) to put into the "Forced Matte" of a rop node, I cannot find any information about that or if it even possible.

Thanks a lot for any help on that !

Edited by SciMunk
title typo
Link to comment
Share on other sites

It can be done, you need scripting for that. Here is a python snippet that shows how to assign a string to the Mantra node Forced Matte field. I don't think recursion is actually needed. If the object in the subnet is not visible then all the children are effectively disabled as well.

subnet_node = hou.node("/obj/subnet1")
names = ""
for child in subnet_node.children():
    if child.isDisplayFlagSet()==1:
        names += "%s " % child.name()
mantra_node = hou.node("/out/mantra1")
mantra_node.parm("matte_objects").set(names)

 

ap_subnet_to_forced_matte.hiplc

Edited by Atom
Link to comment
Share on other sites

Thanks for the script Atom,

I was hoping there would be a more procedural way to do it directly inside the parameter ? script require to be executed everytime change are made and when doingIPR (I'm using the redshift ROP), after a while it can start becoming annoying if we often disable/enable node for testing.

can your script be used in the parameter as a python script ? if yes, can I have a little exemple as I never managed to make a single python parameter working, alway getting some error.

thanks you!

Link to comment
Share on other sites

For Redshift you would have to target the Redshift ROP instead of a Mantra node.

subnet_node = hou.node("/obj/subnet1")
names = ""
for child in subnet_node.children():
    if child.isDisplayFlagSet()==1:
        names += "%s " % child.name()
mantra_node = hou.node("/out/Redshift_ROP1")
mantra_node.parm("RS_objects_forceMatte").set(names)

 

Link to comment
Share on other sites

  • 2 years later...
On 25/11/2018 at 3:46 PM, Atom said:

It can be done, you need scripting for that. Here is a python snippet that shows how to assign a string to the Mantra node Forced Matte field. I don't think recursion is actually needed. If the object in the subnet is not visible then all the children are effectively disabled as well.


subnet_node = hou.node("/obj/subnet1")
names = ""
for child in subnet_node.children():
    if child.isDisplayFlagSet()==1:
        names += "%s " % child.name()
mantra_node = hou.node("/out/mantra1")
mantra_node.parm("matte_objects").set(names)

 

ap_subnet_to_forced_matte.hiplc

Hi !

@Atom maybe you know this one...  :)

Im trying to identify which nodes make the size of a file huge, is it possible to loop to all parent node and subnetwork child and look for stashed or locked nodes in python?

give back the absolute network path for example...

 

Cheers,

vincent*

 

Watched Matrix trailer yesterday and makes me want to play with the primitive sphere a bit... Refining my custom tool and design rules ;)

________________________________________________________________

Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts

 http://fr.linkedin.com/in/vincentthomas

Houdini_Procedural_Speedball__vince.gif.gif

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