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
334 SeqRetimingKey *freeze = seq::retiming_add_freeze_frame(scene, strip, key, duration);
335
336 if (freeze == nullptr) {
337 BKE_report(op->reports, RPT_WARNING, "Cannot create freeze frame");
338 return false;
339 }
340
341 deselect_all_strips(scene);
343
345
347 return true;
348}
349
351 const wmOperator *op,
352 const int duration)
353{
354 Scene *scene = CTX_data_scene(C);
356 strips.remove_if([&](Strip *strip) { return !seq::retiming_is_allowed(strip); });
357 const int timeline_frame = BKE_scene_frame_get(scene);
358 bool success = false;
359
360 for (Strip *strip : strips) {
361 success |= freeze_frame_add_new_for_strip(C, op, strip, timeline_frame, duration);
363 }
364 return success;
365}
366
368 const wmOperator *op,
369 const int duration)
370{
371 Scene *scene = CTX_data_scene(C);
372 bool success = false;
373
375
376 for (auto item : selection.items()) {
377 const int timeline_frame = seq::retiming_key_timeline_frame_get(scene, item.value, item.key);
378 success |= freeze_frame_add_new_for_strip(C, op, item.value, timeline_frame, duration);
379 seq::relations_invalidate_cache_raw(scene, item.value);
380 }
381 return success;
382}
383
385{
386 Scene *scene = CTX_data_scene(C);
387 bool success = false;
388
389 int duration = 1;
390
391 if (RNA_property_is_set(op->ptr, RNA_struct_find_property(op->ptr, "duration"))) {
392 duration = RNA_int_get(op->ptr, "duration");
393 }
394
396 success = freeze_frame_add_from_retiming_selection(C, op, duration);
397 }
398 else {
399 success = freeze_frame_add_from_strip_selection(C, op, duration);
400 }
401
403
404 return success ? OPERATOR_FINISHED : OPERATOR_PASS_THROUGH;
405}
406
408{
409 /* identifiers */
410 ot->name = "Add Freeze Frame";
411 ot->description = "Add freeze frame";
412 ot->idname = "SEQUENCER_OT_retiming_freeze_frame_add";
413
414 /* API callbacks. */
416 ot->poll = retiming_poll;
417
418 /* flags */
420
421 /* properties */
422 RNA_def_int(ot->srna,
423 "duration",
424 0,
425 0,
426 INT_MAX,
427 "Duration",
428 "Duration of freeze frame segment",
429 0,
430 INT_MAX);
431}
432
434
435/* -------------------------------------------------------------------- */
438
440 const wmOperator *op,
441 Strip *strip,
442 const int timeline_frame,
443 const int duration)
444{
445 Scene *scene = CTX_data_scene(C);
446
447 // ensure L+R key
449 SeqRetimingKey *key = seq::retiming_add_key(scene, strip, timeline_frame);
450
451 if (key == nullptr) {
452 key = seq::retiming_key_get_by_timeline_frame(scene, strip, timeline_frame);
453 }
454
455 if (seq::retiming_is_last_key(strip, key) || key->strip_frame_index == 0) {
456 BKE_report(op->reports, RPT_WARNING, "Cannot create transition from first or last key");
457 return false;
458 }
459
460 SeqRetimingKey *transition = seq::retiming_add_transition(scene, strip, key, duration);
461
462 if (transition == nullptr) {
463 BKE_report(op->reports, RPT_WARNING, "Cannot create transition");
464 return false;
465 }
466
467 deselect_all_strips(scene);
469
471
473 return true;
474}
475
477 const wmOperator *op,
478 const int duration)
479{
480 Scene *scene = CTX_data_scene(C);
481 bool success = false;
482
484
485 for (auto item : selection.items()) {
486 const int timeline_frame = seq::retiming_key_timeline_frame_get(scene, item.value, item.key);
487 success |= transition_add_new_for_strip(C, op, item.value, timeline_frame, duration);
488 }
489 return success;
490}
491
493{
494 Scene *scene = CTX_data_scene(C);
495 bool success = false;
496
497 int duration = 1;
498
499 if (RNA_property_is_set(op->ptr, RNA_struct_find_property(op->ptr, "duration"))) {
500 duration = RNA_int_get(op->ptr, "duration");
501 }
502
504 success = transition_add_from_retiming_selection(C, op, duration);
505 }
506 else {
507 BKE_report(op->reports, RPT_WARNING, "Retiming key must be selected");
508 return OPERATOR_CANCELLED;
509 }
510
512
513 return success ? OPERATOR_FINISHED : OPERATOR_PASS_THROUGH;
514}
515
517{
518 /* identifiers */
519 ot->name = "Add Speed Transition";
520 ot->description = "Add smooth transition between 2 retimed segments";
521 ot->idname = "SEQUENCER_OT_retiming_transition_add";
522
523 /* API callbacks. */
525 ot->poll = retiming_poll;
526
527 /* flags */
529
530 /* properties */
531 RNA_def_int(ot->srna,
532 "duration",
533 0,
534 0,
535 INT_MAX,
536 "Duration",
537 "Duration of freeze frame segment",
538 0,
539 INT_MAX);
540}
541
543
544/* -------------------------------------------------------------------- */
547
549{
550 Scene *scene = CTX_data_scene(C);
551
553 blender::Vector<Strip *> strips_to_handle;
554
555 if (!sequencer_retiming_mode_is_active(C) || selection.size() == 0) {
557 }
558
559 for (Strip *strip : selection.values()) {
560 strips_to_handle.append_non_duplicates(strip);
561 }
562
563 for (Strip *strip : strips_to_handle) {
565 for (auto item : selection.items()) {
566 if (item.value != strip) {
567 continue;
568 }
569 keys_to_delete.append(item.key);
570 }
571
572 seq::retiming_remove_multiple_keys(strip, keys_to_delete);
573 }
574
575 for (Strip *strip : strips_to_handle) {
577 }
578
580 return OPERATOR_FINISHED;
581}
582
584 wmOperator *op,
585 const wmEvent *event)
586{
587 Scene *scene = CTX_data_scene(C);
588 ListBase *markers = &scene->markers;
589
590 if (!BLI_listbase_is_empty(markers)) {
591 ARegion *region = CTX_wm_region(C);
592 if (region && (region->regiontype == RGN_TYPE_WINDOW)) {
593 /* Bounding box of 30 pixels is used for markers shortcuts,
594 * prevent conflict with markers shortcuts here. */
595 if (event->mval[1] <= 30) {
597 }
598 }
599 }
600
602}
603
605{
606
607 /* Identifiers. */
608 ot->name = "Delete Retiming Keys";
609 ot->idname = "SEQUENCER_OT_retiming_key_delete";
610 ot->description = "Delete selected retiming keys from the sequencer";
611
612 /* API callbacks. */
615 ot->poll = retiming_poll;
616
617 /* Flags. */
619}
620
622
623/* -------------------------------------------------------------------- */
626
627/* Return speed of existing segment or strip. Assume 1 element is selected. */
628static float strip_speed_get(bContext *C, const wmOperator * /*op*/)
629{
630 /* Strip mode. */
633 if (strips.size() == 1) {
634 Strip *strip = strips[0];
636 return seq::retiming_key_speed_get(strip, key);
637 }
638 }
639
640 Scene *scene = CTX_data_scene(C);
642 /* Retiming mode. */
643 if (selection.size() == 1) {
644 for (auto item : selection.items()) {
645 return seq::retiming_key_speed_get(item.value, item.key);
646 }
647 }
648
649 return 1.0f;
650}
651
653{
654 Scene *scene = CTX_data_scene(C);
656 strips.remove_if([&](Strip *strip) { return !seq::retiming_is_allowed(strip); });
657
658 for (Strip *strip : strips) {
660
661 if (key == nullptr) {
662 continue;
663 }
664 /* TODO: it would be nice to multiply speed with complex retiming by a factor. */
666 scene, strip, key, RNA_float_get(op->ptr, "speed") / 100.0f, false);
667
669 if (seq::transform_test_overlap(scene, seqbase, strip)) {
670 seq::transform_seqbase_shuffle(seqbase, strip, scene);
671 }
672
674 }
675
677 return OPERATOR_FINISHED;
678}
679
681 const wmOperator *op,
683{
684 Scene *scene = CTX_data_scene(C);
686
687 for (auto item : selection.items()) {
689 item.value,
690 item.key,
691 RNA_float_get(op->ptr, "speed") / 100.0f,
692 RNA_boolean_get(op->ptr, "keep_retiming"));
693
694 if (seq::transform_test_overlap(scene, seqbase, item.value)) {
695 seq::transform_seqbase_shuffle(seqbase, item.value, scene);
696 }
697
698 seq::relations_invalidate_cache_raw(scene, item.value);
699 }
700
702 return OPERATOR_FINISHED;
703}
704
706{
707 const Scene *scene = CTX_data_scene(C);
708
709 /* Strip mode. */
711 return strip_speed_set_exec(C, op);
712 }
713
715
716 /* Retiming mode. */
717 if (selection.size() > 0) {
718 return segment_speed_set_exec(C, op, selection);
719 }
720
721 BKE_report(op->reports, RPT_ERROR, "No keys or strips selected");
722 return OPERATOR_CANCELLED;
723}
724
726 wmOperator *op,
727 const wmEvent *event)
728{
729 if (!RNA_struct_property_is_set(op->ptr, "speed")) {
730 RNA_float_set(op->ptr, "speed", strip_speed_get(C, op) * 100.0f);
731 return WM_operator_props_popup(C, op, event);
732 }
733
735}
736
738{
739 /* identifiers */
740 ot->name = "Set Speed";
741 ot->description = "Set speed of retimed segment";
742 ot->idname = "SEQUENCER_OT_retiming_segment_speed_set";
743
744 /* API callbacks. */
747 ot->poll = retiming_poll;
748
749 /* flags */
751
752 /* properties */
753 RNA_def_float(ot->srna,
754 "speed",
755 100.0f,
756 0.001f,
757 FLT_MAX,
758 "Speed",
759 "New speed of retimed segment",
760 0.1f,
761 FLT_MAX);
762
763 RNA_def_boolean(ot->srna,
764 "keep_retiming",
765 true,
766 "Preserve Current Retiming",
767 "Keep speed of other segments unchanged, change strip length instead");
768}
769
771
772static bool select_key(const Editing *ed,
773 SeqRetimingKey *key,
774 const bool toggle,
775 const bool deselect_all)
776{
777 bool changed = false;
778
779 if (deselect_all) {
781 }
782
783 if (key == nullptr) {
784 return changed;
785 }
786
787 if (toggle && seq::retiming_selection_contains(ed, key)) {
789 }
790 else {
792 }
793
794 return true;
795}
796
797static bool select_connected_keys(const Scene *scene,
798 const SeqRetimingKey *source,
799 const Strip *source_owner)
800{
801 if (!seq::is_strip_connected(source_owner)) {
802 return false;
803 }
804
805 const int frame = seq::retiming_key_timeline_frame_get(scene, source_owner, source);
806 bool changed = false;
807 blender::VectorSet<Strip *> connections = seq::connected_strips_get(source_owner);
808 for (Strip *connection : connections) {
809 SeqRetimingKey *con_key = seq::retiming_key_get_by_timeline_frame(scene, connection, frame);
810
811 if (con_key) {
812 seq::retiming_selection_copy(con_key, source);
813 changed = true;
814 }
815 }
816 return changed;
817}
818
820 wmOperator *op,
821 SeqRetimingKey *key,
822 const Strip *key_owner)
823{
824 Scene *scene = CTX_data_scene(C);
825 Editing *ed = seq::editing_get(scene);
826
827 if (!RNA_boolean_get(op->ptr, "extend")) {
829 }
830 for (; key <= seq::retiming_last_key_get(key_owner); key++) {
831 select_key(ed, key, false, false);
832 select_connected_keys(scene, key, key_owner);
833 }
835 return OPERATOR_FINISHED;
836}
837
839 wmOperator *op,
840 SeqRetimingKey *key,
841 const Strip *key_owner)
842{
843 if (RNA_boolean_get(op->ptr, "linked_time")) {
844 return sequencer_retiming_select_linked_time(C, op, key, key_owner);
845 }
846
847 Scene *scene = CTX_data_scene(C);
848 Editing *ed = seq::editing_get(scene);
849
850 const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
851 const bool wait_to_deselect_others = RNA_boolean_get(op->ptr, "wait_to_deselect_others");
852 const bool toggle = RNA_boolean_get(op->ptr, "toggle");
853
854 /* Clicked on an unselected key. */
855 if (!seq::retiming_selection_contains(ed, key) && !toggle) {
856 select_key(ed, key, false, deselect_all);
857 select_connected_keys(scene, key, key_owner);
858 }
859
860 /* Clicked on a key that is already selected, waiting to click release. */
861 if (wait_to_deselect_others && !toggle) {
863 }
864
865 /* The key is already selected, but deselect other selected keys after click is released if no
866 * transform or toggle happened. */
867 bool changed = select_key(ed, key, toggle, deselect_all);
868 if (!toggle) {
869 changed |= select_connected_keys(scene, key, key_owner);
870 }
871
873 return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
874}
875
876static void realize_fake_keys_in_rect(bContext *C, Strip *strip, const rctf &rectf)
877{
878 const Scene *scene = CTX_data_scene(C);
879
880 const int content_start = seq::time_start_frame_get(strip);
881 const int left_key_frame = max_ii(content_start, seq::time_left_handle_frame_get(scene, strip));
882 const int content_end = seq::time_content_end_frame_get(scene, strip);
883 const int right_key_frame = min_ii(content_end, seq::time_right_handle_frame_get(scene, strip));
884
885 /* Realize "fake" keys. */
886 if (left_key_frame > rectf.xmin && left_key_frame < rectf.xmax) {
887 seq::retiming_add_key(scene, strip, left_key_frame);
888 }
889 if (right_key_frame > rectf.xmin && right_key_frame < rectf.xmax) {
890 seq::retiming_add_key(scene, strip, right_key_frame);
891 }
892}
893
895{
896 const Scene *scene = CTX_data_scene(C);
897 const View2D *v2d = UI_view2d_fromcontext(C);
898 Editing *ed = seq::editing_get(scene);
899
900 if (ed == nullptr) {
901 return OPERATOR_CANCELLED;
902 }
903
904 const eSelectOp sel_op = eSelectOp(RNA_enum_get(op->ptr, "mode"));
905 bool changed = false;
906
907 if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
909 }
910
911 rctf rectf;
913 UI_view2d_region_to_view_rctf(v2d, &rectf, &rectf);
914
916
917 for (Strip *strip : sequencer_visible_strips_get(C)) {
918 if (strip->channel < rectf.ymin || strip->channel > rectf.ymax) {
919 continue;
920 }
921 if (!seq::retiming_data_is_editable(strip)) {
922 continue;
923 }
924 realize_fake_keys_in_rect(C, strip, rectf);
925
926 for (SeqRetimingKey &key : seq::retiming_keys_get(strip)) {
927 const int key_frame = seq::retiming_key_timeline_frame_get(scene, strip, &key);
928 const int strip_start = seq::time_left_handle_frame_get(scene, strip);
929 const int strip_end = seq::time_right_handle_frame_get(scene, strip);
930 if (key_frame < strip_start || key_frame > strip_end) {
931 continue;
932 }
933 if (key_frame > rectf.xmax || key_frame < rectf.xmin) {
934 continue;
935 }
936
937 switch (sel_op) {
938 case SEL_OP_ADD:
939 case SEL_OP_SET: {
941 break;
942 }
943 case SEL_OP_SUB: {
945 break;
946 }
947 case SEL_OP_XOR: { /* Toggle */
950 }
951 else {
953 }
954 break;
955 case SEL_OP_AND: {
957 and_keys.add(&key);
958 }
959 break;
960 }
961 }
962 }
963 changed = true;
964 }
965 }
966
967 if (and_keys.size() > 0) {
969 for (auto *key : and_keys) {
971 }
972 }
973
974 return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
975}
976
978{
979 Scene *scene = CTX_data_scene(C);
980 int action = RNA_enum_get(op->ptr, "action");
981
983
984 if (action == SEL_TOGGLE) {
985 action = SEL_SELECT;
986 for (Strip *strip : strips) {
987 if (!seq::retiming_data_is_editable(strip)) {
988 continue;
989 }
990 for (SeqRetimingKey &key : seq::retiming_keys_get(strip)) {
991 if (key.flag & SEQ_KEY_SELECTED) {
992 action = SEL_DESELECT;
993 break;
994 }
995 }
996 }
997 }
998
999 if (action == SEL_DESELECT) {
1001 }
1002
1003 for (Strip *strip : strips) {
1004 if (!seq::retiming_data_is_editable(strip)) {
1005 continue;
1006 }
1007 for (SeqRetimingKey &key : seq::retiming_keys_get(strip)) {
1008 switch (action) {
1009 case SEL_SELECT:
1010 key.flag |= SEQ_KEY_SELECTED;
1011 break;
1012 case SEL_INVERT:
1013 if (key.flag & SEQ_KEY_SELECTED) {
1014 key.flag &= ~SEQ_KEY_SELECTED;
1015 }
1016 else {
1017 key.flag |= SEQ_KEY_SELECTED;
1018 }
1019 break;
1020 }
1021 }
1022 }
1023
1025 return OPERATOR_FINISHED;
1026}
1027
1028} // 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
#define SEL_OP_USE_PRE_DESELECT(sel_op)
@ SEL_SELECT
@ SEL_INVERT
@ SEL_DESELECT
@ SEL_TOGGLE
#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
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_REGISTER
Definition WM_types.hh:180
#define NC_SCENE
Definition WM_types.hh:375
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:4225
void WM_operator_properties_border_to_rctf(wmOperator *op, rctf *r_rect)
wmOperatorStatus WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *)