- move vgroup lock buttons on the panel into the vgroup specials menu.
authorCampbell Barton <ideasman42@gmail.com>
Wed, 14 Sep 2011 08:21:21 +0000 (08:21 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 14 Sep 2011 08:21:21 +0000 (08:21 +0000)
- merge object.vertex_group_lock_all / object.vertex_group_invert_locks / "object.vertex_group_unlock_all into one operator.
- change lock button from a checkbox to a lock icon.

release/scripts/startup/bl_ui/properties_data_mesh.py
source/blender/editors/interface/interface_templates.c
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_ops.c
source/blender/editors/object/object_vgroup.c
source/blender/makesdna/DNA_scene_types.h

index ae3a27a..a94a459 100644 (file)
@@ -35,6 +35,10 @@ class MESH_MT_vertex_group_specials(Menu):
         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").all = True
+        layout.separator()
+        layout.operator("object.vertex_group_lock", icon='LOCK', text="Lock All").action = 'SELECT'
+        layout.operator("object.vertex_group_lock", icon='UNLOCK', text="UnLock All").action = 'DESELECT'
+        layout.operator("object.vertex_group_lock", icon='LOCK', text="Lock Invert All").action = 'INVERT'
 
 
 class MESH_MT_shape_key_specials(Menu):
@@ -144,9 +148,6 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
         row.template_list(ob, "vertex_groups", ob.vertex_groups, "active_index", rows=rows)
 
         col = row.column(align=True)
-        # Jason was here, this was replaced by hardcoded list view checkboxes. #
-        #col.prop(group, "flag")
-        
         col.operator("object.vertex_group_add", icon='ZOOMIN', text="")
         col.operator("object.vertex_group_remove", icon='ZOOMOUT', text="")
         col.menu("MESH_MT_vertex_group_specials", icon='DOWNARROW_HLT', text="")
@@ -157,14 +158,6 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
         if group:
             row = layout.row()
             row.prop(group, "name")
-        #Jason was here
-        # add buttons to make it faster to lock/unlock vgroups
-        if ob.mode == 'WEIGHT_PAINT' and len(ob.vertex_groups) > 0:
-            row = layout.row()
-            sub = row.row(align=True)
-            sub.operator("object.vertex_group_lock_all", text="Lock All")
-            sub.operator("object.vertex_group_invert_locks", text="Invert Locks")
-            sub.operator("object.vertex_group_unlock_all", text="Unlock All")
 
         if ob.mode == 'EDIT' and len(ob.vertex_groups) > 0:
             row = layout.row()
index a696e48..ff1c3c6 100644 (file)
@@ -2126,9 +2126,16 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
        }
        /* Jason was here: I need the RNA struct for vertex groups */
        else if(itemptr->type == &RNA_VertexGroup) {
+               bDeformGroup *dg= (bDeformGroup *)itemptr->data;
                uiItemL(sub, name, icon);
-               uiBlockSetEmboss(block, UI_EMBOSS);
+               /* RNA does not allow nice lock icons, use lower level buttons */
+#if 0
                uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "lock_weight", 0, 0, 0, 0, 0,  NULL);
+#else
+               uiBlockSetEmboss(block, UI_EMBOSSN);
+               uiDefIconButBitC(block, TOG, DG_LOCK_WEIGHT, 0, (dg->flag & DG_LOCK_WEIGHT) ? ICON_LOCKED : ICON_UNLOCKED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &dg->flag, 0, 0, 0, 0, "Maintain relative weights while painting");
+               uiBlockSetEmboss(block, UI_EMBOSS);
+#endif
        }
        else if(itemptr->type == &RNA_KeyingSetPath) {
                KS_Path *ksp = (KS_Path*)itemptr->data;
index fb119b1..cbce152 100644 (file)
@@ -201,9 +201,7 @@ void OBJECT_OT_vertex_group_normalize(struct wmOperatorType *ot);
 void OBJECT_OT_vertex_group_normalize_all(struct wmOperatorType *ot);
 void OBJECT_OT_vertex_group_levels(struct wmOperatorType *ot);
 /* Jason was here */
-void OBJECT_OT_vertex_group_lock_all(struct wmOperatorType *ot);
-void OBJECT_OT_vertex_group_invert_locks(struct wmOperatorType *ot);
-void OBJECT_OT_vertex_group_unlock_all(struct wmOperatorType *ot);
+void OBJECT_OT_vertex_group_lock(struct wmOperatorType *ot);
 void OBJECT_OT_vertex_group_fix(struct wmOperatorType *ot);
 
 void OBJECT_OT_vertex_group_invert(struct wmOperatorType *ot);
index b36357f..c34fb2e 100644 (file)
@@ -175,9 +175,7 @@ void ED_operatortypes_object(void)
        WM_operatortype_append(OBJECT_OT_vertex_group_normalize);
        WM_operatortype_append(OBJECT_OT_vertex_group_normalize_all);
        /* Jason was here */
-       WM_operatortype_append(OBJECT_OT_vertex_group_invert_locks);
-       WM_operatortype_append(OBJECT_OT_vertex_group_lock_all);
-       WM_operatortype_append(OBJECT_OT_vertex_group_unlock_all);
+       WM_operatortype_append(OBJECT_OT_vertex_group_lock);
        WM_operatortype_append(OBJECT_OT_vertex_group_fix);
 
        WM_operatortype_append(OBJECT_OT_vertex_group_invert);
index bbc707d..49ff4ac 100644 (file)
@@ -1292,31 +1292,34 @@ static void vgroup_normalize_all(Object *ob, int lock_active)
 
        if (dvert_array) MEM_freeN(dvert_array);
 }
