104 const int timeline_frame,
106 int *r_best_distance)
108 if (
abs(position - timeline_frame) < *r_best_distance) {
109 *r_best_distance =
abs(position - timeline_frame);
110 *r_best_frame = position;
132 return timeline_frame;
142 const int old_frame = scene->r.cfra;
143 const float old_subframe = scene->r.subframe;
156 scene->r.cfra =
int(frame);
157 scene->r.subframe = frame -
int(frame);
161 scene->r.subframe = 0.0f;
166 const bool frame_changed = (old_frame != scene->r.cfra) || (old_subframe != scene->r.subframe);
167 if (frame_changed || always_update) {
229 return (scene->toolsettings->snap_flag_seq &
SCE_SNAP) &&
276 screen->scrubbing =
true;
298 if (scene->eevee.taa_samples != 1) {
327 screen->scrubbing =
false;
330 if (sseq !=
nullptr) {
345 switch (event->
type) {
388 screen->scrubbing =
false;
391 if (sseq !=
nullptr) {
408 ot->
name =
"Change Frame";
409 ot->
idname =
"ANIM_OT_change_frame";
410 ot->
description =
"Interactively change the current frame number";
441 if (
G.is_rendering) {
463 if (scene ==
nullptr) {
467 frame = scene->r.cfra;
471 scene->r.psfra = frame;
475 int frame_clamped = frame;
477 if (frame_clamped != frame) {
480 frame = frame_clamped;
481 scene->r.sfra = frame;
486 scene->r.pefra = frame;
489 scene->r.efra = frame;
501 ot->
name =
"Set Start Frame";
502 ot->
idname =
"ANIM_OT_start_frame_set";
503 ot->
description =
"Set the current frame as the preview or scene start frame";
518 if (scene ==
nullptr) {
522 frame = scene->r.cfra;
526 scene->r.pefra = frame;
530 int frame_clamped = frame;
532 if (frame_clamped != frame) {
535 frame = frame_clamped;
536 scene->r.efra = frame;
541 scene->r.psfra = frame;
544 scene->r.sfra = frame;
556 ot->
name =
"Set End Frame";
557 ot->
idname =
"ANIM_OT_end_frame_set";
558 ot->
description =
"Set the current frame as the preview or scene end frame";
611 ot->
name =
"Set Preview Range";
612 ot->
idname =
"ANIM_OT_previewrange_set";
613 ot->
description =
"Interactively define frame range used for playback";
646 if (
ELEM(
nullptr, scene, curarea)) {
651 scene->r.flag &= ~SCER_PRV_RANGE;
666 ot->
name =
"Clear Preview Range";
667 ot->
idname =
"ANIM_OT_previewrange_clear";
692 View2D &v2d = region->v2d;
706 ot->
name =
"Frame Scene/Preview Range";
707 ot->
idname =
"ANIM_OT_scene_range_frame";
709 "Reset the horizontal view to the current scene frame range, taking the preview range into "
710 "account if it is active";
735 C,
"Creating a new Action Slot is only possible when an Action is already assigned");
746 Action *action = get_action(object->id);
747 BLI_assert_msg(action,
"The poll function should have ensured the Action is not NULL");
753 "Assigning a slot that was made for this ID should always work");
766 ot->
idname =
"ANIM_OT_slot_new_for_object";
767 ot->
description =
"Create a new Slot for this object, on the Action already assigned to it";
789 animrig::Action *layered_action = animrig::convert_to_layered_action(*bmain, legacy_action);
792 const bool assign_ok = animrig::assign_action(layered_action, object->
id);
793 BLI_assert_msg(assign_ok,
"Expecting assigning a layered Action to always work");
801 BLI_assert(result == animrig::ActionSlotAssignmentResult::OK);
819 if (!adt || !adt->
action) {
824 if (!adt->
action->wrap().is_action_legacy()) {
835 ot->
name =
"Convert Legacy Action";
836 ot->
idname =
"ANIM_OT_convert_legacy_action";
837 ot->
description =
"Convert a legacy Action to a layered Action on the active object";
883 for (
ID *related_id : related_ids) {
884 Action *action = get_action(*related_id);
888 if (action == &active_action) {
919 ot->
name =
"Merge Animation";
920 ot->
idname =
"ANIM_OT_merge_animation";
922 "Merge the animation of the selected objects into the action of the active object. Actions "
923 "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)
wmWindowManager * CTX_wm_manager(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_msg(a, msg)
#define LISTBASE_FOREACH(type, var, list)
MINLINE int round_fl_to_int(float a)
#define UNUSED_VARS_NDEBUG(...)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ SCER_LOCK_FRAME_SELECTION
@ SEQ_SNAP_CURRENT_FRAME_TO_STRIPS
#define FRAMENUMBER_MIN_CLAMP(cfra)
@ USER_SEQ_ED_SIMPLE_TWEAKING
void ED_area_tag_redraw(ScrArea *area)
bool ED_operator_animview_active(bContext *C)
bool ED_space_sequencer_check_show_strip(SpaceSeq *sseq)
StripSelection ED_sequencer_pick_strip_and_handle(const struct Scene *scene, const View2D *v2d, float mouse_co[2])
Sequence * ED_sequencer_special_preview_get()
void ED_sequencer_special_preview_clear()
void ED_sequencer_special_preview_set(bContext *C, const int mval[2])
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_id_update(Main *bmain, ID *id)
rctf ANIM_frame_range_view2d_add_xmargin(const View2D &view_2d, const rctf view_rect)
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)
static int slot_new_for_object_exec(bContext *C, wmOperator *)
void ED_operatortypes_anim()
static void change_frame_apply(bContext *C, wmOperator *op, const bool always_update)
static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int seq_frame_apply_snap(bContext *C, Scene *scene, const int timeline_frame)
static int convert_action_exec(bContext *C, wmOperator *)
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 ANIM_OT_convert_legacy_action(wmOperatorType *ot)
static bool use_sequencer_snapping(bContext *C)
static void change_frame_cancel(bContext *C, wmOperator *)
static int previewrange_clear_exec(bContext *C, wmOperator *)
static int anim_set_sfra_exec(bContext *C, wmOperator *op)
static int merge_actions_selection_exec(bContext *C, wmOperator *op)
static void seq_frame_snap_update_best(const int position, const int timeline_frame, int *r_best_frame, int *r_best_distance)
static void ANIM_OT_start_frame_set(wmOperatorType *ot)
static void ANIM_OT_slot_new_for_object(wmOperatorType *ot)
static void ANIM_OT_scene_range_frame(wmOperatorType *ot)
static bool merge_actions_selection_poll(bContext *C)
static int change_frame_exec(bContext *C, wmOperator *op)
static int anim_set_efra_exec(bContext *C, wmOperator *op)
static void ANIM_OT_end_frame_set(wmOperatorType *ot)
static int scene_range_frame_exec(bContext *C, wmOperator *)
static void change_frame_seq_preview_begin(bContext *C, const wmEvent *event, SpaceSeq *sseq)
static bool sequencer_skip_for_handle_tweak(const bContext *C, const wmEvent *event)
static int previewrange_define_exec(bContext *C, wmOperator *op)
static bool slot_new_for_object_poll(bContext *C)
static float frame_from_event(bContext *C, const wmEvent *event)
static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
void ED_keymap_anim(wmKeyConfig *keyconf)
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 bool change_frame_poll(bContext *C)
static void ANIM_OT_change_frame(wmOperatorType *ot)
static void change_frame_seq_preview_end(SpaceSeq *sseq)
static int seq_snap_threshold_get_frame_distance(bContext *C)
Slot & slot_add_for_id(const ID &animated_id)
const Slot * slot(int64_t index) const
bool is_action_legacy() const
bool is_action_layered() const
void slot_name_set(Main &bmain, Slot &slot, StringRefNull new_name)
blender::Span< const Slot * > slots() const
Slot * slot_for_handle(slot_handle_t handle)
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
VectorSet< Sequence * > SEQ_query_all_strips(ListBase *seqbase)
Action * get_action(ID &animated_id)
void move_slot(Main &bmain, Slot &slot, Action &from_action, Action &to_action)
ActionSlotAssignmentResult
GPU_SHADER_INTERFACE_INFO(overlay_edit_curve_handle_iface, "vert").flat(Type pos vertex_in(1, Type::UINT, "data") .vertex_out(overlay_edit_curve_handle_iface) .geometry_layout(PrimitiveIn Frequency::GEOMETRY storage_buf(1, Qualifier::READ, "uint", "data[]", Frequency::GEOMETRY) .push_constant(Type Frequency::GEOMETRY selection[]
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)
ListBase * SEQ_active_seqbase_get(const Editing *ed)
int SEQ_tool_settings_snap_distance_get(Scene *scene)
short SEQ_tool_settings_snap_flag_get(Scene *scene)
Editing * SEQ_editing_get(const Scene *scene)
int SEQ_time_left_handle_frame_get(const Scene *, const Sequence *seq)
int SEQ_time_right_handle_frame_get(const Scene *scene, const Sequence *seq)
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) 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)
ccl_device_inline int abs(int x)
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)
int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_box_modal(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 *))
bScreen * WM_window_get_active_screen(const wmWindow *win)