[Bf-blender-cvs] [c23b6596b91] master: GPencil: Fix subdivision modifier disabled on strokes with 2 points

Henrik Dick noreply at git.blender.org
Sat Sep 4 15:42:03 CEST 2021


Commit: c23b6596b91ceaf19d6e98bd66d7e67726821dc2
Author: Henrik Dick
Date:   Sat Sep 4 15:34:01 2021 +0200
Branches: master
https://developer.blender.org/rBc23b6596b91ceaf19d6e98bd66d7e67726821dc2

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

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

M	source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c

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

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) {



More information about the Bf-blender-cvs mailing list