"Pick Shortest Path" removes first selected from selection history (making following "Merge Vertices > First" to always merge at last) #117625

Open
opened 2024-01-29 10:41:58 +01:00 by Sergei Sobolev · 4 comments

System Information
Operating system: Windows-10-10.0.22621-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3070/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 551.23

Blender Version
Broken: version: 4.0.2, branch: blender-v4.0-release, commit date: 2023-12-05 07:41, hash: 9be62e85b727
Worked: (newest version of Blender that worked as expected)

Short description of error
Merge first/last doesn't count which vertex was the first or last.

Exact steps for others to reproduce the error
Select the first vertex.
Hold control and select the last.
Press M and choose merge at first/last

the file and a gif are attached to the bug.

**System Information** Operating system: Windows-10-10.0.22621-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3070/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 551.23 **Blender Version** Broken: version: 4.0.2, branch: blender-v4.0-release, commit date: 2023-12-05 07:41, hash: `9be62e85b727` Worked: (newest version of Blender that worked as expected) **Short description of error** Merge first/last doesn't count which vertex was the first or last. **Exact steps for others to reproduce the error** Select the first vertex. Hold control and select the last. Press M and choose merge at first/last the file and a gif are attached to the bug.
352 KiB
4.3 MiB
Sergei Sobolev added the
Type
Report
Status
Needs Triage
Priority
Normal
labels 2024-01-29 10:41:58 +01:00
Member

Seems to work as expected here (if I select the vertices again after opening the file).

Are you doing this right after opening the file?
Or have you actually selected the vertices again after opening the file?

Not sure if this is pure runtime data (does not look like it on first sight) -- if it is, this is probably expected behavior -- but first please answer the above question to make sure we are all on the same page

Seems to work as expected here (if I select the vertices again after opening the file). Are you doing this right after opening the file? Or have you actually selected the vertices again after opening the file? Not sure if this is pure runtime data (does not look like it on first sight) -- if it is, this is probably expected behavior -- but first please answer the above question to make sure we are all on the same page
Philipp Oeser added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2024-01-29 12:27:53 +01:00
Author

Please, do it again. Also, I've attached a GIF that shows the bug. I reopened the file and reproduced the bug. And here is attached a special video with a little explanation.

Please, do it again. Also, I've attached a GIF that shows the bug. I reopened the file and reproduced the bug. And here is attached a special video with a little explanation.
4.5 MiB
Member

Ah, can confirm now, seems like Pick Shortest Path removes the first selected element from the selection history on purpose, see the following call:

BM_select_history_remove(bm, v_act)

Then the last elem in the path might (or might not) be stored in the selection history [which seems fine].

Not sure exactly why the first element is unconditionally always removed here, maybe @ideasman42 recalls why this was done?
If this was done to ensure the same element is not in the history twice, this seems unnecessary since BM_select_history_store takes care of this?

Ah, can confirm now, seems like `Pick Shortest Path` removes the first selected element from the selection history on purpose, see the following call: `BM_select_history_remove(bm, v_act)` Then the last elem in the path might (or might not) be stored in the selection history [which seems fine]. Not sure exactly why the first element is unconditionally always removed here, maybe @ideasman42 recalls why this was done? If this was done to ensure the same element is not in the history twice, this seems unnecessary since `BM_select_history_store` takes care of this?
Member

Actually, my assumption is that code just swapped active and destination.

For vertices v_act is the first selected vertex, then v_dst is the second vertex selected to calculate the path in between.
To me, it makes more sense to remove the second one from the list (if at all) and then possibly (if PathSelectParams track_active is ON) add it back and make it active. But not "loose" the first one ever?

So, could it be that the intention was to do the following @ideasman42 ?


diff --git a/source/blender/editors/mesh/editmesh_path.cc b/source/blender/editors/mesh/editmesh_path.cc
index e48e106e3e8..297e87baf5a 100644
--- a/source/blender/editors/mesh/editmesh_path.cc
+++ b/source/blender/editors/mesh/editmesh_path.cc
@@ -221,7 +221,7 @@ static void mouse_mesh_shortest_path_vert(Scene * /*scene*/,
 
     if (path) {
       if (op_params->track_active) {
-        BM_select_history_remove(bm, v_act);
+        BM_select_history_remove(bm, v_dst);
       }
     }
   }
@@ -428,7 +428,7 @@ static void mouse_mesh_shortest_path_edge(
 
     if (path) {
       if (op_params->track_active) {
-        BM_select_history_remove(bm, e_act);
+        BM_select_history_remove(bm, e_dst);
       }
     }
   }
@@ -574,7 +574,7 @@ static void mouse_mesh_shortest_path_face(Scene * /*scene*/,
     if (f_act != f_dst) {
       if (path) {
         if (op_params->track_active) {
-          BM_select_history_remove(bm, f_act);
+          BM_select_history_remove(bm, f_dst);
         }
       }
     }
Actually, my assumption is that code just swapped active and destination. For vertices `v_act` is the first selected vertex, then `v_dst` is the second vertex selected to calculate the path in between. To me, it makes more sense to remove the second one from the list (if at all) and then possibly (if `PathSelectParams` `track_active` is ON) add it back and make it active. But not "loose" the first one ever? So, could it be that the intention was to do the following @ideasman42 ? ```diff diff --git a/source/blender/editors/mesh/editmesh_path.cc b/source/blender/editors/mesh/editmesh_path.cc index e48e106e3e8..297e87baf5a 100644 --- a/source/blender/editors/mesh/editmesh_path.cc +++ b/source/blender/editors/mesh/editmesh_path.cc @@ -221,7 +221,7 @@ static void mouse_mesh_shortest_path_vert(Scene * /*scene*/, if (path) { if (op_params->track_active) { - BM_select_history_remove(bm, v_act); + BM_select_history_remove(bm, v_dst); } } } @@ -428,7 +428,7 @@ static void mouse_mesh_shortest_path_edge( if (path) { if (op_params->track_active) { - BM_select_history_remove(bm, e_act); + BM_select_history_remove(bm, e_dst); } } } @@ -574,7 +574,7 @@ static void mouse_mesh_shortest_path_face(Scene * /*scene*/, if (f_act != f_dst) { if (path) { if (op_params->track_active) { - BM_select_history_remove(bm, f_act); + BM_select_history_remove(bm, f_dst); } } } ```
Philipp Oeser changed title from Merge first/last doesn't count which vertex was the first or last. to "Pick Shortest Path" removes first selected from selection history (making following "Merge Vertices > First" to always merge at last) 2024-01-30 12:07:20 +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
2 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#117625
No description provided.