diff options
author | Cody Winchester <CodyWinch> | 2020-03-24 19:48:46 +0300 |
---|---|---|
committer | Bastien Montagne <b.mont29@gmail.com> | 2020-03-24 20:28:55 +0300 |
commit | 26ef4fa85ef4ea0f010f31c93d1086c515c3b5d4 (patch) | |
tree | a4155a8375e9214a536381160732aea59554ecd4 /source/blender/modifiers/intern/MOD_weightvgedit.c | |
parent | f3ea8cd60876e499b664e12eec24d163136c04ba (diff) |
Modifiers: Vertex Weight Edit add invert curve falloff option
This commit adds the option to invert the resulting weights of the
falloff curve.
There is a workflow used by some to convert a texture mask into
vertex weights by using a custom curve and inverting the points.
This allows the same effect with a single click, and gives the modifier
more procedural functionality.
With minor UI tweaks by @mont29.
Differential Revision: https://developer.blender.org/D6899
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvgedit.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgedit.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index 6acbbefe745..2b2a4cf85ea 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -244,6 +244,14 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes } } + /* Invert resulting weights */ + if ((wmd->edit_flags & MOD_WVG_INVERT_FALLOFF) != 0) { + for (i = 0; i < numVerts; i++) { + new_w[i] = 1.0f - new_w[i]; + } + } + + /* Do masking. */ struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph); weightvg_do_mask(ctx, |