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
This commit is contained in:
Hans Goudey 2021-02-24 13:08:26 -06:00
parent 66874824e6
commit bc0e121bce
Notes: blender-bot 2023-02-14 01:35:49 +01:00
Referenced by issue #84335, UI - merge vertices hotkey sequence should not depend on selection method
1 changed files with 7 additions and 5 deletions

View File

@ -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;