102 if (
G.is_rendering) {
149 if (op_data.
keylist !=
nullptr) {
181 ListBase anim_data = {
nullptr,
nullptr};
200 switch (ale->datatype) {
229 const float timeline_frame,
234 if (!closest_column) {
237 r_targets.
append({closest_column->
cfra,
true});
241 const float timeline_frame,
251 r_targets.
append({nearest_marker,
true});
255 const float timeline_frame,
259 const int start_frame = scene->
r.
sfra;
261 scene,
step, timeline_frame - start_frame) +
263 r_targets.
append({snap_frame,
false});
267 const float timeline_frame,
271 const int start_frame = scene->
r.
sfra;
272 const float snap_frame = (
round((timeline_frame - start_frame) /
float(
step)) *
step) +
274 r_targets.
append({snap_frame,
false});
278 const float timeline_frame,
280 float *r_best_distance)
282 if (
abs(position - timeline_frame) < *r_best_distance) {
283 *r_best_distance =
abs(position - timeline_frame);
284 *r_best_frame = position;
290 const float timeline_frame,
296 for (
Strip *strip : strips) {
308 if (best_distance !=
FLT_MAX) {
309 r_targets.
append({best_frame,
true});
314 const float timeline_frame,
323 ListBase anim_data = {
nullptr,
nullptr};
337 if (
abs(strip->start - timeline_frame) < best_distance) {
338 best_distance =
abs(strip->start - timeline_frame);
339 best_frame = strip->start;
341 if (
abs(strip->end - timeline_frame) < best_distance) {
342 best_distance =
abs(strip->end - timeline_frame);
343 best_frame = strip->end;
351 r_targets.
append({best_frame,
true});
359 const float timeline_frame)
428 const float timeline_frame)
456 const float timeline_frame)
519 if (
abs(target.pos - frame) <
abs(snap_frame - frame)) {
520 snap_frame = target.pos;
532 if (target.use_snap_treshold) {
535 if (
abs(target.pos - frame) <
abs(snap_frame - frame)) {
536 snap_frame = target.pos;
558 const int old_frame = scene->
r.
cfra;
559 const float old_subframe = scene->
r.
subframe;
568 scene->
r.
cfra = int(frame);
580 const bool frame_changed = (old_frame != scene->
r.
cfra) || (old_subframe != scene->
r.
subframe);
581 if (frame_changed || always_update) {
671 scene, v2d, mouse_co);
738 if (sseq !=
nullptr) {
754 switch (event->
type) {
799 status.item(
IFACE_(
"Toggle Snapping"), ICON_EVENT_CTRL);
812 if (sseq !=
nullptr) {
840 ot->name =
"Change Frame";
841 ot->idname =
"ANIM_OT_change_frame";
842 ot->description =
"Interactively change the current frame number";
854 ot->undo_group =
"Frame Change";
861 prop =
RNA_def_boolean(
ot->srna,
"seq_solo_preview",
false,
"Strip Preview",
"");
875 if (
G.is_rendering) {
898 if (scene ==
nullptr) {
902 frame = scene->
r.
cfra;
910 int frame_clamped = frame;
912 if (frame_clamped != frame) {
915 frame = frame_clamped;
916 scene->
r.
sfra = frame;
924 scene->
r.
efra = frame;
936 ot->name =
"Set Start Frame";
937 ot->idname =
"ANIM_OT_start_frame_set";
938 ot->description =
"Set the current frame as the preview or scene start frame";
954 if (scene ==
nullptr) {
958 frame = scene->
r.
cfra;
966 int frame_clamped = frame;
968 if (frame_clamped != frame) {
971 frame = frame_clamped;
972 scene->
r.
efra = frame;
980 scene->
r.
sfra = frame;
992 ot->name =
"Set End Frame";
993 ot->idname =
"ANIM_OT_end_frame_set";
994 ot->description =
"Set the current frame as the preview or scene end frame";
1034 efra = std::max(efra, sfra);
1049 ot->name =
"Set Preview Range";
1050 ot->idname =
"ANIM_OT_previewrange_set";
1051 ot->description =
"Interactively define frame range used for playback";
1085 if (
ELEM(
nullptr, scene, curarea)) {
1105 ot->name =
"Clear Preview Range";
1106 ot->idname =
"ANIM_OT_previewrange_clear";
1107 ot->description =
"Clear preview range";
1132 ListBase anim_data = {
nullptr,
nullptr};
1139 printf(
"==============================================\n");
1140 printf(
"Animation Channel List:\n");
1141 printf(
"----------------------------------------------\n");
1147 printf(
"==============================================\n");
1155 ot->name =
"Debug Channel List";
1156 ot->idname =
"ANIM_OT_debug_channel_list";
1158 "Log the channel list info in the terminal. This operator is only available in debug builds "
1198 ot->name =
"Frame Scene/Preview Range";
1199 ot->idname =
"ANIM_OT_scene_range_frame";
1201 "Reset the horizontal view to the current scene frame range, taking the preview range into "
1202 "account if it is active";
1232 BLI_assert_msg(assign_ok,
"Expecting assigning a layered Action to always work");
1258 if (!adt || !adt->
action) {
1263 if (!adt->
action->wrap().is_action_legacy()) {
1274 ot->name =
"Convert Legacy Action";
1275 ot->idname =
"ANIM_OT_convert_legacy_action";
1276 ot->description =
"Convert a legacy Action to a layered Action on the active object";
1320 int moved_slots_count = 0;
1323 for (
ID *related_id : related_ids) {
1328 if (action == &active_action) {
1347 moved_slots_count++;
1353 if (moved_slots_count > 0) {
1356 "Moved %i slot(s) into the action of the active object",
1362 "Failed to merge any animation. Note that NLA strips cannot be merged");
1379 ot->name =
"Merge Animation";
1380 ot->idname =
"ANIM_OT_merge_animation";
1382 "Merge the animation of the selected objects into the action of the active object. Actions "
1383 "are not deleted by this, but might end up with zero users";
Functions and classes to work with Actions.
Functions to work with AnimData.
AnimData * BKE_animdata_ensure_id(ID *id)
AnimData * BKE_animdata_from_id(const ID *id)
bScreen * CTX_wm_screen(const bContext *C)
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
ScrArea * CTX_wm_area(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
SpaceSeq * CTX_wm_space_seq(const bContext *C)
bool CTX_data_selected_objects(const bContext *C, blender::Vector< PointerRNA > *list)
Main * CTX_data_main(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
Scene * CTX_data_sequencer_scene(const bContext *C)
bool BKE_id_is_editable(const Main *bmain, const ID *id)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
float BKE_scene_frame_snap_by_seconds(const Scene *scene, double interval_in_seconds, float frame)
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
MINLINE int round_fl_to_int(float a)
#define UNUSED_VARS_NDEBUG(...)
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ ID_RECALC_ANIMATION_NO_FLUSH
@ SCER_LOCK_FRAME_SELECTION
#define FRAMENUMBER_MIN_CLAMP(cfra)
@ ANIMFILTER_DATA_VISIBLE
@ ANIMFILTER_LIST_VISIBLE
@ ANIMFILTER_LIST_CHANNELS
void ED_area_tag_redraw(ScrArea *area)
bool ED_operator_animview_active(bContext *C)
void ED_workspace_status_text(bContext *C, const char *str)
void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
View2D * UI_view2d_fromcontext(const bContext *C)
void UI_view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
float UI_view2d_region_to_view_x(const View2D *v2d, float x)
void ANIM_channel_debug_print_info(bAnimContext &ac, bAnimListElem *ale, short indent_level)
void ANIM_animdata_freelist(ListBase *anim_data)
void ANIM_id_update(Main *bmain, ID *id)
rctf ANIM_frame_range_view2d_add_xmargin(const View2D &view_2d, const rctf view_rect)
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, const eAnimFilter_Flags filter_mode, void *data, const eAnimCont_Types datatype)
void ANIM_OT_keyframe_insert_menu(wmOperatorType *ot)
void ANIM_OT_keyframe_delete_vse(wmOperatorType *ot)
void ANIM_OT_keying_set_add(wmOperatorType *ot)
void ANIM_OT_driver_button_remove(wmOperatorType *ot)
void ANIM_OT_driver_button_add(wmOperatorType *ot)
void ANIM_OT_keyframe_insert(wmOperatorType *ot)
void ANIM_OT_driver_button_edit(wmOperatorType *ot)
void ANIM_OT_keying_set_path_remove(wmOperatorType *ot)
void ANIM_OT_keyframe_clear_button(wmOperatorType *ot)
void ANIM_OT_keyframe_insert_by_name(wmOperatorType *ot)
void ANIM_OT_keyframe_delete(wmOperatorType *ot)
void ANIM_OT_keyingset_button_add(wmOperatorType *ot)
void ANIM_OT_keyframe_clear_v3d(wmOperatorType *ot)
void ANIM_OT_keying_set_remove(wmOperatorType *ot)
void ANIM_OT_paste_driver_button(wmOperatorType *ot)
void ANIM_OT_keyframe_insert_button(wmOperatorType *ot)
void ANIM_OT_keying_set_active_set(wmOperatorType *ot)
void ANIM_OT_copy_driver_button(wmOperatorType *ot)
void ANIM_OT_keyingset_button_remove(wmOperatorType *ot)
void ANIM_OT_keying_set_path_add(wmOperatorType *ot)
void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot)
void ANIM_OT_keyframe_delete_button(wmOperatorType *ot)
void ANIM_OT_keyframe_delete_by_name(wmOperatorType *ot)
void ANIM_OT_keyframe_clear_vse(wmOperatorType *ot)
int ED_markers_find_nearest_marker_time(ListBase *markers, float x)
static wmOperatorStatus debug_channel_list_exec(bContext *C, wmOperator *)
void ED_operatortypes_anim()
static void change_frame_apply(bContext *C, wmOperator *op, const bool always_update)
static void ANIM_OT_previewrange_set(wmOperatorType *ot)
static bool anim_set_end_frames_poll(bContext *C)
static void ANIM_OT_previewrange_clear(wmOperatorType *ot)
static void append_frame_snap_target(const Scene *scene, const float timeline_frame, const int step, blender::Vector< SnapTarget > &r_targets)
static void ANIM_OT_convert_legacy_action(wmOperatorType *ot)
static wmOperatorStatus merge_actions_selection_exec(bContext *C, wmOperator *op)
static float get_snap_threshold(const ToolSettings *tool_settings, const ARegion *region)
static wmOperatorStatus change_frame_exec(bContext *C, wmOperator *op)
static void ANIM_OT_start_frame_set(wmOperatorType *ot)
static void ANIM_OT_scene_range_frame(wmOperatorType *ot)
static bool merge_actions_selection_poll(bContext *C)
static void append_nla_strip_snap_target(bContext *C, const float timeline_frame, blender::Vector< SnapTarget > &r_targets)
static wmOperatorStatus previewrange_define_exec(bContext *C, wmOperator *op)
static wmOperatorStatus change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void seq_frame_snap_update_best(const float position, const float timeline_frame, float *r_best_frame, float *r_best_distance)
static bool use_playhead_snapping(bContext *C)
static void ANIM_OT_end_frame_set(wmOperatorType *ot)
static void change_frame_seq_preview_begin(bContext *C, const wmEvent *event, SpaceSeq *sseq)
static wmOperatorStatus anim_set_sfra_exec(bContext *C, wmOperator *op)
static wmOperatorStatus change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void ensure_change_frame_keylist(bContext *C, FrameChangeModalData &op_data)
static wmOperatorStatus previewrange_clear_exec(bContext *C, wmOperator *)
static bool sequencer_skip_for_handle_tweak(const bContext *C, const wmEvent *event)
static blender::Vector< SnapTarget > action_get_snap_targets(bContext *C, FrameChangeModalData &op_data, const float timeline_frame)
static wmOperatorStatus convert_action_exec(bContext *C, wmOperator *)
static wmOperatorStatus scene_range_frame_exec(bContext *C, wmOperator *)
static std::string change_frame_get_name(wmOperatorType *, PointerRNA *ptr)
static float frame_from_event(bContext *C, const wmEvent *event)
static wmOperatorStatus anim_set_efra_exec(bContext *C, wmOperator *op)
static void append_second_snap_target(Scene *scene, const float timeline_frame, const int step, blender::Vector< SnapTarget > &r_targets)
void ED_keymap_anim(wmKeyConfig *keyconf)
static blender::Vector< SnapTarget > seq_get_snap_targets(bContext *C, FrameChangeModalData &op_data, const float timeline_frame)
static void append_marker_snap_target(Scene *scene, const float timeline_frame, blender::Vector< SnapTarget > &r_targets)
static void ANIM_OT_merge_animation(wmOperatorType *ot)
static bool convert_action_poll(bContext *C)
static bool need_extra_redraw_after_scrubbing_ends(bContext *C)
static void append_sequencer_strip_snap_target(blender::Span< Strip * > strips, const Scene *scene, const float timeline_frame, blender::Vector< SnapTarget > &r_targets)
static bool change_frame_poll(bContext *C)
static void ANIM_OT_change_frame(wmOperatorType *ot)
static void ANIM_OT_debug_channel_list(wmOperatorType *ot)
static blender::Vector< SnapTarget > graph_get_snap_targets(bContext *C, FrameChangeModalData &op_data, const float timeline_frame)
static float apply_frame_snap(bContext *C, FrameChangeModalData &op_data, const float frame)
static void change_frame_seq_preview_end(SpaceSeq *sseq)
static void change_frame_cancel(bContext *C, wmOperator *op)
static blender::Vector< SnapTarget > nla_get_snap_targets(bContext *C, const float timeline_frame)
static void append_keyframe_snap_target(bContext *C, FrameChangeModalData &op_data, const float timeline_frame, blender::Vector< SnapTarget > &r_targets)
void append(const T &value)
void slot_identifier_set(Main &bmain, Slot &slot, StringRefNull new_identifier)
const Slot * slot(int64_t index) const
bool is_action_legacy() const
blender::Span< const Slot * > slots() const
Slot * slot_for_handle(slot_handle_t handle)
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
void fcurve_to_keylist(AnimData *adt, FCurve *fcu, AnimKeylist *keylist, const int saction_flag, blender::float2 range, const bool use_nla_remapping)
const ActKeyColumn * ED_keylist_find_closest(const AnimKeylist *keylist, const float cfra)
void ED_keylist_prepare_for_direct_access(AnimKeylist *keylist)
AnimKeylist * ED_keylist_create()
void ED_keylist_free(AnimKeylist *keylist)
void sequencer_strip_to_keylist(const Strip &strip, AnimKeylist &keylist, Scene &scene)
void grease_pencil_cels_to_keylist(AnimData *, const GreasePencilLayer *gpl, AnimKeylist *keylist, int)
void gpl_to_keylist(bDopeSheet *, bGPDlayer *gpl, AnimKeylist *keylist)
DEG_id_tag_update_ex(cb_data->bmain, cb_data->owner_id, ID_RECALC_TAG_FOR_UNDO|ID_RECALC_SYNC_TO_EVAL)
Vector< ID * > find_related_ids(Main &bmain, ID &id)
Action * get_action(ID &animated_id)
Action * convert_to_layered_action(Main &bmain, const Action &legacy_action)
bool assign_action(bAction *action, ID &animated_id)
ActionSlotAssignmentResult assign_action_slot(Slot *slot_to_assign, ID &animated_id)
void move_slot(Main &bmain, Slot &slot, Action &from_action, Action &to_action)
ActionSlotAssignmentResult
void POSELIB_OT_asset_delete(wmOperatorType *ot)
void POSELIB_OT_create_pose_asset(wmOperatorType *ot)
void POSELIB_OT_asset_modify(wmOperatorType *ot)
ListBase get_editable_fcurves(bAnimContext &ac)
bool check_show_strip(const SpaceSeq &sseq)
StripSelection pick_strip_and_handle(const struct Scene *scene, const View2D *v2d, float mouse_co[2])
void special_preview_clear()
void sync_active_scene_and_time_with_scene_strip(bContext &C)
Strip * special_preview_get()
void special_preview_set(bContext *C, const int mval[2])
int time_right_handle_frame_get(const Scene *scene, const Strip *strip)
VectorSet< Strip * > query_all_strips(ListBase *seqbase)
Editing * editing_get(const Scene *scene)
int time_left_handle_frame_get(const Scene *, const Strip *strip)
ListBase * active_seqbase_get(const Editing *ed)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
struct ToolSettings * toolsettings
struct ReportList * reports
bool ED_time_scrub_event_in_region(const ARegion *region, const wmEvent *event)
void WM_main_add_notifier(uint type, void *reference)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_gesture_box_cancel(bContext *C, wmOperator *op)
wmOperatorStatus WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
void WM_operator_properties_border_to_rcti(wmOperator *op, rcti *r_rect)
void WM_operator_properties_border(wmOperatorType *ot)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))