Modifiers: Laplacian Deform modifier add invert vgroup option
Adds the invert vgroup option to the Laplacian Deform modifier. Differential Revision: https://developer.blender.org/D6843
This commit is contained in:

committed by
Bastien Montagne

parent
19e63bb51e
commit
e30d8f45ef
@@ -497,6 +497,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
||||
row = layout.row()
|
||||
row.enabled = not is_bind
|
||||
row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
|
||||
row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
layout.separator()
|
||||
|
||||
|
@@ -1843,6 +1843,7 @@ typedef struct LaplacianDeformModifierData {
|
||||
/* Laplacian Deform modifier flags */
|
||||
enum {
|
||||
MOD_LAPLACIANDEFORM_BIND = 1 << 0,
|
||||
MOD_LAPLACIANDEFORM_INVERT_VGROUP = 1 << 1,
|
||||
};
|
||||
|
||||
/* many of these options match 'solidify' */
|
||||
|
@@ -5635,6 +5635,11 @@ static void rna_def_modifier_laplaciandeform(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to anchors");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
||||
prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANDEFORM_INVERT_VGROUP);
|
||||
RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
}
|
||||
|
||||
|
@@ -528,6 +528,7 @@ static void initSystem(
|
||||
MDeformVert *dvert = NULL;
|
||||
MDeformVert *dv = NULL;
|
||||
LaplacianSystem *sys;
|
||||
const bool invert_vgroup = (lmd->flag & MOD_LAPLACIANDEFORM_INVERT_VGROUP) != 0;
|
||||
|
||||
if (isValidVertexGroup(lmd, ob, mesh)) {
|
||||
int *index_anchors = MEM_malloc_arrayN(numVerts, sizeof(int), __func__); /* over-alloc */
|
||||
@@ -542,7 +543,8 @@ static void initSystem(
|
||||
BLI_assert(dvert != NULL);
|
||||
dv = dvert;
|
||||
for (i = 0; i < numVerts; i++) {
|
||||
wpaint = defvert_find_weight(dv, defgrp_index);
|
||||
wpaint = invert_vgroup ? 1.0f - defvert_find_weight(dv, defgrp_index) :
|
||||
defvert_find_weight(dv, defgrp_index);
|
||||
dv++;
|
||||
if (wpaint > 0.0f) {
|
||||
STACK_PUSH(index_anchors, i);
|
||||
@@ -596,6 +598,7 @@ static int isSystemDifferent(LaplacianDeformModifierData *lmd,
|
||||
MDeformVert *dvert = NULL;
|
||||
MDeformVert *dv = NULL;
|
||||
LaplacianSystem *sys = (LaplacianSystem *)lmd->cache_system;
|
||||
const bool invert_vgroup = (lmd->flag & MOD_LAPLACIANDEFORM_INVERT_VGROUP) != 0;
|
||||
|
||||
if (sys->total_verts != numVerts) {
|
||||
return LAPDEFORM_SYSTEM_CHANGE_VERTEXES;
|
||||
@@ -612,7 +615,8 @@ static int isSystemDifferent(LaplacianDeformModifierData *lmd,
|
||||
}
|
||||
dv = dvert;
|
||||
for (i = 0; i < numVerts; i++) {
|
||||
wpaint = defvert_find_weight(dv, defgrp_index);
|
||||
wpaint = invert_vgroup ? 1.0f - defvert_find_weight(dv, defgrp_index) :
|
||||
defvert_find_weight(dv, defgrp_index);
|
||||
dv++;
|
||||
if (wpaint > 0.0f) {
|
||||
total_anchors++;
|
||||
|
Reference in New Issue
Block a user