SciMunk Posted November 25, 2018 Share Posted November 25, 2018 (edited) 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 November 25, 2018 by SciMunk title typo Quote Link to comment Share on other sites More sharing options...
Atom Posted November 25, 2018 Share Posted November 25, 2018 (edited) 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 November 25, 2018 by Atom Quote Link to comment Share on other sites More sharing options...
SciMunk Posted November 25, 2018 Author Share Posted November 25, 2018 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! Quote Link to comment Share on other sites More sharing options...
Atom Posted November 25, 2018 Share Posted November 25, 2018 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) Quote Link to comment Share on other sites More sharing options...
pxptpw Posted November 25, 2018 Share Posted November 25, 2018 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 Quote Link to comment Share on other sites More sharing options...
vinyvince Posted September 10, 2021 Share Posted September 10, 2021 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 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.