diff options
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvgmix.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgmix.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index f41689b741c..e509d1464f2 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -78,28 +78,37 @@ static float mix_weight(float weight, float weight2, char mix_mode) return weight2; } #endif - if (mix_mode == MOD_WVG_MIX_SET) + if (mix_mode == MOD_WVG_MIX_SET) { return weight2; - else if (mix_mode == MOD_WVG_MIX_ADD) + } + else if (mix_mode == MOD_WVG_MIX_ADD) { return (weight + weight2); - else if (mix_mode == MOD_WVG_MIX_SUB) + } + else if (mix_mode == MOD_WVG_MIX_SUB) { return (weight - weight2); - else if (mix_mode == MOD_WVG_MIX_MUL) + } + else if (mix_mode == MOD_WVG_MIX_MUL) { return (weight * weight2); + } else if (mix_mode == MOD_WVG_MIX_DIV) { /* Avoid dividing by zero (or really small values). */ - if (weight2 < 0.0f && weight2 > -MOD_WVG_ZEROFLOOR) + if (weight2 < 0.0f && weight2 > -MOD_WVG_ZEROFLOOR) { weight2 = -MOD_WVG_ZEROFLOOR; - else if (weight2 >= 0.0f && weight2 < MOD_WVG_ZEROFLOOR) + } + else if (weight2 >= 0.0f && weight2 < MOD_WVG_ZEROFLOOR) { weight2 = MOD_WVG_ZEROFLOOR; + } return (weight / weight2); } - else if (mix_mode == MOD_WVG_MIX_DIF) + else if (mix_mode == MOD_WVG_MIX_DIF) { return (weight < weight2 ? weight2 - weight : weight - weight2); - else if (mix_mode == MOD_WVG_MIX_AVG) + } + else if (mix_mode == MOD_WVG_MIX_AVG) { return (weight + weight2) * 0.5f; - else + } + else { return weight2; + } } /************************************** @@ -140,8 +149,9 @@ static bool dependsOnTime(ModifierData *md) { WeightVGMixModifierData *wmd = (WeightVGMixModifierData *)md; - if (wmd->mask_texture) + if (wmd->mask_texture) { return BKE_texture_dependsOnTime(wmd->mask_texture); + } return false; } |