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.
This commit is contained in:
Antonioya
2019-03-11 10:42:39 +01:00
parent 6fd11a21f5
commit 0889fea790
3 changed files with 10 additions and 3 deletions

View File

@@ -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,

View File

@@ -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);

View File

@@ -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);