Blender V4.5
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 (ed == nullptr) {
47 return false;
48 }
50}
51
52/*-------------------------------------------------------------------- */
55
57{
58 LISTBASE_FOREACH (Strip *, strip, seqbase) {
59 if ((strip->flag & SELECT) == 0) {
60 continue;
61 }
62 if (!seq::retiming_is_allowed(strip)) {
63 continue;
64 }
65 strip->flag |= SEQ_SHOW_RETIMING;
66 }
67}
68
70{
71 LISTBASE_FOREACH (Strip *, strip, seqbase) {
72 if ((strip->flag & SELECT) == 0) {
73 continue;
74 }
75 if (!seq::retiming_is_allowed(strip)) {
76 continue;
77 }
78 strip->flag &= ~SEQ_SHOW_RETIMING;
79 }
80}
81
83{
84 LISTBASE_FOREACH (Strip *, strip, seqbase) {
85 strip->flag &= ~SEQ_SHOW_RETIMING;
86 }
87}
88
90{
91 Scene *scene = CTX_data_scene(C);
92 Editing *ed = seq::editing_get(scene);
93 Strip *strip_act = seq::select_active_get(scene);
94
95 if (strip_act == nullptr) {
96 return OPERATOR_CANCELLED;
97 }
98
101 }
102 else if (seq::retiming_data_is_editable(strip_act)) {
104 }
105 else {
107 }
108
110 return OPERATOR_FINISHED;
111}
112
114{
115 /* identifiers */
116 ot->name = "Retime Strips";
117 ot->description = "Show retiming keys in selected strips";
118 ot->idname = "SEQUENCER_OT_retiming_show";
119
120 /* API callbacks. */
123
124 /* flags */
126}
127
129
131{
133 if (ed == nullptr) {
134 return false;
135 }
136 Strip *strip = ed->act_strip;
137 if (strip == nullptr) {
138 return false;
139 }
140 if (!seq::retiming_is_allowed(strip)) {
141 CTX_wm_operator_poll_msg_set(C, "This strip type cannot be retimed");
142 return false;
143 }
144 return true;
145}
146
147/*-------------------------------------------------------------------- */
150
152{
153 Scene *scene = CTX_data_scene(C);
154 const Editing *ed = seq::editing_get(scene);
155
156 for (Strip *strip : seq::query_selected_strips(ed->seqbasep)) {
157 seq::retiming_reset(scene, strip);
158 }
159
161 return OPERATOR_FINISHED;
162}
163
165{
166 /* identifiers */
167 ot->name = "Reset Retiming";
168 ot->description = "Reset strip retiming";
169 ot->idname = "SEQUENCER_OT_retiming_reset";
170
171 /* API callbacks. */
173 ot->poll = retiming_poll;
174
175 /* flags */
177}
178
180
182{
183 Scene *scene = CTX_data_scene(C);
185 seq::retiming_add_key(scene, strip, left_fake_key_frame_get(C, strip));
186 return seq::retiming_add_key(scene, strip, right_fake_key_frame_get(C, strip));
187}
188
189/* -------------------------------------------------------------------- */
192
194 wmOperator *op,
195 Strip *strip,
196 const int timeline_frame)
197{
198 Scene *scene = CTX_data_scene(C);
199 const float scene_fps = float(scene->r.frs_sec) / float(scene->r.frs_sec_base);
200 const float frame_index = (BKE_scene_frame_get(scene) - seq::time_start_frame_get(strip)) *
202 const SeqRetimingKey *key = seq::retiming_find_segment_start_key(strip, frame_index);
203
204 if (key != nullptr && seq::retiming_key_is_transition_start(key)) {
205 BKE_report(op->reports, RPT_WARNING, "Cannot create key inside of speed transition");
206 return false;
207 }
208
209 const float end_frame = strip->start + seq::time_strip_length_get(scene, strip);
210 if (strip->start > timeline_frame || end_frame < timeline_frame) {
211 return false;
212 }
213
215 seq::retiming_add_key(scene, strip, timeline_frame);
216 return true;
217}
218
220 wmOperator *op,
222 const int timeline_frame)
223{
224 bool inserted = false;
225
226 for (Strip *strip : strips) {
227 if (!seq::retiming_is_allowed(strip)) {
228 continue;
229 }
230 inserted |= retiming_key_add_new_for_strip(C, op, strip, timeline_frame);
231 }
232
233 return inserted ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
234}
235
237 wmOperator *op,
238 const int timeline_frame)
239{
240 Scene *scene = CTX_data_scene(C);
241 Editing *ed = seq::editing_get(scene);
242 bool inserted = false;
243
245 if (selection.is_empty()) {
246 return OPERATOR_CANCELLED;
247 }
248
249 for (Strip *strip : selection.values()) {
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{
258 Scene *scene = CTX_data_scene(C);
259
260 float timeline_frame;
261 if (RNA_struct_property_is_set(op->ptr, "timeline_frame")) {
262 timeline_frame = RNA_int_get(op->ptr, "timeline_frame");
263 }
264 else {
265 timeline_frame = BKE_scene_frame_get(scene);
266 }
267
268 wmOperatorStatus ret_val;
270 if (!strips.is_empty()) {
271 ret_val = retiming_key_add_from_selection(C, op, strips, timeline_frame);
272 }
273 else {
274 ret_val = retiming_key_add_to_editable_strips(C, op, timeline_frame);
275 }
276
278 return ret_val;
279}
280
282{
283 /* identifiers */
284 ot->name = "Add Retiming Key";
285 ot->description = "Add retiming Key";
286 ot->idname = "SEQUENCER_OT_retiming_key_add";
287
288 /* API callbacks. */
290 ot->poll = retiming_poll;
291
292 /* flags */
294
295 RNA_def_int(ot->srna,
296 "timeline_frame",
297 0,
298 0,
299 INT_MAX,
300 "Timeline Frame",
301 "Frame where key will be added",
302 0,
303 INT_MAX);
304}
305
307
308/* -------------------------------------------------------------------- */
311
313 const wmOperator *op,
314 Strip *strip,
315 const int timeline_frame,
316 const int duration)
317{
318 Scene *scene = CTX_data_scene(C);
320
321 // ensure L+R key
322 SeqRetimingKey *key = seq::retiming_add_key(scene, strip, timeline_frame);
323
324 if (key == nullptr) {
325 BKE_report(op->reports, RPT_WARNING, "Cannot create freeze frame");
326 return false;
327 }
328
330 BKE_report(op->reports, RPT_WARNING, "Cannot create key inside of speed transition");
331 return false;
332 }
333
335 SeqRetimingKey *freeze = seq::retiming_add_freeze_frame(scene, strip, key, duration);
336
337 if (freeze == nullptr) {
338 BKE_report(op->reports, RPT_WARNING, "Cannot create freeze frame");
339 return false;
340 }
341
342 deselect_all_strips(scene);
344
346
348 return true;
349}
350
352 const wmOperator *op,
353 const int duration)
354{
355 Scene *scene = CTX_data_scene(C);
357 strips.remove_if([&](Strip *strip) { return !seq::retiming_is_allowed(strip); });
358 const int timeline_frame = BKE_scene_frame_get(scene);
359 bool success = false;
360
361 for (Strip *strip : strips) {
362 success |= freeze_frame_add_new_for_strip(C, op, strip, timeline_frame, duration);
364 }
365 return success;
366}
367
369 const wmOperator *op,
370 const int duration)
371{
372 Scene *scene = CTX_data_scene(C);
373 bool success = false;
374
376
377 for (auto item : selection.items()) {
378 const int timeline_frame = seq::retiming_key_timeline_frame_get(scene, item.value, item.key);
379 success |= freeze_frame_add_new_for_strip(C, op, item.value, timeline_frame, duration);
380 seq::relations_invalidate_cache_raw(scene, item.value);
381 }
382 return success;
383}
384
386{
387 Scene *scene = CTX_data_scene(C);
388 bool success = false;
389
390 int duration = 1;
391
392 if (RNA_property_is_set(op->ptr, RNA_struct_find_property(op->ptr, "duration"))) {
393 duration = RNA_int_get(op->ptr, "duration");
394 }
395
397 success = freeze_frame_add_from_retiming_selection(C, op, duration);
398 }
399 else {
400 success = freeze_frame_add_from_strip_selection(C, op, duration);
401 }
402
404
405 return success ? OPERATOR_FINISHED : OPERATOR_PASS_THROUGH;
406}
407
409{
410 /* identifiers */
411 ot->name = "Add Freeze Frame";
412 ot->description = "Add freeze frame";
413 ot->idname = "SEQUENCER_OT_retiming_freeze_frame_add";
414
415 /* API callbacks. */
417 ot->poll = retiming_poll;
418
419 /* flags */
421
422 /* properties */
423 RNA_def_int(ot->srna,
424 "duration",
425 0,
426 0,
427 INT_MAX,
428 "Duration",
429 "Duration of freeze frame segment",
430 0,
431 INT_MAX);
432}
433
435
436/* -------------------------------------------------------------------- */
439
441 const wmOperator *op,
442 Strip *strip,
443 const int timeline_frame,
444 const int duration)
445{
446 Scene *scene = CTX_data_scene(C);
447
448 // ensure L+R key
450 SeqRetimingKey *key = seq::retiming_add_key(scene, strip, timeline_frame);
451
452 if (key == nullptr) {
453 key = seq::retiming_key_get_by_timeline_frame(scene, strip, timeline_frame);
454 }
455
456 if (seq::retiming_is_last_key(strip, key) || key->strip_frame_index == 0) {
457 BKE_report(op->reports, RPT_WARNING, "Cannot create transition from first or last key");
458 return false;
459 }
460
461 SeqRetimingKey *transition = seq::retiming_add_transition(scene, strip, key, duration);
462
463 if (transition == nullptr) {
464 BKE_report(op->reports, RPT_WARNING, "Cannot create transition");
465 return false;
466 }
467
468 deselect_all_strips(scene);
470
472
474 return true;
475}
476
478 const wmOperator *op,
479 const int duration)
480{
481 Scene *scene = CTX_data_scene(C);
482 bool success = false;
483
485
486 for (auto item : selection.items()) {
487 const int timeline_frame = seq::retiming_key_timeline_frame_get(scene, item.value, item.key);
488 success |= transition_add_new_for_strip(C, op, item.value, timeline_frame, duration);
489 }
490 return success;
491}
492
494{
495 Scene *scene = CTX_data_scene(C);
496 bool success = false;
497
498 int duration = 1;
499
500 if (RNA_property_is_set(op->ptr, RNA_struct_find_property(op->ptr, "duration"))) {
501 duration = RNA_int_get(op->ptr, "duration");
502 }
503
505 success = transition_add_from_retiming_selection(C, op, duration);
506 }
507 else {
508 BKE_report(op->reports, RPT_WARNING, "Retiming key must be selected");
509 return OPERATOR_CANCELLED;
510 }
511
513
514 return success ? OPERATOR_FINISHED : OPERATOR_PASS_THROUGH;
515}
516
518{
519 /* identifiers */
520 ot->name = "Add Speed Transition";
521 ot->description = "Add smooth transition between 2 retimed segments";
522 ot->idname = "SEQUENCER_OT_retiming_transition_add";
523
524 /* API callbacks. */
526 ot->poll = retiming_poll;
527
528 /* flags */
530
531 /* properties */
532 RNA_def_int(ot->srna,
533 "duration",
534 0,
535 0,
536 INT_MAX,
537 "Duration",
538 "Duration of freeze frame segment",
539 0,
540 INT_MAX);
541}
542
544
545/* -------------------------------------------------------------------- */
548
550{
551 Scene *scene = CTX_data_scene(C);
552
554 blender::Vector<Strip *> strips_to_handle;
555
556 if (!sequencer_retiming_mode_is_active(C) || selection.size() == 0) {
558 }
559
560 for (Strip *strip : selection.values()) {
561 strips_to_handle.append_non_duplicates(strip);
562 }
563
564 for (Strip *strip : strips_to_handle) {
566 for (auto item : selection.items()) {
567 if (item.value != strip) {
568 continue;
569 }
570 keys_to_delete.append(item.key);
571 }
572
573 seq::retiming_remove_multiple_keys(strip, keys_to_delete);
574 }
575
576 for (Strip *strip : strips_to_handle) {
578 }
579
581 return OPERATOR_FINISHED;
582}
583
585 wmOperator *op,
586 const wmEvent *event)
587{
588 Scene *scene = CTX_data_scene(C);
589 ListBase *markers = &scene->markers;
590
591 if (!BLI_listbase_is_empty(markers)) {
592 ARegion *region = CTX_wm_region(C);
593 if (region && (region->regiontype == RGN_TYPE_WINDOW)) {
594 /* Bounding box of 30 pixels is used for markers shortcuts,
595 * prevent conflict with markers shortcuts here. */
596 if (event->mval[1] <= 30) {
598 }
599 }
600 }
601
603}
604
606{
607
608 /* Identifiers. */
609 ot->name = "Delete Retiming Keys";
610 ot->idname = "SEQUENCER_OT_retiming_key_delete";
611 ot->description = "Delete selected retiming keys from the sequencer";
612
613 /* API callbacks. */
616 ot->poll = retiming_poll;
617
618 /* Flags. */
620}
621
623
624/* -------------------------------------------------------------------- */
627
628/* Return speed of existing segment or strip. Assume 1 element is selected. */
629static float strip_speed_get(bContext *C, const wmOperator * /*op*/)
630{
631 /* Strip mode. */
634 if (strips.size() == 1) {
635 Strip *strip = strips[0];
637 return seq::retiming_key_speed_get(strip, key);
638 }
639 }
640
641 Scene *scene = CTX_data_scene(C);
643 /* Retiming mode. */
644 if (selection.size() == 1) {
645 for (auto item : selection.items()) {
646 return seq::retiming_key_speed_get(item.value, item.key);
647 }
648 }
649
650 return 1.0f;
651}
652
654{
655 Scene *scene = CTX_data_scene(C);
657 strips.remove_if([&](Strip *strip) { return !seq::retiming_is_allowed(strip); });
658
659 for (Strip *strip : strips) {
661
662 if (key == nullptr) {
663 continue;
664 }
665 /* TODO: it would be nice to multiply speed with complex retiming by a factor. */
667 scene, strip, key, RNA_float_get(op->ptr, "speed") / 100.0f, false);
668
670 if (seq::transform_test_overlap(scene, seqbase, strip)) {
671 seq::transform_seqbase_shuffle(seqbase, strip, scene);
672 }
673
675 }
676
678 return OPERATOR_FINISHED;
679}
680
682 const wmOperator *op,
684{
685 Scene *scene = CTX_data_scene(C);
687
688 for (auto item : selection.items()) {
690 item.value,
691 item.key,
692 RNA_float_get(op->ptr, "speed") / 100.0f,
693 RNA_boolean_get(op->ptr, "keep_retiming"));
694
695 if (seq::transform_test_overlap(scene, seqbase, item.value)) {
696 seq::transform_seqbase_shuffle(seqbase, item.value, scene);
697 }
698
699 seq::relations_invalidate_cache_raw(scene, item.value);
700 }
701
703 return OPERATOR_FINISHED;
704}
705
707{
708 const Scene *scene = CTX_data_scene(C);
709
710 /* Strip mode. */
712 return strip_speed_set_exec(C, op);
713 }
714
716
717 /* Retiming mode. */
718 if (selection.size() > 0) {
719 return segment_speed_set_exec(C, op, selection);
720 }
721
722 BKE_report(op->reports, RPT_ERROR, "No keys or strips selected");
723 return OPERATOR_CANCELLED;
724}
725
727 wmOperator *op,
728 const wmEvent *event)
729{
730 if (!RNA_struct_property_is_set(op->ptr, "speed")) {
731 RNA_float_set(op->ptr, "speed", strip_speed_get(C, op) * 100.0f);
732 return WM_operator_props_popup(C, op, event);
733 }
734
736}
737
739{
740 /* identifiers */
741 ot->name = "Set Speed";
742 ot->description = "Set speed of retimed segment";
743 ot->idname = "SEQUENCER_OT_retiming_segment_speed_set";
744
745 /* API callbacks. */
748 ot->poll = retiming_poll;
749
750 /* flags */
752
753 /* properties */
754 RNA_def_float(ot->srna,
755 "speed",
756 100.0f,
757 0.001f,
758 FLT_MAX,
759 "Speed",
760 "New speed of retimed segment",
761 0.1f,
762 FLT_MAX);
763
764 RNA_def_boolean(ot->srna,
765 "keep_retiming",
766 true,
767 "Preserve Current Retiming",
768 "Keep speed of other segments unchanged, change strip length instead");
769}
770
772
773static bool select_key(const Editing *ed,
774 SeqRetimingKey *key,
775 const bool toggle,
776 const bool deselect_all)
777{
778 bool changed = false;
779
780 if (deselect_all) {
782 }
783
784 if (key == nullptr) {
785 return changed;
786 }
787
788 if (toggle && seq::retiming_selection_contains(ed, key)) {
790 }
791 else {
793 }
794
795 return true;
796}
797
798static bool select_connected_keys(const Scene *scene,
799 const SeqRetimingKey *source,
800 const Strip *source_owner)
801{
802 if (!seq::is_strip_connected(source_owner)) {
803 return false;
804 }
805
806 const int frame = seq::retiming_key_timeline_frame_get(scene, source_owner, source);
807 bool changed = false;
808 blender::VectorSet<Strip *> connections = seq::connected_strips_get(source_owner);
809 for (Strip *connection : connections) {
810 SeqRetimingKey *con_key = seq::retiming_key_get_by_timeline_frame(scene, connection, frame);
811
812 if (con_key) {
813 seq::retiming_selection_copy(con_key, source);
814 changed = true;
815 }
816 }
817 return changed;
818}
819
821 wmOperator *op,
822 SeqRetimingKey *key,
823 const Strip *key_owner)
824{
825 Scene *scene = CTX_data_scene(C);
826 Editing *ed = seq::editing_get(scene);
827
828 if (!RNA_boolean_get(op->ptr, "extend")) {
830 }
831 for (; key <= seq::retiming_last_key_get(key_owner); key++) {
832 select_key(ed, key, false, false);
833 select_connected_keys(scene, key, key_owner);
834 }
836 return OPERATOR_FINISHED;
837}
838
840 wmOperator *op,
841 SeqRetimingKey *key,
842 const Strip *key_owner)
843{
844 if (RNA_boolean_get(op->ptr, "linked_time")) {
845 return sequencer_retiming_select_linked_time(C, op, key, key_owner);
846 }
847
848 Scene *scene = CTX_data_scene(C);
849 Editing *ed = seq::editing_get(scene);
850
851 const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
852 const bool wait_to_deselect_others = RNA_boolean_get(op->ptr, "wait_to_deselect_others");
853 const bool toggle = RNA_boolean_get(op->ptr, "toggle");
854
855 /* Clicked on an unselected key. */
856 if (!seq::retiming_selection_contains(ed, key) && !toggle) {
857 select_key(ed, key, false, deselect_all);
858 select_connected_keys(scene, key, key_owner);
859 }
860
861 /* Clicked on a key that is already selected, waiting to click release. */
862 if (wait_to_deselect_others && !toggle) {
864 }
865
866 /* The key is already selected, but deselect other selected keys after click is released if no
867 * transform or toggle happened. */
868 bool changed = select_key(ed, key, toggle, deselect_all);
869 if (!toggle) {
870 changed |= select_connected_keys(scene, key, key_owner);
871 }
872
874 return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
875}
876
877static void realize_fake_keys_in_rect(bContext *C, Strip *strip, const rctf &rectf)
878{
879 const Scene *scene = CTX_data_scene(C);
880
881 const int content_start = seq::time_start_frame_get(strip);
882 const int left_key_frame = max_ii(content_start, seq::time_left_handle_frame_get(scene, strip));
883 const int content_end = seq::time_content_end_frame_get(scene, strip);
884 const int right_key_frame = min_ii(content_end, seq::time_right_handle_frame_get(scene, strip));
885
886 /* Realize "fake" keys. */
887 if (left_key_frame > rectf.xmin && left_key_frame < rectf.xmax) {
888 seq::retiming_add_key(scene, strip, left_key_frame);
889 }
890 if (right_key_frame > rectf.xmin && right_key_frame < rectf.xmax) {
891 seq::retiming_add_key(scene, strip, right_key_frame);
892 }
893}
894
896{
897 const Scene *scene = CTX_data_scene(C);
898 const View2D *v2d = UI_view2d_fromcontext(C);
899 Editing *ed = seq::editing_get(scene);
900
901 if (ed == nullptr) {
902 return OPERATOR_CANCELLED;
903 }
904
905 const eSelectOp sel_op = eSelectOp(RNA_enum_get(op->ptr, "mode"));
906 bool changed = false;
907
908 if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
910 }
911
912 rctf rectf;
914 UI_view2d_region_to_view_rctf(v2d, &rectf, &rectf);
915
917
918 for (Strip *strip : sequencer_visible_strips_get(C)) {
919 if (strip->channel < rectf.ymin || strip->channel > rectf.ymax) {
920 continue;
921 }
922 if (!seq::retiming_data_is_editable(strip)) {
923 continue;
924 }
925 realize_fake_keys_in_rect(C, strip, rectf);
926
927 for (SeqRetimingKey &key : seq::retiming_keys_get(strip)) {
928 const int key_frame = seq::retiming_key_timeline_frame_get(scene, strip, &key);
929 const int strip_start = seq::time_left_handle_frame_get(scene, strip);
930 const int strip_end = seq::time_right_handle_frame_get(scene, strip);
931 if (key_frame < strip_start || key_frame > strip_end) {
932 continue;
933 }
934 if (key_frame > rectf.xmax || key_frame < rectf.xmin) {
935 continue;
936 }
937
938 switch (sel_op) {
939 case SEL_OP_ADD:
940 case SEL_OP_SET: {
942 break;
943 }
944 case SEL_OP_SUB: {
946 break;
947 }
948 case SEL_OP_XOR: { /* Toggle */
951 }
952 else {
954 }
955 break;
956 case SEL_OP_AND: {
958 and_keys.add(&key);
959 }
960 break;
961 }
962 }
963 }
964 changed = true;
965 }
966 }
967
968 if (and_keys.size() > 0) {
970 for (auto *key : and_keys) {
972 }
973 }
974
975 return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
976}
977
979{
980 Scene *scene = CTX_data_scene(C);
981 int action = RNA_enum_get(op->ptr, "action");
982
984
985 if (action == SEL_TOGGLE) {
986 action = SEL_SELECT;
987 for (Strip *strip : strips) {
988 if (!seq::retiming_data_is_editable(strip)) {
989 continue;
990 }
991 for (SeqRetimingKey &key : seq::retiming_keys_get(strip)) {
992 if (key.flag & SEQ_KEY_SELECTED) {
993 action = SEL_DESELECT;
994 break;
995 }
996 }
997 }
998 }
999
1000 if (action == SEL_DESELECT) {
1002 }
1003
1004 for (Strip *strip : strips) {
1005 if (!seq::retiming_data_is_editable(strip)) {
1006 continue;
1007 }
1008 for (SeqRetimingKey &key : seq::retiming_keys_get(strip)) {
1009 switch (action) {
1010 case SEL_SELECT:
1011 key.flag |= SEQ_KEY_SELECTED;
1012 break;
1013 case SEL_INVERT:
1014 if (key.flag & SEQ_KEY_SELECTED) {
1015 key.flag &= ~SEQ_KEY_SELECTED;
1016 }
1017 else {
1018 key.flag |= SEQ_KEY_SELECTED;
1019 }
1020 break;
1021 }
1022 }
1023 }
1024
1026 return OPERATOR_FINISHED;
1027}
1028
1029} // namespace blender::ed::vse
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
Scene * CTX_data_scene(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:126
float BKE_scene_frame_get(const Scene *scene)
Definition scene.cc:2381
#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:1854
void UI_view2d_region_to_view_rctf(const View2D *v2d, const rctf *rect_src, rctf *rect_dst) ATTR_NONNULL()
Definition view2d.cc:1674
#define ND_SEQUENCER
Definition WM_types.hh:434
#define NC_SCENE
Definition WM_types.hh:375
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_REGISTER
Definition WM_types.hh:180
int64_t size() const
Definition BLI_map.hh:976
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)
#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:127
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:272
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:420
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:760
struct ReportList * reports
struct PointerRNA * ptr
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * ot
Definition wm_files.cc:4226
void WM_operator_properties_border_to_rctf(wmOperator *op, rctf *r_rect)
wmOperatorStatus WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *)