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:
authorBastien Montagne <b.mont29@gmail.com>2020-03-24 20:28:09 +0300
committerBastien Montagne <b.mont29@gmail.com>2020-03-24 20:28:55 +0300
commitbb26c1359e4f4bb21ec4ec4ab37e28d1fada20b8 (patch)
tree1e08863d43915ef90b59b85cd95afe6d279f50dd /source/blender/modifiers/intern/MOD_weightvg_util.c
parent26ef4fa85ef4ea0f010f31c93d1086c515c3b5d4 (diff)
Add invert mapping option to proximity weight edit modifier, and some cleanup.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvg_util.c')
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index e93ab608498..23e4da32ed7 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -54,20 +54,22 @@
* mapping to the real vertex index (in case the weight tables do not cover the whole vertices...).
* cmap might be NULL, in which case curve mapping mode will return unmodified data.
*/
-void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cmap, RNG *rng)
+void weightvg_do_map(
+ int num, float *new_w, short falloff_type, const bool do_invert, CurveMapping *cmap, RNG *rng)
{
int i;
/* Return immediately, if we have nothing to do! */
/* Also security checks... */
- if (((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL)) || !ELEM(falloff_type,
- MOD_WVG_MAPPING_CURVE,
- MOD_WVG_MAPPING_SHARP,
- MOD_WVG_MAPPING_SMOOTH,
- MOD_WVG_MAPPING_ROOT,
- MOD_WVG_MAPPING_SPHERE,
- MOD_WVG_MAPPING_RANDOM,
- MOD_WVG_MAPPING_STEP)) {
+ if (!do_invert && (((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL)) ||
+ !ELEM(falloff_type,
+ MOD_WVG_MAPPING_CURVE,
+ MOD_WVG_MAPPING_SHARP,
+ MOD_WVG_MAPPING_SMOOTH,
+ MOD_WVG_MAPPING_ROOT,
+ MOD_WVG_MAPPING_SPHERE,
+ MOD_WVG_MAPPING_RANDOM,
+ MOD_WVG_MAPPING_STEP))) {
return;
}
@@ -103,9 +105,14 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm
case MOD_WVG_MAPPING_STEP:
fac = (fac >= 0.5f) ? 1.0f : 0.0f;
break;
+ case MOD_WVG_MAPPING_NONE:
+ BLI_assert(do_invert);
+ break;
+ default:
+ BLI_assert(0);
}
- new_w[i] = fac;
+ new_w[i] = do_invert ? 1.0f - fac : fac;
}
}