[Bf-blender-cvs] [ca6ee0ef724] greasepencil-object: Use UV randomness UV rotation parameter
Antonio Vazquez
noreply at git.blender.org
Wed Feb 21 11:09:36 CET 2018
Commit: ca6ee0ef72424a8911abb3d2cdac0e38f47f722b
Author: Antonio Vazquez
Date: Wed Feb 21 11:09:27 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBca6ee0ef72424a8911abb3d2cdac0e38f47f722b
Use UV randomness UV rotation parameter
===================================================================
M source/blender/editors/gpencil/gpencil_paint.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 047ec8b4f80..ec0f48e0bdb 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -577,15 +577,19 @@ static short gp_stroke_addpoint(
CLAMP(pt->pressure, GPENCIL_STRENGTH_MIN, 1.0f);
}
- /* apply random to uv texture rotation */
- /* TODO: Add a UI parameter to control randomness */
- if (BLI_frand() > 0.5f) {
- pt->uv_rot = BLI_frand() * M_PI * -1;
+ /* apply randomness to uv texture rotation */
+ if (brush->uv_random > 0.0f) {
+ if (BLI_frand() > 0.5f) {
+ pt->uv_rot = (BLI_frand() * M_PI * -1) * brush->uv_random;
+ }
+ else {
+ pt->uv_rot = (BLI_frand() * M_PI) * brush->uv_random;
+ }
+ CLAMP(pt->uv_rot, -M_PI_2, M_PI_2);
}
else {
- pt->uv_rot = BLI_frand() * M_PI;
+ pt->uv_rot = 0.0f;
}
- CLAMP(pt->uv_rot, -M_PI_2, M_PI_2);
/* apply angle of stroke to brush size */
if (brush->draw_angle_factor > 0.0f) {
More information about the Bf-blender-cvs
mailing list