Querying nodes in new for loop
2624 5 1- KMcNamara
- 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?
- KMcNamara
- Member
- 228 posts
- Joined: Dec. 2012
- Offline
- bonsak
- 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
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
- KMcNamara
- Member
- 228 posts
- Joined: Dec. 2012
- Offline
- jlait
- 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.
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.
- KMcNamara
- Member
- 228 posts
- Joined: Dec. 2012
- Offline
Ok, thanks jeff. I'll go with the proposed technique then.
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).
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).
-
- Quick Links