[Bf-blender-cvs] [183e3f6bb93] master: Fix T86968: Last UV factor in cyclic strokes

Falk David noreply at git.blender.org
Wed Apr 21 12:16:46 CEST 2021


Commit: 183e3f6bb93e97a281a9bb2baf168631163577d0
Author: Falk David
Date:   Wed Apr 21 12:16:16 2021 +0200
Branches: master
https://developer.blender.org/rB183e3f6bb93e97a281a9bb2baf168631163577d0

Fix T86968: Last UV factor in cyclic strokes

The UV factor of the last point of a cyclic stroke was using the factor of
the first point leading to unwanted scaling artifacts.

The fix sets the uv factor of the last point to the currect value (last UV
factor + length between last and first point).

Reviewed By: antoniov, fclem

Maniphest Tasks: T86968

Differential Revision: https://developer.blender.org/D10850

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

M	source/blender/draw/intern/draw_cache_impl_gpencil.c

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

diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c b/source/blender/draw/intern/draw_cache_impl_gpencil.c
index c07271a0d33..49b5e0fecd3 100644
--- a/source/blender/draw/intern/draw_cache_impl_gpencil.c
+++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c
@@ -348,7 +348,14 @@ static void gpencil_buffer_add_stroke(gpStrokeVert *verts,
   }
   /* Draw line to first point to complete the loop for cyclic strokes. */
   if (is_cyclic) {
-    gpencil_buffer_add_point(verts, cols, gps, &pts[0], v++, false);
+    gpencil_buffer_add_point(verts, cols, gps, &pts[0], v, false);
+    /* UV factor needs to be adjusted for the last point to not be equal to the UV factor of the
+     * first point. It should be the factor of the last point plus the distance from the last point
+     * to the first.
+     */
+    gpStrokeVert *vert = &verts[v];
+    vert->u_stroke = verts[v - 1].u_stroke + len_v3v3(&pts[pts_len - 1].x, &pts[0].x);
+    v++;
   }
   /* Last adjacency point (not drawn). */
   adj_idx = (is_cyclic) ? 1 : max_ii(0, pts_len - 2);



More information about the Bf-blender-cvs mailing list