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.
This commit is contained in:
Antonio Vazquez 2021-03-12 19:43:13 +01:00
parent 5788f608d3
commit 9d08c169d1
1 changed files with 8 additions and 8 deletions

View File

@ -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;
}