[Bf-blender-cvs] [dcf7a050775] blender-v2.90-release: GPencil: Fix unreported missing strokes in interpolation

Antonio Vazquez noreply at git.blender.org
Tue Jul 28 16:24:08 CEST 2020


Commit: dcf7a0507755a7557b40952ccf8f32c0c59e146f
Author: Antonio Vazquez
Date:   Tue Jul 28 16:23:45 2020 +0200
Branches: blender-v2.90-release
https://developer.blender.org/rBdcf7a0507755a7557b40952ccf8f32c0c59e146f

GPencil: Fix unreported missing strokes in interpolation

Sometimes the interpolated stroke was tagged and removed.

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

M	source/blender/editors/gpencil/gpencil_interpolate.c

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

diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index 179f621205b..3a7029b1288 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -136,15 +136,17 @@ static void gpencil_interpolate_free_temp_strokes(bGPDframe *gpf)
 }
 
 /* Helper: Untag all strokes. */
-static void gpencil_interpolate_untag_strokes(bGPDframe *gpf)
+static void gpencil_interpolate_untag_strokes(bGPDlayer *gpl)
 {
-  if (gpf == NULL) {
+  if (gpl == NULL) {
     return;
   }
 
-  LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
-    if (gps->flag & GP_STROKE_TAG) {
-      gps->flag &= ~GP_STROKE_TAG;
+  LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
+    LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
+      if (gps->flag & GP_STROKE_TAG) {
+        gps->flag &= ~GP_STROKE_TAG;
+      }
     }
   }
 }
@@ -263,15 +265,6 @@ static void gpencil_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi)
   /* set layers */
   LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
     tGPDinterpolate_layer *tgpil;
-
-    /* Untag strokes to be sure nothing is pending. This must be done for
-     * all layer because it could be anything tagged and it would be removed
-     * at the end of the process when all tagged strokes are removed. */
-    if (gpl->actframe != NULL) {
-      gpencil_interpolate_untag_strokes(gpl->actframe);
-      gpencil_interpolate_untag_strokes(gpl->actframe->next);
-    }
-
     /* all layers or only active */
     if (!(tgpi->flag & GP_TOOLFLAG_INTERPOLATE_ALL_LAYERS) && (gpl != active_gpl)) {
       continue;
@@ -483,6 +476,11 @@ static bool gpencil_interpolate_set_init_values(bContext *C, wmOperator *op, tGP
   /* set layers */
   gpencil_interpolate_set_points(C, tgpi);
 
+  /* Untag strokes to be sure nothing is pending due any canceled process. */
+  LISTBASE_FOREACH (bGPDlayer *, gpl, &tgpi->gpd->layers) {
+    gpencil_interpolate_untag_strokes(gpl);
+  }
+
   return 1;
 }
 
@@ -606,6 +604,8 @@ static int gpencil_interpolate_modal(bContext *C, wmOperator *op, const wmEvent
 
           /* make copy of source stroke, then adjust pointer to points too */
           gps_dst = BKE_gpencil_stroke_duplicate(gps_src, true);
+          gps_dst->flag &= ~GP_STROKE_TAG;
+
           /* Calc geometry data. */
           BKE_gpencil_stroke_geometry_update(gps_dst);



More information about the Bf-blender-cvs mailing list