'Dissolve' operator leaves inconsistent selection #72806

Open
opened 2019-12-30 20:47:16 +01:00 by Stanislav Blinov · 11 comments

Blender Version
Broken: 2.82 (62d131e962) (down to, and including, 2.79)
Worked: N/A

Short description of error
After dissolution of edges in Edge selection mode, some vertices not connected with edges remain selected (which is indicated by a tool gizmo, Verts readout in the status bar, and verified by switching to Vertex selection mode).

Exact steps for others to reproduce the error

  1. In a empty scene, add a mesh Grid.
  2. Switch to edit mode and Edge selection mode.
  3. Select one edge somewhere inside the grid (not on border).
  4. Dissolve it via the Delete -> Dissolve Edges or a default shortcut Ctrl+X.
  5. Verts readout in the status bar should show 2 selected vertices (despite you being in edge mode with no edges selected).
  6. Switch to Vertex selection mode: the two verts from that dissolved edge are still selected.
  7. Deselect all, switch to Edge selection mode and box-select one square at the corner of the Grid.
  8. Dissolve edges as in (4).
  9. Note that this time, Verts in status bar only shows one selected vertex: switching to Vertex mode would reveal it's the corner one.

It would seem that the vertices do remain "selected" for operators as well: after (4) or (8) you can transform those verts using a gizmo or shortcuts, extrude them (with strange results), connect them using Fill or Connect Vertex Path, and delete them (even though you're in Edge mode).

Update: Video demo here .

**Blender Version** Broken: 2.82 (62d131e962d6e0a4f39db98d4f89243c16c55779) (down to, and including, 2.79) Worked: N/A **Short description of error** After dissolution of edges in Edge selection mode, some vertices not connected with edges remain selected (which is indicated by a tool gizmo, Verts readout in the status bar, and verified by switching to Vertex selection mode). **Exact steps for others to reproduce the error** 1. In a empty scene, add a mesh Grid. 2. Switch to edit mode and Edge selection mode. 3. Select one edge somewhere inside the grid (not on border). 4. Dissolve it via the Delete -> Dissolve Edges or a default shortcut Ctrl+X. 5. Verts readout in the status bar should show 2 selected vertices (despite you being in edge mode with no edges selected). 6. Switch to Vertex selection mode: the two verts from that dissolved edge are still selected. 7. Deselect all, switch to Edge selection mode and box-select one square at the corner of the Grid. 8. Dissolve edges as in (4). 9. Note that this time, Verts in status bar only shows one selected vertex: switching to Vertex mode would reveal it's the corner one. It would seem that the vertices do remain "selected" for operators as well: after (4) or (8) you can transform those verts using a gizmo or shortcuts, extrude them (with strange results), connect them using Fill or Connect Vertex Path, and delete them (even though you're in Edge mode). Update: Video demo [here ](https://youtu.be/FAfhSU2AdbQ).

Added subscriber: @Stan_Pancakes

Added subscriber: @Stan_Pancakes

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

By "box-select one square at the corner of the Grid" you mean this?:
image.png

In this case the vertices of the selected edges will also be deleted, so they will not appear as selected.
That doesn't seem like a bug to me.

By `"box-select one square at the corner of the Grid"` you mean this?: ![image.png](https://archive.blender.org/developer/F8266354/image.png) In this case the vertices of the selected edges will also be deleted, so they will not appear as selected. That doesn't seem like a bug to me.

One square, as in one face :) But it shows with your example too. After doing a ctrl+x, look at the stats. You should have one edge and one vert selected (should be impossible when an edge is selected), and switching to vertex mode will only have one corner vert selected.

EDIT: furthermore, switching back to edge mode will then still select an edge (from one vertex), and this time with 2 verts. :-=\

One square, as in one face :) But it shows with your example too. After doing a ctrl+x, look at the stats. You should have one edge and **one** vert selected (should be impossible when an edge is selected), and switching to vertex mode will only have one corner vert selected. EDIT: furthermore, switching back to edge mode will then still select an edge (from **one** vertex), and this time with 2 verts. :-=\

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'

Added subscriber: @ideasman42

Added subscriber: @ideasman42

I can confirm. The resulting edge is selected but one of its vertices is not.
Theoretically in code this is possible, but for the user this can get in the way of operations like transform for example.

This patch would solve most cases with this incosistence.

diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index 6c662323ec1..573971136fb 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -355,7 +355,13 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
     BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) {
       if (BMO_vert_flag_test(bm, v, VERT_MARK)) {
         if (BM_vert_is_edge_pair(v)) {
-          BM_vert_collapse_edge(bm, v->e, v, true, true);
+          BMEdge *e_new = BM_vert_collapse_edge(bm, v->e, v, true, true);
+          if (e_new->v1->head.hflag & e_new->v2->head.hflag & BM_ELEM_SELECT) {
+            BM_elem_flag_enable(e_new, BM_ELEM_SELECT);
+          }
+          else {
+            BM_elem_flag_disable(e_new, BM_ELEM_SELECT);
+          }
         }
       }
     }

But the real solution might be to flush the mesh after calling the operator.
I don't know if this qualifies as a bug or known issue.
@ideasman42, what do you think?

I can confirm. The resulting edge is selected but one of its vertices is not. Theoretically in code this is possible, but for the user this can get in the way of operations like transform for example. This patch would solve most cases with this incosistence. ``` diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 6c662323ec1..573971136fb 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -355,7 +355,13 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op) BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) { if (BMO_vert_flag_test(bm, v, VERT_MARK)) { if (BM_vert_is_edge_pair(v)) { - BM_vert_collapse_edge(bm, v->e, v, true, true); + BMEdge *e_new = BM_vert_collapse_edge(bm, v->e, v, true, true); + if (e_new->v1->head.hflag & e_new->v2->head.hflag & BM_ELEM_SELECT) { + BM_elem_flag_enable(e_new, BM_ELEM_SELECT); + } + else { + BM_elem_flag_disable(e_new, BM_ELEM_SELECT); + } } } } ``` But the real solution might be to flush the mesh after calling the operator. I don't know if this qualifies as a bug or known issue. @ideasman42, what do you think?

It's not just transform, simple mode switching can also bring unexpected results (see the video linked in the description).

It's not just transform, simple mode switching can also bring unexpected results (see the video linked in the description).

Added subscriber: @mont29

Added subscriber: @mont29

Would consider this as a bug for now, afaik tools should always leave selection in a state that is consistent with current selection mode?

Would consider this as a bug for now, afaik tools should always leave selection in a state that is consistent with current selection mode?
Philipp Oeser removed the
Interest
Modeling
label 2023-02-09 15:29:32 +01:00
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
3 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#72806
No description provided.