Blender V5.0
sequencer_retiming.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BLI_listbase.h"
10#include "BLI_map.hh"
11#include "BLI_math_base.h"
12#include "BLI_set.hh"
13
14#include "DNA_scene_types.h"
15
16#include "BKE_context.hh"
17#include "BKE_report.hh"
18#include "BKE_scene.hh"
19
20#include "ED_select_utils.hh"
21#include "ED_sequencer.hh"
22
23#include "SEQ_connect.hh"
24#include "SEQ_iterator.hh"
25#include "SEQ_relations.hh"
26#include "SEQ_retiming.hh"
27#include "SEQ_select.hh"
28#include "SEQ_sequencer.hh"
29#include "SEQ_time.hh"
30#include "SEQ_transform.hh"
31
32#include "WM_api.hh"
33
34#include "RNA_define.hh"
35
36#include "UI_view2d.hh"
37
38/* Own include. */
39#include "sequencer_intern.hh"
40
41namespace blender::ed::vse {
42
44{
46 if (!scene) {
47 return false;
48 }
49 Editing *ed = seq::editing_get(scene);
50 if (!ed) {
51 return false;
52 }
53
54 Map retiming_sel = seq::retiming_selection_get(ed);
55
57 return false;
58 }
59
60 bool any_strip_has_editable_retiming = false;
61 for (const Strip *strip : retiming_sel.values()) {
62 any_strip_has_editable_retiming |= seq::retiming_data_is_editable(strip);
63 }
64
65 return any_strip_has_editable_retiming;
66}
67
68/*-------------------------------------------------------------------- */
71
73{
74 LISTBASE_FOREACH (Strip *, strip, seqbase) {
75 if ((strip->flag & SELECT) == 0) {
76 continue;
77 }
78 if (!seq::retiming_is_allowed(strip)) {
79 continue;
80 }
81 strip->flag |= SEQ_SHOW_RETIMING;
82 }
83}
84
86{
87 LISTBASE_FOREACH (Strip *, strip, seqbase) {
88 if ((strip->flag & SELECT) == 0) {
89 continue;
90 }
91 if (!seq::retiming_is_allowed(strip)) {
92 continue;
93 }
94 strip->flag &= ~SEQ_SHOW_RETIMING;
95 }
96}
97
99{
100 LISTBASE_FOREACH (Strip *, strip, seqbase) {
101 strip->flag &= ~SEQ_SHOW_RETIMING;
102 }
103}
104
106{
108 Editing *ed = seq::editing_get(scene);
109 Strip *strip_act = seq::select_active_get(scene);
110
111 if (strip_act == nullptr) {
112 return OPERATOR_CANCELLED;
113 }
114
116 sequencer_retiming_data_hide_all(ed->current_strips());
117 }
118 else if (seq::retiming_data_is_editable(strip_act)) {
120 }
121 else {
123 }
124
126 return OPERATOR_FINISHED;
127}
128
130{
131 /* identifiers */
132 ot->name = "Retime Strips";
133 ot->description = "Show retiming keys in selected strips";
134 ot->idname = "SEQUENCER_OT_retiming_show";
135
136 /* API callbacks. */
139
140 /* flags */
142}
143
145
147{
149 if (!scene) {
150 return false;
151 }
152 Editing *ed = seq::editing_get(scene);
153 if (!ed) {
154 return false;
155 }
156 Strip *strip = ed->act_strip;
157 if (strip == nullptr) {
158 return false;
159 }
160 if (!seq::retiming_is_allowed(strip)) {
161 CTX_wm_operator_poll_msg_set(C, "This strip type cannot be retimed");
162 return false;
163 }
164 return true;
165}
166
167/*-------------------------------------------------------------------- */
170
172{
174 const Editing *ed = seq::editing_get(scene);
175
176 for (Strip *strip : seq::query_selected_strips(ed->current_strips())) {
177 seq::retiming_reset(scene, strip);
178 }
179
181 return OPERATOR_FINISHED;
182}
183
185{
186 /* identifiers */
187 ot->name = "Reset Retiming";
188 ot->description = "Reset strip retiming";
189 ot->idname = "SEQUENCER_OT_retiming_reset";
190
191 /* API callbacks. */
193 ot->poll = retiming_poll;
194
195 /* flags */
197}
198
200
202{
205 seq::retiming_add_key(scene, strip, left_fake_key_frame_get(C, strip));
206 return seq::retiming_add_key(scene, strip, right_fake_key_frame_get(C, strip));
207}
208
209/* -------------------------------------------------------------------- */
212
214 wmOperator *op,
215 Strip *strip,
216 const int timeline_frame)
217{
219 const float scene_fps = float(scene->r.frs_sec) / float(scene->r.frs_sec_base);
220 const float frame_index = (BKE_scene_frame_get(scene) - seq::time_start_frame_get(strip)) *
222 const SeqRetimingKey *key = seq::retiming_find_segment_start_key(strip, frame_index);
223
224 if (key != nullptr && seq::retiming_key_is_transition_start(key)) {
225 BKE_report(op->reports, RPT_WARNING, "Cannot create key inside of speed transition");
226 return false;
227 }
228
229 const float end_frame = strip->start + seq::time_strip_length_get(scene, strip);
230 if (strip->start > timeline_frame || end_frame < timeline_frame) {
231 return false;
232 }
233
235 seq::retiming_add_key(scene, strip, timeline_frame);
236 return true;
237}
238
240 wmOperator *op,
242 const int timeline_frame)
243{
244 bool inserted = false;
245
246 for (Strip *strip : strips) {
247 if (!seq::retiming_is_allowed(strip)) {
248 continue;
249 }
250 inserted |= retiming_key_add_new_for_strip(C, op, strip, timeline_frame);
251 }
252
253 return inserted ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
254}
255
257 wmOperator *op,
258 const int timeline_frame)
259{
261 Editing *ed = seq::editing_get(scene);
262 bool inserted = false;
263
265 if (selection.is_empty()) {
266 return OPERATOR_CANCELLED;
267 }
268
269 for (Strip *strip : selection.values()) {
270 inserted |= retiming_key_add_new_for_strip(C, op, strip, timeline_frame);
271 }
272
273 return inserted ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
274}
275
277{
279
280 float timeline_frame;
281 if (RNA_struct_property_is_set(op->ptr, "timeline_frame")) {
282 timeline_frame = RNA_int_get(op->ptr, "timeline_frame");
283 }
284 else {
285 timeline_frame = BKE_scene_frame_get(scene);
286 }
287
288 wmOperatorStatus ret_val;
290 if (!strips.is_empty()) {
291 ret_val = retiming_key_add_from_selection(C, op, strips, timeline_frame);
292 }
293 else {
294 ret_val = retiming_key_add_to_editable_strips(C, op, timeline_frame);
295 }
296
298 return ret_val;
299}
300
302{
303 /* identifiers */
304 ot->name = "Add Retiming Key";
305 ot->description = "Add retiming Key";
306 ot->idname = "SEQUENCER_OT_retiming_key_add";
307
308 /* API callbacks. */
310 ot->poll = retiming_poll;
311
312 /* flags */
314
315 RNA_def_int(ot->srna,
316 "timeline_frame",
317 0,
318 0,
319 INT_MAX,
320 "Timeline Frame",
321 "Frame where key will be added",
322 0,
323 INT_MAX);
324}
325
327
328/* -------------------------------------------------------------------- */
331
333 const wmOperator *op,
334 Strip *strip,
335 const int timeline_frame,
336 const int duration)
337{
340
341 // ensure L+R key
342 SeqRetimingKey *key = seq::retiming_add_key(scene, strip, timeline_frame);
343
344 if (key == nullptr) {
345 BKE_report(op->reports, RPT_WARNING, "Cannot create freeze frame");
346 return false;
347 }
348
350 BKE_report(op->reports, RPT_WARNING, "Cannot create key inside of speed transition");
351 return false;
352 }
353
355 SeqRetimingKey *freeze = seq::retiming_add_freeze_frame(scene, strip, key, duration);
356
357 if (freeze == nullptr) {
358 BKE_report(op->reports, RPT_WARNING, "Cannot create freeze frame");
359 return false;
360 }
361
362 deselect_all_strips(scene);
364
366
368 return true;
369}
370
372 const wmOperator *op,
373 const int duration)
374{
377 strips.remove_if([&](Strip *strip) { return !seq::retiming_is_allowed(strip); });
378 const int timeline_frame = BKE_scene_frame_get(scene);
379 bool success = false;
380
381 for (Strip *strip : strips) {
382 success |= freeze_frame_add_new_for_strip(C, op, strip, timeline_frame, duration);
384 }
385 return success;
386}
387
389 const wmOperator *op,
390 const int duration)
391{
393 bool success = false;
394
396
397 for (auto item : selection.items()) {
398 const int timeline_frame = seq::retiming_key_timeline_frame_get(scene, item.value, item.key);
399 success |= freeze_frame_add_new_for_strip(C, op, item.value, timeline_frame, duration);
400 seq::relations_invalidate_cache_raw(scene, item.value);
401 }
402 return success;
403}
404
406{
408 bool success = false;
409
410 int duration = 1;
411
412 if (RNA_property_is_set(op->ptr, RNA_struct_find_property(op->ptr, "duration"))) {
413 duration = RNA_int_get(op->ptr, "duration");
414 }
415
417 success = freeze_frame_add_from_retiming_selection(C, op, duration);
418 }
419 else {
420 success = freeze_frame_add_from_strip_selection(C, op, duration);
421 }
422
424
425 return success ? OPERATOR_FINISHED : OPERATOR_PASS_THROUGH;
426}
427
429{
430 /* identifiers */
431 ot->name = "Add Freeze Frame";
432 ot->description = "Add freeze frame";
433 ot->idname = "SEQUENCER_OT_retiming_freeze_frame_add";
434
435 /* API callbacks. */
437 ot->poll = retiming_poll;
438
439 /* flags */
441
442 /* properties */
443 RNA_def_int(ot->srna,
444 "duration",
445 0,
446 0,
447 INT_MAX,
448 "Duration",
449 "Duration of freeze frame segment",
450 0,
451 INT_MAX);
452}
453
455
456/* -------------------------------------------------------------------- */
459
461 const wmOperator *op,
462 Strip *strip,
463 const int timeline_frame,
464 const int duration)
465{
467
468 // ensure L+R key
470 SeqRetimingKey *key = seq::retiming_add_key(scene, strip, timeline_frame);
471
472 if (key == nullptr) {
473 key = seq::retiming_key_get_by_timeline_frame(scene, strip, timeline_frame);
474 }
475
476 if (seq::retiming_is_last_key(strip, key) || key->strip_frame_index == 0) {
477 BKE_report(op->reports, RPT_WARNING, "Cannot create transition from first or last key");
478 return false;
479 }
480
481 SeqRetimingKey *transition = seq::retiming_add_transition(scene, strip, key, duration);
482
483 if (transition == nullptr) {
484 BKE_report(op->reports, RPT_WARNING, "Cannot create transition");
485 return false;
486 }
487
488 deselect_all_strips(scene);
490
492
494 return true;
495}
496
498 const wmOperator *op,
499 const int duration)
500{
502 bool success = false;
503
505
506 for (auto item : selection.items()) {
507 const int timeline_frame = seq::retiming_key_timeline_frame_get(scene, item.value, item.key);
508 success |= transition_add_new_for_strip(C, op, item.value, timeline_frame, duration);
509 }
510 return success;
511}
512
514{
516 bool success = false;
517
518 int duration = 1;
519
520 if (RNA_property_is_set(op->ptr, RNA_struct_find_property(op->ptr, "duration"))) {
521 duration = RNA_int_get(op->ptr, "duration");
522 }
523
525 success = transition_add_from_retiming_selection(C, op, duration);
526 }
527 else {
528 BKE_report(op->reports, RPT_WARNING, "Retiming key must be selected");
529 return OPERATOR_CANCELLED;
530 }
531
533
534 return success ? OPERATOR_FINISHED : OPERATOR_PASS_THROUGH;
535}
536
538{
539 /* identifiers */
540 ot->name = "Add Speed Transition";
541 ot->description = "Add smooth transition between 2 retimed segments";
542 ot->idname = "SEQUENCER_OT_retiming_transition_add";
543
544 /* API callbacks. */
546 ot->poll = retiming_poll;
547
548 /* flags */
550
551 /* properties */
552 RNA_def_int(ot->srna,
553 "duration",
554 0,
555 0,
556 INT_MAX,
557 "Duration",
558 "Duration of freeze frame segment",
559 0,
560 INT_MAX);
561}
562
564
565/* -------------------------------------------------------------------- */
568
570{
572
574 blender::Vector<Strip *> strips_to_handle;
575
576 if (!sequencer_retiming_mode_is_active(C) || selection.size() == 0) {
578 }
579
580 for (Strip *strip : selection.values()) {
581 strips_to_handle.append_non_duplicates(strip);
582 }
583
584 for (Strip *strip : strips_to_handle) {
586 for (auto item : selection.items()) {
587 if (item.value != strip) {
588 continue;
589 }
590 keys_to_delete.append(item.key);
591 }
592
593 seq::retiming_remove_multiple_keys(strip, keys_to_delete);
594 }
595
596 for (Strip *strip : strips_to_handle) {
598 }
599
601 return OPERATOR_FINISHED;
602}
603
605 wmOperator *op,
606 const wmEvent *event)
607{
609 ListBase *markers = &scene->markers;
610
611 if (!BLI_listbase_is_empty(markers)) {
612 ARegion *region = CTX_wm_region(C);
613 if (region && (region->regiontype == RGN_TYPE_WINDOW)) {
614 /* Bounding box of 30 pixels is used for markers shortcuts,
615 * prevent conflict with markers shortcuts here. */
616 if (event->mval[1] <= 30) {
618 }
619 }
620 }
621
623}
624
626{
627
628 /* Identifiers. */
629 ot->name = "Delete Retiming Keys";
630 ot->idname = "SEQUENCER_OT_retiming_key_delete";
631 ot->description = "Delete selected retiming keys from the sequencer";
632
633 /* API callbacks. */
636 ot->poll = retiming_poll;
637
638 /* Flags. */
640}
641
643
644/* -------------------------------------------------------------------- */
647
648/* Return speed of existing segment or strip. Assume 1 element is selected. */
649static float strip_speed_get(bContext *C, const wmOperator * /*op*/)
650{
651 /* Strip mode. */
654 if (strips.size() == 1) {
655 Strip *strip = strips[0];
657 return seq::retiming_key_speed_get(strip, key);
658 }
659 }
660
663 /* Retiming mode. */
664 if (selection.size() == 1) {
665 for (auto item : selection.items()) {
666 return seq::retiming_key_speed_get(item.value, item.key);
667 }
668 }
669
670 return 1.0f;
671}
672
674{
677 strips.remove_if([&](Strip *strip) { return !seq::retiming_is_allowed(strip); });
678
679 for (Strip *strip : strips) {
681
682 if (key == nullptr) {
683 continue;
684 }
685
686 /* TODO: it would be nice to multiply speed with complex retiming by a factor. */
688 scene, strip, key, RNA_float_get(op->ptr, "speed") / 100.0f, false);
689
691 if (seq::transform_test_overlap(scene, seqbase, strip)) {
692 seq::transform_seqbase_shuffle(seqbase, strip, scene);
693 }
694
696 }
697
699 return OPERATOR_FINISHED;
700}
701
703 const wmOperator *op,
705{
708
709 for (auto item : selection.items()) {
711 item.value,
712 item.key,
713 RNA_float_get(op->ptr, "speed") / 100.0f,
714 RNA_boolean_get(op->ptr, "keep_retiming"));
715
716 if (seq::transform_test_overlap(scene, seqbase, item.value)) {
717 seq::transform_seqbase_shuffle(seqbase, item.value, scene);
718 }
719
720 seq::relations_invalidate_cache_raw(scene, item.value);
721 }
722
724 return OPERATOR_FINISHED;
725}
726
728{
729 const Scene *scene = CTX_data_sequencer_scene(C);
730
731 /* Strip mode. */
733 return strip_speed_set_exec(C, op);
734 }
735
737
738 /* Retiming mode. */
739 if (selection.size() > 0) {
740 return segment_speed_set_exec(C, op, selection);
741 }
742
743 BKE_report(op->reports, RPT_ERROR, "No keys or strips selected");
744 return OPERATOR_CANCELLED;
745}
746
748 wmOperator *op,
749 const wmEvent *event)
750{
751 if (!RNA_struct_property_is_set(op->ptr, "speed")) {
752 RNA_float_set(op->ptr, "speed", strip_speed_get(C, op) * 100.0f);
753 return WM_operator_props_popup(C, op, event);
754 }
755
757}
758
760{
761 /* identifiers */
762 ot->name = "Set Speed";
763 ot->description = "Set speed of retimed segment";
764 ot->idname = "SEQUENCER_OT_retiming_segment_speed_set";
765
766 /* API callbacks. */
769 ot->poll = retiming_poll;
770
771 /* flags */
773
774 /* properties */
775 RNA_def_float(ot->srna,
776 "speed",
777 100.0f,
778 0.001f,
779 FLT_MAX,
780 "Speed",
781 "New speed of retimed segment",
782 0.1f,
783 FLT_MAX);
784
785 RNA_def_boolean(ot->srna,
786 "keep_retiming",
787 true,
788 "Preserve Current Retiming",
789 "Keep speed of other segments unchanged, change strip length instead");
790}
791
793
794static bool select_key(const Editing *ed,
795 SeqRetimingKey *key,
796 const bool toggle,
797 const bool deselect_all)
798{
799 bool changed = false;
800
801 if (deselect_all) {
803 }
804
805 if (key == nullptr) {
806 return changed;
807 }
808
809 if (toggle && seq::retiming_selection_contains(ed, key)) {
811 }
812 else {
814 }
815
816 return true;
817}
818
819static bool select_connected_keys(const Scene *scene,
820 const SeqRetimingKey *source,
821 const Strip *source_owner)
822{
823 if (!seq::is_strip_connected(source_owner)) {
824 return false;
825 }
826
827 const int frame = seq::retiming_key_timeline_frame_get(scene, source_owner, source);
828 bool changed = false;
829 blender::VectorSet<Strip *> connections = seq::connected_strips_get(source_owner);
830 for (Strip *connection : connections) {
831 SeqRetimingKey *con_key = seq::retiming_key_get_by_timeline_frame(scene, connection, frame);
832
833 if (con_key) {
834 seq::retiming_selection_copy(con_key, source);
835 changed = true;
836 }
837 }
838 return changed;
839}
840
842 wmOperator *op,
843 SeqRetimingKey *key,
844 const Strip *key_owner)
845{
847 Editing *ed = seq::editing_get(scene);
848
849 if (!RNA_boolean_get(op->ptr, "extend")) {
851 }
852 for (; key <= seq::retiming_last_key_get(key_owner); key++) {
853 select_key(ed, key, false, false);
854 select_connected_keys(scene, key, key_owner);
855 }
857 return OPERATOR_FINISHED;
858}
859
861 wmOperator *op,
862 SeqRetimingKey *key,
863 const Strip *key_owner)
864{
865 if (RNA_boolean_get(op->ptr, "linked_time")) {
866 return sequencer_retiming_select_linked_time(C, op, key, key_owner);
867 }
868
870 Editing *ed = seq::editing_get(scene);
871
872 const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
873 const bool wait_to_deselect_others = RNA_boolean_get(op->ptr, "wait_to_deselect_others");
874 const bool toggle = RNA_boolean_get(op->ptr, "toggle");
875
876 /* Clicked on an unselected key. */
877 if (!seq::retiming_selection_contains(ed, key) && !toggle) {
878 select_key(ed, key, false, deselect_all);
879 select_connected_keys(scene, key, key_owner);
880 }
881
882 /* Clicked on a key that is already selected, waiting to click release. */
883 if (wait_to_deselect_others && !toggle) {
885 }
886
887 /* The key is already selected, but deselect other selected keys after click is released if no
888 * transform or toggle happened. */
889 bool changed = select_key(ed, key, toggle, deselect_all);
890 if (!toggle) {
891 changed |= select_connected_keys(scene, key, key_owner);
892 }
893
895 return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
896}
897
898static void realize_fake_keys_in_rect(bContext *C, Strip *strip, const rctf &rectf)
899{
900 const Scene *scene = CTX_data_sequencer_scene(C);
901
902 const int content_start = seq::time_start_frame_get(strip);
903 const int left_key_frame = max_ii(content_start, seq::time_left_handle_frame_get(scene, strip));
904 const int content_end = seq::time_content_end_frame_get(scene, strip);
905 const int right_key_frame = min_ii(content_end, seq::time_right_handle_frame_get(scene, strip));
906
907 /* Realize "fake" keys. */
908 if (left_key_frame > rectf.xmin && left_key_frame < rectf.xmax) {
909 seq::retiming_add_key(scene, strip, left_key_frame);
910 }
911 if (right_key_frame > rectf.xmin && right_key_frame < rectf.xmax) {
912 seq::retiming_add_key(scene, strip, right_key_frame);
913 }
914}
915
917{
918 const Scene *scene = CTX_data_sequencer_scene(C);
919 const View2D *v2d = UI_view2d_fromcontext(C);
920 Editing *ed = seq::editing_get(scene);
921
922 if (ed == nullptr) {
923 return OPERATOR_CANCELLED;
924 }
925
926 const eSelectOp sel_op = eSelectOp(RNA_enum_get(op->ptr, "mode"));
927 bool changed = false;
928
929 if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
931 }
932
933 rctf rectf;
935 UI_view2d_region_to_view_rctf(v2d, &rectf, &rectf);
936
938
939 for (Strip *strip : sequencer_visible_strips_get(C)) {
940 if (strip->channel < rectf.ymin || strip->channel > rectf.ymax) {
941 continue;
942 }
943 if (!seq::retiming_data_is_editable(strip)) {
944 continue;
945 }
946 realize_fake_keys_in_rect(C, strip, rectf);
947
948 for (SeqRetimingKey &key : seq::retiming_keys_get(strip)) {
949 const int key_frame = seq::retiming_key_timeline_frame_get(scene, strip, &key);
950 const int strip_start = seq::time_left_handle_frame_get(scene, strip);
951 const int strip_end = seq::time_right_handle_frame_get(scene, strip);
952 if (key_frame < strip_start || key_frame > strip_end) {
953 continue;
954 }
955 if (key_frame > rectf.xmax || key_frame < rectf.xmin) {
956 continue;
957 }
958
959 switch (sel_op) {
960 case SEL_OP_ADD:
961 case SEL_OP_SET: {
963 break;
964 }
965 case SEL_OP_SUB: {
967 break;
968 }
969 case SEL_OP_XOR: { /* Toggle */
972 }
973 else {
975 }
976 break;
977 case SEL_OP_AND: {
979 and_keys.add(&key);
980 }
981 break;
982 }
983 }
984 }
985 changed = true;
986 }
987 }
988
989 if (and_keys.size() > 0) {
991 for (auto *key : and_keys) {
993 }
994 }
995
996 return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
997}
998
1000{
1002 int action = RNA_enum_get(op->ptr, "action");
1003
1005
1006 if (action == SEL_TOGGLE) {
1007 action = SEL_SELECT;
1008 for (Strip *strip : strips) {
1009 if (!seq::retiming_data_is_editable(strip)) {
1010 continue;
1011 }
1012 for (SeqRetimingKey &key : seq::retiming_keys_get(strip)) {
1013 if (key.flag & SEQ_KEY_SELECTED) {
1014 action = SEL_DESELECT;
1015 break;
1016 }
1017 }
1018 }
1019 }
1020
1021 if (action == SEL_DESELECT) {
1023 }
1024
1025 for (Strip *strip : strips) {
1026 if (!seq::retiming_data_is_editable(strip)) {
1027 continue;
1028 }
1029 for (SeqRetimingKey &key : seq::retiming_keys_get(strip)) {
1030 switch (action) {
1031 case SEL_SELECT:
1032 key.flag |= SEQ_KEY_SELECTED;
1033 break;
1034 case SEL_INVERT:
1035 if (key.flag & SEQ_KEY_SELECTED) {
1036 key.flag &= ~SEQ_KEY_SELECTED;
1037 }
1038 else {
1039 key.flag |= SEQ_KEY_SELECTED;
1040 }
1041 break;
1042 }
1043 }
1044 }
1045
1047 return OPERATOR_FINISHED;
1048}
1049
1050} // namespace blender::ed::vse
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
ARegion * CTX_wm_region(const bContext *C)
Scene * CTX_data_sequencer_scene(const bContext *C)
@ RPT_ERROR
Definition BKE_report.hh:39
@ RPT_WARNING
Definition BKE_report.hh:38
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
float BKE_scene_frame_get(const Scene *scene)
Definition scene.cc:2384
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
@ RGN_TYPE_WINDOW
@ SEQ_KEY_SELECTED
@ SEQ_SHOW_RETIMING
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
eSelectOp
@ SEL_OP_ADD
@ SEL_OP_SUB
@ SEL_OP_SET
@ SEL_OP_AND
@ SEL_OP_XOR
@ SEL_SELECT
@ SEL_INVERT
@ SEL_DESELECT
@ SEL_TOGGLE
#define SEL_OP_USE_PRE_DESELECT(sel_op)
#define C
Definition RandGen.cpp:29
View2D * UI_view2d_fromcontext(const bContext *C)
Definition view2d.cc:1855
void UI_view2d_region_to_view_rctf(const View2D *v2d, const rctf *rect_src, rctf *rect_dst) ATTR_NONNULL()
Definition view2d.cc:1675
#define ND_SEQUENCER
Definition WM_types.hh:437
#define NC_SCENE
Definition WM_types.hh:378
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_REGISTER
Definition WM_types.hh:180
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
ValueIterator values() const &
Definition BLI_map.hh:884
int64_t size() const
Definition BLI_map.hh:976
bool is_empty() const
Definition BLI_map.hh:986
ItemIterator items() const &
Definition BLI_map.hh:902
int64_t size() const
Definition BLI_set.hh:587
bool add(const Key &key)
Definition BLI_set.hh:248
int64_t size() const
int64_t remove_if(Predicate &&predicate)
void append(const T &value)
void append_non_duplicates(const T &value)
nullptr float
#define SELECT
void SEQUENCER_OT_retiming_transition_add(wmOperatorType *ot)
static SeqRetimingKey * ensure_left_and_right_keys(const bContext *C, Strip *strip)
static bool select_connected_keys(const Scene *scene, const SeqRetimingKey *source, const Strip *source_owner)
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 wmOperatorStatus sequencer_retiming_key_delete_invoke(bContext *C, wmOperator *op, const wmEvent *event)
int right_fake_key_frame_get(const bContext *C, const Strip *strip)
void SEQUENCER_OT_retiming_reset(wmOperatorType *ot)
static float strip_speed_get(bContext *C, const wmOperator *)
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)
static wmOperatorStatus retiming_key_add_to_editable_strips(bContext *C, wmOperator *op, const int timeline_frame)
static bool freeze_frame_add_new_for_strip(const bContext *C, const wmOperator *op, Strip *strip, const int timeline_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)
static void sequencer_retiming_data_hide_all(ListBase *seqbase)
blender::VectorSet< Strip * > all_strips_from_context(bContext *C)
static wmOperatorStatus sequencer_retiming_key_delete_exec(bContext *C, wmOperator *)
blender::VectorSet< Strip * > selected_strips_from_context(bContext *C)
bool sequencer_editing_initialized_and_active(bContext *C)
static void realize_fake_keys_in_rect(bContext *C, Strip *strip, const rctf &rectf)
static wmOperatorStatus sequencer_retiming_freeze_frame_add_exec(bContext *C, wmOperator *op)
static void sequencer_retiming_data_show_selection(ListBase *seqbase)
wmOperatorStatus sequencer_retiming_box_select_exec(bContext *C, wmOperator *op)
static wmOperatorStatus strip_speed_set_exec(bContext *C, const wmOperator *op)
void SEQUENCER_OT_retiming_key_delete(wmOperatorType *ot)
static bool transition_add_new_for_strip(const bContext *C, const wmOperator *op, Strip *strip, const int timeline_frame, const int duration)
static void sequencer_retiming_data_hide_selection(ListBase *seqbase)
static wmOperatorStatus sequencer_retiming_key_add_exec(bContext *C, wmOperator *op)
static bool retiming_key_add_new_for_strip(bContext *C, wmOperator *op, Strip *strip, const int timeline_frame)
static bool retiming_poll(bContext *C)
void sequencer_select_do_updates(const bContext *C, Scene *scene)
static wmOperatorStatus retiming_key_add_from_selection(bContext *C, wmOperator *op, blender::Span< Strip * > strips, const int timeline_frame)
void SEQUENCER_OT_retiming_show(wmOperatorType *ot)
void SEQUENCER_OT_retiming_key_add(wmOperatorType *ot)
bool deselect_all_strips(const Scene *scene)
static wmOperatorStatus segment_speed_set_exec(const bContext *C, const wmOperator *op, blender::Map< SeqRetimingKey *, Strip * > selection)
wmOperatorStatus sequencer_retiming_select_all_exec(bContext *C, wmOperator *op)
int left_fake_key_frame_get(const bContext *C, const Strip *strip)
static bool transition_add_from_retiming_selection(const bContext *C, const wmOperator *op, const int duration)
void SEQUENCER_OT_retiming_freeze_frame_add(wmOperatorType *ot)
static wmOperatorStatus sequencer_retiming_reset_exec(bContext *C, wmOperator *)
blender::Vector< Strip * > sequencer_visible_strips_get(const bContext *C)
static wmOperatorStatus sequencer_retiming_data_show_exec(bContext *C, wmOperator *)
bool sequencer_retiming_mode_is_active(const bContext *C)
wmOperatorStatus sequencer_retiming_key_select_exec(bContext *C, wmOperator *op, SeqRetimingKey *key, const Strip *key_owner)
wmOperatorStatus sequencer_retiming_select_linked_time(bContext *C, wmOperator *op, SeqRetimingKey *key, const Strip *key_owner)
int time_right_handle_frame_get(const Scene *scene, const Strip *strip)
SeqRetimingKey * retiming_add_transition(const Scene *scene, Strip *strip, SeqRetimingKey *key, float offset)
void retiming_key_speed_set(const Scene *scene, Strip *strip, SeqRetimingKey *key, const float speed, bool keep_retiming)
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)
float time_content_end_frame_get(const Scene *scene, const Strip *strip)
VectorSet< Strip * > query_selected_strips(ListBase *seqbase)
Definition iterator.cc:152
blender::Map< SeqRetimingKey *, Strip * > retiming_selection_get(const Editing *ed)
float time_media_playback_rate_factor_get(const Strip *strip, const float scene_fps)
Definition strip_time.cc:41
SeqRetimingKey * retiming_add_freeze_frame(const Scene *scene, Strip *strip, SeqRetimingKey *key, const int offset)
int retiming_key_timeline_frame_get(const Scene *scene, const Strip *strip, const SeqRetimingKey *key)
bool transform_test_overlap(const Scene *scene, Strip *strip1, Strip *strip2)
Editing * editing_get(const Scene *scene)
Definition sequencer.cc:286
void retiming_remove_multiple_keys(Strip *strip, blender::Vector< SeqRetimingKey * > &keys_to_remove)
MutableSpan< SeqRetimingKey > retiming_keys_get(const Strip *strip)
void retiming_data_ensure(Strip *strip)
int time_left_handle_frame_get(const Scene *, const Strip *strip)
SeqRetimingKey * retiming_find_segment_start_key(const Strip *strip, float frame_index)
void relations_invalidate_cache_raw(Scene *scene, Strip *strip)
void retiming_selection_remove(SeqRetimingKey *key)
float time_start_frame_get(const Strip *strip)
SeqRetimingKey * retiming_key_get_by_timeline_frame(const Scene *scene, const Strip *strip, const int timeline_frame)
blender::VectorSet< Strip * > connected_strips_get(const Strip *strip)
int time_strip_length_get(const Scene *scene, const Strip *strip)
Strip * select_active_get(const Scene *scene)
bool is_strip_connected(const Strip *strip)
bool retiming_data_is_editable(const Strip *strip)
void retiming_selection_copy(SeqRetimingKey *dst, const SeqRetimingKey *src)
bool retiming_selection_clear(const Editing *ed)
float retiming_key_speed_get(const Strip *strip, const SeqRetimingKey *key)
bool retiming_is_allowed(const Strip *strip)
ListBase * active_seqbase_get(const Editing *ed)
Definition sequencer.cc:433
SeqRetimingKey * retiming_last_key_get(const Strip *strip)
void retiming_selection_append(SeqRetimingKey *key)
SeqRetimingKey * retiming_add_key(const Scene *scene, Strip *strip, const int timeline_frame)
bool retiming_is_last_key(const Strip *strip, const SeqRetimingKey *key)
bool transform_seqbase_shuffle(ListBase *seqbasep, Strip *test, Scene *evil_scene)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
int RNA_int_get(PointerRNA *ptr, const char *name)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_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)
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)
#define FLT_MAX
Definition stdcycles.h:14
struct RenderData r
ListBase markers
float xmax
float xmin
float ymax
float ymin
int mval[2]
Definition WM_types.hh:763
struct ReportList * reports
struct PointerRNA * ptr
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * ot
Definition wm_files.cc:4237
void WM_operator_properties_border_to_rctf(wmOperator *op, rctf *r_rect)
wmOperatorStatus WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *)