Jump to content

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 :-)

Link to comment
Share on other sites

  • 3 months later...

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. 

Link to comment
Share on other sites

  • 11 months later...
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?



Link to comment
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')))
Link to comment
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.

Link to comment
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
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.

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