diff options
author | Bastien Montagne <b.mont29@gmail.com> | 2020-03-24 20:28:09 +0300 |
---|---|---|
committer | Bastien Montagne <b.mont29@gmail.com> | 2020-03-24 20:28:55 +0300 |
commit | bb26c1359e4f4bb21ec4ec4ab37e28d1fada20b8 (patch) | |
tree | 1e08863d43915ef90b59b85cd95afe6d279f50dd /source/blender/modifiers/intern/MOD_weightvgedit.c | |
parent | 26ef4fa85ef4ea0f010f31c93d1086c515c3b5d4 (diff) |
Add invert mapping option to proximity weight edit modifier, and some cleanup.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvgedit.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgedit.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index 2b2a4cf85ea..ba1745f7b5e 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -230,28 +230,21 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes } /* Do mapping. */ - if (wmd->falloff_type != MOD_WVG_MAPPING_NONE) { + const bool do_invert_mapping = (wmd->edit_flags & MOD_WVG_INVERT_FALLOFF) != 0; + if (do_invert_mapping || wmd->falloff_type != MOD_WVG_MAPPING_NONE) { RNG *rng = NULL; if (wmd->falloff_type == MOD_WVG_MAPPING_RANDOM) { rng = BLI_rng_new_srandom(BLI_ghashutil_strhash(ctx->object->id.name + 2)); } - weightvg_do_map(numVerts, new_w, wmd->falloff_type, wmd->cmap_curve, rng); + weightvg_do_map(numVerts, new_w, wmd->falloff_type, do_invert_mapping, wmd->cmap_curve, rng); if (rng) { BLI_rng_free(rng); } } - /* 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, |