[Bf-blender-cvs] [bc0e121bce2] master: UI: Reorder mesh merge operator types for consistent shortcuts

Hans Goudey noreply at git.blender.org
Wed Feb 24 20:08:32 CET 2021


Commit: bc0e121bce257a8ea9d7855b074a7a22a8c3699b
Author: Hans Goudey
Date:   Wed Feb 24 13:08:26 2021 -0600
Branches: master
https://developer.blender.org/rBbc0e121bce257a8ea9d7855b074a7a22a8c3699b

UI: Reorder mesh merge operator types for consistent shortcuts

In vertex selection mode, the "At First" and "At Last" options are
contextually added to the beginning of the list of merge operations.
This means the automatic shortcuts in the merge menu are different,
making learning the shortcuts much more difficult than necessary.

This patch reorders the items so that "At First" and "At Last" are
added after the first three options so the shortcuts are always
consistent.

Fixes T84335

Differential Revision: https://developer.blender.org/D10008

===================================================================

M	source/blender/editors/mesh/editmesh_tools.c

===================================================================

diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 231e6fbc2d9..2ea68c3354a 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3261,11 +3261,11 @@ static int edbm_merge_exec(bContext *C, wmOperator *op)
 }
 
 static const EnumPropertyItem merge_type_items[] = {
-    {MESH_MERGE_FIRST, "FIRST", 0, "At First", ""},
-    {MESH_MERGE_LAST, "LAST", 0, "At Last", ""},
     {MESH_MERGE_CENTER, "CENTER", 0, "At Center", ""},
     {MESH_MERGE_CURSOR, "CURSOR", 0, "At Cursor", ""},
     {MESH_MERGE_COLLAPSE, "COLLAPSE", 0, "Collapse", ""},
+    {MESH_MERGE_FIRST, "FIRST", 0, "At First", ""},
+    {MESH_MERGE_LAST, "LAST", 0, "At Last", ""},
     {0, NULL, 0, NULL, NULL},
 };
 
@@ -3284,6 +3284,11 @@ static const EnumPropertyItem *merge_type_itemf(bContext *C,
     int totitem = 0;
     BMEditMesh *em = BKE_editmesh_from_object(obedit);
 
+    /* Keep these first so that their automatic shortcuts don't change. */
+    RNA_enum_items_add_value(&item, &totitem, merge_type_items, MESH_MERGE_CENTER);
+    RNA_enum_items_add_value(&item, &totitem, merge_type_items, MESH_MERGE_CURSOR);
+    RNA_enum_items_add_value(&item, &totitem, merge_type_items, MESH_MERGE_COLLAPSE);
+
     /* Only active object supported:
      * In practice it doesn't make sense to run this operation on non-active meshes
      * since selecting will activate - we could have own code-path for these but it's a hassle
@@ -3305,9 +3310,6 @@ static const EnumPropertyItem *merge_type_itemf(bContext *C,
       }
     }
 
-    RNA_enum_items_add_value(&item, &totitem, merge_type_items, MESH_MERGE_CENTER);
-    RNA_enum_items_add_value(&item, &totitem, merge_type_items, MESH_MERGE_CURSOR);
-    RNA_enum_items_add_value(&item, &totitem, merge_type_items, MESH_MERGE_COLLAPSE);
     RNA_enum_item_end(&item, &totitem);
 
     *r_free = true;



More information about the Bf-blender-cvs mailing list