+
 /* Jason was here */
-static void vgroup_invert_locks(Object *ob)
-{
-       bDeformGroup *dg = ob->defbase.first;
-       while(dg) {
-               dg->flag = !dg->flag;
-               dg = dg->next;
-       }
-}
-/* Jason was here */
-static void vgroup_lock_all(Object *ob)
+static void vgroup_lock_all(Object *ob, int action)
 {
-       bDeformGroup *dg = ob->defbase.first;
-       while(dg) {
-               dg->flag |= DG_LOCK_WEIGHT;
-               dg = dg->next;
+       bDeformGroup *dg;
+
+       if(action == SEL_TOGGLE) {
+               action= SEL_SELECT;
+               for(dg= ob->defbase.first; dg; dg= dg->next) {
+                       if(dg->flag & DG_LOCK_WEIGHT) {
+                               action= SEL_DESELECT;
+                               break;
+                       }
+               }
        }
-}
-/* Jason was here */
-static void vgroup_unlock_all(Object *ob)
-{
-       bDeformGroup *dg = ob->defbase.first;
-       while(dg) {
-               dg->flag &= ~DG_LOCK_WEIGHT;
-               dg = dg->next;
+
+       for(dg= ob->defbase.first; dg; dg= dg->next) {
+               switch(action) {
+                       case SEL_SELECT:
+                               dg->flag |= DG_LOCK_WEIGHT;
+                               break;
+                       case SEL_DESELECT:
+                               dg->flag &= ~DG_LOCK_WEIGHT;
+                               break;
+                       case SEL_INVERT:
+                               dg->flag ^= DG_LOCK_WEIGHT;
+                               break;
+               }
        }
 }
 
@@ -2375,75 +2378,35 @@ void OBJECT_OT_vertex_group_fix(wmOperatorType *ot)
        RNA_def_float(ot->srna, "strength", 1.f, -2.0f, FLT_MAX, "Strength", "The distance moved can be changed by this multiplier.", -2.0f, 2.0f);
        RNA_def_float(ot->srna, "cp", 1.0f, 0.05f, FLT_MAX, "Change Sensitivity", "Changes the amount weights are altered with each iteration: lower values are slower.", 0.05f, 1.f);
 }
-/* Jason was here */
-static int vertex_group_invert_locks_exec(bContext *C, wmOperator *UNUSED(op))
-{
-       Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
-
-       vgroup_invert_locks(ob);
-
-       return OPERATOR_FINISHED;
-}
-/* Jason was here */
-void OBJECT_OT_vertex_group_invert_locks(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Invert All Vertex Group Locks";
-       ot->idname= "OBJECT_OT_vertex_group_invert_locks";
-
-       /* api callbacks */
-       ot->poll= vertex_group_poll;
-       ot->exec= vertex_group_invert_locks_exec;
 
-       /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
 /* Jason was here */
-static int vertex_group_lock_all_exec(bContext *C, wmOperator *UNUSED(op))
+static int vertex_group_lock_exec(bContext *C, wmOperator *op)
 {
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
 
-       vgroup_lock_all(ob);
+       int action = RNA_enum_get(op->ptr, "action");
+
+       vgroup_lock_all(ob, action);
 
        return OPERATOR_FINISHED;
 }
 /* Jason was here */
-void OBJECT_OT_vertex_group_lock_all(wmOperatorType *ot)
+void OBJECT_OT_vertex_group_lock(wmOperatorType *ot)
 {
        /* identifiers */
-       ot->name= "Turn on all Vertex Group Locks";
-       ot->idname= "OBJECT_OT_vertex_group_lock_all";
+       ot->name= "Change the Lock On Vertex Groups";
+       ot->idname= "OBJECT_OT_vertex_group_lock";
 
        /* api callbacks */
        ot->poll= vertex_group_poll;
-       ot->exec= vertex_group_lock_all_exec;
+       ot->exec= vertex_group_lock_exec;
 
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-/* Jason was here */
-static int vertex_group_unlock_all_exec(bContext *C, wmOperator *UNUSED(op))
-{
-       Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
 
-       vgroup_unlock_all(ob);
-
-       return OPERATOR_FINISHED;
+       WM_operator_properties_select_all(ot);
 }
-/* Jason was here */
-void OBJECT_OT_vertex_group_unlock_all(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Turn off all Vertex Group Locks";
-       ot->idname= "OBJECT_OT_vertex_group_unlock_all";
 
-       /* api callbacks */
-       ot->poll= vertex_group_poll;
-       ot->exec= vertex_group_unlock_all_exec;
-
-       /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
 static int vertex_group_invert_exec(bContext *C, wmOperator *op)
 {
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
index 66244e8..fe2566b 100644 (file)
@@ -759,12 +759,12 @@ typedef struct ToolSettings {
        short snap_flag, snap_target;
        short proportional, prop_mode;
        char proportional_objects; /* proportional edit, object mode */
-       char pad[7];
+       char pad[5];
 
-       int auto_normalize; /*auto normalizing mode in wpaint*/
+       char auto_normalize; /*auto normalizing mode in wpaint*/
 
        //Jason
-       int multipaint; /* paint multiple bones in wpaint */
+       char multipaint; /* paint multiple bones in wpaint */
 
        short sculpt_paint_settings; /* user preferences for sculpt and paint */
        short pad1;