[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52917] trunk/blender: Use own list of actions for Vertex Group Lock operator instead of reusing Select All actions .

Sv. Lockal lockalsash at gmail.com
Wed Dec 12 11:21:26 CET 2012


Revision: 52917
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52917
Author:   lockal
Date:     2012-12-12 10:21:24 +0000 (Wed, 12 Dec 2012)
Log Message:
-----------
Use own list of actions for Vertex Group Lock operator instead of reusing Select All actions.

Previous actions and descriptions were confusing, e. g. UnLock All used the description of Deselect All.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_data_mesh.py
    trunk/blender/source/blender/editors/object/object_vgroup.c

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_data_mesh.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_data_mesh.py	2012-12-12 09:49:05 UTC (rev 52916)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_data_mesh.py	2012-12-12 10:21:24 UTC (rev 52917)
@@ -36,8 +36,8 @@
         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'
 
 

Modified: trunk/blender/source/blender/editors/object/object_vgroup.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_vgroup.c	2012-12-12 09:49:05 UTC (rev 52916)
+++ trunk/blender/source/blender/editors/object/object_vgroup.c	2012-12-12 10:21:24 UTC (rev 52917)
@@ -1516,16 +1516,30 @@
 	}
 }
 
+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 @@
 
 	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 @@
 	/* 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)




More information about the Bf-blender-cvs mailing list