Loop selection corner case #84906

Closed
opened 2021-01-20 16:43:03 +01:00 by Stanislav Blinov · 9 comments

Blender Version
Broken: 2.93 master
Worked: never?

Short description of error

(pun almost intended)

image.png

In the left image, alt-clicking the highlighted edge only selects that edge, whereas alt-clicking any other edge along that loop selects the whole loop (including that edge). However, if faces are extruded to make the mesh in the right image, then alt-clicking that edge selects the whole loop.

Note that even though the edge does border an n-gon, there's still a clearly defined direction for the loop as the edge leads to a 4-pole.

loop_selection_issue.blend

**Blender Version** Broken: 2.93 master Worked: never? **Short description of error** (pun almost intended) ![image.png](https://archive.blender.org/developer/F9589686/image.png) In the left image, alt-clicking the highlighted edge only selects that edge, whereas alt-clicking any other edge along that loop selects the whole loop (including that edge). However, if faces are extruded to make the mesh in the right image, then alt-clicking that edge selects the whole loop. Note that even though the edge does border an n-gon, there's still a clearly defined direction for the loop as the edge leads to a 4-pole. [loop_selection_issue.blend](https://archive.blender.org/developer/F9589694/loop_selection_issue.blend)

Added subscriber: @Stan_Pancakes

Added subscriber: @Stan_Pancakes

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Thanks for the report I can confirm the problem.
Although there is an n-gon, in fact the behavior seems strange.
This is related to 01b3e9cc

Thanks for the report I can confirm the problem. Although there is an n-gon, in fact the behavior seems strange. This is related to 01b3e9cc
Member

Added subscribers: @ideasman42, @filedescriptor

Added subscribers: @ideasman42, @filedescriptor
Member

I looked into this and found a "fix" (I am not sure if it has any side effects):
P1924: Potential fix for #84906?

diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c
index 7d56e560275..0a9f2d60cab 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_impl.c
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@ -862,32 +862,7 @@ static void bmw_EdgeLoopWalker_begin(BMWalker *walker, void *data)
   lwalk->lastv = lwalk->startv = v;
   lwalk->is_boundary = BM_edge_is_boundary(e);
   lwalk->is_single = (lwalk->is_boundary && bm_edge_is_single(e));
-
-  /* could also check that vertex*/
-  if ((lwalk->is_boundary == false) && (vert_edge_count- [x] == 3 || vert_edge_count- [x] == 3)) {
-    BMIter iter;
-    BMFace *f_iter;
-    BMFace *f_best = NULL;
-
-    BM_ITER_ELEM (f_iter, &iter, e, BM_FACES_OF_EDGE) {
-      if (f_best == NULL || f_best->len < f_iter->len) {
-        f_best = f_iter;
-      }
-    }
-
-    if (f_best) {
-      /* only use hub selection for 5+ sides else this could
-       * conflict with normal edge loop selection. */
-      lwalk->f_hub = f_best->len > 4 ? f_best : NULL;
-    }
-    else {
-      /* edge doesn't have any faces connected to it */
-      lwalk->f_hub = NULL;
-    }
-  }
-  else {
-    lwalk->f_hub = NULL;
-  }
+  lwalk->f_hub = NULL;
 
   /* rewind */
   while ((owalk_pt = BMW_current_state(walker))) {

That if that I removed gets executed when the lower edge with the n-gon in the example is (loop) selected. Later in the step function, we only walk along the n-gon if the next vertex has exactly 3 neighbours. when it does not, the iteration ends. This seems very strange.

To summarize: I don't know what the use of the f_hub is or what the if in the bmw_EdgeLoopWalker_begin function should do. Sadly the comment on line 10 in the diff seems to incomplete. Removing that if (and therefore the use of f_hub) seems to fix the problem.

@ideasman42 what are your thoughts on this? Do you know what that code is for?

I looked into this and found a "fix" (I am not sure if it has any side effects): [P1924: Potential fix for #84906?](https://archive.blender.org/developer/P1924.txt) ```diff diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c index 7d56e560275..0a9f2d60cab 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_impl.c +++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c @@ -862,32 +862,7 @@ static void bmw_EdgeLoopWalker_begin(BMWalker *walker, void *data) lwalk->lastv = lwalk->startv = v; lwalk->is_boundary = BM_edge_is_boundary(e); lwalk->is_single = (lwalk->is_boundary && bm_edge_is_single(e)); - - /* could also check that vertex*/ - if ((lwalk->is_boundary == false) && (vert_edge_count- [x] == 3 || vert_edge_count- [x] == 3)) { - BMIter iter; - BMFace *f_iter; - BMFace *f_best = NULL; - - BM_ITER_ELEM (f_iter, &iter, e, BM_FACES_OF_EDGE) { - if (f_best == NULL || f_best->len < f_iter->len) { - f_best = f_iter; - } - } - - if (f_best) { - /* only use hub selection for 5+ sides else this could - * conflict with normal edge loop selection. */ - lwalk->f_hub = f_best->len > 4 ? f_best : NULL; - } - else { - /* edge doesn't have any faces connected to it */ - lwalk->f_hub = NULL; - } - } - else { - lwalk->f_hub = NULL; - } + lwalk->f_hub = NULL; /* rewind */ while ((owalk_pt = BMW_current_state(walker))) { ``` That `if` that I removed gets executed when the lower edge with the n-gon in the example is (loop) selected. Later in the step function, we only walk along the n-gon if the next vertex has exactly 3 neighbours. when it does not, the iteration ends. This seems very strange. To summarize: I don't know what the use of the `f_hub` is or what the `if` in the `bmw_EdgeLoopWalker_begin` function should do. Sadly the comment on line 10 in the diff seems to incomplete. Removing that `if` (and therefore the use of `f_hub`) seems to fix the problem. @ideasman42 what are your thoughts on this? Do you know what that code is for?

This issue was referenced by 213f8294b5

This issue was referenced by 213f8294b5c801c367fbddd6c1b4e6656908e71e

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Campbell Barton self-assigned this 2021-01-29 00:09:29 +01:00

@mano-wii & @filedescriptor, thanks for looking into this.

The f_hub was introduced in 01b3e9cc9f.

This is the image linked (recovered from the archive) BMesh_NGon_Loop_Select.png although the image along is still not enough to explain the behavior.

Committed more detailed description of this feature 1e355b0992 to avoid this kind of confusion in the future.

@mano-wii & @filedescriptor, thanks for looking into this. The `f_hub` was introduced in 01b3e9cc9f. This is the image linked (recovered from the archive) ![BMesh_NGon_Loop_Select.png](https://archive.blender.org/developer/F9603290/BMesh_NGon_Loop_Select.png) although the image along is still not enough to explain the behavior. Committed more detailed description of this feature 1e355b0992 to avoid this kind of confusion in the future.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#84906
No description provided.