From f78aa6c03491963fcd16bafd8d987736ac8aedaf Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Thu, 15 Jun 2023 15:36:00 +0200 Subject: [PATCH] Fix #108527: Fixing Vertex Group operators to default back to Active Vertex Group Reverting changes made in [D14961](https://archive.blender.org/developer/D14961) to default to `Deform Bone` for objects with armatures. Instead explicitly update RNA enum to set default subset for just the normalize all operator. Pull Request: https://projects.blender.org/blender/blender/pulls/108902 --- source/blender/editors/object/object_vgroup.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/object/object_vgroup.cc b/source/blender/editors/object/object_vgroup.cc index 576dd83cf61..9a90d37263e 100644 --- a/source/blender/editors/object/object_vgroup.cc +++ b/source/blender/editors/object/object_vgroup.cc @@ -722,7 +722,7 @@ static const EnumPropertyItem WT_vertex_group_select_item[] = { const EnumPropertyItem *ED_object_vgroup_selection_itemf_helper(const bContext *C, PointerRNA * /*ptr*/, - PropertyRNA *prop, + PropertyRNA * /*prop*/, bool *r_free, const uint selection_mask) { @@ -760,12 +760,6 @@ const EnumPropertyItem *ED_object_vgroup_selection_itemf_helper(const bContext * RNA_enum_items_add_value(&item, &totitem, WT_vertex_group_select_item, WT_VGROUP_ALL); } - /* Set `Deform Bone` as default selection if armature is present. */ - if (ob) { - RNA_def_property_enum_default( - prop, BKE_modifiers_is_deformed_by_armature(ob) ? WT_VGROUP_BONE_DEFORM : WT_VGROUP_ALL); - } - RNA_enum_item_end(&item, &totitem); *r_free = true; @@ -2907,6 +2901,12 @@ void OBJECT_OT_vertex_group_normalize(wmOperatorType *ot) static int vertex_group_normalize_all_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_context(C); + + /* If armature is present, default to `Deform Bones` otherwise `All Groups`. */ + RNA_enum_set(op->ptr, + "group_select_mode", + BKE_modifiers_is_deformed_by_armature(ob) ? WT_VGROUP_BONE_DEFORM : WT_VGROUP_ALL); + bool lock_active = RNA_boolean_get(op->ptr, "lock_active"); eVGroupSelect subset_type = static_cast( RNA_enum_get(op->ptr, "group_select_mode"));