Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Dick <weasel>2021-09-04 16:34:01 +0300
committerAntonio Vazquez <blendergit@gmail.com>2021-09-04 16:41:43 +0300
commitc23b6596b91ceaf19d6e98bd66d7e67726821dc2 (patch)
treed368ee871e1a85a98d93b24b50ee984abbde6c67 /source/blender/gpencil_modifiers
parent863d8065260c9b508dfbda571c92e66e18551c71 (diff)
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
Diffstat (limited to 'source/blender/gpencil_modifiers')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
index f444103ae3f..ee5ba7e92ca 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
@@ -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) {