diff options
author | Cody Winchester <CodyWinch> | 2020-02-18 19:03:20 +0300 |
---|---|---|
committer | Bastien Montagne <b.mont29@gmail.com> | 2020-02-18 19:23:16 +0300 |
commit | 5df0f8bffb55de161b7835baf9e1c3a60ce870d8 (patch) | |
tree | 3228278cb88f924b6ebaff429c26bf945991cc76 /source/blender/modifiers/intern | |
parent | b8567b704bb92b57f12ca09faeba2ab4adb656c0 (diff) |
Modifiers: Explode modifier add invert vgroup option
Adds the invert vgroup option to the Explode modifier.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D6844
Diffstat (limited to 'source/blender/modifiers/intern')
-rw-r--r-- | source/blender/modifiers/intern/MOD_explode.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 88e45f652a0..26a353b4235 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -97,6 +97,7 @@ static void createFacepa(ExplodeModifierData *emd, ParticleSystemModifierData *p float center[3], co[3]; int *facepa = NULL, *vertpa = NULL, totvert = 0, totface = 0, totpart = 0; int i, p, v1, v2, v3, v4 = 0; + const bool invert_vgroup = (emd->flag & eExplodeFlag_INVERT_VGROUP) != 0; mvert = mesh->mvert; mface = mesh->mface; @@ -129,7 +130,9 @@ static void createFacepa(ExplodeModifierData *emd, ParticleSystemModifierData *p for (i = 0; i < totvert; i++, dvert++) { float val = BLI_rng_get_float(rng); val = (1.0f - emd->protect) * val + emd->protect * 0.5f; - if (val < defvert_find_weight(dvert, defgrp_index)) { + const float weight = invert_vgroup ? 1.0f - defvert_find_weight(dvert, defgrp_index) : + defvert_find_weight(dvert, defgrp_index); + if (val < weight) { vertpa[i] = -1; } } |