Querying nodes in new for loop

   2620   5   1
User Avatar
Member
228 posts
Joined: Dec. 2012
Offline
With the old subnet Foreach SOP it was straightforward to get a list of nodes that were inside - just get a list of children. With the new loops, is there a way (via python/VEX/etc) to get a list of the nodes that are contained within the loop / boundary? Example, I want a list of nodes within the gray loop boundary - Houdini is clearly tracking it but can it be queried from script?

Attachments:
forLoop.jpg (11.9 KB)

www.kmcnamara.com
User Avatar
Member
228 posts
Joined: Dec. 2012
Offline
Bumping up to see if anyone knows - otherwise I'll get in touch with support
www.kmcnamara.com
User Avatar
Member
459 posts
Joined: Oct. 2011
Offline
Hi
I don't know if there is a way to query that membership. But the Block Begin and the Block End are aware of each other through the Block Path parameter. So you have a range to work with (Sort of)
Could you iterate over all the nodes connected to the output of Block Start and the input of Block end? As some nodes are only connected to one or the other and some are only indirectly connected so you would have to run you iterations a couple of levels deep.
Might be worth a try.

-b
http://www.racecar.no [www.racecar.no]
User Avatar
Member
228 posts
Joined: Dec. 2012
Offline
Yea I was thinking of that as an alternative. I was thinking about traversing down from the block begin but wasn't aware of the block path parameter so traversing from both ends will be more complete. If there isn't a built in function for this, that's what I'll do! Thanks
www.kmcnamara.com
User Avatar
Staff
6413 posts
Joined: July 2005
Offline
There is no exposed parameter for this. It also isn't very accurate, you probably have noticed that the convex hull doesn't always have all the nodes that are inside. For example, if you have a detail() expression connecting to a metadata node, that node should also be pulled inside. But it isn't.

OTOH, the rule you used for old-style foreach nodes was also wrong. Whether a node was inside or outside of the subnet actually has nothing to do with whether or not it is inside the loop. For example, any nodes placed before the Each sop would be executed only once, despite being “inside” the subnet. You can also pull the Each sop outside of the subnet and have nodes outside the subnet be inside the loop.
User Avatar
Member
228 posts
Joined: Dec. 2012
Offline
Ok, thanks jeff. I'll go with the proposed technique then.

jlait
OTOH, the rule you used for old-style foreach nodes was also wrong. Whether a node was inside or outside of the subnet actually has nothing to do with whether or not it is inside the loop. For example, any nodes placed before the Each sop would be executed only once, despite being “inside” the subnet. You can also pull the Each sop outside of the subnet and have nodes outside the subnet be inside the loop.

Yes, but I would consider that bad style and we don't do that in our setups. For our use case, we're just looking for something generally works. If a user does something crazy and we miss a few nodes, that's ok for now (likewise for the cases where the new for loop boundary misses nodes - not a huge deal for our use case).
www.kmcnamara.com
  • Quick Links