From 6d9fcdf9830e26b1d5c7e5dda5d86229126599e9 Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Tue, 4 Jun 2013 22:30:41 +0000 Subject: [PATCH] Added 'clear active group' to object data properties -> Vertex Groups -> pulldown menu --- .../scripts/startup/bl_ui/properties_data_mesh.py | 5 +++-- source/blender/editors/object/object_vgroup.c | 13 ++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 86a48999663..f85e7697df6 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -34,8 +34,9 @@ class MESH_MT_vertex_group_specials(Menu): layout.operator("object.vertex_group_copy_to_linked", icon='LINK_AREA') layout.operator("object.vertex_group_copy_to_selected", icon='LINK_AREA') layout.operator("object.vertex_group_mirror", icon='ARROW_LEFTRIGHT') - layout.operator("object.vertex_group_remove", icon='X', text="Delete All Vertex Groups").all = True - layout.operator("object.vertex_group_remove_from", icon='X', text="Remove Selected from All Vertex Groups").all = True + layout.operator("object.vertex_group_remove_from", icon='X', text="Remove from All Groups").use_all_groups = True + layout.operator("object.vertex_group_remove_from", icon='X', text="Clear Active Group").use_all_verts = True + layout.operator("object.vertex_group_remove", icon='X', text="Delete All Groups").all = True layout.separator() layout.operator("object.vertex_group_lock", icon='LOCKED', text="Lock All").action = 'LOCK' layout.operator("object.vertex_group_lock", icon='UNLOCKED', text="UnLock All").action = 'UNLOCK' diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 9a6cc7e4340..b3c8b1f720b 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -2850,9 +2850,12 @@ void OBJECT_OT_vertex_group_assign(wmOperatorType *ot) static int vertex_group_remove_from_exec(bContext *C, wmOperator *op) { + const bool use_all_groups = RNA_boolean_get(op->ptr, "use_all_groups"); + const bool use_all_verts = RNA_boolean_get(op->ptr, "use_all_verts"); + Object *ob = ED_object_context(C); - if (RNA_boolean_get(op->ptr, "all")) { + if (use_all_groups) { if (vgroup_remove_verts(ob, 0) == false) { return OPERATOR_CANCELLED; } @@ -2860,7 +2863,7 @@ static int vertex_group_remove_from_exec(bContext *C, wmOperator *op) else { bDeformGroup *dg = BLI_findlink(&ob->defbase, ob->actdef - 1); - if ((dg == NULL) || (vgroup_active_remove_verts(ob, false, dg) == false)) { + if ((dg == NULL) || (vgroup_active_remove_verts(ob, use_all_verts, dg) == false)) { return OPERATOR_CANCELLED; } } @@ -2873,6 +2876,7 @@ static int vertex_group_remove_from_exec(bContext *C, wmOperator *op) void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot) { + PropertyRNA *prop; /* identifiers */ ot->name = "Remove from Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_remove_from"; @@ -2889,7 +2893,10 @@ void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot) ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO; /* properties */ - RNA_def_boolean(ot->srna, "all", 0, "All", "Remove from all vertex groups"); + prop = RNA_def_boolean(ot->srna, "use_all_groups", 0, "All Groups", "Remove from all Groups"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_boolean(ot->srna, "use_all_verts", 0, "All verts", "Clear Active Group"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } static int vertex_group_select_exec(bContext *C, wmOperator *UNUSED(op))