56 if (strip ==
nullptr) {
82 for (
Strip *retiming_strip : retiming_sel.
values()) {
84 selected.
add(retiming_strip);
86 selected_keys.
add(retiming_strip);
94 const bool all_show = std::ranges::all_of(
97 for (
Strip *strip : selected) {
107 if (selected_keys.
contains(strip)) {
120 ot->
name =
"Retime Strips";
121 ot->
description =
"Show retiming keys in selected strips";
122 ot->
idname =
"SEQUENCER_OT_retiming_show";
154 ot->
name =
"Reset Retiming";
156 ot->
idname =
"SEQUENCER_OT_retiming_reset";
177 bool inserted =
false;
179 for (
Strip *strip : strips) {
197 bool inserted =
false;
242 ot->
name =
"Add Retiming Key";
244 ot->
idname =
"SEQUENCER_OT_retiming_key_add";
259 "Frame where key will be added",
279 if (key ==
nullptr) {
292 if (freeze ==
nullptr) {
314 bool success =
false;
316 for (
Strip *strip : strips) {
328 bool success =
false;
332 for (
auto item : selection.
items()) {
343 bool success =
false;
366 ot->
name =
"Add Freeze Frame";
368 ot->
idname =
"SEQUENCER_OT_retiming_freeze_frame_add";
384 "Duration of freeze frame segment",
404 if (key ==
nullptr) {
415 if (transition ==
nullptr) {
434 bool success =
false;
438 for (
auto item : selection.
items()) {
448 bool success =
false;
472 ot->
name =
"Add Speed Transition";
473 ot->
description =
"Add smooth transition between 2 retimed segments";
474 ot->
idname =
"SEQUENCER_OT_retiming_transition_add";
490 "Duration of speed transition segment",
516 for (
Strip *strip : strips_to_handle) {
518 for (
auto item : selection.
items()) {
519 if (item.value != strip) {
522 keys_to_delete.
append(item.key);
528 for (
Strip *strip : strips_to_handle) {
541 ListBaseT<TimeMarker> *markers = &scene->
markers;
543 if (!markers->is_empty()) {
548 if (event->
mval[1] <= 30) {
561 ot->
name =
"Delete Retiming Keys";
562 ot->
idname =
"SEQUENCER_OT_retiming_key_delete";
563 ot->
description =
"Delete selected retiming keys from the sequencer";
596 if (selection.
size() == 1) {
597 for (
auto item : selection.
items()) {
614 if (right_key ==
nullptr) {
629 for (
auto item : selection.
items()) {
634 retimed_strips.
add(item.value);
649 for (
Strip *strip : strips) {
661 if (selection.
size() > 0) {
688 ot->
name =
"Set Speed";
690 ot->
idname =
"SEQUENCER_OT_retiming_segment_speed_set";
707 "New speed of retimed segment",
768 if (r_strip !=
nullptr) {
774 if (key ==
nullptr) {
785 const Scene *scene,
const View2D *v2d,
const Strip *strip,
const int mval[2],
int &r_frame)
796 const int right_x = right_frame;
799 r_frame = (left_distance < right_distance) ? left_frame : right_frame;
809 int mouse_co_region[2])
837 const bool deselect_all)
839 bool changed =
false;
845 if (key ==
nullptr) {
861 const Strip *source_owner)
868 bool changed =
false;
870 for (
Strip *connection : connections) {
884 const Strip *key_owner)
900 const Strip *key_owner)
906 const bool wait_to_deselect_others =
RNA_boolean_get(op->
ptr,
"wait_to_deselect_others");
923 if (wait_to_deselect_others && !toggle) {
929 bool changed =
select_key(
ed, key, toggle, deselect_all);
940 const int content_start = strip->content_start();
941 const int left_key_frame =
max_ii(content_start, strip->left_handle());
942 const int content_end = strip->content_end(scene);
943 const int right_key_frame =
min_ii(content_end, strip->right_handle(scene));
946 if (left_key_frame > rectf.
xmin && left_key_frame < rectf.
xmax) {
949 if (right_key_frame > rectf.
xmin && right_key_frame < rectf.
xmax) {
965 bool changed =
false;
978 if (strip->channel < rectf.
ymin || strip->channel > rectf.
ymax) {
988 const int strip_start = strip->left_handle();
989 const int strip_end = strip->right_handle(scene);
990 if (key_frame < strip_start || key_frame > strip_end) {
993 if (key_frame > rectf.
xmax || key_frame < rectf.
xmin) {
1027 if (and_keys.
size() > 0) {
1029 for (
auto *key : and_keys) {
1046 for (
Strip *strip : strips) {
1063 for (
Strip *strip : strips) {
#define SEL_OP_USE_PRE_DESELECT(sel_op)
ValueIterator values() const &
ItemIterator items() const &
bool contains(const Key &key) const
int64_t remove_if(Predicate &&predicate)
void append(const T &value)
void append_non_duplicates(const T &value)
float distance(float, float) RET
ccl_device_inline dual3 fabs(const ccl_private dual3 &a)
VectorSet< Strip * > selected_strips_from_context(bContext *C)
void SEQUENCER_OT_retiming_transition_add(wmOperatorType *ot)
static bool select_connected_keys(const Scene *scene, const SeqRetimingKey *source, const Strip *source_owner)
bool retiming_overlay_enabled(const SpaceSeq *sseq)
static bool freeze_frame_add_from_strip_selection(bContext *C, const wmOperator *op, const int duration)
static wmOperatorStatus sequencer_retiming_transition_add_exec(bContext *C, wmOperator *op)
static bool freeze_frame_add_from_retiming_selection(const bContext *C, const wmOperator *op, const int duration)
static bool retiming_fake_key_frame_clicked(const Scene *scene, const View2D *v2d, const Strip *strip, const int mval[2], int &r_frame)
static wmOperatorStatus sequencer_retiming_key_delete_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void SEQUENCER_OT_retiming_reset(wmOperatorType *ot)
void SEQUENCER_OT_retiming_segment_speed_set(wmOperatorType *ot)
static bool select_key(const Editing *ed, SeqRetimingKey *key, const bool toggle, const bool deselect_all)
bool is_mouse_over_retiming_keys_box(const Scene *scene, const Strip *strip, const View2D *v2d, const SpaceSeq *sseq, int mouse_co_region[2])
static bool transition_add_new_for_strip(const bContext *C, const wmOperator *op, Strip *strip, const int frame, const int duration)
static wmOperatorStatus sequencer_retiming_segment_speed_set_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus sequencer_retiming_segment_speed_set_exec(bContext *C, wmOperator *op)
SeqRetimingKey * try_to_realize_fake_keys(const Scene *scene, const View2D *v2d, Strip *strip, const int mval[2])
static wmOperatorStatus sequencer_retiming_key_delete_exec(bContext *C, wmOperator *)
static void segment_speed_set(Scene *scene, Map< SeqRetimingKey *, Strip * > selection, const float speed)
bool sequencer_editing_initialized_and_active(bContext *C)
static bool freeze_frame_add_new_for_strip(const bContext *C, const wmOperator *op, Strip *strip, const int frame, const int duration)
static wmOperatorStatus sequencer_retiming_freeze_frame_add_exec(bContext *C, wmOperator *op)
wmOperatorStatus sequencer_retiming_box_select_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_retiming_key_delete(wmOperatorType *ot)
static wmOperatorStatus sequencer_retiming_key_add_exec(bContext *C, wmOperator *op)
static bool retiming_poll(bContext *C)
void sequencer_select_do_updates(const bContext *C, Scene *scene)
void SEQUENCER_OT_retiming_show(wmOperatorType *ot)
void SEQUENCER_OT_retiming_key_add(wmOperatorType *ot)
bool deselect_all_strips(const Scene *scene)
wmOperatorStatus sequencer_retiming_select_all_exec(bContext *C, wmOperator *op)
static void strip_speed_set(Scene *scene, Strip *strip, const float speed)
SeqRetimingKey * retiming_mouseover_key_get(const Scene *scene, const View2D *v2d, const int mval[2], Strip **r_strip)
static bool transition_add_from_retiming_selection(const bContext *C, const wmOperator *op, const int duration)
static float strip_speed_get(const Scene *scene)
rcti strip_retiming_keys_box_get(const Scene *scene, const View2D *v2d, const Strip *strip)
void SEQUENCER_OT_retiming_freeze_frame_add(wmOperatorType *ot)
static wmOperatorStatus retiming_key_add_from_selection(const Scene *scene, wmOperator *op, Span< Strip * > strips, const int frame)
VectorSet< Strip * > all_strips_from_context(bContext *C)
static wmOperatorStatus sequencer_retiming_reset_exec(bContext *C, wmOperator *)
Vector< Strip * > sequencer_visible_strips_get(const bContext *C)
static void realize_fake_keys_in_rect(const Scene *scene, Strip *strip, const rctf &rectf)
static float retiming_key_mouseover_threshold()
static void sequencer_retiming_select_linked_time(const Scene *scene, const bool extend, SeqRetimingKey *key, const Strip *key_owner)
static SeqRetimingKey * mouse_over_key_get_from_strip(const Scene *scene, const View2D *v2d, const Strip *strip, const int mval[2])
static wmOperatorStatus sequencer_retiming_data_show_exec(bContext *C, wmOperator *)
static wmOperatorStatus retiming_key_add_to_editable_strips(const Scene *scene, wmOperator *op, const int frame)
wmOperatorStatus sequencer_retiming_key_select_exec(bContext *C, wmOperator *op, SeqRetimingKey *key, const Strip *key_owner)
SeqRetimingKey * ensure_left_and_right_keys(const Scene *scene, Strip *strip)
SeqRetimingKey * retiming_key_add_new_for_strip(const Scene *scene, ReportList *reports, Strip *strip, const int frame)
SeqRetimingKey * retiming_add_transition(const Scene *scene, Strip *strip, SeqRetimingKey *key, float offset)
MutableSpan< SeqRetimingKey > retiming_keys_get(const Strip *strip)
void realize_fake_keys(const Scene *scene, Strip *strip)
bool retiming_key_is_transition_start(const SeqRetimingKey *key)
void retiming_reset(Scene *scene, Strip *strip)
bool retiming_selection_contains(const Editing *ed, const SeqRetimingKey *key)
VectorSet< Strip * > query_selected_strips(ListBaseT< Strip > *seqbase)
ListBaseT< Strip > * active_seqbase_get(const Editing *ed)
void transform_handle_overlap(Scene *scene, ListBaseT< Strip > *seqbasep, Span< Strip * > source_strips, bool use_sync_markers, Span< Strip * > time_dependent_strips)
SeqRetimingKey * retiming_add_key(const Scene *scene, Strip *strip, const int frame)
SeqRetimingKey * retiming_add_freeze_frame(const Scene *scene, Strip *strip, SeqRetimingKey *key, const int offset)
Editing * editing_get(const Scene *scene)
int retiming_key_frame_get(const Scene *scene, const Strip *strip, const SeqRetimingKey *key)
void relations_invalidate_cache_raw(Scene *scene, Strip *strip)
void retiming_selection_remove(SeqRetimingKey *key)
int right_fake_key_frame_get(const Scene *scene, const Strip *strip)
bool is_strip_connected(const Strip *strip)
void retiming_remove_multiple_keys(Strip *strip, Vector< SeqRetimingKey * > &keys_to_remove)
void retiming_selection_copy(SeqRetimingKey *dst, const SeqRetimingKey *src)
bool retiming_has_keys(const Strip *strip)
bool retiming_selection_clear(const Editing *ed)
float retiming_key_speed_get(const Strip *strip, const SeqRetimingKey *key)
void retiming_key_speed_set(const Scene *scene, Strip *strip, SeqRetimingKey *key, const float speed)
bool retiming_is_allowed(const Strip *strip)
bool retiming_show_keys(const Strip *strip)
int left_fake_key_frame_get(const Scene *scene, const Strip *strip)
SeqRetimingKey * retiming_key_get_by_frame(const Scene *scene, const Strip *strip, const int frame)
VectorSet< Strip * > connected_strips_get(const Strip *strip)
bool retiming_keys_are_selected(const Scene *scene)
Map< SeqRetimingKey *, Strip * > retiming_selection_get(const Editing *ed)
SeqRetimingKey * retiming_last_key_get(const Strip *strip)
void retiming_selection_append(SeqRetimingKey *key)
bool retiming_is_last_key(const Strip *strip, const SeqRetimingKey *key)
void view2d_region_to_view_rctf(const View2D *v2d, const rctf *rect_src, rctf *rect_dst) ATTR_NONNULL()
View2D * view2d_fromcontext(const bContext *C)
float view2d_view_to_region_x(const View2D *v2d, float x)
MINLINE float min_ff(float a, float b)
int RNA_enum_get(PointerRNA *ptr, const char *name)
Scene * CTX_data_sequencer_scene(const bContext *C)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
MINLINE int round_fl_to_int(float a)
int RNA_int_get(PointerRNA *ptr, const char *name)
MINLINE int max_ii(int a, int b)
void WM_operator_properties_border_to_rctf(wmOperator *op, rctf *r_rect)
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
float BKE_scene_frame_get(const Scene *scene)
void BKE_report(ReportList *reports, eReportType type, const char *message)
wmOperatorStatus WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2])
bool BLI_rcti_isect_pt(const struct rcti *rect, int x, int y)
MINLINE int min_ii(int a, int b)
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)
ARegion * CTX_wm_region(const bContext *C)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
ListBaseT< TimeMarker > markers
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports