Jump to content
danw

Any way to force node update dependencies?

Recommended Posts

I've got a subnet, which I place a number of geometry objects inside.

 

I'm then using another /obj level geometry object with an Object Merge node, which is set to merge /obj/subnet1/*

This works perfectly, any objects inside the subnet are automatically merged together into that main object.

 

The problem is, if I add or remove an object from subnet1, it doesn't force an update on the Object Merge node.  I have to manually go and poke at some attributes to force a refresh before it will pick up the new objects.

 

I realise using a wildcard isn't likely to create a dependency that actually detects the addition or removal of entire objects.  Is there any way I can force the issue though?

 

Can anyone suggest a way to force a specific node to refresh when a subnet contents change?  Or a more elegant way to automatically merge the contents of a subnet of course :-)

Share this post


Link to post
Share on other sites

Convert your subnet to an HDA. 

Under the scripts tab of the HDA, you can add an "on updated" script which will run whenever you update your hda. 

In the "on updated" script, you can add hscript or python code to force a cook of your target SOP. 

Share this post


Link to post
Share on other sites
I've got the same problem when using the `opnchildren` function to retrieve the number of objects in a network. The parameter holding the `opnchildren` expression gets updated as soon I add/remove an object from the network but anything else depending on that parameter doesn't get updated unless I toggle the bypass flag of the problematic nodes.

 

I've atached a simple example scene to illustrate the issue.

 

I would like to avoid having to create a digital asset if possible—is there any other solution?

 

cook_issue.hipnc

Share this post


Link to post
Share on other sites

Add button to your subnet > change Callback Script language to Python > then put following code in there:

for c in hou.pwd().children(): c.cook(force=True, frame_range=(hou.hscriptExpression('$RFSTART'), hou.hscriptExpression('$RFSTART + 1')))

Share this post


Link to post
Share on other sites

This will cook 1 frame of children of subnet. So any time you change something, press this button.

Share this post


Link to post
Share on other sites

Thanks pbarua! I ended up using a similar approach but I somehow wished that there would be a way to do this without any user input. I would have expected the nodes to be recooked when the parameters they depend on are being changed but maybe it is a deeper issue than what it looks like.

Share this post


Link to post
Share on other sites

Why dont you merge all objects in subnet with merge node (lets call it OUT_GEOS) so your objectmerge path pointed to OUT_GEOS

Everytime you add a new object you hook it into OUT_GEOS too?

Share this post


Link to post
Share on other sites

Why dont you merge all objects in subnet with merge node (lets call it OUT_GEOS) so your objectmerge path pointed to OUT_GEOS

Everytime you add a new object you hook it into OUT_GEOS too?

You can't merge objects unless you write your own merge at object level.

If you have more than 100 objects inside subnet then it's really painful to fetch them individually using objectmerge sop. So I think using * is better option.  

Edited by pbarua

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

×