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_weightvgproximity.c')
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index e2e8e732311..7c9242ed900 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -239,8 +239,13 @@ static float get_ob2ob_distance(const Object *ob, const Object *obr)
/**
* Maps distances to weights, with an optional "smoothing" mapping.
*/
-static void do_map(
- Object *ob, float *weights, const int nidx, const float min_d, const float max_d, short mode)
+static void do_map(Object *ob,
+ float *weights,
+ const int nidx,
+ const float min_d,
+ const float max_d,
+ short mode,
+ const bool do_invert_mapping)
{
const float range_inv = 1.0f / (max_d - min_d); /* invert since multiplication is faster */
uint i = nidx;
@@ -276,14 +281,15 @@ static void do_map(
}
}
- if (!ELEM(mode, MOD_WVG_MAPPING_NONE, MOD_WVG_MAPPING_CURVE)) {
+ BLI_assert(mode != MOD_WVG_MAPPING_CURVE);
+ if (do_invert_mapping || mode != MOD_WVG_MAPPING_NONE) {
RNG *rng = NULL;
if (mode == MOD_WVG_MAPPING_RANDOM) {
rng = BLI_rng_new_srandom(BLI_ghashutil_strhash(ob->id.name + 2));
}
- weightvg_do_map(nidx, weights, mode, NULL, rng);
+ weightvg_do_map(nidx, weights, mode, do_invert_mapping, NULL, rng);
if (rng) {
BLI_rng_free(rng);
@@ -559,7 +565,13 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
}
/* Map distances to weights. */
- do_map(ob, new_w, numIdx, wmd->min_dist, wmd->max_dist, wmd->falloff_type);
+ do_map(ob,
+ new_w,
+ numIdx,
+ wmd->min_dist,
+ wmd->max_dist,
+ wmd->falloff_type,
+ (wmd->proximity_flags & MOD_WVG_PROXIMITY_INVERT_FALLOFF) != 0);
/* Do masking. */
struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);