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:
authorCody Winchester <CodyWinch>2020-02-03 13:55:29 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2020-02-03 13:55:29 +0300
commit7bbbb9ba8a139b96fe9484e05d3db43fb5ad0a18 (patch)
tree5aa2afa39806b25a50ef42c1ecec3dc904065c90 /source/blender/modifiers/intern/MOD_displace.c
parent68ab4dd28a22727d088b57a323b8b68284a0198e (diff)
Displace Modifier add invert vgroup option
Adds the invert vertex weights option to the Displace modifier. Adds a flag and char padding to the Displace modifier DNA for the invert group boolean. Differential Revision: https://developer.blender.org/D6686
Diffstat (limited to 'source/blender/modifiers/intern/MOD_displace.c')
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 9cb694be88b..7f65b3bb5ae 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -174,6 +174,7 @@ static void displaceModifier_do_task(void *__restrict userdata,
DisplaceUserdata *data = (DisplaceUserdata *)userdata;
DisplaceModifierData *dmd = data->dmd;
MDeformVert *dvert = data->dvert;
+ const bool invert_vgroup = (dmd->flag & MOD_DISP_INVERT_VGROUP) != 0;
float weight = data->weight;
int defgrp_index = data->defgrp_index;
int direction = data->direction;
@@ -192,7 +193,8 @@ static void displaceModifier_do_task(void *__restrict userdata,
float local_vec[3];
if (dvert) {
- weight = defvert_find_weight(dvert + iter, defgrp_index);
+ weight = invert_vgroup ? 1.0f - defvert_find_weight(dvert + iter, defgrp_index) :
+ defvert_find_weight(dvert + iter, defgrp_index);
if (weight == 0.0f) {
return;
}