Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Rupsis <nrupsis>2022-06-30 13:53:56 +0300
committerSybren A. Stüvel <sybren@blender.org>2022-06-30 13:54:27 +0300
commit0f22b5599a03d5ce61450528c74ad2f2e47cf913 (patch)
tree065723f3ff061ca2f0d2632b91f3bb9032ae4256 /source/blender/editors/object
parent4a7e1c920979c016fc8a2de325e39617a3a9b94e (diff)
Normalize Weights: use valid default Subset for current context
For the Normalize Weights operator, dynamically set the default 'Subset' parameter so that it is applicable to the current context. When the user's last use of Normalize Weights was set to "Deform Pose Bones", and then tries to use the operator on a mesh without armature, Blender would try to use the previous opertor properties and show an error message. This is resolved by switching to `WT_VGROUP_ACTIVE` in such cases. Reviewed By: zanqdo, sybren Maniphest Tasks: T95038 Differential Revision: https://developer.blender.org/D14961
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_vgroup.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 9ad36cacc7d..88b27bd4cea 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -693,7 +693,7 @@ static const EnumPropertyItem WT_vertex_group_select_item[] = {
const EnumPropertyItem *ED_object_vgroup_selection_itemf_helper(const bContext *C,
PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop),
+ PropertyRNA *prop,
bool *r_free,
const uint selection_mask)
{
@@ -731,6 +731,10 @@ 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. */
+ 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;