[Bf-blender-cvs] [34ce7a5f3af] greasepencil-object: GPencil: Fix Hue random to use full range
Antonio Vazquez
noreply at git.blender.org
Tue Apr 21 12:24:05 CEST 2020
Commit: 34ce7a5f3af9e27cc5ce63ac3c32b784b09b69ed
Author: Antonio Vazquez
Date: Tue Apr 21 12:23:54 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rB34ce7a5f3af9e27cc5ce63ac3c32b784b09b69ed
GPencil: Fix Hue random to use full range
The value was clamped and the colors in the extreme was not working as expected.
===================================================================
M source/blender/editors/gpencil/gpencil_utils.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 08f1b8119f9..42a4ed54d79 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -2791,6 +2791,15 @@ void ED_gpencil_sbuffer_vertex_color_random(bGPdata *gpd,
}
rgb_to_hsv_v(tpt->vert_color, hsv);
add_v3_v3(hsv, factor_value);
+ /* For Hue need to cover all range, but for Saturation and Value
+ * is not logic because the effect is too hard, so the value is just clamped. */
+ if (hsv[0] < 0.0f) {
+ hsv[0] += 1.0f;
+ }
+ else if (hsv[0] > 1.0f) {
+ hsv[0] -= 1.0f;
+ }
+
CLAMP3(hsv, 0.0f, 1.0f);
hsv_to_rgb_v(hsv, tpt->vert_color);
}
More information about the Bf-blender-cvs
mailing list