[Bf-blender-cvs] [ba4b648] temp-modifier-deltamush-experimental: Add vertex-group invert option
Campbell Barton
noreply at git.blender.org
Sun Mar 29 22:03:27 CEST 2015
Commit: ba4b648266839c564e53c9fbaba63c46750ca1ec
Author: Campbell Barton
Date: Mon Mar 30 07:02:56 2015 +1100
Branches: temp-modifier-deltamush-experimental
https://developer.blender.org/rBba4b648266839c564e53c9fbaba63c46750ca1ec
Add vertex-group invert option
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/modifiers/intern/MOD_deltamush.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index a463bdc..f0fb349 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1395,7 +1395,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
layout.prop(md, "iterations")
layout.prop(md, "lambda_factor", text="Factor")
layout.label(text="Vertex Group:")
- layout.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+ sub = layout.row(align=True)
+ sub.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+ sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
if __name__ == "__main__": # only for live edit.
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 1bd9353..ce0857d 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1303,6 +1303,7 @@ typedef struct DeltaMushModifierData {
/* Delta Mush modifier flags */
enum {
+ MOD_DELTAMUSH_INVERT_VGROUP = (1 << 0),
MOD_DELTAMUSH_BIND = (1 << 1),
MOD_DELTAMUSH_ONLY_SMOOTH = (1 << 2),
MOD_DELTAMUSH_PIN_BOUNDARY = (1 << 3),
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 6757258..7b1fba3 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2150,6 +2150,11 @@ static void rna_def_modifier_deltamush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Repeat", "");
RNA_def_property_update(prop, 0, "rna_DeltaMushModifier_update");
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DELTAMUSH_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_DeltaMushModifier_update");
+
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
RNA_def_property_ui_text(prop, "Vertex Group",
diff --git a/source/blender/modifiers/intern/MOD_deltamush.c b/source/blender/modifiers/intern/MOD_deltamush.c
index 4fc223e..e5277d8 100644
--- a/source/blender/modifiers/intern/MOD_deltamush.c
+++ b/source/blender/modifiers/intern/MOD_deltamush.c
@@ -138,7 +138,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
/* check individual weights for changes and cache values */
static float *dm_get_weights(
MDeformVert *dvert, const int defgrp_index,
- const unsigned int numVerts)
+ const unsigned int numVerts, const bool use_invert_vgroup)
{
if (dvert) {
unsigned int i;
@@ -148,7 +148,13 @@ static float *dm_get_weights(
for (i = 0; i < numVerts; i++, dvert++) {
const float w = defvert_find_weight(dvert, defgrp_index);
- smooth_weights[i] = w;
+
+ if (use_invert_vgroup == false) {
+ smooth_weights[i] = w;
+ }
+ else {
+ smooth_weights[i] = 1.0f - w;
+ }
}
return smooth_weights;
@@ -461,7 +467,9 @@ static void smooth_verts(
float *smooth_weights = NULL;
short *boundaries = NULL;
- smooth_weights = dm_get_weights(dvert, defgrp_index, numVerts);
+ smooth_weights = dm_get_weights(
+ dvert, defgrp_index,
+ numVerts, (dmmd->flag & MOD_DELTAMUSH_INVERT_VGROUP) != 0);
if (dmmd->flag & MOD_DELTAMUSH_PIN_BOUNDARY) {
boundaries = dm_get_boundaries(dm);
More information about the Bf-blender-cvs
mailing list