7
$\begingroup$

Say I have a mesh in edit mode with a single edge selected and that edge belongs to a loop. How do I select that loop with geometry nodes in Tool mode?

Context: I find myself in a situation where I often need to reduce geometry of imported models and so I select some edge ring, checker deselect, multiselect loops and dissolve them to delete every other loop. Would be nice to have a node tool. Picked selecting a loop as a random step of this and have no idea how to approach this.

$\endgroup$
5
  • 1
    $\begingroup$ Great question. So, we want to walk the mesh, both ways, through 4-poles, finding edge +2 in each pole. Do you know how Blender finds edge +2, in the code? You could sort by cross-product with incoming, but that seems expensive. $\endgroup$
    – Robin Betts
    Nov 15, 2023 at 11:24
  • $\begingroup$ @quellenform, hi what do you have against "node tools" tag? :D It's a bit weird they call it tools as opposed to operators, but I think that's sort of official term now: code.blender.org/2023/10/node-tools I think it would be nice to have a "node tools" tag. I think there will be other questions specific to that. I hope there will be... $\endgroup$ Nov 15, 2023 at 22:13
  • $\begingroup$ @MartynasŽiemys I have nothing against it, but new tags should be discussed on Meta beforehand. Otherwise we run the risk of having a separate tag for each individual topic. $\endgroup$
    – quellenform
    Nov 15, 2023 at 22:28
  • $\begingroup$ Didn't think it required an official discussion based on this, but sure, makes sense $\endgroup$ Nov 15, 2023 at 22:39
  • $\begingroup$ There is a simpler set up to select edge loop in GN. However there is no way you would know the amount of edges in the loop and when to stop iterating in Geometry nodes (like WHILE loop). So you have to set the number of iterations manually which is somewhat a better tool than the current edge selection, because you can stop the edge selection at any step ( in my opinion). Is that is OK? $\endgroup$ Nov 19, 2023 at 12:36

1 Answer 1

9
+200
$\begingroup$

This method only works correctly when there's no faces flipped compared to others in the way of the loop. I may update this answer later with the solution. It also works for only one selected edge, and doesn't work for borders or no face edge loops

It is also slow on heavy meshes due to the required large iteration count of Repeat Zones

result

To select an edge loop starting on a specific edge we can walk through the edges of both ends until we find a non 4-pole or the.

To get the next edge in one of the directions, use the Corners of Edge node to get one of the corners of the edge $\to$ get the following corner in face with the Offset Corner in Face node $\to$ get its next edge with the Edges of Corner node $\to$ get its edge corner that is not the corner used to get the edge $\to$ offset that corner by $1 \to$ get that corner's next edge. While doing that we can check if the next vertex (offset corner by $1$) is not a 4-pole with the Vertex of Corner node and the face count of the Vertex Neighbors node, if its not, chech if the next edge is already selected:

This node group does a single step for one direction, to do both directions we use one node group per edge corner in a repeat zone:

In the loop, you use the node groups to get the next edge and set it selected, but only do that if Stop (found a non 4-pole) is false. If Stop is True, just pass the previous values to the next iteration using the Switch node.

I used 2 repeat zones nested to reduce the number of iterations executed after both directions stop. Just an extra group of Switch nodes to check.


$\small\text{Blender 4.0}$

$\endgroup$
1
  • 2
    $\begingroup$ I hope they add more native selection functionality to Node Tools soon. :D This might not be very practical to use, but it's very great help for learning how stuff works. $\endgroup$ Nov 17, 2023 at 22:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .