diff options
Diffstat (limited to 'source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c index e3e7168330d..7e89d8e2d6f 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c @@ -174,10 +174,8 @@ static void reduce_stroke_points(bGPDstroke *gps, gps->dvert = new_dvert; gps->totpoints = num_points; - /* mark stroke as needing to have its geometry caches rebuilt */ - gps->flag |= GP_STROKE_RECALC_GEOMETRY; - gps->tot_triangles = 0; - MEM_SAFE_FREE(gps->triangles); + /* Calc geometry data. */ + BKE_gpencil_stroke_geometry_update(gps); } /* --------------------------------------------- */ @@ -400,19 +398,15 @@ static void build_concurrent(BuildGpencilModifierData *mmd, bGPDframe *gpf, floa } /* --------------------------------------------- */ - -/* Entry-point for Build Modifier */ -static void generateStrokes(GpencilModifierData *md, - Depsgraph *depsgraph, - Object *UNUSED(ob), - bGPDlayer *gpl, - bGPDframe *gpf) +static void generate_geometry(GpencilModifierData *md, + Depsgraph *depsgraph, + bGPDlayer *gpl, + bGPDframe *gpf) { BuildGpencilModifierData *mmd = (BuildGpencilModifierData *)md; const bool reverse = (mmd->transition != GP_BUILD_TRANSITION_GROW); const float ctime = DEG_get_ctime(depsgraph); - // printf("GP Build Modifier - %f\n", ctime); /* Early exit if it's an empty frame */ if (gpf->strokes.first == NULL) { @@ -459,7 +453,7 @@ static void generateStrokes(GpencilModifierData *md, * By default, the upper bound is given by the "maximum length" setting */ float start_frame = gpf->framenum + mmd->start_delay; - float end_frame = gpf->framenum + mmd->length; + float end_frame = start_frame + mmd->length; if (gpf->next) { /* Use the next frame or upper bound as end frame, whichever is lower/closer */ @@ -506,7 +500,6 @@ static void generateStrokes(GpencilModifierData *md, /* Determine how far along we are between the keyframes */ float fac = (ctime - start_frame) / (end_frame - start_frame); - // printf(" Progress on %d = %f (%f - %f)\n", gpf->framenum, fac, start_frame, end_frame); /* Time management mode */ switch (mmd->mode) { @@ -526,6 +519,21 @@ static void generateStrokes(GpencilModifierData *md, } } +/* Entry-point for Build Modifier */ +static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Object *ob) +{ + Scene *scene = DEG_get_evaluated_scene(depsgraph); + bGPdata *gpd = (bGPdata *)ob->data; + + LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { + bGPDframe *gpf = BKE_gpencil_frame_retime_get(depsgraph, scene, ob, gpl); + if (gpf == NULL) { + continue; + } + generate_geometry(md, depsgraph, gpl, gpf); + } +} + /* ******************************************** */ GpencilModifierTypeInfo modifierType_Gpencil_Build = { |