[Bf-blender-cvs] [3f4e87e9874] greasepencil-object: GPencil: Clamp weight in Opacity modifier for Material mode

Antonioya noreply at git.blender.org
Thu Jul 18 20:25:35 CEST 2019


Commit: 3f4e87e98740c77fa08219a695b2236944db75a3
Author: Antonioya
Date:   Thu Jul 18 20:25:29 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB3f4e87e98740c77fa08219a695b2236944db75a3

GPencil: Clamp weight in Opacity modifier for Material mode

If the value is not clamped, the opacity gets wild values.

===================================================================

M	source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c

===================================================================

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
index a67567be3be..6c1206f851d 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
@@ -111,7 +111,7 @@ static void deformStroke(GpencilModifierData *md,
         MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
 
         /* verify vertex group */
-        const float weight = get_modifier_point_weight(
+        float weight = get_modifier_point_weight(
             dvert, (mmd->flag & GP_OPACITY_INVERT_VGROUP) != 0, def_nr);
         if (weight < 0.0f) {
           continue;
@@ -120,6 +120,8 @@ static void deformStroke(GpencilModifierData *md,
           pt->strength += mmd->factor - 1.0f;
         }
         else {
+          CLAMP(weight, 0.0f, 1.0f);
+          weight = 1.0f - weight;
           pt->strength += (mmd->factor * weight) - 1.0f;
         }
         CLAMP(pt->strength, 0.0f, 1.0f);



More information about the Bf-blender-cvs mailing list