[Bf-blender-cvs] [9d08c169d1d] master: GPencil: Interpolate can use all keyframe types except breakdown

Antonio Vazquez noreply at git.blender.org
Fri Mar 12 19:43:26 CET 2021


Commit: 9d08c169d1d540553f879afaecf7f06965a81469
Author: Antonio Vazquez
Date:   Fri Mar 12 19:43:13 2021 +0100
Branches: master
https://developer.blender.org/rB9d08c169d1d540553f879afaecf7f06965a81469

GPencil: Interpolate can use all keyframe types except breakdown

Before only it was only possible interpolate frames of `Keyframe` type. Now all types except `Breakdown` can be used. 

`Breakdown` cannot be used because it would be impossible interpolate two times because the extremes of the interpolation would change and the clean operator would not work.

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

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 3b7c80cee07..1281f1392d8 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -435,16 +435,16 @@ static void gpencil_interpolate_update_strokes(bContext *C, tGPDinterpolate *tgp
   WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL);
 }
 
-/* Helper: Get previous keyframe. */
+/* Helper: Get previous keyframe (exclude breakdown type). */
 static bGPDframe *gpencil_get_previous_keyframe(bGPDlayer *gpl, int cfra)
 {
   if (gpl->actframe != NULL && gpl->actframe->framenum < cfra &&
-      gpl->actframe->key_type == BEZT_KEYTYPE_KEYFRAME) {
+      gpl->actframe->key_type != BEZT_KEYTYPE_BREAKDOWN) {
     return gpl->actframe;
   }
 
   LISTBASE_FOREACH_BACKWARD (bGPDframe *, gpf, &gpl->frames) {
-    if (gpf->key_type != BEZT_KEYTYPE_KEYFRAME) {
+    if (gpf->key_type == BEZT_KEYTYPE_BREAKDOWN) {
       continue;
     }
     if (gpf->framenum >= cfra) {
@@ -456,11 +456,11 @@ static bGPDframe *gpencil_get_previous_keyframe(bGPDlayer *gpl, int cfra)
   return NULL;
 }
 
-/* Helper: Get next keyframe. */
+/* Helper: Get next keyframe (exclude breakdown type). */
 static bGPDframe *gpencil_get_next_keyframe(bGPDlayer *gpl, int cfra)
 {
   LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
-    if (gpf->key_type != BEZT_KEYTYPE_KEYFRAME) {
+    if (gpf->key_type == BEZT_KEYTYPE_BREAKDOWN) {
       continue;
     }
     if (gpf->framenum <= cfra) {
@@ -760,7 +760,7 @@ static int gpencil_interpolate_invoke(bContext *C, wmOperator *op, const wmEvent
   Scene *scene = CTX_data_scene(C);
   tGPDinterpolate *tgpi = NULL;
 
-  /* cannot interpolate if not between 2 frames */
+  /* Cannot interpolate if not between 2 frames. */
   int cfra = CFRA;
   bGPDframe *gpf_prv = gpencil_get_previous_keyframe(gpl, cfra);
   bGPDframe *gpf_next = gpencil_get_next_keyframe(gpl, cfra);
@@ -768,7 +768,7 @@ static int gpencil_interpolate_invoke(bContext *C, wmOperator *op, const wmEvent
     BKE_report(
         op->reports,
         RPT_ERROR,
-        "Cannot find a pair of grease pencil frames to interpolate between in active layer");
+        "Cannot find valid keyframes to interpolate (Breakdowns keyframes are not allowed)");
     return OPERATOR_CANCELLED;
   }
 
@@ -1260,7 +1260,7 @@ static int gpencil_interpolate_seq_exec(bContext *C, wmOperator *op)
     BKE_report(
         op->reports,
         RPT_ERROR,
-        "Cannot find a pair of grease pencil frames to interpolate between in active layer");
+        "Cannot find valid keyframes to interpolate (Breakdowns keyframes are not allowed)");
     return OPERATOR_CANCELLED;
   }



More information about the Bf-blender-cvs mailing list