Jump to content
SciMunk

recursively select all 'visible' node in subnetwork ?

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

Share this post


Link to post
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

Share this post


Link to post
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!

Share this post


Link to post
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)

 

Share this post


Link to post
Share on other sites

on the redshift forced matte parameter, keyframe the channel , and then type in atoms script , right click on the parameter and change the expression language to python,

and this returns the desired results

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×