Commit: 23b37b7c2f4f781cd6c3914a5b6dd90d8e215ab7
Author: Antonio Vazquez
Date:   Thu Aug 10 11:19:25 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB23b37b7c2f4f781cd6c3914a5b6dd90d8e215ab7

Fix opacity modifier error with values greater than 1.0

If the opacity is set to >1 values, the alpha must be overrided.

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

M       source/blender/blenkernel/intern/gpencil_modifier.c

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

diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c 
b/source/blender/blenkernel/intern/gpencil_modifier.c
index 1c10833e404..8da8f9fa135 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -460,14 +460,21 @@ void BKE_gpencil_opacity_modifier(int UNUSED(id), 
GpencilOpacityModifierData *mm
                return;
        }
 
-       gps->palcolor->rgb[3] = gps->palcolor->rgb[3] * mmd->factor;
+       gps->palcolor->rgb[3] = (gps->palcolor->rgb[3] * mmd->factor);
        gps->palcolor->fill[3] = gps->palcolor->fill[3] * mmd->factor;
 
+       /* if factor is > 1, then force opacity */
+       if (mmd->factor > 1.0f) {
+               gps->palcolor->rgb[3] += mmd->factor - 1.0f;
+               gps->palcolor->fill[3] += mmd->factor - 1.0f;
+       }
+
+
        CLAMP(gps->palcolor->rgb[3], 0.0f, 1.0f);
        CLAMP(gps->palcolor->fill[3], 0.0f, 1.0f);
 
-       /* if opacity < 1.0 or > 1.0, affect the strength of the stroke */
-       if ((mmd->factor < 1.0f) || (mmd->factor > 1.0f)) {
+       /* if opacity > 1.0, affect the strength of the stroke */
+       if (mmd->factor > 1.0f) {
                for (int i = 0; i < gps->totpoints; ++i) {
                        pt = &gps->points[i];
                        /* verify vertex group */

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to