diff options
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 14 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_deps.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 24 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 13 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_markers.c | 15 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_motion_paths.c | 8 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_ops.c | 14 | ||||
-rw-r--r-- | source/blender/editors/animation/drivers.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/fmodifier_ui.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_edit.c | 6 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_general.c | 109 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 33 |
13 files changed, 92 insertions, 152 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 9eeabf2d05e..729e8533d50 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3123,7 +3123,7 @@ static bAnimChannelType ACF_DSSIMULATION = { /* TODO: just get this from RNA? */ static int acf_dsgpencil_icon(bAnimListElem *UNUSED(ale)) { - return ICON_GREASEPENCIL; + return ICON_OUTLINER_DATA_GREASEPENCIL; } /* Get the appropriate flag(s) for the setting when it is valid. */ @@ -4747,13 +4747,13 @@ static void achannel_setting_slider_cb(bContext *C, void *id_poin, void *fcu_poi RNA_id_pointer_create(id, &id_ptr); /* Get NLA context for value remapping */ - const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct(depsgraph, - (float)CFRA); + const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct( + depsgraph, (float)scene->r.cfra); NlaKeyframingContext *nla_context = BKE_animsys_get_nla_keyframing_context( &nla_cache, &id_ptr, adt, &anim_eval_context); /* get current frame and apply NLA-mapping to it (if applicable) */ - cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP); + cfra = BKE_nla_tweakedit_remap(adt, (float)scene->r.cfra, NLATIME_CONVERT_UNMAP); /* Get flags for keyframing. */ flag = ANIM_get_keyframing_flags(scene, true); @@ -4803,8 +4803,8 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi RNA_id_pointer_create((ID *)key, &id_ptr); /* Get NLA context for value remapping */ - const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct(depsgraph, - (float)CFRA); + const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct( + depsgraph, (float)scene->r.cfra); NlaKeyframingContext *nla_context = BKE_animsys_get_nla_keyframing_context( &nla_cache, &id_ptr, key->adt, &anim_eval_context); @@ -4872,7 +4872,7 @@ static void achannel_setting_slider_nla_curve_cb(bContext *C, float cfra; /* get current frame - *no* NLA mapping should be done */ - cfra = (float)CFRA; + cfra = (float)scene->r.cfra; /* get flags for keyframing */ flag = ANIM_get_keyframing_flags(scene, true); diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index b223a1493fd..8464f280c29 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2033,7 +2033,7 @@ static void setflag_anim_channels(bAnimContext *ac, if ((ac->spacetype == SPACE_GRAPH) && (ac->regiontype != RGN_TYPE_CHANNELS)) { /* graph editor (case 2) */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_CURVE_VISIBLE | - ANIMFILTER_NODUPLIS); + ANIMFILTER_FCURVESONLY | ANIMFILTER_NODUPLIS); } else { /* standard case */ diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index d80eac2422e..ff53ad42e84 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -356,7 +356,7 @@ void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data) if (ale->update & ANIM_UPDATE_HANDLES) { ale->update &= ~ANIM_UPDATE_HANDLES; if (fcu) { - calchandles_fcurve(fcu); + BKE_fcurve_handles_recalc(fcu); } } diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index ee1522c7b76..d9dcbf1d57e 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -120,9 +120,9 @@ void ANIM_draw_framerange(Scene *scene, View2D *v2d) immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -25, -100); - if (SFRA < EFRA) { - immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax); - immRectf(pos, (float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); + if (scene->r.sfra < scene->r.efra) { + immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)scene->r.sfra, v2d->cur.ymax); + immRectf(pos, (float)scene->r.efra, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); } else { immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); @@ -135,11 +135,11 @@ void ANIM_draw_framerange(Scene *scene, View2D *v2d) immBegin(GPU_PRIM_LINES, 4); - immVertex2f(pos, (float)SFRA, v2d->cur.ymin); - immVertex2f(pos, (float)SFRA, v2d->cur.ymax); + immVertex2f(pos, (float)scene->r.sfra, v2d->cur.ymin); + immVertex2f(pos, (float)scene->r.sfra, v2d->cur.ymax); - immVertex2f(pos, (float)EFRA, v2d->cur.ymin); - immVertex2f(pos, (float)EFRA, v2d->cur.ymax); + immVertex2f(pos, (float)scene->r.efra, v2d->cur.ymin); + immVertex2f(pos, (float)scene->r.efra, v2d->cur.ymax); immEnd(); immUnbindProgram(); @@ -530,7 +530,7 @@ static bool find_prev_next_keyframes(struct bContext *C, int *r_nextfra, int *r_ bool donenext = false, doneprev = false; int nextcount = 0, prevcount = 0; - cfranext = cfraprev = (float)(CFRA); + cfranext = cfraprev = (float)(scene->r.cfra); /* seed up dummy dopesheet context with flags to perform necessary filtering */ if ((scene->flag & SCE_KEYS_NO_SELONLY) == 0) { @@ -559,7 +559,7 @@ static bool find_prev_next_keyframes(struct bContext *C, int *r_nextfra, int *r_ aknext = ED_keylist_find_next(keylist, cfranext); if (aknext) { - if (CFRA == (int)aknext->cfra) { + if (scene->r.cfra == (int)aknext->cfra) { /* make this the new starting point for the search and ignore */ cfranext = aknext->cfra; } @@ -577,7 +577,7 @@ static bool find_prev_next_keyframes(struct bContext *C, int *r_nextfra, int *r_ akprev = ED_keylist_find_prev(keylist, cfraprev); if (akprev) { - if (CFRA == (int)akprev->cfra) { + if (scene->r.cfra == (int)akprev->cfra) { /* make this the new starting point for the search */ } else { @@ -599,14 +599,14 @@ static bool find_prev_next_keyframes(struct bContext *C, int *r_nextfra, int *r_ *r_prevfra = cfraprev; } else { - *r_prevfra = CFRA - (cfranext - CFRA); + *r_prevfra = scene->r.cfra - (cfranext - scene->r.cfra); } if (donenext) { *r_nextfra = cfranext; } else { - *r_nextfra = CFRA + (CFRA - cfraprev); + *r_nextfra = scene->r.cfra + (scene->r.cfra - cfraprev); } return true; diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index a75944fa2f2..d9eeed94868 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1807,11 +1807,13 @@ static size_t animdata_filter_gpencil_data(ListBase *anim_data, ListBase tmp_data = {NULL, NULL}; size_t tmp_items = 0; - /* add gpencil animation channels */ - BEGIN_ANIMFILTER_SUBCHANNELS (EXPANDED_GPD(gpd)) { - tmp_items += animdata_filter_gpencil_layers_data(&tmp_data, ads, gpd, filter_mode); + if (!(filter_mode & ANIMFILTER_FCURVESONLY)) { + /* add gpencil animation channels */ + BEGIN_ANIMFILTER_SUBCHANNELS (EXPANDED_GPD(gpd)) { + tmp_items += animdata_filter_gpencil_layers_data(&tmp_data, ads, gpd, filter_mode); + } + END_ANIMFILTER_SUBCHANNELS; } - END_ANIMFILTER_SUBCHANNELS; /* did we find anything? */ if (tmp_items) { @@ -1925,6 +1927,9 @@ static size_t animdata_filter_ds_gpencil( tmp_items += animfilter_block_data(ac, &tmp_data, ads, &gpd->id, filter_mode); /* add Grease Pencil layers */ + if (!(filter_mode & ANIMFILTER_FCURVESONLY)) { + tmp_items += animdata_filter_gpencil_layers_data(&tmp_data, ads, gpd, filter_mode); + } /* TODO: do these need a separate expander? * XXX: what order should these go in? */ diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index ad06b185132..3608140a29d 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -104,7 +104,7 @@ int ED_markers_post_apply_transform( ListBase *markers, Scene *scene, int mode, float value, char side) { TimeMarker *marker; - float cfra = (float)CFRA; + float cfra = (float)scene->r.cfra; int changed_tot = 0; /* sanity check - no markers, or locked markers */ @@ -1497,8 +1497,8 @@ static void ED_markers_select_leftright(bAnimContext *ac, } LISTBASE_FOREACH (TimeMarker *, marker, markers) { - if ((mode == MARKERS_LRSEL_LEFT && marker->frame <= CFRA) || - (mode == MARKERS_LRSEL_RIGHT && marker->frame >= CFRA)) { + if ((mode == MARKERS_LRSEL_LEFT && marker->frame <= scene->r.cfra) || + (mode == MARKERS_LRSEL_RIGHT && marker->frame >= scene->r.cfra)) { marker->flag |= SELECT; } } @@ -1588,12 +1588,13 @@ static void MARKER_OT_delete(wmOperatorType *ot) ot->idname = "MARKER_OT_delete"; /* api callbacks */ - ot->invoke = WM_operator_confirm; + ot->invoke = WM_operator_confirm_or_exec; ot->exec = ed_marker_delete_exec; ot->poll = ed_markers_poll_selected_no_locked_markers; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + WM_operator_properties_confirm_or_exec(ot); } /** \} */ @@ -1754,11 +1755,11 @@ static int ed_marker_camera_bind_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - marker = ED_markers_find_nearest_marker(markers, CFRA); - if ((marker == NULL) || (marker->frame != CFRA)) { + marker = ED_markers_find_nearest_marker(markers, scene->r.cfra); + if ((marker == NULL) || (marker->frame != scene->r.cfra)) { marker = MEM_callocN(sizeof(TimeMarker), "Camera TimeMarker"); marker->flag = SELECT; - marker->frame = CFRA; + marker->frame = scene->r.cfra; BLI_addtail(markers, marker); /* deselect all others, so that the user can then move it without problems */ diff --git a/source/blender/editors/animation/anim_motion_paths.c b/source/blender/editors/animation/anim_motion_paths.c index b15bd3db678..23c1d68b4d6 100644 --- a/source/blender/editors/animation/anim_motion_paths.c +++ b/source/blender/editors/animation/anim_motion_paths.c @@ -391,7 +391,7 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph, return; } - const int cfra = CFRA; + const int cfra = scene->r.cfra; int sfra = INT_MAX, efra = INT_MIN; switch (range) { case ANIMVIZ_CALC_RANGE_CURRENT_FRAME: @@ -485,7 +485,7 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph, sfra, efra, efra - sfra + 1); - for (CFRA = sfra; CFRA <= efra; CFRA++) { + for (scene->r.cfra = sfra; scene->r.cfra <= efra; scene->r.cfra++) { if (range == ANIMVIZ_CALC_RANGE_CURRENT_FRAME) { /* For current frame, only update tagged. */ BKE_scene_graph_update_tagged(depsgraph, bmain); @@ -496,14 +496,14 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph, } /* perform baking for targets */ - motionpaths_calc_bake_targets(targets, CFRA); + motionpaths_calc_bake_targets(targets, scene->r.cfra); } /* reset original environment */ /* NOTE: We don't always need to reevaluate the main scene, as the depsgraph * may be a temporary one that works on a subset of the data. * We always have to restore the current frame though. */ - CFRA = cfra; + scene->r.cfra = cfra; if (range != ANIMVIZ_CALC_RANGE_CURRENT_FRAME && restore) { motionpaths_calc_update_scene(depsgraph); } diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index f3972cb45df..c7e755fb6df 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -142,14 +142,14 @@ static void change_frame_apply(bContext *C, wmOperator *op) /* set the new frame number */ if (scene->r.flag & SCER_SHOW_SUBFRAME) { - CFRA = (int)frame; - SUBFRA = frame - (int)frame; + scene->r.cfra = (int)frame; + scene->r.subframe = frame - (int)frame; } else { - CFRA = round_fl_to_int(frame); - SUBFRA = 0.0f; + scene->r.cfra = round_fl_to_int(frame); + scene->r.subframe = 0.0f; } - FRAMENUMBER_MIN_CLAMP(CFRA); + FRAMENUMBER_MIN_CLAMP(scene->r.cfra); /* do updates */ DEG_id_tag_update(&scene->id, ID_RECALC_FRAME_CHANGE); @@ -382,7 +382,7 @@ static int anim_set_sfra_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - frame = CFRA; + frame = scene->r.cfra; /* if Preview Range is defined, set the 'start' frame for that */ if (PRVRANGEON) { @@ -437,7 +437,7 @@ static int anim_set_efra_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - frame = CFRA; + frame = scene->r.cfra; /* if Preview Range is defined, set the 'end' frame for that */ if (PRVRANGEON) { diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index c6f68228807..effedd4307d 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -124,7 +124,7 @@ struct FCurve *alloc_driver_fcurve(const char rna_path[], insert_vert_fcurve( fcu, 1.0f, 1.0f, BEZT_KEYTYPE_KEYFRAME, INSERTKEY_FAST | INSERTKEY_NO_USERPREF); fcu->extend = FCURVE_EXTRAPOLATE_LINEAR; - calchandles_fcurve(fcu); + BKE_fcurve_handles_recalc(fcu); } } diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 6f31472907b..d2f0ee622c4 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -1020,7 +1020,7 @@ bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace, FCurve *c /* adding or removing the Cycles modifier requires an update to handles */ if (curve && BKE_fcurve_is_cyclic(curve) != was_cyclic) { - calchandles_fcurve(curve); + BKE_fcurve_handles_recalc(curve); } /* did we succeed? */ diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index f8277cf6a85..706db498a82 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -444,7 +444,7 @@ void ANIM_animdata_keyframe_callback(bAnimContext *ac, ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale = anim_data.first; ale; ale = ale->next) { - ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, callback_fn, calchandles_fcurve); + ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, callback_fn, BKE_fcurve_handles_recalc); ale->update |= ANIM_UPDATE_DEFAULT; } @@ -831,7 +831,7 @@ static short snap_bezier_cframe(KeyframeEditData *ked, BezTriple *bezt) { const Scene *scene = ked->scene; if (bezt->f2 & SELECT) { - bezt->vec[1][0] = (float)CFRA; + bezt->vec[1][0] = (float)scene->r.cfra; } return 0; } @@ -929,7 +929,7 @@ static short mirror_bezier_cframe(KeyframeEditData *ked, BezTriple *bezt) const Scene *scene = ked->scene; if (bezt->f2 & SELECT) { - mirror_bezier_xaxis_ex(bezt, CFRA); + mirror_bezier_xaxis_ex(bezt, scene->r.cfra); } return 0; diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index 00e2f221117..7723c221a40 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -47,77 +47,6 @@ /* **************************************************** */ -void delete_fcurve_key(FCurve *fcu, int index, bool do_recalc) -{ - /* sanity check */ - if (fcu == NULL) { - return; - } - - /* verify the index: - * 1) cannot be greater than the number of available keyframes - * 2) negative indices are for specifying a value from the end of the array - */ - if (abs(index) >= fcu->totvert) { - return; - } - if (index < 0) { - index += fcu->totvert; - } - - /* Delete this keyframe */ - memmove( - &fcu->bezt[index], &fcu->bezt[index + 1], sizeof(BezTriple) * (fcu->totvert - index - 1)); - fcu->totvert--; - - if (fcu->totvert == 0) { - MEM_SAFE_FREE(fcu->bezt); - } - - /* recalc handles - only if it won't cause problems */ - if (do_recalc) { - calchandles_fcurve(fcu); - } -} - -bool delete_fcurve_keys(FCurve *fcu) -{ - bool changed = false; - - if (fcu->bezt == NULL) { /* ignore baked curves */ - return false; - } - - /* Delete selected BezTriples */ - for (int i = 0; i < fcu->totvert; i++) { - if (fcu->bezt[i].f2 & SELECT) { - if (i == fcu->active_keyframe_index) { - BKE_fcurve_active_keyframe_set(fcu, NULL); - } - memmove(&fcu->bezt[i], &fcu->bezt[i + 1], sizeof(BezTriple) * (fcu->totvert - i - 1)); - fcu->totvert--; - i--; - changed = true; - } - } - - /* Free the array of BezTriples if there are not keyframes */ - if (fcu->totvert == 0) { - clear_fcurve_keys(fcu); - } - - return changed; -} - -void clear_fcurve_keys(FCurve *fcu) -{ - MEM_SAFE_FREE(fcu->bezt); - - fcu->totvert = 0; -} - -/* ---------------- */ - bool duplicate_fcurve_keys(FCurve *fcu) { bool changed = false; @@ -282,7 +211,7 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, boo } if (fcu->bezt->vec[1][1] == default_value) { - clear_fcurve_keys(fcu); + BKE_fcurve_delete_keys_all(fcu); /* check if curve is really unused and if it is, return signal for deletion */ if (BKE_fcurve_is_empty(fcu)) { @@ -679,7 +608,7 @@ void smooth_fcurve(FCurve *fcu) } /* recalculate handles */ - calchandles_fcurve(fcu); + BKE_fcurve_handles_recalc(fcu); } /* ---------------- */ @@ -762,7 +691,7 @@ void sample_fcurve(FCurve *fcu) } /* recalculate channel's handles? */ - calchandles_fcurve(fcu); + BKE_fcurve_handles_recalc(fcu); } /* **************************************************** */ @@ -921,7 +850,7 @@ short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data) } /* in case 'relative' paste method is used */ - animcopy_cfra = CFRA; + animcopy_cfra = scene->r.cfra; /* everything went fine */ return 0; @@ -1121,7 +1050,7 @@ static void paste_animedit_keys_fcurve( case KEYFRAME_PASTE_MERGE_OVER: /* remove all keys */ - clear_fcurve_keys(fcu); + BKE_fcurve_delete_keys_all(fcu); break; case KEYFRAME_PASTE_MERGE_OVER_RANGE: @@ -1148,7 +1077,7 @@ static void paste_animedit_keys_fcurve( } /* remove frames in the range */ - delete_fcurve_keys(fcu); + BKE_fcurve_delete_keys_selected(fcu); } break; } @@ -1182,7 +1111,7 @@ static void paste_animedit_keys_fcurve( } /* recalculate F-Curve's handles? */ - calchandles_fcurve(fcu); + BKE_fcurve_handles_recalc(fcu); } const EnumPropertyItem rna_enum_keyframe_paste_offset_items[] = { @@ -1217,11 +1146,11 @@ const EnumPropertyItem rna_enum_keyframe_paste_merge_items[] = { {0, NULL, 0, NULL, NULL}, }; -short paste_animedit_keys(bAnimContext *ac, - ListBase *anim_data, - const eKeyPasteOffset offset_mode, - const eKeyMergeMode merge_mode, - bool flip) +eKeyPasteError paste_animedit_keys(bAnimContext *ac, + ListBase *anim_data, + const eKeyPasteOffset offset_mode, + const eKeyMergeMode merge_mode, + bool flip) { bAnimListElem *ale; @@ -1235,25 +1164,23 @@ short paste_animedit_keys(bAnimContext *ac, /* check if buffer is empty */ if (BLI_listbase_is_empty(&animcopybuf)) { - BKE_report(ac->reports, RPT_ERROR, "No animation data in buffer to paste"); - return -1; + return KEYFRAME_PASTE_NOTHING_TO_PASTE; } if (BLI_listbase_is_empty(anim_data)) { - BKE_report(ac->reports, RPT_ERROR, "No selected F-Curves to paste into"); - return -1; + return KEYFRAME_PASTE_NOWHERE_TO_PASTE; } /* methods of offset */ switch (offset_mode) { case KEYFRAME_PASTE_OFFSET_CFRA_START: - offset = (float)(CFRA - animcopy_firstframe); + offset = (float)(scene->r.cfra - animcopy_firstframe); break; case KEYFRAME_PASTE_OFFSET_CFRA_END: - offset = (float)(CFRA - animcopy_lastframe); + offset = (float)(scene->r.cfra - animcopy_lastframe); break; case KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE: - offset = (float)(CFRA - animcopy_cfra); + offset = (float)(scene->r.cfra - animcopy_cfra); break; case KEYFRAME_PASTE_OFFSET_NONE: offset = 0.0f; @@ -1335,7 +1262,7 @@ short paste_animedit_keys(bAnimContext *ac, ANIM_animdata_update(ac, anim_data); - return 0; + return KEYFRAME_PASTE_OK; } /* **************************************************** */ diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index aa99a4e50c3..9084b9bb214 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -639,7 +639,7 @@ int insert_vert_fcurve( * - we may calculate twice (due to auto-handle needing to be calculated twice) */ if ((flag & INSERTKEY_FAST) == 0) { - calchandles_fcurve(fcu); + BKE_fcurve_handles_recalc(fcu); } /* return the index at which the keyframe was added */ @@ -1282,10 +1282,12 @@ static bool insert_keyframe_value(ReportList *reports, /* delete keyframe immediately before/after newly added */ switch (insert_mode) { case KEYNEEDED_DELPREV: - delete_fcurve_key(fcu, fcu->totvert - 2, 1); + BKE_fcurve_delete_key(fcu, fcu->totvert - 2); + BKE_fcurve_handles_recalc(fcu); break; case KEYNEEDED_DELNEXT: - delete_fcurve_key(fcu, 1, 1); + BKE_fcurve_delete_key(fcu, 1); + BKE_fcurve_handles_recalc(fcu); break; } @@ -1683,7 +1685,8 @@ static bool delete_keyframe_fcurve(AnimData *adt, FCurve *fcu, float cfra) i = BKE_fcurve_bezt_binarysearch_index(fcu->bezt, cfra, fcu->totvert, &found); if (found) { /* delete the key at the index (will sanity check + do recalc afterwards) */ - delete_fcurve_key(fcu, i, 1); + BKE_fcurve_delete_key(fcu, i); + BKE_fcurve_handles_recalc(fcu); /* Only delete curve too if it won't be doing anything anymore */ if (BKE_fcurve_is_empty(fcu)) { @@ -1947,7 +1950,8 @@ static int insert_key_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); bool ob_edit_mode = false; - float cfra = (float)CFRA; /* XXX for now, don't bother about all the yucky offset crap */ + float cfra = (float) + scene->r.cfra; /* XXX for now, don't bother about all the yucky offset crap */ int num_channels; const bool confirm = op->flag & OP_IS_INVOKE; @@ -2168,7 +2172,8 @@ static int delete_key_exec(bContext *C, wmOperator *op) static int delete_key_using_keying_set(bContext *C, wmOperator *op, KeyingSet *ks) { Scene *scene = CTX_data_scene(C); - float cfra = (float)CFRA; /* XXX for now, don't bother about all the yucky offset crap */ + float cfra = (float) + scene->r.cfra; /* XXX for now, don't bother about all the yucky offset crap */ int num_channels; const bool confirm = op->flag & OP_IS_INVOKE; @@ -2344,7 +2349,7 @@ void ANIM_OT_keyframe_clear_v3d(wmOperatorType *ot) static int delete_key_v3d_without_keying_set(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - float cfra = (float)CFRA; + float cfra = (float)scene->r.cfra; int selected_objects_len = 0; int selected_objects_success_len = 0; @@ -2494,7 +2499,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) char *path; uiBut *but; const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct( - CTX_data_depsgraph_pointer(C), (float)CFRA); + CTX_data_depsgraph_pointer(C), (float)scene->r.cfra); bool changed = false; int index; const bool all = RNA_boolean_get(op->ptr, "all"); @@ -2663,7 +2668,8 @@ static int delete_key_button_exec(bContext *C, wmOperator *op) PropertyRNA *prop = NULL; Main *bmain = CTX_data_main(C); char *path; - float cfra = (float)CFRA; /* XXX for now, don't bother about all the yucky offset crap */ + float cfra = (float) + scene->r.cfra; /* XXX for now, don't bother about all the yucky offset crap */ bool changed = false; int index; const bool all = RNA_boolean_get(op->ptr, "all"); @@ -2706,7 +2712,8 @@ static int delete_key_button_exec(bContext *C, wmOperator *op) i = BKE_fcurve_bezt_binarysearch_index(fcu->bezt, cfra, fcu->totvert, &found); if (found) { /* delete the key at the index (will sanity check + do recalc afterwards) */ - delete_fcurve_key(fcu, i, 1); + BKE_fcurve_delete_key(fcu, i); + BKE_fcurve_handles_recalc(fcu); changed = true; } } @@ -2835,7 +2842,7 @@ void ANIM_OT_keyframe_clear_button(wmOperatorType *ot) bool autokeyframe_cfra_can_key(const Scene *scene, ID *id) { - float cfra = (float)CFRA; /* XXX for now, this will do */ + float cfra = (float)scene->r.cfra; /* XXX for now, this will do */ /* only filter if auto-key mode requires this */ if (IS_AUTOKEY_ON(scene) == 0) { @@ -3065,7 +3072,7 @@ bool ED_autokeyframe_object(bContext *C, Scene *scene, Object *ob, KeyingSet *ks * 3) Free the extra info. */ ANIM_relative_keyingset_add_source(&dsources, &ob->id, NULL, NULL); - ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)scene->r.cfra); BLI_freelistN(&dsources); return true; @@ -3085,7 +3092,7 @@ bool ED_autokeyframe_pchan( * 3) Free the extra info. */ ANIM_relative_keyingset_add_source(&dsources, &ob->id, &RNA_PoseBone, pchan); - ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)scene->r.cfra); BLI_freelistN(&dsources); return true; |