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:
Diffstat (limited to 'source/blender/modifiers/intern/MOD_laplaciandeform.c')
-rw-r--r--source/blender/modifiers/intern/MOD_laplaciandeform.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c
index 0fc2e0971da..683696b0725 100644
--- a/source/blender/modifiers/intern/MOD_laplaciandeform.c
+++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c
@@ -34,7 +34,7 @@
#include "BKE_deform.h"
#include "BKE_editmesh.h"
-#include "BKE_library.h"
+#include "BKE_lib_id.h"
#include "BKE_mesh_mapping.h"
#include "BKE_mesh_runtime.h"
#include "BKE_particle.h"
@@ -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 - BKE_defvert_find_weight(dv, defgrp_index) :
+ BKE_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 - BKE_defvert_find_weight(dv, defgrp_index) :
+ BKE_defvert_find_weight(dv, defgrp_index);
dv++;
if (wpaint > 0.0f) {
total_anchors++;