102 if (
G.is_rendering) {
146 if (op_data.
keylist !=
nullptr) {
178 ListBase anim_data = {
nullptr,
nullptr};
197 switch (ale->datatype) {
226 const float timeline_frame,
231 if (!closest_column) {
234 r_targets.
append({closest_column->
cfra,
true});
238 const float timeline_frame,
248 r_targets.
append({nearest_marker,
true});
252 const float timeline_frame,
258 scene,
step, timeline_frame - start_frame) +
260 r_targets.
append({snap_frame,
false});
264 const float timeline_frame,
269 const float snap_frame = (
round((timeline_frame - start_frame) /
float(
step)) *
step) +
271 r_targets.
append({snap_frame,
false});
275 const float timeline_frame,
277 float *r_best_distance)
279 if (
abs(position - timeline_frame) < *r_best_distance) {
280 *r_best_distance =
abs(position - timeline_frame);
281 *r_best_frame = position;
287 const float timeline_frame,
305 if (best_distance !=
FLT_MAX) {
306 r_targets.
append({best_frame,
true});
311 const float timeline_frame,
320 ListBase anim_data = {
nullptr,
nullptr};
338 if (
abs(
strip->end - timeline_frame) < best_distance) {
339 best_distance =
abs(
strip->end - timeline_frame);
340 best_frame =
strip->end;
348 r_targets.
append({best_frame,
true});
356 const float timeline_frame)
425 const float timeline_frame)
453 const float timeline_frame)
516 snap_frame = target.pos;
528 if (target.use_snap_treshold) {
532 snap_frame = target.pos;
571 if (frame_changed || always_update) {
663 scene, v2d, mouse_co);
730 if (sseq !=
nullptr) {
746 switch (event->
type) {
791 status.
item(
IFACE_(
"Toggle Snapping"), ICON_EVENT_CTRL);
804 if (sseq !=
nullptr) {
832 ot->
name =
"Change Frame";
833 ot->
idname =
"ANIM_OT_change_frame";
834 ot->
description =
"Interactively change the current frame number";
867 if (
G.is_rendering) {
889 if (
scene ==
nullptr) {
901 int frame_clamped =
frame;
903 if (frame_clamped !=
frame) {
906 frame = frame_clamped;
927 ot->
name =
"Set Start Frame";
928 ot->
idname =
"ANIM_OT_start_frame_set";
929 ot->
description =
"Set the current frame as the preview or scene start frame";
944 if (
scene ==
nullptr) {
956 int frame_clamped =
frame;
958 if (frame_clamped !=
frame) {
961 frame = frame_clamped;
982 ot->
name =
"Set End Frame";
983 ot->
idname =
"ANIM_OT_end_frame_set";
984 ot->
description =
"Set the current frame as the preview or scene end frame";
1020 efra = std::max(efra, sfra);
1035 ot->
name =
"Set Preview Range";
1036 ot->
idname =
"ANIM_OT_previewrange_set";
1037 ot->
description =
"Interactively define frame range used for playback";
1090 ot->
name =
"Clear Preview Range";
1091 ot->
idname =
"ANIM_OT_previewrange_clear";
1117 ListBase anim_data = {
nullptr,
nullptr};
1124 printf(
"==============================================\n");
1125 printf(
"Animation Channel List:\n");
1126 printf(
"----------------------------------------------\n");
1132 printf(
"==============================================\n");
1140 ot->
name =
"Debug Channel List";
1141 ot->
idname =
"ANIM_OT_debug_channel_list";
1143 "Log the channel list info in the terminal. This operator is only available in debug builds "
1180 ot->
name =
"Frame Scene/Preview Range";
1181 ot->
idname =
"ANIM_OT_scene_range_frame";
1183 "Reset the horizontal view to the current scene frame range, taking the preview range into "
1184 "account if it is active";
1210 animrig::Action *layered_action = animrig::convert_to_layered_action(*bmain, legacy_action);
1213 const bool assign_ok = animrig::assign_action(layered_action, object->
id);
1214 BLI_assert_msg(assign_ok,
"Expecting assigning a layered Action to always work");
1240 if (!adt || !adt->
action) {
1245 if (!adt->
action->wrap().is_action_legacy()) {
1256 ot->
name =
"Convert Legacy Action";
1257 ot->
idname =
"ANIM_OT_convert_legacy_action";
1258 ot->
description =
"Convert a legacy Action to a layered Action on the active object";
1302 int moved_slots_count = 0;
1305 for (
ID *related_id : related_ids) {
1306 Action *action = get_action(*related_id);
1310 if (action == &active_action) {
1329 moved_slots_count++;
1335 if (moved_slots_count > 0) {
1338 "Moved %i slot(s) into the action of the active object",
1344 "Failed to merge any animation. Note that NLA strips cannot be merged");
1361 ot->
name =
"Merge Animation";
1362 ot->
idname =
"ANIM_OT_merge_animation";
1364 "Merge the animation of the selected objects into the action of the active object. Actions "
1365 "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)
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)
int BKE_scene_frame_snap_by_seconds(Scene *scene, double interval_in_seconds, int 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_id_tag_update_ex(Main *bmain, 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)
@ USER_SEQ_ED_SIMPLE_TWEAKING
@ 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_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)
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 item(std::string text, int icon1, int icon2=0)
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)
Action * get_action(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()
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
wmOperatorStatus(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
std::string(* get_name)(wmOperatorType *ot, PointerRNA *ptr)
wmOperatorStatus(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
void(* cancel)(bContext *C, wmOperator *op)
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 *))