diff options
author | Cody Winchester <CodyWinch> | 2020-02-03 14:01:13 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2020-02-03 14:05:04 +0300 |
commit | 808fa22a7ad8f954bda35dd07776154a24b884fe (patch) | |
tree | fabf50ebe5e1baac9d5846782914f30c5448de6f /source/blender/modifiers/intern/MOD_warp.c | |
parent | a8ea1ea1b7d5817bf37387f6804bbaad1adb2cba (diff) |
Warp Modifier add invert vgroup option
Adds the invert vertex weights option to the Warp Modifier. Setup in the same way as the other modifiers.
Uses the existing flag char that is labeled unused.
Differential Revision: https://developer.blender.org/D6720
Diffstat (limited to 'source/blender/modifiers/intern/MOD_warp.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_warp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 7155498c942..ba017577004 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -175,7 +175,7 @@ static void warpModifier_do(WarpModifierData *wmd, int i; int defgrp_index; MDeformVert *dvert, *dv = NULL; - + const bool invert_vgroup = (wmd->flag & MOD_WARP_INVERT_VGROUP) != 0; float(*tex_co)[3] = NULL; if (!(wmd->object_from && wmd->object_to)) { @@ -235,7 +235,8 @@ static void warpModifier_do(WarpModifierData *wmd, /* skip if no vert group found */ if (defgrp_index != -1) { dv = &dvert[i]; - weight = defvert_find_weight(dv, defgrp_index) * strength; + weight = invert_vgroup ? 1.0f - defvert_find_weight(dv, defgrp_index) * strength : + defvert_find_weight(dv, defgrp_index) * strength; if (weight <= 0.0f) { continue; } |