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:
-rw-r--r--release/scripts/startup/bl_ui/properties_data_mesh.py7
-rw-r--r--source/blender/editors/object/object_intern.h5
-rw-r--r--source/blender/editors/object/object_ops.c5
-rw-r--r--source/blender/editors/object/object_vgroup.c108
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c9
5 files changed, 128 insertions, 6 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py
index 1aa5433190e..888ba55be3d 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -139,6 +139,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel):
col = row.column(align=True)
# Jason was here #
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="")
@@ -149,6 +150,12 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel):
if group:
row = layout.row()
row.prop(group, "name")
+ #Jason was here
+ 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/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 801880f0f32..1d3d0a311e0 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -199,6 +199,11 @@ void OBJECT_OT_vertex_group_copy(struct wmOperatorType *ot);
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_invert(struct wmOperatorType *ot);
void OBJECT_OT_vertex_group_blend(struct wmOperatorType *ot);
void OBJECT_OT_vertex_group_clean(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index ff9b13379a2..c9e6004510c 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -173,6 +173,11 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_vertex_group_copy);
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_invert);
WM_operatortype_append(OBJECT_OT_vertex_group_levels);
WM_operatortype_append(OBJECT_OT_vertex_group_blend);
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 53562caf1b5..bc598a5b8e4 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -829,7 +829,33 @@ 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)
+{
+ bDeformGroup *dg = ob->defbase.first;
+ while(dg) {
+ dg->flag = TRUE;
+ dg = dg->next;
+ }
+}
+/* Jason was here */
+static void vgroup_unlock_all(Object *ob)
+{
+ bDeformGroup *dg = ob->defbase.first;
+ while(dg) {
+ dg->flag = FALSE;
+ dg = dg->next;
+ }
+}
static void vgroup_invert(Object *ob, int auto_assign, int auto_remove)
{
@@ -1746,7 +1772,87 @@ void OBJECT_OT_vertex_group_normalize_all(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "lock_active", TRUE, "Lock Active", "Keep the values of the active group while normalizing others.");
}
+/* Jason was here */
+static int vertex_group_invert_locks_exec(bContext *C, wmOperator *op)
+{
+ Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+
+ vgroup_invert_locks(ob);
+ // not sure what these 3 do yet!
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+
+ 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 *op)
+{
+ Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+
+ vgroup_lock_all(ob);
+ // not sure what these 3 do yet!
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+
+ return OPERATOR_FINISHED;
+}
+/* Jason was here */
+void OBJECT_OT_vertex_group_lock_all(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Turn on all Vertex Group Locks";
+ ot->idname= "OBJECT_OT_vertex_group_lock_all";
+ /* api callbacks */
+ ot->poll= vertex_group_poll;
+ ot->exec= vertex_group_lock_all_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+/* Jason was here */
+static int vertex_group_unlock_all_exec(bContext *C, wmOperator *op)
+{
+ Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+
+ vgroup_unlock_all(ob);
+ // not sure what these 3 do yet!
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+
+ return OPERATOR_FINISHED;
+}
+/* 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/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 6c1de59a0c2..ecd09975355 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1230,6 +1230,7 @@ static void redistribute_weight_change(MDeformVert *dvert, MDeformWeight *pnt_dw
//printf("\n");
if(groups_left_that_can_change > 0) {
groups_currently_left = groups_left_that_can_change;
+ change = change_left/groups_left_that_can_change;
do {
was_a_change = FALSE;
for(i = 0; i < dvert->totweight; i++) {
@@ -1238,12 +1239,9 @@ static void redistribute_weight_change(MDeformVert *dvert, MDeformWeight *pnt_dw
continue;
}
- change = change_left/groups_left_that_can_change;
-
dw->weight += change;
change_left -= change;
//printf("group %d, change: %f weight: %f groups left: %d\n", dw->def_nr, change, dw->weight, groups_left_that_can_change);
-
if(dw->weight >= 1.0f) {
change_left += dw->weight-1.0f;
@@ -1277,10 +1275,11 @@ static void check_locks_and_normalize(Mesh *me, int index, int vgroup, MDeformWe
dw->weight = oldw;
} else if(bone_groups[dw->def_nr]) {
redistribute_weight_change(me->dvert+index, dw, oldw, flags, defcnt, bone_groups);
- //do_weight_paint_auto_normalize(me->dvert+index, vgroup, validmap);//do_wp_auto_normalize_locked_groups(me, me->dvert, validmap);
+ do_weight_paint_auto_normalize(me->dvert+index, vgroup, validmap);//do_wp_auto_normalize_locked_groups(me, me->dvert, validmap);
}
- } //else if(bone_groups[dw->def_nr]) // should it be disabled for the active group if it is not a bone group
+ } else if(bone_groups[dw->def_nr]) {// disable auto normalize if the active group is not a bone group
do_weight_paint_auto_normalize(me->dvert+index, vgroup, validmap);
+ }
}
// Jason