[Bf-blender-cvs] [be36035058c] greasepencil-object: Tint modifier change alpha if value > 1

Antonio Vazquez noreply at git.blender.org
Thu Aug 10 16:39:34 CEST 2017


Commit: be36035058c05eef609a7aea27872b714d80378d
Author: Antonio Vazquez
Date:   Thu Aug 10 16:39:18 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBbe36035058c05eef609a7aea27872b714d80378d

Tint modifier change alpha if value > 1

The alpha only change if the value of the factor is greater than 1. Whith a value of 2, get a full tint with full opacity.

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

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

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

diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 71df740419a..284ecb09ac6 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -418,14 +418,14 @@ void BKE_gpencil_tint_modifier(int UNUSED(id), GpencilTintModifierData *mmd, Obj
 	interp_v3_v3v3(gps->palcolor->rgb, gps->palcolor->rgb, mmd->rgb, mmd->factor);
 	interp_v3_v3v3(gps->palcolor->fill, gps->palcolor->fill, mmd->rgb, mmd->factor);
 
-	/* if factor is 1, the alpha must be solid to get full tint */
-	if (mmd->factor == 1.0f) {
-		gps->palcolor->rgb[3] = 1.0f;
-		gps->palcolor->fill[3] = 1.0f;
+	/* if factor is > 1, the alpha must be changed to get full tint */
+	if (mmd->factor > 1.0f) {
+		gps->palcolor->rgb[3] += mmd->factor - 1.0f;
+		gps->palcolor->fill[3] += mmd->factor - 1.0f;
 	}
 
-	CLAMP3(gps->palcolor->rgb, 0.0f, 1.0f);
-	CLAMP3(gps->palcolor->fill, 0.0f, 1.0f);
+	CLAMP4(gps->palcolor->rgb, 0.0f, 1.0f);
+	CLAMP4(gps->palcolor->fill, 0.0f, 1.0f);
 }
 
 /* color correction strokes */
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 95e2ed78e30..d72be291967 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -5060,8 +5060,7 @@ static void rna_def_modifier_gpenciltint(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "factor");
-	RNA_def_property_range(prop, 0, 1.0);
-	RNA_def_property_ui_range(prop, 0, 1.0, 0.1, 3);
+	RNA_def_property_ui_range(prop, 0, 2.0, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Factor", "Factor for mixing color");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");




More information about the Bf-blender-cvs mailing list