[Bf-blender-cvs] [a4700549e06] master: GPencil: Fix unreported random rotation for single point with texture

Antonio Vazquez noreply at git.blender.org
Fri May 28 17:15:48 CEST 2021


Commit: a4700549e065e86c3d42c93e73f76106f4054512
Author: Antonio Vazquez
Date:   Fri May 28 17:14:01 2021 +0200
Branches: master
https://developer.blender.org/rBa4700549e065e86c3d42c93e73f76106f4054512

GPencil: Fix unreported random rotation for single point with texture

When using ``Path`` alignment, if the stroke has one point the texture rotates randomly when move the viewport. This was because with one point is impossible to calculate a path.

Now, if the stroke has only one point, the texture for this stroke is aligned to Object.

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

M	source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl

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

diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
index 7412959a30b..ac48b94fea9 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
@@ -442,6 +442,10 @@ void stroke_vertex()
   if (is_dot) {
 #  ifdef GP_MATERIAL_BUFFER_LEN
     int alignement = GP_FLAG(m) & GP_STROKE_ALIGNMENT;
+    /* For one point strokes use object aligment. */
+    if (ma.x == -1 && ma2.x == -1 && alignement == GP_STROKE_ALIGNMENT_STROKE) {
+      alignement = GP_STROKE_ALIGNMENT_OBJECT;
+    }
 #  endif
 
     vec2 x_axis;



More information about the Bf-blender-cvs mailing list