[Bf-blender-cvs] [5b97867905c] greasepencil-object: GPencil: Fix unreported missing frames in interpolation

Antonio Vazquez noreply at git.blender.org
Sat Jul 25 16:33:27 CEST 2020


Commit: 5b97867905c51eb00010cd8ade4728854c6d036c
Author: Antonio Vazquez
Date:   Thu Jul 23 16:03:38 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rB5b97867905c51eb00010cd8ade4728854c6d036c

GPencil: Fix unreported missing frames in interpolation

When interpolate, the temp frames are tagged, and later removed. If for any reason any stroke was tagged in other area of Blender (this tag is used for temp tagging), the stroke could be removed by error when run interpolation.

In a previous fix, the tag was cleared before, but only for the frame range of the interpolation. Now, the clear is done for all frames.

Also, instead to clear for each stroke sampling, now it's done only once at invoke time.

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

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..2d60d84bc19 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;
 }



More information about the Bf-blender-cvs mailing list