Commit: 0889fea790989a66b35757614752aeaaf925f5ad
Author: Antonioya
Date:   Mon Mar 11 10:42:39 2019 +0100
Branches: master
https://developer.blender.org/rB0889fea790989a66b35757614752aeaaf925f5ad

GPencil: Fix unreported UV error when use subdivide modifier

When the subdivide modifier was used, the UV was not recalculated and the 
texture of the stroke was wrong.

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

M       source/blender/blenkernel/intern/gpencil_modifier.c
M       source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M       source/blender/draw/engines/gpencil/gpencil_draw_utils.c

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

diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c 
b/source/blender/blenkernel/intern/gpencil_modifier.c
index bd83e93ef00..5af0bd99721 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -425,9 +425,12 @@ void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph, 
Object *ob, bGPDlayer *g
 
                        if (mti && mti->deformStroke) {
                                mti->deformStroke(md, depsgraph, ob, gpl, gps);
-
+                               /* subdivide allways requires update */
+                               if (md->type == eGpencilModifierType_Subdiv) {
+                                       gps->flag |= GP_STROKE_RECALC_GEOMETRY;
+                               }
                                /* some modifiers could require a recalc of 
fill triangulation data */
-                               if (gpd->flag & GP_DATA_STROKE_FORCE_RECALC) {
+                               else if (gpd->flag & 
GP_DATA_STROKE_FORCE_RECALC) {
                                        if (ELEM(md->type,
                                                 eGpencilModifierType_Armature,
                                                 eGpencilModifierType_Hook,
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 4c69965478e..70e679d4e72 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -202,7 +202,6 @@ void DRW_gpencil_get_fill_geom(struct GpencilBatchCacheElem 
*be, Object *ob, bGP
        /* Calculate triangles cache for filling area (must be done only after 
changes) */
        if ((gps->flag & GP_STROKE_RECALC_GEOMETRY) || (gps->tot_triangles == 
0) || (gps->triangles == NULL)) {
                DRW_gpencil_triangulate_stroke_fill(ob, gps);
-               ED_gpencil_calc_stroke_uv(ob, gps);
        }
 
        BLI_assert(gps->tot_triangles >= 1);
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index a96d293c381..4875273d8b9 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1005,6 +1005,11 @@ static void gpencil_draw_strokes(
                                    ((gp_style->stroke_rgba[3] > 
GPENCIL_ALPHA_OPACITY_THRESH) ||
                                     (gpl->blend_mode == eGplBlendMode_Normal)))
                                {
+                                       /* recalc strokes uv (geometry be 
changed by modifiers) */
+                                       if (gps->flag & 
GP_STROKE_RECALC_GEOMETRY) {
+                                               ED_gpencil_calc_stroke_uv(ob, 
gps);
+                                       }
+
                                        gpencil_add_stroke_vertexdata(
                                                cache, ob, gpl, derived_gpf, 
gps,
                                                opacity, tintcolor, false, 
custonion);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to