Use own list of actions for Vertex Group Lock operator instead of reusing Select...
authorSv. Lockal <lockalsash@gmail.com>
Wed, 12 Dec 2012 10:21:24 +0000 (10:21 +0000)
committerSv. Lockal <lockalsash@gmail.com>
Wed, 12 Dec 2012 10:21:24 +0000 (10:21 +0000)
Previous actions and descriptions were confusing, e. g. UnLock All used the description of Deselect All.

release/scripts/startup/bl_ui/properties_data_mesh.py
source/blender/editors/object/object_vgroup.c

index 6125540d4918ca829245f08f913a0e568fc57c8c..e33bed7ec6d66f70c503e40cbcea2e0c4bb77c97 100644 (file)
@@ -36,8 +36,8 @@ class MESH_MT_vertex_group_specials(Menu):
         layout.operator("object.vertex_group_mirror", icon='ARROW_LEFTRIGHT')
         layout.operator("object.vertex_group_remove", icon='X', text="Delete All").all = True
         layout.separator()
-        layout.operator("object.vertex_group_lock", icon='LOCKED', text="Lock All").action = 'SELECT'
-        layout.operator("object.vertex_group_lock", icon='UNLOCKED', text="UnLock All").action = 'DESELECT'
+        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'
         layout.operator("object.vertex_group_lock", icon='LOCKED', text="Lock Invert All").action = 'INVERT'
 
 
index 1b135c0686e2e447b8539bcdcba16654db6589c5..dae95a1bffc949eb74c58ba2ee5fe8d3163201ee 100644 (file)
@@ -1516,16 +1516,30 @@ static void vgroup_normalize_all(Object *ob, int lock_active)
        }
 }
 
+enum {
+       VGROUP_TOGGLE,
+       VGROUP_LOCK,
+       VGROUP_UNLOCK,
+       VGROUP_INVERT
+};
+
+static EnumPropertyItem vgroup_lock_actions[] = {
+       {VGROUP_TOGGLE, "TOGGLE", 0, "Toggle", "Unlock all vertex groups if there is at least one locked group, lock all in other case"},
+       {VGROUP_LOCK, "LOCK", 0, "Lock", "Lock all vertex groups"},
+       {VGROUP_UNLOCK, "UNLOCK", 0, "Unlock", "Unlock all vertex groups"},
+       {VGROUP_INVERT, "INVERT", 0, "Invert", "Invert the lock state of all vertex groups"},
+       {0, NULL, 0, NULL, NULL}
+};
 
 static void vgroup_lock_all(Object *ob, int action)
 {
        bDeformGroup *dg;
 
-       if (action == SEL_TOGGLE) {
-               action = SEL_SELECT;
+       if (action == VGROUP_TOGGLE) {
+               action = VGROUP_LOCK;
                for (dg = ob->defbase.first; dg; dg = dg->next) {
                        if (dg->flag & DG_LOCK_WEIGHT) {
-                               action = SEL_DESELECT;
+                               action = VGROUP_UNLOCK;
                                break;
                        }
                }
@@ -1533,13 +1547,13 @@ static void vgroup_lock_all(Object *ob, int action)
 
        for (dg = ob->defbase.first; dg; dg = dg->next) {
                switch (action) {
-                       case SEL_SELECT:
+                       case VGROUP_LOCK:
                                dg->flag |= DG_LOCK_WEIGHT;
                                break;
-                       case SEL_DESELECT:
+                       case VGROUP_UNLOCK:
                                dg->flag &= ~DG_LOCK_WEIGHT;
                                break;
-                       case SEL_INVERT:
+                       case VGROUP_INVERT:
                                dg->flag ^= DG_LOCK_WEIGHT;
                                break;
                }
@@ -2963,7 +2977,7 @@ void OBJECT_OT_vertex_group_lock(wmOperatorType *ot)
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-       WM_operator_properties_select_all(ot);
+       RNA_def_enum(ot->srna, "action", vgroup_lock_actions, VGROUP_TOGGLE, "Action", "Lock action to execute on vertex groups");
 }
 
 static int vertex_group_invert_exec(bContext *C, wmOperator *op)