GPencil: Fix subdivision modifier disabled on strokes with 2 points

Fixes the regression introduces in rB29f3af952725 . The subdivision modifier used to work on two point strokes with simple mode but not with catmul clark. Now it will work with simple mode and in case of catmull clark mode it will still use simple mode on these strokes.

Differential Revision: https://developer.blender.org/D12397
This commit is contained in:
Henrik Dick 2021-09-04 15:34:01 +02:00 committed by Antonio Vazquez
parent 863d806526
commit c23b6596b9
1 changed files with 5 additions and 6 deletions

View File

@ -76,16 +76,12 @@ static void deformStroke(GpencilModifierData *md,
SubdivGpencilModifierData *mmd = (SubdivGpencilModifierData *)md;
bGPdata *gpd = ob->data;
/* It makes sense when adding points to a straight line */
/* e.g. for creating thickness variation in later modifiers. */
const int minimum_vert = (mmd->flag & GP_SUBDIV_SIMPLE) ? 2 : 3;
if (!is_stroke_affected_by_modifier(ob,
mmd->layername,
mmd->material,
mmd->pass_index,
mmd->layer_pass,
minimum_vert,
2,
gpl,
gps,
mmd->flag & GP_SUBDIV_INVERT_LAYER,
@ -95,7 +91,10 @@ static void deformStroke(GpencilModifierData *md,
return;
}
BKE_gpencil_stroke_subdivide(gpd, gps, mmd->level, mmd->type);
/* For strokes with less than 3 points, only the Simple Subdivision makes sense. */
short type = gps->totpoints < 3 ? GP_SUBDIV_SIMPLE : mmd->type;
BKE_gpencil_stroke_subdivide(gpd, gps, mmd->level, type);
/* If the stroke is cyclic, must generate the closing geometry. */
if (gps->flag & GP_STROKE_CYCLIC) {