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:
authorCampbell Barton <ideasman42@gmail.com>2011-09-14 12:21:21 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-14 12:21:21 +0400
commitdf433c7a1dd351831ca299e7aecfb7877a19b2f7 (patch)
tree2ca717bb5fb93c556cb4d04651b08dc07f2bccdd
parent86777f46e1d359ad9cf208c5ab3ed76d4a345267 (diff)
- move vgroup lock buttons on the panel into the vgroup specials menu.
- 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.
-rw-r--r--release/scripts/startup/bl_ui/properties_data_mesh.py15
-rw-r--r--source/blender/editors/interface/interface_templates.c9
-rw-r--r--source/blender/editors/object/object_intern.h4
-rw-r--r--source/blender/editors/object/object_ops.c4
-rw-r--r--source/blender/editors/object/object_vgroup.c105
-rw-r--r--source/blender/makesdna/DNA_scene_types.h6
6 files changed, 51 insertions, 92 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py
index ae3a27a776f..a94a45958de 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -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()
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index a696e488800..ff1c3c687f9 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -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;
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index fb119b1d264..cbce1526c3c 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -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);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index b36357facb1..c34fb2e22dc 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -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);
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index bbc707de718..49ff4ac212d 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -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;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 66244e87995..fe2566b4542 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -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;