Blender  V3.3
sequencer_edit.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
8 #include <math.h>
9 #include <stdlib.h>
10 #include <string.h>
11 
12 #include "MEM_guardedalloc.h"
13 
14 #include "BLI_blenlib.h"
15 #include "BLI_math.h"
16 #include "BLI_timecode.h"
17 #include "BLI_utildefines.h"
18 
19 #include "BLT_translation.h"
20 
21 #include "DNA_anim_types.h"
22 #include "DNA_scene_types.h"
23 #include "DNA_sound_types.h"
24 
25 #include "BKE_context.h"
26 #include "BKE_fcurve.h"
27 #include "BKE_global.h"
28 #include "BKE_lib_id.h"
29 #include "BKE_main.h"
30 #include "BKE_report.h"
31 #include "BKE_sound.h"
32 
33 #include "SEQ_add.h"
34 #include "SEQ_animation.h"
35 #include "SEQ_channels.h"
36 #include "SEQ_clipboard.h"
37 #include "SEQ_edit.h"
38 #include "SEQ_effects.h"
39 #include "SEQ_iterator.h"
40 #include "SEQ_prefetch.h"
41 #include "SEQ_relations.h"
42 #include "SEQ_render.h"
43 #include "SEQ_select.h"
44 #include "SEQ_sequencer.h"
45 #include "SEQ_time.h"
46 #include "SEQ_transform.h"
47 #include "SEQ_utils.h"
48 
49 #include "WM_api.h"
50 #include "WM_types.h"
51 
52 #include "RNA_define.h"
53 #include "RNA_enum_types.h"
54 #include "RNA_prototypes.h"
55 
56 /* For menu, popup, icons, etc. */
57 #include "ED_keyframing.h"
58 #include "ED_numinput.h"
59 #include "ED_outliner.h"
60 #include "ED_scene.h"
61 #include "ED_screen.h"
62 #include "ED_sequencer.h"
63 
64 #include "UI_interface.h"
65 #include "UI_resources.h"
66 #include "UI_view2d.h"
67 
68 #include "DEG_depsgraph.h"
69 #include "DEG_depsgraph_build.h"
70 
71 /* Own include. */
72 #include "sequencer_intern.h"
73 
74 /* -------------------------------------------------------------------- */
78 typedef struct TransSeq {
79  int start, machine;
82  /* int final_left, final_right; */ /* UNUSED */
83  int len;
86 
89 /* -------------------------------------------------------------------- */
94 {
96 }
97 
99 {
100  if (sseq && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
101  return (SEQ_active_mask_get(scene) != NULL);
102  }
103 
104  return false;
105 }
106 
108 {
109  SpaceSeq *sseq = CTX_wm_space_seq(C);
110 
111  if (sseq) {
114  }
115 
116  return false;
117 }
118 
120 {
121  return (sseq->mainb == SEQ_DRAW_IMG_IMBUF) &&
123 }
124 
126 {
128 }
129 
131 {
132  if (!BLI_str_startswith(fcurve->rna_path, "sequence_editor.sequences_all[\"")) {
133  return false;
134  }
135 
136  if (!BLI_str_endswith(fcurve->rna_path, "\"].color")) {
137  return false;
138  }
139 
140  return true;
141 }
142 
144  const struct Scene *scene)
145 {
146  if (sseq->draw_flag & SEQ_DRAW_BACKDROP) {
147  return true;
148  }
149 
150  if (!scene->adt) {
151  return false;
152  }
153  if (!scene->adt->action) {
154  return false;
155  }
156 
157  LISTBASE_FOREACH (FCurve *, fcurve, &scene->adt->action->curves) {
159  return true;
160  }
161  }
162 
163  return false;
164 }
165 
168 /* -------------------------------------------------------------------- */
173 {
174  return (SEQ_editing_get(CTX_data_scene(C)) != NULL);
175 }
176 
178 {
180 }
181 
182 #if 0 /* UNUSED */
183 bool sequencer_strip_poll(bContext *C)
184 {
185  Editing *ed;
186  return (((ed = SEQ_editing_get(CTX_data_scene(C))) != NULL) &&
187  (ed->act_seq != NULL));
188 }
189 #endif
190 
192 {
193  Editing *ed;
194  Sequence *seq;
195  return (((ed = SEQ_editing_get(CTX_data_scene(C))) != NULL) && ((seq = ed->act_seq) != NULL) &&
196  (SEQ_HAS_PATH(seq)));
197 }
198 
200 {
201  SpaceSeq *sseq = CTX_wm_space_seq(C);
202  if (sseq == NULL) {
203  return false;
204  }
206  return false;
207  }
209  (sseq->mainb == SEQ_DRAW_IMG_IMBUF))) {
210  return false;
211  }
212  ARegion *region = CTX_wm_region(C);
213  if (!(region && region->regiontype == RGN_TYPE_PREVIEW)) {
214  return false;
215  }
216 
217  return true;
218 }
219 
221 {
222  SpaceSeq *sseq = CTX_wm_space_seq(C);
223  if (sseq == NULL) {
224  return false;
225  }
227  return false;
228  }
229  if (!(ELEM(sseq->view, SEQ_VIEW_PREVIEW) && (sseq->mainb == SEQ_DRAW_IMG_IMBUF))) {
230  return false;
231  }
232  ARegion *region = CTX_wm_region(C);
233  if (!(region && region->regiontype == RGN_TYPE_PREVIEW)) {
234  return false;
235  }
236 
237  return true;
238 }
239 
241 {
242  SpaceSeq *sseq = CTX_wm_space_seq(C);
243  if (sseq == NULL) {
244  return false;
245  }
247  return false;
248  }
249  ARegion *region = CTX_wm_region(C);
250  if (!(region && region->regiontype == RGN_TYPE_WINDOW)) {
251  return false;
252  }
253  return true;
254 }
255 
258 /* -------------------------------------------------------------------- */
263 {
265  const bool do_all = RNA_boolean_get(op->ptr, "all");
266  const Editing *ed = SEQ_editing_get(scene);
267 
268  SEQ_edit_remove_gaps(scene, ed->seqbasep, scene->r.cfra, do_all);
269 
272 
273  return OPERATOR_FINISHED;
274 }
275 
277 {
278  /* Identifiers. */
279  ot->name = "Remove Gaps";
280  ot->idname = "SEQUENCER_OT_gap_remove";
281  ot->description =
282  "Remove gap at current frame to first strip at the right, independent of selection or "
283  "locked state of strips";
284 
285  /* Api callbacks. */
286  // ot->invoke = sequencer_snap_invoke;
289 
290  /* Flags. */
292 
293  RNA_def_boolean(ot->srna, "all", 0, "All Gaps", "Do all gaps to right of current frame");
294 }
295 
298 /* -------------------------------------------------------------------- */
303 {
305  const int frames = RNA_int_get(op->ptr, "frames");
306  const Editing *ed = SEQ_editing_get(scene);
308 
310 
311  return OPERATOR_FINISHED;
312 }
313 
315 {
316  /* Identifiers. */
317  ot->name = "Insert Gaps";
318  ot->idname = "SEQUENCER_OT_gap_insert";
319  ot->description =
320  "Insert gap at current frame to first strips at the right, independent of selection or "
321  "locked state of strips";
322 
323  /* Api callbacks. */
324  // ot->invoke = sequencer_snap_invoke;
327 
328  /* Flags. */
330 
332  "frames",
333  10,
334  0,
335  INT_MAX,
336  "Frames",
337  "Frames to insert after current strip",
338  0,
339  1000);
340 }
341 
344 /* -------------------------------------------------------------------- */
349 {
351 
354  Sequence *seq;
355  int snap_frame;
356 
357  snap_frame = RNA_int_get(op->ptr, "frame");
358 
359  /* Check meta-strips. */
360  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
361  if (seq->flag & SELECT && !SEQ_transform_is_locked(channels, seq) &&
363  if ((seq->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) == 0) {
364  SEQ_transform_translate_sequence(scene, seq, (snap_frame - seq->startofs) - seq->start);
365  }
366  else {
367  if (seq->flag & SEQ_LEFTSEL) {
368  SEQ_time_left_handle_frame_set(scene, seq, snap_frame);
369  }
370  else { /* SEQ_RIGHTSEL */
371  SEQ_time_right_handle_frame_set(scene, seq, snap_frame);
372  }
374  }
375  }
376  }
377 
378  /* Test for effects and overlap. */
379  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
380  if (seq->flag & SELECT && !SEQ_transform_is_locked(channels, seq)) {
381  seq->flag &= ~SEQ_OVERLAP;
382  if (SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) {
384  }
385  }
386  }
387 
388  /* Recalculate bounds of effect strips, offsetting the keyframes if not snapping any handle. */
389  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
390  if (seq->type & SEQ_TYPE_EFFECT) {
391  const bool either_handle_selected = (seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) != 0;
392 
393  if (seq->seq1 && (seq->seq1->flag & SELECT)) {
394  if (!either_handle_selected) {
396  scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq)));
397  }
398  }
399  else if (seq->seq2 && (seq->seq2->flag & SELECT)) {
400  if (!either_handle_selected) {
402  scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq)));
403  }
404  }
405  else if (seq->seq3 && (seq->seq3->flag & SELECT)) {
406  if (!either_handle_selected) {
408  scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq)));
409  }
410  }
411  }
412  }
413 
416 
417  return OPERATOR_FINISHED;
418 }
419 
420 static int sequencer_snap_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
421 {
423 
424  int snap_frame;
425 
426  snap_frame = scene->r.cfra;
427 
428  RNA_int_set(op->ptr, "frame", snap_frame);
429  return sequencer_snap_exec(C, op);
430 }
431 
433 {
434  /* Identifiers. */
435  ot->name = "Snap Strips to the Current Frame";
436  ot->idname = "SEQUENCER_OT_snap";
437  ot->description = "Frame where selected strips will be snapped";
438 
439  /* Api callbacks. */
443 
444  /* Flags. */
446 
448  "frame",
449  0,
450  INT_MIN,
451  INT_MAX,
452  "Frame",
453  "Frame where selected strips will be snapped",
454  INT_MIN,
455  INT_MAX);
456 }
457 
460 /* -------------------------------------------------------------------- */
464 typedef struct SlipData {
465  int init_mouse[2];
466  float init_mouseloc[2];
469  bool *trim;
470  int num_seq;
471  bool slow;
472  int slow_offset; /* Offset at the point where offset was turned on. */
475 
476 static void transseq_backup(TransSeq *ts, Sequence *seq)
477 {
479  ts->start = seq->start;
480  ts->machine = seq->machine;
481  ts->startofs = seq->startofs;
482  ts->endofs = seq->endofs;
483  ts->anim_startofs = seq->anim_startofs;
484  ts->anim_endofs = seq->anim_endofs;
485  ts->len = seq->len;
486 }
487 
488 static void transseq_restore(TransSeq *ts, Sequence *seq)
489 {
490  seq->start = ts->start;
491  seq->machine = ts->machine;
492  seq->startofs = ts->startofs;
493  seq->endofs = ts->endofs;
494  seq->anim_startofs = ts->anim_startofs;
495  seq->anim_endofs = ts->anim_endofs;
496  seq->len = ts->len;
497 }
498 
500  ListBase *seqbasep, Sequence **seq_array, bool *trim, int offset, bool do_trim)
501 {
502  Sequence *seq;
503  int num_items = 0;
504 
505  for (seq = seqbasep->first; seq; seq = seq->next) {
506  if (!do_trim || (!(seq->type & SEQ_TYPE_EFFECT) && (seq->flag & SELECT))) {
507  seq_array[offset + num_items] = seq;
508  trim[offset + num_items] = do_trim && ((seq->type & SEQ_TYPE_EFFECT) == 0);
509  num_items++;
510 
511  if (seq->type == SEQ_TYPE_META) {
512  /* Trim the sub-sequences. */
513  num_items += slip_add_sequences_recursive(
514  &seq->seqbase, seq_array, trim, num_items + offset, false);
515  }
516  }
517  }
518 
519  return num_items;
520 }
521 
522 static int slip_count_sequences_recursive(ListBase *seqbasep, bool first_level)
523 {
524  Sequence *seq;
525  int trimmed_sequences = 0;
526 
527  for (seq = seqbasep->first; seq; seq = seq->next) {
528  if (!first_level || (!(seq->type & SEQ_TYPE_EFFECT) && (seq->flag & SELECT))) {
529  trimmed_sequences++;
530 
531  if (seq->type == SEQ_TYPE_META) {
532  /* Trim the sub-sequences. */
533  trimmed_sequences += slip_count_sequences_recursive(&seq->seqbase, false);
534  }
535  }
536  }
537 
538  return trimmed_sequences;
539 }
540 
541 static int sequencer_slip_invoke(bContext *C, wmOperator *op, const wmEvent *event)
542 {
543  SlipData *data;
546  float mouseloc[2];
547  int num_seq;
549 
550  /* Recursively count the trimmed elements. */
551  num_seq = slip_count_sequences_recursive(ed->seqbasep, true);
552 
553  if (num_seq == 0) {
554  return OPERATOR_CANCELLED;
555  }
556 
557  data = op->customdata = MEM_mallocN(sizeof(SlipData), "trimdata");
558  data->ts = MEM_mallocN(num_seq * sizeof(TransSeq), "trimdata_transform");
559  data->seq_array = MEM_mallocN(num_seq * sizeof(Sequence *), "trimdata_sequences");
560  data->trim = MEM_mallocN(num_seq * sizeof(bool), "trimdata_trim");
561  data->num_seq = num_seq;
562 
563  initNumInput(&data->num_input);
564  data->num_input.idx_max = 0;
565  data->num_input.val_flag[0] |= NUM_NO_FRACTION;
566  data->num_input.unit_sys = USER_UNIT_NONE;
567  data->num_input.unit_type[0] = 0;
568 
569  slip_add_sequences_recursive(ed->seqbasep, data->seq_array, data->trim, 0, true);
570 
571  for (int i = 0; i < num_seq; i++) {
572  transseq_backup(data->ts + i, data->seq_array[i]);
573  }
574 
575  UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &mouseloc[0], &mouseloc[1]);
576 
577  copy_v2_v2_int(data->init_mouse, event->mval);
578  copy_v2_v2(data->init_mouseloc, mouseloc);
579 
580  data->slow = false;
581 
583 
584  /* Notify so we draw extensions immediately. */
586 
587  return OPERATOR_RUNNING_MODAL;
588 }
589 
591 {
592  for (int i = data->num_seq - 1; i >= 0; i--) {
593  Sequence *seq = data->seq_array[i];
594 
595  seq->start = data->ts[i].start + offset;
596  if (data->trim[i]) {
597  seq->startofs = data->ts[i].startofs - offset;
598  seq->endofs = data->ts[i].endofs + offset;
599  }
600  }
601 
602  for (int i = data->num_seq - 1; i >= 0; i--) {
603  Sequence *seq = data->seq_array[i];
605  }
606 }
607 
608 /* Make sure, that each strip contains at least 1 frame of content. */
610 {
611  for (int i = 0; i < data->num_seq; i++) {
612  if (data->trim[i]) {
613  Sequence *seq = data->seq_array[i];
614  int seq_content_start = data->ts[i].start + *offset;
615  int seq_content_end = seq_content_start + seq->len + seq->anim_startofs + seq->anim_endofs;
616  int diff = 0;
617 
618  if (seq_content_start >= SEQ_time_right_handle_frame_get(scene, seq)) {
619  diff = SEQ_time_right_handle_frame_get(scene, seq) - seq_content_start - 1;
620  }
621 
622  if (seq_content_end <= SEQ_time_left_handle_frame_get(scene, seq)) {
623  diff = SEQ_time_left_handle_frame_get(scene, seq) - seq_content_end + 1;
624  }
625  *offset += diff;
626  }
627  }
628 }
629 
631 {
634  int offset = RNA_int_get(op->ptr, "offset");
635 
636  /* Recursively count the trimmed elements. */
637  int num_seq = slip_count_sequences_recursive(ed->seqbasep, true);
638 
639  if (num_seq == 0) {
640  return OPERATOR_CANCELLED;
641  }
642 
643  SlipData *data = op->customdata = MEM_mallocN(sizeof(SlipData), "trimdata");
644  data->ts = MEM_mallocN(num_seq * sizeof(TransSeq), "trimdata_transform");
645  data->seq_array = MEM_mallocN(num_seq * sizeof(Sequence *), "trimdata_sequences");
646  data->trim = MEM_mallocN(num_seq * sizeof(bool), "trimdata_trim");
647  data->num_seq = num_seq;
648 
649  slip_add_sequences_recursive(ed->seqbasep, data->seq_array, data->trim, 0, true);
650 
651  for (int i = 0; i < num_seq; i++) {
652  transseq_backup(data->ts + i, data->seq_array[i]);
653  }
654 
657 
658  MEM_freeN(data->seq_array);
659  MEM_freeN(data->trim);
660  MEM_freeN(data->ts);
661  MEM_freeN(data);
662 
665  return OPERATOR_FINISHED;
666 }
667 
669 {
670  char msg[UI_MAX_DRAW_STR];
671 
672  if (area) {
673  if (hasNumInput(&data->num_input)) {
674  char num_str[NUM_STR_REP_LEN];
675  outputNumInput(&data->num_input, num_str, &scene->unit);
676  BLI_snprintf(msg, sizeof(msg), TIP_("Slip offset: %s"), num_str);
677  }
678  else {
679  BLI_snprintf(msg, sizeof(msg), TIP_("Slip offset: %d"), offset);
680  }
681  }
682 
684 }
685 
686 static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *event)
687 {
688  Main *bmain = CTX_data_main(C);
690  SlipData *data = (SlipData *)op->customdata;
692  const bool has_numInput = hasNumInput(&data->num_input);
693  bool handled = true;
694 
695  /* Modal numinput active, try to handle numeric inputs. */
696  if (event->val == KM_PRESS && has_numInput && handleNumInput(C, &data->num_input, event)) {
697  float offset_fl;
698  applyNumInput(&data->num_input, &offset_fl);
699  int offset = round_fl_to_int(offset_fl);
700 
703 
704  RNA_int_set(op->ptr, "offset", offset);
705 
708 
709  return OPERATOR_RUNNING_MODAL;
710  }
711 
712  switch (event->type) {
713  case MOUSEMOVE: {
714  if (!has_numInput) {
715  float mouseloc[2];
716  int offset;
717  int mouse_x;
719 
720  if (data->slow) {
721  mouse_x = event->mval[0] - data->slow_offset;
722  mouse_x *= 0.1f;
723  mouse_x += data->slow_offset;
724  }
725  else {
726  mouse_x = event->mval[0];
727  }
728 
729  /* Choose the side based on which side of the current frame the mouse is. */
730  UI_view2d_region_to_view(v2d, mouse_x, 0, &mouseloc[0], &mouseloc[1]);
731  offset = mouseloc[0] - data->init_mouseloc[0];
732 
735 
736  RNA_int_set(op->ptr, "offset", offset);
737 
740  }
741  break;
742  }
743 
744  case LEFTMOUSE:
745  case EVT_RETKEY:
746  case EVT_SPACEKEY: {
747  MEM_freeN(data->seq_array);
748  MEM_freeN(data->trim);
749  MEM_freeN(data->ts);
750  MEM_freeN(data);
751  op->customdata = NULL;
752  if (area) {
754  }
757  return OPERATOR_FINISHED;
758  }
759 
760  case EVT_ESCKEY:
761  case RIGHTMOUSE: {
762  for (int i = 0; i < data->num_seq; i++) {
763  transseq_restore(data->ts + i, data->seq_array[i]);
764  }
765 
766  for (int i = 0; i < data->num_seq; i++) {
767  Sequence *seq = data->seq_array[i];
768  SEQ_add_reload_new_file(bmain, scene, seq, false);
769  }
770 
771  MEM_freeN(data->seq_array);
772  MEM_freeN(data->ts);
773  MEM_freeN(data->trim);
774  MEM_freeN(data);
775  op->customdata = NULL;
776 
778 
779  if (area) {
781  }
782 
783  return OPERATOR_CANCELLED;
784  }
785 
786  case EVT_RIGHTSHIFTKEY:
787  case EVT_LEFTSHIFTKEY:
788  if (!has_numInput) {
789  if (event->val == KM_PRESS) {
790  data->slow = true;
791  data->slow_offset = event->mval[0];
792  }
793  else if (event->val == KM_RELEASE) {
794  data->slow = false;
795  }
796  }
797  break;
798 
799  default:
800  handled = false;
801  break;
802  }
803 
804  /* Modal numinput inactive, try to handle numeric inputs. */
805  if (!handled && event->val == KM_PRESS && handleNumInput(C, &data->num_input, event)) {
806  float offset_fl;
807  applyNumInput(&data->num_input, &offset_fl);
808  int offset = round_fl_to_int(offset_fl);
809 
812 
813  RNA_int_set(op->ptr, "offset", offset);
814 
817  }
818 
819  return OPERATOR_RUNNING_MODAL;
820 }
821 
823 {
824  /* Identifiers. */
825  ot->name = "Slip Strips";
826  ot->idname = "SEQUENCER_OT_slip";
827  ot->description = "Slip the contents of selected strips";
828 
829  /* Api callbacks. */
834 
835  /* Flags. */
837 
839  "offset",
840  0,
841  INT32_MIN,
842  INT32_MAX,
843  "Offset",
844  "Offset to the data of the strip",
845  INT32_MIN,
846  INT32_MAX);
847 }
848 
851 /* -------------------------------------------------------------------- */
856 {
860  Sequence *seq;
861  bool selected;
862 
863  selected = !RNA_boolean_get(op->ptr, "unselected");
864 
865  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
866  if (!SEQ_transform_is_locked(channels, seq)) {
867  if (selected) {
868  if (seq->flag & SELECT) {
869  seq->flag |= SEQ_MUTE;
871  }
872  }
873  else {
874  if ((seq->flag & SELECT) == 0) {
875  seq->flag |= SEQ_MUTE;
877  }
878  }
879  }
880  }
881 
884 
885  return OPERATOR_FINISHED;
886 }
887 
889 {
890  /* Identifiers. */
891  ot->name = "Mute Strips";
892  ot->idname = "SEQUENCER_OT_mute";
893  ot->description = "Mute (un)selected strips";
894 
895  /* Api callbacks. */
898 
899  /* Flags. */
901 
903  ot->srna, "unselected", 0, "Unselected", "Mute unselected rather than selected strips");
904 }
905 
908 /* -------------------------------------------------------------------- */
913 {
917  Sequence *seq;
918  bool selected;
919 
920  selected = !RNA_boolean_get(op->ptr, "unselected");
921 
922  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
923  if (!SEQ_transform_is_locked(channels, seq)) {
924  if (selected) {
925  if (seq->flag & SELECT) {
926  seq->flag &= ~SEQ_MUTE;
928  }
929  }
930  else {
931  if ((seq->flag & SELECT) == 0) {
932  seq->flag &= ~SEQ_MUTE;
934  }
935  }
936  }
937  }
938 
941 
942  return OPERATOR_FINISHED;
943 }
944 
946 {
947  /* Identifiers. */
948  ot->name = "Unmute Strips";
949  ot->idname = "SEQUENCER_OT_unmute";
950  ot->description = "Unmute (un)selected strips";
951 
952  /* Api callbacks. */
955 
956  /* Flags. */
958 
960  ot->srna, "unselected", 0, "Unselected", "Unmute unselected rather than selected strips");
961 }
962 
965 /* -------------------------------------------------------------------- */
970 {
973  Sequence *seq;
974 
975  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
976  if (seq->flag & SELECT) {
977  seq->flag |= SEQ_LOCK;
978  }
979  }
980 
982 
983  return OPERATOR_FINISHED;
984 }
985 
987 {
988  /* Identifiers. */
989  ot->name = "Lock Strips";
990  ot->idname = "SEQUENCER_OT_lock";
991  ot->description = "Lock strips so they can't be transformed";
992 
993  /* Api callbacks. */
996 
997  /* Flags. */
999 }
1000 
1003 /* -------------------------------------------------------------------- */
1008 {
1010  Editing *ed = SEQ_editing_get(scene);
1011  Sequence *seq;
1012 
1013  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
1014  if (seq->flag & SELECT) {
1015  seq->flag &= ~SEQ_LOCK;
1016  }
1017  }
1018 
1020 
1021  return OPERATOR_FINISHED;
1022 }
1023 
1025 {
1026  /* Identifiers. */
1027  ot->name = "Unlock Strips";
1028  ot->idname = "SEQUENCER_OT_unlock";
1029  ot->description = "Unlock strips so they can be transformed";
1030 
1031  /* Api callbacks. */
1034 
1035  /* Flags. */
1037 }
1038 
1041 /* -------------------------------------------------------------------- */
1046 {
1047  Main *bmain = CTX_data_main(C);
1049  Editing *ed = SEQ_editing_get(scene);
1050  Sequence *seq;
1051  const bool adjust_length = RNA_boolean_get(op->ptr, "adjust_length");
1052 
1053  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
1054  if (seq->flag & SELECT) {
1055  SEQ_add_reload_new_file(bmain, scene, seq, !adjust_length);
1056 
1057  if (adjust_length) {
1058  if (SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) {
1060  }
1061  }
1062  }
1063  }
1064 
1066 
1067  return OPERATOR_FINISHED;
1068 }
1069 
1071 {
1072  PropertyRNA *prop;
1073 
1074  /* Identifiers. */
1075  ot->name = "Reload Strips";
1076  ot->idname = "SEQUENCER_OT_reload";
1077  ot->description = "Reload strips in the sequencer";
1078 
1079  /* Api callbacks. */
1082 
1083  /* Flags. */
1084  ot->flag = OPTYPE_REGISTER; /* No undo, the data changed is stored outside 'main'. */
1085 
1086  prop = RNA_def_boolean(ot->srna,
1087  "adjust_length",
1088  0,
1089  "Adjust Length",
1090  "Adjust length of strips to their data length");
1092 }
1093 
1096 /* -------------------------------------------------------------------- */
1101 {
1102  if (G.is_rendering) {
1103  return 0;
1104  }
1105  return sequencer_edit_poll(C);
1106 }
1107 
1109 {
1111  Editing *ed = SEQ_editing_get(scene);
1112 
1113  SEQ_relations_free_imbuf(scene, &ed->seqbase, false);
1114 
1116 
1117  return OPERATOR_FINISHED;
1118 }
1119 
1121 {
1122  /* Identifiers. */
1123  ot->name = "Refresh Sequencer";
1124  ot->idname = "SEQUENCER_OT_refresh_all";
1125  ot->description = "Refresh the sequencer editor";
1126 
1127  /* Api callbacks. */
1130 }
1131 
1134 /* -------------------------------------------------------------------- */
1139  Sequence *activeseq,
1140  int type,
1141  Sequence **r_selseq1,
1142  Sequence **r_selseq2,
1143  Sequence **r_selseq3,
1144  const char **r_error_str)
1145 {
1146  Editing *ed = SEQ_editing_get(scene);
1147  Sequence *seq1 = NULL, *seq2 = NULL, *seq3 = NULL, *seq;
1148 
1149  *r_error_str = NULL;
1150 
1151  if (!activeseq) {
1152  seq2 = SEQ_select_active_get(scene);
1153  }
1154 
1155  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
1156  if (seq->flag & SELECT) {
1157  if (seq->type == SEQ_TYPE_SOUND_RAM && SEQ_effect_get_num_inputs(type) != 0) {
1158  *r_error_str = N_("Cannot apply effects to audio sequence strips");
1159  return 0;
1160  }
1161  if (!ELEM(seq, activeseq, seq2)) {
1162  if (seq2 == NULL) {
1163  seq2 = seq;
1164  }
1165  else if (seq1 == NULL) {
1166  seq1 = seq;
1167  }
1168  else if (seq3 == NULL) {
1169  seq3 = seq;
1170  }
1171  else {
1172  *r_error_str = N_("Cannot apply effect to more than 3 sequence strips");
1173  return 0;
1174  }
1175  }
1176  }
1177  }
1178 
1179  /* Make sequence selection a little bit more intuitive
1180  * for 3 strips: the last-strip should be seq3. */
1181  if (seq3 != NULL && seq2 != NULL) {
1182  Sequence *tmp = seq2;
1183  seq2 = seq3;
1184  seq3 = tmp;
1185  }
1186 
1187  switch (SEQ_effect_get_num_inputs(type)) {
1188  case 0:
1189  *r_selseq1 = *r_selseq2 = *r_selseq3 = NULL;
1190  return 1; /* Success. */
1191  case 1:
1192  if (seq2 == NULL) {
1193  *r_error_str = N_("At least one selected sequence strip is needed");
1194  return 0;
1195  }
1196  if (seq1 == NULL) {
1197  seq1 = seq2;
1198  }
1199  if (seq3 == NULL) {
1200  seq3 = seq2;
1201  }
1203  case 2:
1204  if (seq1 == NULL || seq2 == NULL) {
1205  *r_error_str = N_("2 selected sequence strips are needed");
1206  return 0;
1207  }
1208  if (seq3 == NULL) {
1209  seq3 = seq2;
1210  }
1211  break;
1212  }
1213 
1214  if (seq1 == NULL && seq2 == NULL && seq3 == NULL) {
1215  *r_error_str = N_("TODO: in what cases does this happen?");
1216  return 0;
1217  }
1218 
1219  *r_selseq1 = seq1;
1220  *r_selseq2 = seq2;
1221  *r_selseq3 = seq3;
1222 
1223  /* TODO(Richard): This function needs some refactoring, this is just quick hack for T73828. */
1224  if (SEQ_effect_get_num_inputs(type) < 3) {
1225  *r_selseq3 = NULL;
1226  }
1227  if (SEQ_effect_get_num_inputs(type) < 2) {
1228  *r_selseq2 = NULL;
1229  }
1230 
1231  return 1;
1232 }
1233 
1235 {
1237  Sequence *seq1, *seq2, *seq3, *last_seq = SEQ_select_active_get(scene);
1238  const char *error_msg;
1239 
1240  if (SEQ_effect_get_num_inputs(last_seq->type) == 0) {
1241  BKE_report(op->reports, RPT_ERROR, "Cannot reassign inputs: strip has no inputs");
1242  return OPERATOR_CANCELLED;
1243  }
1244 
1246  scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg) ||
1247  SEQ_effect_get_num_inputs(last_seq->type) == 0) {
1248  BKE_report(op->reports, RPT_ERROR, error_msg);
1249  return OPERATOR_CANCELLED;
1250  }
1251  /* Check if reassigning would create recursivity. */
1252  if (SEQ_relations_render_loop_check(seq1, last_seq) ||
1253  SEQ_relations_render_loop_check(seq2, last_seq) ||
1254  SEQ_relations_render_loop_check(seq3, last_seq)) {
1255  BKE_report(op->reports, RPT_ERROR, "Cannot reassign inputs: recursion detected");
1256  return OPERATOR_CANCELLED;
1257  }
1258 
1259  last_seq->seq1 = seq1;
1260  last_seq->seq2 = seq2;
1261  last_seq->seq3 = seq3;
1262 
1263  int old_start = last_seq->start;
1264 
1266  SEQ_offset_animdata(scene, last_seq, (last_seq->start - old_start));
1267 
1269 
1270  return OPERATOR_FINISHED;
1271 }
1272 
1274 {
1276  Editing *ed = SEQ_editing_get(scene);
1277 
1278  if (ed) {
1279  Sequence *last_seq = SEQ_select_active_get(scene);
1280  if (last_seq && (last_seq->type & SEQ_TYPE_EFFECT)) {
1281  return 1;
1282  }
1283  }
1284 
1285  return 0;
1286 }
1287 
1289 {
1290  /* Identifiers. */
1291  ot->name = "Reassign Inputs";
1292  ot->idname = "SEQUENCER_OT_reassign_inputs";
1293  ot->description = "Reassign the inputs for the effect strip";
1294 
1295  /* Api callbacks. */
1298 
1299  /* Flags. */
1301 }
1302 
1305 /* -------------------------------------------------------------------- */
1310 {
1312  Sequence *seq, *last_seq = SEQ_select_active_get(scene);
1313 
1314  if (last_seq->seq1 == NULL || last_seq->seq2 == NULL) {
1315  BKE_report(op->reports, RPT_ERROR, "No valid inputs to swap");
1316  return OPERATOR_CANCELLED;
1317  }
1318 
1319  seq = last_seq->seq1;
1320  last_seq->seq1 = last_seq->seq2;
1321  last_seq->seq2 = seq;
1322 
1324 
1326 
1327  return OPERATOR_FINISHED;
1328 }
1330 {
1331  /* Identifiers. */
1332  ot->name = "Swap Inputs";
1333  ot->idname = "SEQUENCER_OT_swap_inputs";
1334  ot->description = "Swap the first two inputs for the effect strip";
1335 
1336  /* Api callbacks. */
1339 
1340  /* Flags. */
1342 }
1343 
1346 /* -------------------------------------------------------------------- */
1350 static int mouse_frame_side(View2D *v2d, short mouse_x, int frame)
1351 {
1352  int mval[2];
1353  float mouseloc[2];
1354 
1355  mval[0] = mouse_x;
1356  mval[1] = 0;
1357 
1358  /* Choose the side based on which side of the current frame the mouse is on. */
1359  UI_view2d_region_to_view(v2d, mval[0], mval[1], &mouseloc[0], &mouseloc[1]);
1360 
1361  return mouseloc[0] > frame ? SEQ_SIDE_RIGHT : SEQ_SIDE_LEFT;
1362 }
1363 
1365  {SEQ_SPLIT_SOFT, "SOFT", 0, "Soft", ""},
1366  {SEQ_SPLIT_HARD, "HARD", 0, "Hard", ""},
1367  {0, NULL, 0, NULL, NULL},
1368 };
1369 
1371  {SEQ_SIDE_MOUSE, "MOUSE", 0, "Mouse Position", ""},
1372  {SEQ_SIDE_LEFT, "LEFT", 0, "Left", ""},
1373  {SEQ_SIDE_RIGHT, "RIGHT", 0, "Right", ""},
1374  {SEQ_SIDE_BOTH, "BOTH", 0, "Both", ""},
1375  {SEQ_SIDE_NO_CHANGE, "NO_CHANGE", 0, "No Change", ""},
1376  {0, NULL, 0, NULL, NULL},
1377 };
1378 
1380 {
1381  Main *bmain = CTX_data_main(C);
1383  Editing *ed = SEQ_editing_get(scene);
1384  bool changed = false;
1385  bool seq_selected = false;
1386 
1387  const int split_frame = RNA_int_get(op->ptr, "frame");
1388  const int split_channel = RNA_int_get(op->ptr, "channel");
1389  const bool use_cursor_position = RNA_boolean_get(op->ptr, "use_cursor_position");
1390  const eSeqSplitMethod method = RNA_enum_get(op->ptr, "type");
1391  const int split_side = RNA_enum_get(op->ptr, "side");
1392  const bool ignore_selection = RNA_boolean_get(op->ptr, "ignore_selection");
1393 
1395 
1396  LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
1397  seq->tmp = NULL;
1398  }
1399 
1401  if (use_cursor_position && seq->machine != split_channel) {
1402  continue;
1403  }
1404 
1405  if (ignore_selection || seq->flag & SELECT) {
1406  const char *error_msg = NULL;
1407  if (SEQ_edit_strip_split(bmain, scene, ed->seqbasep, seq, split_frame, method, &error_msg) !=
1408  NULL) {
1409  changed = true;
1410  }
1411  if (error_msg != NULL) {
1412  BKE_report(op->reports, RPT_ERROR, error_msg);
1413  }
1414  }
1415  }
1416 
1417  if (changed) { /* Got new strips? */
1418  if (ignore_selection) {
1419  if (use_cursor_position) {
1421  if (SEQ_time_right_handle_frame_get(scene, seq) == split_frame &&
1422  seq->machine == split_channel) {
1423  seq_selected = seq->flag & SEQ_ALLSEL;
1424  }
1425  }
1426  if (!seq_selected) {
1428  if (SEQ_time_left_handle_frame_get(scene, seq) == split_frame &&
1429  seq->machine == split_channel) {
1430  seq->flag &= ~SEQ_ALLSEL;
1431  }
1432  }
1433  }
1434  }
1435  }
1436  else {
1437  if (split_side != SEQ_SIDE_BOTH) {
1439  if (split_side == SEQ_SIDE_LEFT) {
1440  if (SEQ_time_left_handle_frame_get(scene, seq) >= split_frame) {
1441  seq->flag &= ~SEQ_ALLSEL;
1442  }
1443  }
1444  else {
1445  if (SEQ_time_right_handle_frame_get(scene, seq) <= split_frame) {
1446  seq->flag &= ~SEQ_ALLSEL;
1447  }
1448  }
1449  }
1450  }
1451  }
1452  }
1453  if (changed) {
1455  return OPERATOR_FINISHED;
1456  }
1457 
1458  /* Passthrough to selection if used as tool. */
1460 }
1461 
1462 static int sequencer_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1463 {
1465  View2D *v2d = UI_view2d_fromcontext(C);
1466 
1467  int split_side = RNA_enum_get(op->ptr, "side");
1468  int split_frame = scene->r.cfra;
1469 
1470  if (split_side == SEQ_SIDE_MOUSE) {
1471  if (ED_operator_sequencer_active(C) && v2d) {
1472  split_side = mouse_frame_side(v2d, event->mval[0], split_frame);
1473  }
1474  else {
1475  split_side = SEQ_SIDE_BOTH;
1476  }
1477  }
1478  float mouseloc[2];
1479  UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &mouseloc[0], &mouseloc[1]);
1480  if (RNA_boolean_get(op->ptr, "use_cursor_position")) {
1481  RNA_int_set(op->ptr, "frame", mouseloc[0]);
1482  }
1483  else {
1484  RNA_int_set(op->ptr, "frame", split_frame);
1485  }
1486  RNA_int_set(op->ptr, "channel", mouseloc[1]);
1487  RNA_enum_set(op->ptr, "side", split_side);
1488  // RNA_enum_set(op->ptr, "type", split_hard);
1489 
1490  return sequencer_split_exec(C, op);
1491 }
1492 
1494 {
1495  uiLayout *layout = op->layout;
1496  uiLayoutSetPropSep(layout, true);
1497  uiLayoutSetPropDecorate(layout, false);
1498 
1499  uiLayout *row = uiLayoutRow(layout, false);
1500  uiItemR(row, op->ptr, "type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
1501  uiItemR(layout, op->ptr, "frame", 0, NULL, ICON_NONE);
1502  uiItemR(layout, op->ptr, "side", 0, NULL, ICON_NONE);
1503 
1504  uiItemS(layout);
1505 
1506  uiItemR(layout, op->ptr, "use_cursor_position", 0, NULL, ICON_NONE);
1507  if (RNA_boolean_get(op->ptr, "use_cursor_position")) {
1508  uiItemR(layout, op->ptr, "channel", 0, NULL, ICON_NONE);
1509  }
1510 }
1511 
1513 {
1514  /* Identifiers. */
1515  ot->name = "Split Strips";
1516  ot->idname = "SEQUENCER_OT_split";
1517  ot->description = "Split the selected strips in two";
1518 
1519  /* Api callbacks. */
1524 
1525  /* Flags. */
1527 
1528  PropertyRNA *prop;
1529  RNA_def_int(ot->srna,
1530  "frame",
1531  0,
1532  INT_MIN,
1533  INT_MAX,
1534  "Frame",
1535  "Frame where selected strips will be split",
1536  INT_MIN,
1537  INT_MAX);
1538  RNA_def_int(ot->srna,
1539  "channel",
1540  0,
1541  INT_MIN,
1542  INT_MAX,
1543  "Channel",
1544  "Channel in which strip will be cut",
1545  INT_MIN,
1546  INT_MAX);
1547  RNA_def_enum(ot->srna,
1548  "type",
1551  "Type",
1552  "The type of split operation to perform on strips");
1553 
1555  "use_cursor_position",
1556  0,
1557  "Use Cursor Position",
1558  "Split at position of the cursor instead of current frame");
1559 
1560  prop = RNA_def_enum(ot->srna,
1561  "side",
1564  "Side",
1565  "The side that remains selected after splitting");
1566 
1568 
1569  prop = RNA_def_boolean(
1570  ot->srna,
1571  "ignore_selection",
1572  false,
1573  "Ignore Selection",
1574  "Make cut event if strip is not selected preserving selection state after cut");
1575 
1577 }
1578 
1581 /* -------------------------------------------------------------------- */
1586 {
1588  Editing *ed = SEQ_editing_get(scene);
1589 
1590  if (ed == NULL) {
1591  return OPERATOR_CANCELLED;
1592  }
1593 
1594  Sequence *active_seq = SEQ_select_active_get(scene);
1595  ListBase duplicated_strips = {NULL, NULL};
1596 
1597  SEQ_sequence_base_dupli_recursive(scene, scene, &duplicated_strips, ed->seqbasep, 0, 0);
1599 
1600  if (duplicated_strips.first == NULL) {
1601  return OPERATOR_CANCELLED;
1602  }
1603 
1604  /* Duplicate animation.
1605  * First backup original curves from scene and duplicate strip curves from backup into scene.
1606  * This way, when pasted strips are renamed, curves are renamed with them. Finally, restore
1607  * original curves from backup.
1608  */
1609  ListBase fcurves_original_backup = {NULL, NULL};
1610  SEQ_animation_backup_original(scene, &fcurves_original_backup);
1611 
1612  Sequence *seq = duplicated_strips.first;
1613 
1614  /* Rely on the nseqbase list being added at the end.
1615  * Their UUIDs has been re-generated by the SEQ_sequence_base_dupli_recursive(), */
1616  BLI_movelisttolist(ed->seqbasep, &duplicated_strips);
1617 
1618  /* Handle duplicated strips: set active, select, ensure unique name and duplicate animation
1619  * data. */
1620  for (; seq; seq = seq->next) {
1621  if (active_seq != NULL && STREQ(seq->name, active_seq->name)) {
1623  }
1624  seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL + SEQ_LOCK);
1625  seq->flag |= SEQ_IGNORE_CHANNEL_LOCK;
1626  SEQ_animation_duplicate(scene, seq, &fcurves_original_backup);
1628  }
1629 
1630  SEQ_animation_restore_original(scene, &fcurves_original_backup);
1631 
1633  return OPERATOR_FINISHED;
1634 }
1635 
1637 {
1638  /* Identifiers. */
1639  ot->name = "Duplicate Strips";
1640  ot->idname = "SEQUENCER_OT_duplicate";
1641  ot->description = "Duplicate the selected strips";
1642 
1643  /* Api callbacks. */
1646 
1647  /* Flags. */
1649 }
1650 
1653 /* -------------------------------------------------------------------- */
1658 {
1659  if (seq->type != SEQ_TYPE_SCENE) {
1660  return;
1661  }
1662 
1663  Main *bmain = CTX_data_main(C);
1664  if (seq->scene) {
1665  if (ED_scene_delete(C, bmain, seq->scene)) {
1667  }
1668  }
1669 }
1670 
1672 {
1673  Main *bmain = CTX_data_main(C);
1676  const bool delete_data = RNA_boolean_get(op->ptr, "delete_data");
1677 
1679  return OPERATOR_CANCELLED;
1680  }
1681 
1683 
1684  SeqCollection *selected_strips = selected_strips_from_context(C);
1685  Sequence *seq;
1686 
1687  SEQ_ITERATOR_FOREACH (seq, selected_strips) {
1688  SEQ_edit_flag_for_removal(scene, seqbasep, seq);
1689  if (delete_data) {
1691  }
1692  }
1694 
1695  SEQ_collection_free(selected_strips);
1696 
1698  DEG_relations_tag_update(bmain);
1700  return OPERATOR_FINISHED;
1701 }
1702 
1703 static int sequencer_delete_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1704 {
1705  ARegion *region = CTX_wm_region(C);
1708 
1710  /* Bounding box of 30 pixels is used for markers shortcuts,
1711  * prevent conflict with markers shortcuts here.
1712  */
1713  if (event->mval[1] <= 30) {
1714  return OPERATOR_PASS_THROUGH;
1715  }
1716  }
1717 
1718  return sequencer_delete_exec(C, op);
1719 }
1720 
1722 {
1723 
1724  /* Identifiers. */
1725  ot->name = "Erase Strips";
1726  ot->idname = "SEQUENCER_OT_delete";
1727  ot->description = "Erase selected strips from the sequencer";
1728 
1729  /* Api callbacks. */
1733 
1734  /* Flags. */
1736 
1737  /* Properties. */
1739  "delete_data",
1740  false,
1741  "Delete Data",
1742  "After removing the Strip, delete the associated data also");
1744 }
1745 
1748 /* -------------------------------------------------------------------- */
1753 {
1755  Editing *ed = SEQ_editing_get(scene);
1756  Sequence *seq;
1757 
1758  /* For effects, try to find a replacement input. */
1759  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
1760  if ((seq->type & SEQ_TYPE_EFFECT) == 0 && (seq->flag & SELECT)) {
1761  seq->startofs = seq->endofs = 0;
1762  }
1763  }
1764 
1765  /* Update lengths, etc. */
1766  seq = ed->seqbasep->first;
1767  while (seq) {
1769  seq = seq->next;
1770  }
1771 
1772  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
1773  if ((seq->type & SEQ_TYPE_EFFECT) == 0 && (seq->flag & SELECT)) {
1774  if (SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) {
1776  }
1777  }
1778  }
1779 
1781 
1782  return OPERATOR_FINISHED;
1783 }
1784 
1786 {
1787 
1788  /* Identifiers. */
1789  ot->name = "Clear Strip Offset";
1790  ot->idname = "SEQUENCER_OT_offset_clear";
1791  ot->description = "Clear strip offsets from the start and end frames";
1792 
1793  /* Api callbacks. */
1796 
1797  /* Flags. */
1799 }
1800 
1803 /* -------------------------------------------------------------------- */
1808 {
1810  Editing *ed = SEQ_editing_get(scene);
1811  ListBase *seqbase = SEQ_active_seqbase_get(ed);
1812 
1813  Sequence *seq, *seq_new;
1814  Strip *strip_new;
1815  StripElem *se, *se_new;
1816  int start_ofs, timeline_frame, frame_end;
1817  int step = RNA_int_get(op->ptr, "length");
1818 
1819  seq = seqbase->first; /* Poll checks this is valid. */
1820 
1822 
1823  while (seq) {
1824  if ((seq->flag & SELECT) && (seq->type == SEQ_TYPE_IMAGE) && (seq->len > 1)) {
1825  Sequence *seq_next;
1826 
1827  /* Remove seq so overlap tests don't conflict,
1828  * see seq_free_sequence below for the real freeing. */
1829  BLI_remlink(seqbase, seq);
1830  /* TODO: remove f-curve and assign to split image strips.
1831  * The old animation system would remove the user of `seq->ipo`. */
1832 
1833  start_ofs = timeline_frame = SEQ_time_left_handle_frame_get(scene, seq);
1834  frame_end = SEQ_time_right_handle_frame_get(scene, seq);
1835 
1836  while (timeline_frame < frame_end) {
1837  /* New seq. */
1838  se = SEQ_render_give_stripelem(scene, seq, timeline_frame);
1839 
1840  seq_new = SEQ_sequence_dupli_recursive(scene, scene, seqbase, seq, SEQ_DUPE_UNIQUE_NAME);
1841 
1842  seq_new->start = start_ofs;
1843  seq_new->type = SEQ_TYPE_IMAGE;
1844  seq_new->len = 1;
1845  seq_new->endofs = 1 - step;
1846 
1847  /* New strip. */
1848  strip_new = seq_new->strip;
1849  strip_new->us = 1;
1850 
1851  /* New stripdata, only one element now. */
1852  /* Note this assume all elements (images) have the same dimension,
1853  * since we only copy the name here. */
1854  se_new = MEM_reallocN(strip_new->stripdata, sizeof(*se_new));
1855  BLI_strncpy(se_new->name, se->name, sizeof(se_new->name));
1856  strip_new->stripdata = se_new;
1857 
1858  if (step > 1) {
1859  seq_new->flag &= ~SEQ_OVERLAP;
1860  if (SEQ_transform_test_overlap(scene, seqbase, seq_new)) {
1861  SEQ_transform_seqbase_shuffle(seqbase, seq_new, scene);
1862  }
1863  }
1864 
1865  /* XXX, COPY FCURVES */
1866 
1867  timeline_frame++;
1868  start_ofs += step;
1869  }
1870 
1871  seq_next = seq->next;
1872  SEQ_edit_flag_for_removal(scene, seqbase, seq);
1873  seq = seq_next;
1874  }
1875  else {
1876  seq = seq->next;
1877  }
1878  }
1879 
1882 
1883  return OPERATOR_FINISHED;
1884 }
1885 
1887 {
1888  /* Identifiers. */
1889  ot->name = "Separate Images";
1890  ot->idname = "SEQUENCER_OT_images_separate";
1891  ot->description = "On image sequence strips, it returns a strip for each image";
1892 
1893  /* Api callbacks. */
1897 
1898  /* Flags. */
1900 
1901  RNA_def_int(ot->srna, "length", 1, 1, INT_MAX, "Length", "Length of each frame", 1, 1000);
1902 }
1903 
1906 /* -------------------------------------------------------------------- */
1911 {
1913  Editing *ed = SEQ_editing_get(scene);
1914  Sequence *active_seq = SEQ_select_active_get(scene);
1915 
1917 
1918  if (active_seq && active_seq->type == SEQ_TYPE_META && active_seq->flag & SELECT) {
1919  /* Deselect active meta seq. */
1921  SEQ_meta_stack_set(scene, active_seq);
1922  }
1923  else {
1924  /* Exit meta-strip if possible. */
1925  if (BLI_listbase_is_empty(&ed->metastack)) {
1926  return OPERATOR_CANCELLED;
1927  }
1928 
1929  /* Display parent meta. */
1930  Sequence *meta_parent = SEQ_meta_stack_pop(ed);
1931  SEQ_select_active_set(scene, meta_parent);
1932  }
1933 
1934  // DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
1936 
1937  return OPERATOR_FINISHED;
1938 }
1939 
1941 {
1942  /* Identifiers. */
1943  ot->name = "Toggle Meta Strip";
1944  ot->idname = "SEQUENCER_OT_meta_toggle";
1945  ot->description = "Toggle a meta-strip (to edit enclosed strips)";
1946 
1947  /* Api callbacks. */
1950 
1951  /* Flags. */
1953 }
1954 
1957 /* -------------------------------------------------------------------- */
1962 {
1964  Editing *ed = SEQ_editing_get(scene);
1965  Sequence *active_seq = SEQ_select_active_get(scene);
1966  ListBase *active_seqbase = SEQ_active_seqbase_get(ed);
1967 
1968  if (SEQ_transform_seqbase_isolated_sel_check(active_seqbase) == false) {
1969  BKE_report(op->reports, RPT_ERROR, "Please select all related strips");
1970  return OPERATOR_CANCELLED;
1971  }
1972 
1974 
1975  int channel_max = 1, meta_start_frame = MAXFRAME, meta_end_frame = MINFRAME;
1976  Sequence *seqm = SEQ_sequence_alloc(active_seqbase, 1, 1, SEQ_TYPE_META);
1977 
1978  /* Remove all selected from main list, and put in meta.
1979  * Sequence is moved within the same edit, no need to re-generate the UUID. */
1980  LISTBASE_FOREACH_MUTABLE (Sequence *, seq, active_seqbase) {
1981  if (seq != seqm && seq->flag & SELECT) {
1982  BLI_remlink(active_seqbase, seq);
1983  BLI_addtail(&seqm->seqbase, seq);
1985  channel_max = max_ii(seq->machine, channel_max);
1986  meta_start_frame = min_ii(SEQ_time_left_handle_frame_get(scene, seq), meta_start_frame);
1987  meta_end_frame = max_ii(SEQ_time_right_handle_frame_get(scene, seq), meta_end_frame);
1988  }
1989  }
1990 
1991  seqm->machine = active_seq ? active_seq->machine : channel_max;
1992  strcpy(seqm->name + 2, "MetaStrip");
1994  seqm->start = meta_start_frame;
1995  seqm->len = meta_end_frame - meta_start_frame;
1997  if (SEQ_transform_test_overlap(scene, active_seqbase, seqm)) {
1998  SEQ_transform_seqbase_shuffle(active_seqbase, seqm, scene);
1999  }
2000 
2003 
2004  return OPERATOR_FINISHED;
2005 }
2006 
2008 {
2009  /* Identifiers. */
2010  ot->name = "Make Meta Strip";
2011  ot->idname = "SEQUENCER_OT_meta_make";
2012  ot->description = "Group selected strips into a meta-strip";
2013 
2014  /* Api callbacks. */
2017 
2018  /* Flags. */
2020 }
2021 
2024 /* -------------------------------------------------------------------- */
2029 {
2031  Editing *ed = SEQ_editing_get(scene);
2032  Sequence *active_seq = SEQ_select_active_get(scene);
2033 
2034  if (active_seq == NULL || active_seq->type != SEQ_TYPE_META) {
2035  return OPERATOR_CANCELLED;
2036  }
2037 
2039 
2040  LISTBASE_FOREACH (Sequence *, seq, &active_seq->seqbase) {
2042  }
2043 
2044  /* Remove all selected from meta, and put in main list.
2045  * Sequence is moved within the same edit, no need to re-generate the UUID. */
2046  BLI_movelisttolist(ed->seqbasep, &active_seq->seqbase);
2047  BLI_listbase_clear(&active_seq->seqbase);
2048 
2049  ListBase *active_seqbase = SEQ_active_seqbase_get(ed);
2050  SEQ_edit_flag_for_removal(scene, active_seqbase, active_seq);
2051  SEQ_edit_remove_flagged_sequences(scene, active_seqbase);
2052 
2053  /* Test for effects and overlap. */
2054  LISTBASE_FOREACH (Sequence *, seq, active_seqbase) {
2055  if (seq->flag & SELECT) {
2056  seq->flag &= ~SEQ_OVERLAP;
2057  if (SEQ_transform_test_overlap(scene, active_seqbase, seq)) {
2058  SEQ_transform_seqbase_shuffle(active_seqbase, seq, scene);
2059  }
2060  }
2061  }
2062 
2065 
2066  return OPERATOR_FINISHED;
2067 }
2068 
2070 {
2071  /* Identifiers. */
2072  ot->name = "UnMeta Strip";
2073  ot->idname = "SEQUENCER_OT_meta_separate";
2074  ot->description = "Put the contents of a meta-strip back in the sequencer";
2075 
2076  /* Api callbacks. */
2079 
2080  /* Flags. */
2082 }
2083 
2086 /* -------------------------------------------------------------------- */
2091  const short side,
2092  const bool do_skip_mute,
2093  const bool do_center)
2094 {
2095  bool changed = false;
2096  int timeline_frame = scene->r.cfra;
2097  int next_frame = SEQ_time_find_next_prev_edit(
2098  scene, timeline_frame, side, do_skip_mute, do_center, false);
2099 
2100  if (next_frame != timeline_frame) {
2101  scene->r.cfra = next_frame;
2102  changed = true;
2103  }
2104 
2105  return changed;
2106 }
2107 
2109 {
2110  /* Prevent changes during render. */
2111  if (G.is_rendering) {
2112  return 0;
2113  }
2114 
2115  return sequencer_edit_poll(C);
2116 }
2117 
2119 {
2121  const bool next = RNA_boolean_get(op->ptr, "next");
2122  const bool center = RNA_boolean_get(op->ptr, "center");
2123 
2124  /* Currently do_skip_mute is always true. */
2126  return OPERATOR_CANCELLED;
2127  }
2128 
2131 
2132  return OPERATOR_FINISHED;
2133 }
2134 
2136 {
2137  /* Identifiers. */
2138  ot->name = "Jump to Strip";
2139  ot->idname = "SEQUENCER_OT_strip_jump";
2140  ot->description = "Move frame to previous edit point";
2141 
2142  /* Api callbacks. */
2145 
2146  /* Flags. */
2147  ot->flag = OPTYPE_UNDO;
2148 
2149  /* Properties. */
2150  RNA_def_boolean(ot->srna, "next", true, "Next Strip", "");
2151  RNA_def_boolean(ot->srna, "center", true, "Use Strip Center", "");
2152 }
2153 
2156 /* -------------------------------------------------------------------- */
2161  {SEQ_SIDE_LEFT, "LEFT", 0, "Left", ""},
2162  {SEQ_SIDE_RIGHT, "RIGHT", 0, "Right", ""},
2163  {0, NULL, 0, NULL, NULL},
2164 };
2165 
2166 static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb)
2167 {
2168  int gap = SEQ_time_left_handle_frame_get(scene, seqb) -
2170  int seq_a_start;
2171  int seq_b_start;
2172 
2173  seq_b_start = (seqb->start - SEQ_time_left_handle_frame_get(scene, seqb)) +
2175  SEQ_transform_translate_sequence(scene, seqb, seq_b_start - seqb->start);
2177 
2178  seq_a_start = (seqa->start - SEQ_time_left_handle_frame_get(scene, seqa)) +
2180  SEQ_transform_translate_sequence(scene, seqa, seq_a_start - seqa->start);
2182 }
2183 
2184 static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, int sel)
2185 {
2186  /* sel: 0==unselected, 1==selected, -1==don't care. */
2187  Sequence *seq, *best_seq = NULL;
2188  Editing *ed = SEQ_editing_get(scene);
2189 
2190  int dist, best_dist;
2191  best_dist = MAXFRAME * 2;
2192 
2193  if (ed == NULL) {
2194  return NULL;
2195  }
2196 
2197  seq = ed->seqbasep->first;
2198  while (seq) {
2199  if ((seq != test) && (test->machine == seq->machine) &&
2200  ((sel == -1) || (sel == (seq->flag & SELECT)))) {
2201  dist = MAXFRAME * 2;
2202 
2203  switch (lr) {
2204  case SEQ_SIDE_LEFT:
2207  dist = SEQ_time_right_handle_frame_get(scene, test) -
2209  }
2210  break;
2211  case SEQ_SIDE_RIGHT:
2214  dist = SEQ_time_left_handle_frame_get(scene, seq) -
2216  }
2217  break;
2218  }
2219 
2220  if (dist == 0) {
2221  best_seq = seq;
2222  break;
2223  }
2224  if (dist < best_dist) {
2225  best_dist = dist;
2226  best_seq = seq;
2227  }
2228  }
2229  seq = seq->next;
2230  }
2231  return best_seq; /* Can be null. */
2232 }
2233 
2234 static bool seq_is_parent(Sequence *par, Sequence *seq)
2235 {
2236  return ((par->seq1 == seq) || (par->seq2 == seq) || (par->seq3 == seq));
2237 }
2238 
2240 {
2242  Editing *ed = SEQ_editing_get(scene);
2243  Sequence *active_seq = SEQ_select_active_get(scene);
2244  ListBase *seqbase = SEQ_active_seqbase_get(ed);
2245  Sequence *seq, *iseq;
2246  int side = RNA_enum_get(op->ptr, "side");
2247 
2248  if (active_seq == NULL) {
2249  return OPERATOR_CANCELLED;
2250  }
2251 
2252  seq = find_next_prev_sequence(scene, active_seq, side, -1);
2253 
2254  if (seq) {
2255 
2256  /* Disallow effect strips. */
2257  if (SEQ_effect_get_num_inputs(seq->type) >= 1 &&
2258  (seq->effectdata || seq->seq1 || seq->seq2 || seq->seq3)) {
2259  return OPERATOR_CANCELLED;
2260  }
2261  if ((SEQ_effect_get_num_inputs(active_seq->type) >= 1) &&
2262  (active_seq->effectdata || active_seq->seq1 || active_seq->seq2 || active_seq->seq3)) {
2263  return OPERATOR_CANCELLED;
2264  }
2265 
2266  switch (side) {
2267  case SEQ_SIDE_LEFT:
2268  swap_sequence(scene, seq, active_seq);
2269  break;
2270  case SEQ_SIDE_RIGHT:
2271  swap_sequence(scene, active_seq, seq);
2272  break;
2273  }
2274 
2275  /* Do this in a new loop since both effects need to be calculated first. */
2276  for (iseq = seqbase->first; iseq; iseq = iseq->next) {
2277  if ((iseq->type & SEQ_TYPE_EFFECT) &&
2278  (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
2279  /* This may now overlap. */
2280  if (SEQ_transform_test_overlap(scene, seqbase, iseq)) {
2281  SEQ_transform_seqbase_shuffle(seqbase, iseq, scene);
2282  }
2283  }
2284  }
2285 
2287  return OPERATOR_FINISHED;
2288  }
2289 
2290  return OPERATOR_CANCELLED;
2291 }
2292 
2294 {
2295  /* Identifiers. */
2296  ot->name = "Swap Strip";
2297  ot->idname = "SEQUENCER_OT_swap";
2298  ot->description = "Swap active strip with strip to the right or left";
2299 
2300  /* Api callbacks. */
2303 
2304  /* Flags. */
2306 
2307  /* Properties. */
2308  RNA_def_enum(
2309  ot->srna, "side", prop_side_lr_types, SEQ_SIDE_RIGHT, "Side", "Side of the strip to swap");
2310 }
2311 
2314 /* -------------------------------------------------------------------- */
2319 {
2321  Sequence *active_seq = SEQ_select_active_get(scene);
2322  StripElem *se = NULL;
2323 
2324  if (active_seq == NULL || active_seq->strip == NULL) {
2325  return OPERATOR_CANCELLED;
2326  }
2327 
2328  switch (active_seq->type) {
2329  case SEQ_TYPE_IMAGE:
2330  se = SEQ_render_give_stripelem(scene, active_seq, scene->r.cfra);
2331  break;
2332  case SEQ_TYPE_MOVIE:
2333  se = active_seq->strip->stripdata;
2334  break;
2335  default:
2336  return OPERATOR_CANCELLED;
2337  }
2338 
2339  if (se == NULL) {
2340  return OPERATOR_CANCELLED;
2341  }
2342 
2343  /* Prevent setting the render size if sequence values aren't initialized. */
2344  if (se->orig_width <= 0 || se->orig_height <= 0) {
2345  return OPERATOR_CANCELLED;
2346  }
2347 
2348  scene->r.xsch = se->orig_width;
2349  scene->r.ysch = se->orig_height;
2350 
2351  active_seq->strip->transform->scale_x = active_seq->strip->transform->scale_y = 1.0f;
2352  active_seq->strip->transform->xofs = active_seq->strip->transform->yofs = 0.0f;
2353 
2357 
2358  return OPERATOR_FINISHED;
2359 }
2360 
2362 {
2363  /* Identifiers. */
2364  ot->name = "Set Render Size";
2365  ot->idname = "SEQUENCER_OT_rendersize";
2366  ot->description = "Set render size and aspect from active sequence";
2367 
2368  /* Api callbacks. */
2371 
2372  /* Flags. */
2374 }
2375 
2378 /* -------------------------------------------------------------------- */
2383 {
2384  if (seq->type == SEQ_TYPE_META) {
2385  Sequence *iseq;
2386  for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) {
2387  seq_copy_del_sound(scene, iseq);
2388  }
2389  }
2390  else if (seq->scene_sound) {
2392  seq->scene_sound = NULL;
2393  }
2394 }
2395 
2397 {
2398  if (scene->adt == NULL || scene->adt->action == NULL ||
2400  return;
2401  }
2402 
2403  /* Add curves for strips inside meta strip. */
2404  if (seq->type == SEQ_TYPE_META) {
2405  LISTBASE_FOREACH (Sequence *, meta_child, &seq->seqbase) {
2406  sequencer_copy_animation(scene, meta_child);
2407  }
2408  }
2409 
2410  GSet *fcurves = SEQ_fcurves_by_strip_get(seq, &scene->adt->action->curves);
2411  if (fcurves == NULL) {
2412  return;
2413  }
2414 
2415  GSET_FOREACH_BEGIN (FCurve *, fcu, fcurves) {
2417  }
2418  GSET_FOREACH_END();
2419 
2420  BLI_gset_free(fcurves, NULL);
2421 }
2422 
2424 {
2425  Main *bmain = CTX_data_main(C);
2427  Editing *ed = SEQ_editing_get(scene);
2428 
2430 
2432  BKE_report(op->reports, RPT_ERROR, "Please select all related strips");
2433  return OPERATOR_CANCELLED;
2434  }
2435 
2436  /* NOTE: The UUID is re-generated on paste, so we can keep UUID in the clipboard since
2437  * nobody can reach them anyway.
2438  * This reduces chance or running out of UUIDs if a cat falls asleep on Ctrl-C. */
2440  scene,
2442  ed->seqbasep,
2443  0,
2445 
2448 
2450  /* Copy curves. */
2452  /* Remove anything that references the current scene. */
2453  seq_copy_del_sound(scene, seq);
2454  }
2455 
2456  /* Replace datablock pointers with copies, to keep things working in case
2457  * data-blocks get deleted or another .blend file is opened. */
2459 
2460  return OPERATOR_FINISHED;
2461 }
2462 
2464 {
2465  /* Identifiers. */
2466  ot->name = "Copy";
2467  ot->idname = "SEQUENCER_OT_copy";
2468  ot->description = "Copy selected strips to clipboard";
2469 
2470  /* Api callbacks. */
2473 
2474  /* Flags. */
2475  ot->flag = OPTYPE_REGISTER;
2476 }
2477 
2480 /* -------------------------------------------------------------------- */
2485 {
2486  Editing *ed = SEQ_editing_get(scene);
2487 
2488  if (ed == NULL) {
2489  return;
2490  }
2491 
2493  seq->flag &= ~SEQ_ALLSEL;
2494  }
2495 }
2496 
2498 {
2500  return;
2501  }
2502 
2503  Main *bmain = CTX_data_main(C);
2505  bAction *act;
2506 
2507  if (scene->adt != NULL && scene->adt->action != NULL) {
2508  act = scene->adt->action;
2509  }
2510  else {
2511  /* get action to add F-Curve+keyframe to */
2512  act = ED_id_action_ensure(bmain, &scene->id);
2513  }
2514 
2516  BLI_addtail(&act->curves, BKE_fcurve_copy(fcu));
2517  }
2518 }
2519 
2521 {
2522  Main *bmain = CTX_data_main(C);
2524  Editing *ed = SEQ_editing_ensure(scene); /* Create if needed. */
2525  ListBase nseqbase = {NULL, NULL};
2526  int ofs;
2527  Sequence *iseq, *iseq_first;
2528 
2530  BKE_report(op->reports, RPT_INFO, "No strips to paste");
2531  return OPERATOR_CANCELLED;
2532  }
2533 
2535  if (RNA_boolean_get(op->ptr, "keep_offset")) {
2537  }
2538  else {
2539  int min_seq_startdisp = INT_MAX;
2541  if (SEQ_time_left_handle_frame_get(scene, seq) < min_seq_startdisp) {
2542  min_seq_startdisp = SEQ_time_left_handle_frame_get(scene, seq);
2543  }
2544  }
2545  /* Paste strips relative to the current-frame. */
2546  ofs = scene->r.cfra - min_seq_startdisp;
2547  }
2548 
2549  /* Paste animation.
2550  * NOTE: Only fcurves are copied. Drivers and NLA action strips are not copied.
2551  * First backup original curves from scene and move curves from clipboard into scene. This way,
2552  * when pasted strips are renamed, pasted fcurves are renamed with them. Finally restore original
2553  * curves from backup.
2554  */
2555 
2556  ListBase fcurves_original_backup = {NULL, NULL};
2557  SEQ_animation_backup_original(scene, &fcurves_original_backup);
2559 
2560  /* Copy strips, temporarily restoring pointers to actual data-blocks. This
2561  * must happen on the clipboard itself, so that copying does user counting
2562  * on the actual data-blocks. */
2566 
2567  iseq_first = nseqbase.first;
2568 
2569  /* NOTE: SEQ_sequence_base_dupli_recursive() takes care of generating new UUIDs for sequences
2570  * in the new list. */
2571  BLI_movelisttolist(ed->seqbasep, &nseqbase);
2572 
2573  /* Make sure, that pasted strips have unique names. This has to be done immediately after adding
2574  * strips to seqbase, for lookup cache to work correctly. */
2575  for (iseq = iseq_first; iseq; iseq = iseq->next) {
2577  }
2578 
2579  for (iseq = iseq_first; iseq; iseq = iseq->next) {
2582  }
2583 
2584  /* Translate after name has been changed, otherwise this will affect animdata of original
2585  * strip. */
2587  /* Ensure, that pasted strips don't overlap. */
2588  if (SEQ_transform_test_overlap(scene, ed->seqbasep, iseq)) {
2590  }
2591  }
2592 
2593  SEQ_animation_restore_original(scene, &fcurves_original_backup);
2594 
2596  DEG_relations_tag_update(bmain);
2599 
2600  return OPERATOR_FINISHED;
2601 }
2602 
2604 {
2605  /* Identifiers. */
2606  ot->name = "Paste";
2607  ot->idname = "SEQUENCER_OT_paste";
2608  ot->description = "Paste strips from clipboard";
2609 
2610  /* Api callbacks. */
2613 
2614  /* Flags. */
2616 
2617  /* Properties. */
2618  PropertyRNA *prop = RNA_def_boolean(
2619  ot->srna,
2620  "keep_offset",
2621  false,
2622  "Keep Offset",
2623  "Keep strip offset relative to the current frame when pasting");
2625 }
2626 
2629 /* -------------------------------------------------------------------- */
2634 {
2636  Sequence *seq_act;
2637  Sequence *seq_other;
2638  const char *error_msg;
2639 
2640  if (SEQ_select_active_get_pair(scene, &seq_act, &seq_other) == 0) {
2641  BKE_report(op->reports, RPT_ERROR, "Please select two strips");
2642  return OPERATOR_CANCELLED;
2643  }
2644 
2645  if (SEQ_edit_sequence_swap(scene, seq_act, seq_other, &error_msg) == 0) {
2646  BKE_report(op->reports, RPT_ERROR, error_msg);
2647  return OPERATOR_CANCELLED;
2648  }
2649 
2650  if (seq_act->scene_sound) {
2652  }
2653 
2654  if (seq_other->scene_sound) {
2656  }
2657 
2658  seq_act->scene_sound = NULL;
2659  seq_other->scene_sound = NULL;
2660 
2661  if (seq_act->sound) {
2663  }
2664  if (seq_other->sound) {
2666  }
2667 
2670 
2672 
2673  return OPERATOR_FINISHED;
2674 }
2675 
2677 {
2678  /* Identifiers. */
2679  ot->name = "Sequencer Swap Data";
2680  ot->idname = "SEQUENCER_OT_swap_data";
2681  ot->description = "Swap 2 sequencer strips";
2682 
2683  /* Api callbacks. */
2686 
2687  /* Flags. */
2689 }
2690 
2693 /* -------------------------------------------------------------------- */
2698  {0, "A_B", 0, "A -> B", ""},
2699  {1, "B_C", 0, "B -> C", ""},
2700  {2, "A_C", 0, "A -> C", ""},
2701  {0, NULL, 0, NULL, NULL},
2702 };
2703 
2705 {
2708 
2709  Sequence **seq_1, **seq_2;
2710 
2711  switch (RNA_enum_get(op->ptr, "swap")) {
2712  case 0:
2713  seq_1 = &seq->seq1;
2714  seq_2 = &seq->seq2;
2715  break;
2716  case 1:
2717  seq_1 = &seq->seq2;
2718  seq_2 = &seq->seq3;
2719  break;
2720  default: /* 2 */
2721  seq_1 = &seq->seq1;
2722  seq_2 = &seq->seq3;
2723  break;
2724  }
2725 
2726  if (*seq_1 == NULL || *seq_2 == NULL) {
2727  BKE_report(op->reports, RPT_ERROR, "One of the effect inputs is unset, cannot swap");
2728  return OPERATOR_CANCELLED;
2729  }
2730 
2731  SWAP(Sequence *, *seq_1, *seq_2);
2732 
2735 
2736  return OPERATOR_FINISHED;
2737 }
2738 
2740 {
2741  /* Identifiers. */
2742  ot->name = "Change Effect Input";
2743  ot->idname = "SEQUENCER_OT_change_effect_input";
2744 
2745  /* Api callbacks. */
2748 
2749  /* Flags. */
2751 
2752  ot->prop = RNA_def_enum(
2753  ot->srna, "swap", prop_change_effect_input_types, 0, "Swap", "The effect inputs to swap");
2754 }
2755 
2758 /* -------------------------------------------------------------------- */
2763  {SEQ_TYPE_CROSS, "CROSS", 0, "Crossfade", "Crossfade effect strip type"},
2764  {SEQ_TYPE_ADD, "ADD", 0, "Add", "Add effect strip type"},
2765  {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", "Subtract effect strip type"},
2766  {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", "Alpha Over effect strip type"},
2767  {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", "Alpha Under effect strip type"},
2768  {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", "Gamma Cross effect strip type"},
2769  {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", "Multiply effect strip type"},
2770  {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Alpha Over Drop", "Alpha Over Drop effect strip type"},
2771  {SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", "Wipe effect strip type"},
2772  {SEQ_TYPE_GLOW, "GLOW", 0, "Glow", "Glow effect strip type"},
2773  {SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", "Transform effect strip type"},
2774  {SEQ_TYPE_COLOR, "COLOR", 0, "Color", "Color effect strip type"},
2775  {SEQ_TYPE_SPEED, "SPEED", 0, "Speed", "Color effect strip type"},
2776  {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
2777  {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
2778  {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
2779  {SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
2780  {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
2781  {0, NULL, 0, NULL, NULL},
2782 };
2783 
2785 {
2788  const int new_type = RNA_enum_get(op->ptr, "type");
2789 
2790  /* Free previous effect and init new effect. */
2791  struct SeqEffectHandle sh;
2792 
2793  if ((seq->type & SEQ_TYPE_EFFECT) == 0) {
2794  return OPERATOR_CANCELLED;
2795  }
2796 
2797  /* Can someone explain the logic behind only allowing to increase this,
2798  * copied from 2.4x - campbell */
2800  BKE_report(op->reports, RPT_ERROR, "New effect needs more input strips");
2801  return OPERATOR_CANCELLED;
2802  }
2803 
2804  sh = SEQ_effect_handle_get(seq);
2805  sh.free(seq, true);
2806 
2807  seq->type = new_type;
2808 
2809  sh = SEQ_effect_handle_get(seq);
2810  sh.init(seq);
2811 
2814 
2815  return OPERATOR_FINISHED;
2816 }
2817 
2819 {
2820  /* Identifiers. */
2821  ot->name = "Change Effect Type";
2822  ot->idname = "SEQUENCER_OT_change_effect_type";
2823 
2824  /* Api callbacks. */
2827 
2828  /* Flags. */
2830 
2831  ot->prop = RNA_def_enum(ot->srna,
2832  "type",
2835  "Type",
2836  "Sequencer effect type");
2837 }
2838 
2841 /* -------------------------------------------------------------------- */
2846 {
2847  Main *bmain = CTX_data_main(C);
2850  const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path");
2851  const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders");
2852  int minext_frameme, numdigits;
2853 
2854  if (seq->type == SEQ_TYPE_IMAGE) {
2855  char directory[FILE_MAX];
2856  int len;
2857  StripElem *se;
2858 
2859  /* Need to find min/max frame for placeholders. */
2860  if (use_placeholders) {
2861  len = sequencer_image_seq_get_minmax_frame(op, seq->sfra, &minext_frameme, &numdigits);
2862  }
2863  else {
2865  }
2866  if (len == 0) {
2867  return OPERATOR_CANCELLED;
2868  }
2869 
2870  RNA_string_get(op->ptr, "directory", directory);
2871  if (is_relative_path) {
2872  /* TODO(campbell): shouldn't this already be relative from the filesel?
2873  * (as the 'filepath' is) for now just make relative here,
2874  * but look into changing after 2.60. */
2875  BLI_path_rel(directory, BKE_main_blendfile_path(bmain));
2876  }
2877  BLI_strncpy(seq->strip->dir, directory, sizeof(seq->strip->dir));
2878 
2879  if (seq->strip->stripdata) {
2880  MEM_freeN(seq->strip->stripdata);
2881  }
2882  seq->strip->stripdata = se = MEM_callocN(len * sizeof(StripElem), "stripelem");
2883 
2884  if (use_placeholders) {
2885  sequencer_image_seq_reserve_frames(op, se, len, minext_frameme, numdigits);
2886  }
2887  else {
2888  RNA_BEGIN (op->ptr, itemptr, "files") {
2889  char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0, NULL);
2890  BLI_strncpy(se->name, filename, sizeof(se->name));
2891  MEM_freeN(filename);
2892  se++;
2893  }
2894  RNA_END;
2895  }
2896 
2897  /* Reset these else we won't see all the images. */
2898  seq->anim_startofs = seq->anim_endofs = 0;
2899 
2900  /* Correct start/end frames so we don't move.
2901  * Important not to set seq->len = len; allow the function to handle it. */
2902  SEQ_add_reload_new_file(bmain, scene, seq, true);
2903  }
2904  else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) {
2905  bSound *sound = seq->sound;
2906  if (sound == NULL) {
2907  return OPERATOR_CANCELLED;
2908  }
2909  char filepath[FILE_MAX];
2910  RNA_string_get(op->ptr, "filepath", filepath);
2911  BLI_strncpy(sound->filepath, filepath, sizeof(sound->filepath));
2912  BKE_sound_load(bmain, sound);
2913  }
2914  else {
2915  /* Lame, set rna filepath. */
2916  PointerRNA seq_ptr;
2917  PropertyRNA *prop;
2918  char filepath[FILE_MAX];
2919 
2920  RNA_pointer_create(&scene->id, &RNA_Sequence, seq, &seq_ptr);
2921 
2922  RNA_string_get(op->ptr, "filepath", filepath);
2923  prop = RNA_struct_find_property(&seq_ptr, "filepath");
2924  RNA_property_string_set(&seq_ptr, prop, filepath);
2925  RNA_property_update(C, &seq_ptr, prop);
2927  }
2928 
2931 
2932  return OPERATOR_FINISHED;
2933 }
2934 
2936 {
2939  char filepath[FILE_MAX];
2940 
2941  BLI_join_dirfile(filepath, sizeof(filepath), seq->strip->dir, seq->strip->stripdata->name);
2942 
2943  RNA_string_set(op->ptr, "directory", seq->strip->dir);
2944  RNA_string_set(op->ptr, "filepath", filepath);
2945 
2946  /* Set default display depending on seq type. */
2947  if (seq->type == SEQ_TYPE_IMAGE) {
2948  RNA_boolean_set(op->ptr, "filter_movie", false);
2949  }
2950  else {
2951  RNA_boolean_set(op->ptr, "filter_image", false);
2952  }
2953 
2955 
2956  return OPERATOR_RUNNING_MODAL;
2957 }
2958 
2960 {
2961  /* Identifiers. */
2962  ot->name = "Change Data/Files";
2963  ot->idname = "SEQUENCER_OT_change_path";
2964 
2965  /* Api callbacks. */
2969 
2970  /* Flags. */
2972 
2975  FILE_SPECIAL,
2976  FILE_OPENFILE,
2982  "use_placeholders",
2983  false,
2984  "Use Placeholders",
2985  "Use placeholders for missing frames of the strip");
2986 }
2987 
2990 /* -------------------------------------------------------------------- */
2995 {
2997  if (ed == NULL) {
2998  return false;
2999  }
3000  Sequence *seq = ed->act_seq;
3001  return ((seq != NULL) && (seq->type == SEQ_TYPE_SCENE));
3002 }
3004 {
3005  Main *bmain = CTX_data_main(C);
3007  Scene *scene_seq = BLI_findlink(&bmain->scenes, RNA_enum_get(op->ptr, "scene"));
3008 
3009  if (scene_seq == NULL) {
3010  BKE_report(op->reports, RPT_ERROR, "Scene not found");
3011  return OPERATOR_CANCELLED;
3012  }
3013 
3014  /* Assign new scene. */
3016  if (seq) {
3017  seq->scene = scene_seq;
3018  /* Do a refresh of the sequencer data. */
3021  DEG_relations_tag_update(bmain);
3022  }
3023 
3026 
3027  return OPERATOR_FINISHED;
3028 }
3029 
3031 {
3032  if (!RNA_struct_property_is_set(op->ptr, "scene")) {
3033  return WM_enum_search_invoke(C, op, event);
3034  }
3035 
3036  return sequencer_change_scene_exec(C, op);
3037 }
3038 
3040 {
3041  PropertyRNA *prop;
3042 
3043  /* Identifiers. */
3044  ot->name = "Change Scene";
3045  ot->idname = "SEQUENCER_OT_change_scene";
3046  ot->description = "Change Scene assigned to Strip";
3047 
3048  /* Api callbacks. */
3052 
3053  /* Flags. */
3055 
3056  /* Properties. */
3057  prop = RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
3060  ot->prop = prop;
3061 }
3062 
3065 /* -------------------------------------------------------------------- */
3070 static int seq_cmp_time_startdisp_channel(void *thunk, const void *a, const void *b)
3071 {
3072  const Scene *scene = thunk;
3073  Sequence *seq_a = (Sequence *)a;
3074  Sequence *seq_b = (Sequence *)b;
3075 
3076  int seq_a_start = SEQ_time_left_handle_frame_get(scene, seq_a);
3077  int seq_b_start = SEQ_time_left_handle_frame_get(scene, seq_b);
3078 
3079  /* If strips have the same start frame favor the one with a higher channel.*/
3080  if (seq_a_start == seq_b_start) {
3081  return seq_a->machine > seq_b->machine;
3082  }
3083 
3084  return (seq_a_start > seq_b_start);
3085 }
3086 
3088  wmOperator *op,
3089  const wmEvent *UNUSED(event))
3090 {
3091  Main *bmain = CTX_data_main(C);
3092  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
3093  char filepath[FILE_MAX];
3094 
3095  if (BKE_main_blendfile_path(bmain)[0] == '\0') {
3096  BLI_strncpy(filepath, "untitled", sizeof(filepath));
3097  }
3098  else {
3099  BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
3100  }
3101 
3102  BLI_path_extension_replace(filepath, sizeof(filepath), ".srt");
3103  RNA_string_set(op->ptr, "filepath", filepath);
3104  }
3105 
3107 
3108  return OPERATOR_RUNNING_MODAL;
3109 }
3110 
3111 typedef struct Seq_get_text_cb_data {
3115 
3116 static bool seq_get_text_strip_cb(Sequence *seq, void *user_data)
3117 {
3119  Editing *ed = SEQ_editing_get(cd->scene);
3121  /* Only text strips that are not muted and don't end with negative frame. */
3122  if ((seq->type == SEQ_TYPE_TEXT) && !SEQ_render_is_muted(channels, seq) &&
3123  (SEQ_time_right_handle_frame_get(cd->scene, seq) > cd->scene->r.sfra)) {
3124  BLI_addtail(cd->text_seq, MEM_dupallocN(seq));
3125  }
3126  return true;
3127 }
3128 
3130 {
3132  Sequence *seq, *seq_next;
3133  Editing *ed = SEQ_editing_get(scene);
3134  ListBase text_seq = {0};
3135  int iter = 0;
3136  FILE *file;
3137  char filepath[FILE_MAX];
3138 
3139  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
3140  BKE_report(op->reports, RPT_ERROR, "No filename given");
3141  return OPERATOR_CANCELLED;
3142  }
3143 
3144  RNA_string_get(op->ptr, "filepath", filepath);
3145  BLI_path_extension_ensure(filepath, sizeof(filepath), ".srt");
3146 
3147  /* Avoid File write exceptions. */
3148  if (!BLI_exists(filepath)) {
3149  BLI_make_existing_file(filepath);
3150  if (!BLI_file_touch(filepath)) {
3151  BKE_report(op->reports, RPT_ERROR, "Can't create subtitle file");
3152  return OPERATOR_CANCELLED;
3153  }
3154  }
3155  else if (!BLI_file_is_writable(filepath)) {
3156  BKE_report(op->reports, RPT_ERROR, "Can't overwrite export file");
3157  return OPERATOR_CANCELLED;
3158  }
3159 
3160  if (ed != NULL) {
3161  Seq_get_text_cb_data cb_data = {&text_seq, scene};
3163  }
3164 
3165  if (BLI_listbase_is_empty(&text_seq)) {
3166  BKE_report(op->reports, RPT_ERROR, "No subtitles (text strips) to export");
3167  return OPERATOR_CANCELLED;
3168  }
3169 
3171 
3172  /* Open and write file. */
3173  file = BLI_fopen(filepath, "w");
3174 
3175  for (seq = text_seq.first; seq; seq = seq_next) {
3176  TextVars *data = seq->effectdata;
3177  char timecode_str_start[32];
3178  char timecode_str_end[32];
3179 
3180  /* Write time-code relative to start frame of scene. Don't allow negative time-codes. */
3182  timecode_str_start,
3183  sizeof(timecode_str_start),
3184  -2,
3186  FPS,
3189  timecode_str_end,
3190  sizeof(timecode_str_end),
3191  -2,
3193  FPS,
3195 
3196  fprintf(
3197  file, "%d\n%s --> %s\n%s\n\n", iter++, timecode_str_start, timecode_str_end, data->text);
3198 
3199  seq_next = seq->next;
3200  MEM_freeN(seq);
3201  }
3202 
3203  fclose(file);
3204 
3205  return OPERATOR_FINISHED;
3206 }
3207 
3209 {
3210  Editing *ed;
3211  Sequence *seq;
3212  return (((ed = SEQ_editing_get(CTX_data_scene(C))) != NULL) && ((seq = ed->act_seq) != NULL) &&
3213  (seq->type == SEQ_TYPE_TEXT));
3214 }
3215 
3217 {
3218  /* Identifiers. */
3219  ot->name = "Export Subtitles";
3220  ot->idname = "SEQUENCER_OT_export_subtitles";
3221  ot->description = "Export .srt file containing text strips";
3222 
3223  /* Api callbacks. */
3227 
3228  /* Flags. */
3230 
3233  FILE_BLENDER,
3234  FILE_SAVE,
3238 }
3239 
3242 /* -------------------------------------------------------------------- */
3247 {
3249  Editing *ed = SEQ_editing_get(scene);
3250  Sequence *seq;
3251 
3252  int sfra = MAXFRAME;
3253  int efra = -MAXFRAME;
3254  bool selected = false;
3255  const bool preview = RNA_boolean_get(op->ptr, "preview");
3256 
3257  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
3258  if (seq->flag & SELECT) {
3259  selected = true;
3260  sfra = min_ii(sfra, SEQ_time_left_handle_frame_get(scene, seq));
3261  efra = max_ii(efra, SEQ_time_right_handle_frame_get(scene, seq) - 1);
3262  }
3263  }
3264 
3265  if (!selected) {
3266  BKE_report(op->reports, RPT_WARNING, "Select one or more strips");
3267  return OPERATOR_CANCELLED;
3268  }
3269  if (efra < 0) {
3270  BKE_report(op->reports, RPT_ERROR, "Can't set a negative range");
3271  return OPERATOR_CANCELLED;
3272  }
3273 
3274  if (preview) {
3275  scene->r.flag |= SCER_PRV_RANGE;
3276  scene->r.psfra = max_ii(0, sfra);
3277  scene->r.pefra = efra;
3278  }
3279  else {
3280  scene->r.flag &= ~SCER_PRV_RANGE;
3281  scene->r.sfra = max_ii(0, sfra);
3282  scene->r.efra = efra;
3283  }
3284 
3286 
3287  return OPERATOR_FINISHED;
3288 }
3289 
3291 {
3292  PropertyRNA *prop;
3293 
3294  /* Identifiers. */
3295  ot->name = "Set Range to Strips";
3296  ot->idname = "SEQUENCER_OT_set_range_to_strips";
3297  ot->description = "Set the frame range to the selected strips start and end";
3298 
3299  /* Api callbacks. */
3302 
3303  /* Flags. */
3305 
3306  prop = RNA_def_boolean(ot->srna, "preview", false, "Preview", "Set the preview range instead");
3308 }
3309 
3312 /* -------------------------------------------------------------------- */
3316 enum {
3321 };
3322 
3324  {STRIP_TRANSFORM_POSITION, "POSITION", 0, "Position", "Reset strip transform location"},
3325  {STRIP_TRANSFORM_SCALE, "SCALE", 0, "Scale", "Reset strip transform scale"},
3326  {STRIP_TRANSFORM_ROTATION, "ROTATION", 0, "Rotation", "Reset strip transform rotation"},
3327  {STRIP_TRANSFORM_ALL, "ALL", 0, "All", "Reset strip transform location, scale and rotation"},
3328  {0, NULL, 0, NULL, NULL},
3329 };
3330 
3332 {
3334  const Editing *ed = SEQ_editing_get(scene);
3335  Sequence *seq;
3336  const int property = RNA_enum_get(op->ptr, "property");
3337 
3338  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
3339  if (seq->flag & SELECT && seq->type != SEQ_TYPE_SOUND_RAM) {
3341  switch (property) {
3343  transform->xofs = 0;
3344  transform->yofs = 0;
3345  break;
3346  case STRIP_TRANSFORM_SCALE:
3347  transform->scale_x = 1.0f;
3348  transform->scale_y = 1.0f;
3349  break;
3351  transform->rotation = 0.0f;
3352  break;
3353  case STRIP_TRANSFORM_ALL:
3354  transform->xofs = 0;
3355  transform->yofs = 0;
3356  transform->scale_x = 1.0f;
3357  transform->scale_y = 1.0f;
3358  transform->rotation = 0.0f;
3359  break;
3360  }
3362  }
3363  }
3364 
3366  return OPERATOR_FINISHED;
3367 }
3368 
3370 {
3371  /* Identifiers. */
3372  ot->name = "Clear Strip Transform";
3373  ot->idname = "SEQUENCER_OT_strip_transform_clear";
3374  ot->description = "Reset image transformation to default value";
3375 
3376  /* Api callbacks. */
3379 
3380  /* Flags. */
3382 
3383  ot->prop = RNA_def_enum(ot->srna,
3384  "property",
3387  "Property",
3388  "Strip transform property to be reset");
3389 }
3390 
3393 /* -------------------------------------------------------------------- */
3398  {SEQ_SCALE_TO_FIT, "FIT", 0, "Scale to Fit", "Scale image so fits in preview"},
3399  {SEQ_SCALE_TO_FILL, "FILL", 0, "Scale to Fill", "Scale image so it fills preview completely"},
3400  {SEQ_STRETCH_TO_FILL, "STRETCH", 0, "Stretch to Fill", "Stretch image so it fills preview"},
3401  {0, NULL, 0, NULL, NULL},
3402 };
3403 
3405 {
3407  const Editing *ed = SEQ_editing_get(scene);
3408  Sequence *seq;
3409  const eSeqImageFitMethod fit_method = RNA_enum_get(op->ptr, "fit_method");
3410 
3411  for (seq = ed->seqbasep->first; seq; seq = seq->next) {
3412  if (seq->flag & SELECT && seq->type != SEQ_TYPE_SOUND_RAM) {
3413  const int timeline_frame = scene->r.cfra;
3414  StripElem *strip_elem = SEQ_render_give_stripelem(scene, seq, timeline_frame);
3415 
3416  if (strip_elem == NULL) {
3417  continue;
3418  }
3419 
3421  strip_elem->orig_width,
3422  strip_elem->orig_height,
3423  scene->r.xsch,
3424  scene->r.ysch,
3425  fit_method);
3427  }
3428  }
3429 
3431  return OPERATOR_FINISHED;
3432 }
3433 
3435 {
3436  /* Identifiers. */
3437  ot->name = "Strip Transform Set Fit";
3438  ot->idname = "SEQUENCER_OT_strip_transform_fit";
3439 
3440  /* Api callbacks. */
3443 
3444  /* Flags. */
3446 
3447  ot->prop = RNA_def_enum(ot->srna,
3448  "fit_method",
3451  "Fit Method",
3452  "Scale fit fit_method");
3453 }
3454 
3456 {
3458  const Editing *ed = SEQ_editing_get(scene);
3459  const short color_tag = RNA_enum_get(op->ptr, "color");
3460 
3461  LISTBASE_FOREACH (Sequence *, seq, &ed->seqbase) {
3462  if (seq->flag & SELECT) {
3463  seq->color_tag = color_tag;
3464  }
3465  }
3466 
3468  return OPERATOR_FINISHED;
3469 }
3470 
3472 {
3474  if (scene == NULL) {
3475  return false;
3476  }
3477 
3478  Editing *ed = SEQ_editing_get(scene);
3479  if (ed == NULL) {
3480  return false;
3481  }
3482 
3483  Sequence *act_seq = ed->act_seq;
3484  return act_seq != NULL;
3485 }
3486 
3488 {
3489  /* Identifiers. */
3490  ot->name = "Set Color Tag";
3491  ot->idname = "SEQUENCER_OT_strip_color_tag_set";
3492  ot->description = "Set a color tag for the selected strips";
3493 
3494  /* Api callbacks. */
3497 
3498  /* Flags. */
3500 
3501  RNA_def_enum(
3502  ot->srna, "color", rna_enum_strip_color_items, SEQUENCE_COLOR_NONE, "Color Tag", "");
3503 }
3504 
3507 /* -------------------------------------------------------------------- */
3512 {
3514  SpaceSeq *sseq = CTX_wm_space_seq(C);
3515 
3516  float cursor_pixel[2];
3517  RNA_float_get_array(op->ptr, "location", cursor_pixel);
3518 
3519  SEQ_image_preview_unit_from_px(scene, cursor_pixel, sseq->cursor);
3520 
3522 
3523  /* Use pass-through to allow click-drag to transform the cursor. */
3525 }
3526 
3528 {
3529  ARegion *region = CTX_wm_region(C);
3530  float cursor_pixel[2];
3532  &region->v2d, event->mval[0], event->mval[1], &cursor_pixel[0], &cursor_pixel[1]);
3533 
3534  RNA_float_set_array(op->ptr, "location", cursor_pixel);
3535 
3536  return sequencer_set_2d_cursor_exec(C, op);
3537 }
3538 
3540 {
3541  /* identifiers */
3542  ot->name = "Set 2D Cursor";
3543  ot->description = "Set 2D cursor location";
3544  ot->idname = "SEQUENCER_OT_cursor_set";
3545 
3546  /* api callbacks */
3550 
3551  /* flags */
3553 
3554  /* properties */
3556  "location",
3557  2,
3558  NULL,
3559  -FLT_MAX,
3560  FLT_MAX,
3561  "Location",
3562  "Cursor location in normalized preview coordinates",
3563  -10.0f,
3564  10.0f);
3565 }
3566 
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct SpaceSeq * CTX_wm_space_seq(const bContext *C)
Definition: context.c:851
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
struct FCurve * BKE_fcurve_copy(const struct FCurve *fcu)
@ LIB_ID_CREATE_NO_USER_REFCOUNT
Definition: BKE_lib_id.h:126
@ LIB_ID_FREE_NO_MAIN
Definition: BKE_lib_id.h:240
const char * BKE_main_blendfile_path(const struct Main *bmain) ATTR_NONNULL()
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
void BKE_sound_load(struct Main *main, struct bSound *sound)
void * BKE_sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence)
void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle)
#define ATTR_FALLTHROUGH
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: storage.c:314
bool BLI_file_is_writable(const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: fileops.c:167
bool BLI_file_touch(const char *file) ATTR_NONNULL()
Definition: fileops.c:192
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: fileops.c:906
struct GSet GSet
Definition: BLI_ghash.h:340
#define GSET_FOREACH_END()
Definition: BLI_ghash.h:540
#define GSET_FOREACH_BEGIN(type, var, what)
Definition: BLI_ghash.h:534
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
Definition: BLI_ghash.c:1037
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
Definition: BLI_listbase.h:269
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:354
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
Definition: BLI_listbase.h:348
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
Definition: BLI_listbase.h:273
void void void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src) ATTR_NONNULL(1
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:100
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void void BLI_listbase_sort_r(ListBase *listbase, int(*cmp)(void *, const void *, const void *), void *thunk) ATTR_NONNULL(1
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int round_fl_to_int(float a)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
bool BLI_make_existing_file(const char *name)
Definition: path_util.c:1197
#define FILE_MAX
bool BLI_path_extension_ensure(char *path, size_t maxlen, const char *ext) ATTR_NONNULL()
Definition: path_util.c:1420
bool BLI_path_extension_replace(char *path, size_t maxlen, const char *ext) ATTR_NONNULL()
Definition: path_util.c:1393
void BLI_path_rel(char *file, const char *relfile) ATTR_NONNULL()
Definition: path_util.c:450
void BLI_join_dirfile(char *__restrict dst, size_t maxlen, const char *__restrict dir, const char *__restrict file) ATTR_NONNULL()
Definition: path_util.c:1531
bool BLI_str_startswith(const char *__restrict str, const char *__restrict start) ATTR_NONNULL()
Definition: string.c:860
bool BLI_str_endswith(const char *__restrict str, const char *__restrict end) ATTR_NONNULL()
Definition: string.c:887
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
size_t BLI_timecode_string_from_time(char *str, size_t maxncpy, int brevity_level, float time_seconds, double fps, short timecode_style) ATTR_NONNULL()
Definition: timecode.c:22
#define SWAP(type, a, b)
#define UNUSED(x)
#define ELEM(...)
#define STREQ(a, b)
#define TIP_(msgid)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_FRAME_CHANGE
Definition: DNA_ID.h:841
@ ID_RECALC_AUDIO
Definition: DNA_ID.h:848
@ ID_RECALC_SEQUENCER_STRIPS
Definition: DNA_ID.h:838
#define MINFRAME
#define USER_UNIT_NONE
#define SCER_PRV_RANGE
#define FPS
eSeqImageFitMethod
@ SEQ_SCALE_TO_FILL
@ SEQ_STRETCH_TO_FILL
@ SEQ_SCALE_TO_FIT
#define FRA2TIME(a)
#define MAXFRAME
@ RGN_TYPE_WINDOW
@ RGN_TYPE_PREVIEW
@ SEQ_TYPE_TRANSFORM
@ SEQ_TYPE_SOUND_RAM
@ SEQ_TYPE_CROSS
@ SEQ_TYPE_SOUND_HD
@ SEQ_TYPE_GLOW
@ SEQ_TYPE_COLORMIX
@ SEQ_TYPE_WIPE
@ SEQ_TYPE_META
@ SEQ_TYPE_OVERDROP
@ SEQ_TYPE_ALPHAUNDER
@ SEQ_TYPE_SCENE
@ SEQ_TYPE_GAMCROSS
@ SEQ_TYPE_MULTICAM
@ SEQ_TYPE_MUL
@ SEQ_TYPE_GAUSSIAN_BLUR
@ SEQ_TYPE_ADD
@ SEQ_TYPE_ALPHAOVER
@ SEQ_TYPE_TEXT
@ SEQ_TYPE_IMAGE
@ SEQ_TYPE_SUB
@ SEQ_TYPE_SPEED
@ SEQ_TYPE_COLOR
@ SEQ_TYPE_EFFECT
@ SEQ_TYPE_MOVIE
@ SEQ_TYPE_ADJUSTMENT
#define SEQ_HAS_PATH(_seq)
@ SEQUENCE_COLOR_NONE
#define SEQ_ALLSEL
@ SEQ_MUTE
@ SEQ_RIGHTSEL
@ SEQ_IGNORE_CHANNEL_LOCK
@ SEQ_OVERLAP
@ SEQ_LOCK
@ SEQ_LEFTSEL
@ FILE_SORT_DEFAULT
@ FILE_SPECIAL
@ FILE_BLENDER
@ FILE_TYPE_FOLDER
@ SEQ_VIEW_SEQUENCE_PREVIEW
@ SEQ_VIEW_SEQUENCE
@ SEQ_VIEW_PREVIEW
@ SEQ_DRAW_BACKDROP
@ FILE_DEFAULTDISPLAY
@ SEQ_DRAW_IMG_IMBUF
@ USER_TIMECODE_SUBRIP
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
void outputNumInput(NumInput *n, char *str, struct UnitSettings *unit_settings)
Definition: numinput.c:87
void initNumInput(NumInput *n)
Definition: numinput.c:69
#define NUM_STR_REP_LEN
Definition: ED_numinput.h:13
@ NUM_NO_FRACTION
Definition: ED_numinput.h:58
bool applyNumInput(NumInput *n, float *vec)
Definition: numinput.c:189
bool hasNumInput(const NumInput *n)
Definition: numinput.c:170
bool handleNumInput(struct bContext *C, NumInput *n, const struct wmEvent *event)
void ED_outliner_select_sync_from_sequence_tag(struct bContext *C)
bool ED_scene_delete(struct bContext *C, struct Main *bmain, struct Scene *scene) ATTR_NONNULL()
Definition: scene_edit.c:128
bool ED_operator_sequencer_active(struct bContext *C)
Definition: screen_ops.c:334
void ED_area_status_text(ScrArea *area, const char *str)
Definition: area.c:792
NSNotificationCenter * center
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
#define RNA_BEGIN(sptr, itemptr, propname)
Definition: RNA_access.h:543
#define RNA_END
Definition: RNA_access.h:550
const EnumPropertyItem * RNA_scene_without_active_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free)
@ PROP_ENUM_NO_TRANSLATE
Definition: RNA_types.h:294
@ PROP_SKIP_SAVE
Definition: RNA_types.h:218
@ PROP_HIDDEN
Definition: RNA_types.h:216
#define C
Definition: RandGen.cpp:25
eSeqSplitMethod
Definition: SEQ_edit.h:60
@ SEQ_SPLIT_SOFT
Definition: SEQ_edit.h:61
@ SEQ_SPLIT_HARD
Definition: SEQ_edit.h:62
#define SEQ_ITERATOR_FOREACH(var, collection)
Definition: SEQ_iterator.h:35
#define SEQ_DUPE_UNIQUE_NAME
Definition: SEQ_sequencer.h:38
@ SEQ_SIDE_RIGHT
Definition: SEQ_sequencer.h:32
@ SEQ_SIDE_MOUSE
Definition: SEQ_sequencer.h:29
@ SEQ_SIDE_BOTH
Definition: SEQ_sequencer.h:33
@ SEQ_SIDE_NO_CHANGE
Definition: SEQ_sequencer.h:34
@ SEQ_SIDE_LEFT
Definition: SEQ_sequencer.h:31
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemS(uiLayout *layout)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
@ UI_ITEM_R_EXPAND
#define UI_MAX_DRAW_STR
Definition: UI_interface.h:91
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
struct View2D * UI_view2d_fromcontext(const struct bContext *C)
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
@ WM_FILESEL_FILES
Definition: WM_api.h:756
@ WM_FILESEL_DIRECTORY
Definition: WM_api.h:753
@ WM_FILESEL_RELPATH
Definition: WM_api.h:752
@ WM_FILESEL_FILEPATH
Definition: WM_api.h:755
@ FILE_OPENFILE
Definition: WM_api.h:764
@ FILE_SAVE
Definition: WM_api.h:765
#define ND_SEQUENCER
Definition: WM_types.h:385
@ KM_PRESS
Definition: WM_types.h:267
@ KM_RELEASE
Definition: WM_types.h:268
#define ND_SPACE_SEQUENCER
Definition: WM_types.h:478
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#define ND_RENDER_OPTIONS
Definition: WM_types.h:383
#define NC_SCENE
Definition: WM_types.h:328
#define ND_FRAME_RANGE
Definition: WM_types.h:399
#define ND_FRAME
Definition: WM_types.h:382
#define NA_REMOVED
Definition: WM_types.h:526
#define ND_SCENEBROWSE
Definition: WM_types.h:380
#define NC_SPACE
Definition: WM_types.h:342
void SEQ_offset_animdata(Scene *scene, Sequence *seq, int ofs)
Definition: animation.c:67
void SEQ_animation_backup_original(Scene *scene, ListBase *list)
Definition: animation.c:118
GSet * SEQ_fcurves_by_strip_get(const Sequence *seq, ListBase *fcurve_base)
Definition: animation.c:46
void SEQ_animation_duplicate(Scene *scene, Sequence *seq, ListBase *list)
Definition: animation.c:137
void SEQ_animation_restore_original(Scene *scene, ListBase *list)
Definition: animation.c:128
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
ListBase * SEQ_channels_displayed_get(Editing *ed)
Definition: channels.c:23
ListBase seqbase_clipboard
Definition: clipboard.c:45
void SEQ_clipboard_pointers_restore(ListBase *seqbase, Main *bmain)
Definition: clipboard.c:165
void SEQ_clipboard_active_seq_name_store(Scene *scene)
Definition: clipboard.c:174
bool SEQ_clipboard_pasted_seq_was_active(Sequence *pasted_seq)
Definition: clipboard.c:185
int seqbase_clipboard_frame
Definition: clipboard.c:47
ListBase fcurves_clipboard
Definition: clipboard.c:46
void SEQ_clipboard_pointers_store(Main *bmain, ListBase *seqbase)
Definition: clipboard.c:157
void SEQ_clipboard_free(void)
Definition: clipboard.c:52
#define SELECT
FILE * file
Scene scene
void * user_data
int len
Definition: draw_manager.c:108
struct SeqEffectHandle SEQ_effect_handle_get(Sequence *seq)
Definition: effects.c:3704
int SEQ_effect_get_num_inputs(int seq_type)
Definition: effects.c:3741
const vector< Marker > & markers
void SEQ_collection_free(SeqCollection *collection)
Definition: iterator.c:81
void SEQ_for_each_callback(ListBase *seqbase, SeqForEachFunc callback, void *user_data)
Definition: iterator.c:76
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
ccl_gpu_kernel_postfix ccl_global float int int int int sh
bAction * ED_id_action_ensure(Main *bmain, ID *id)
Definition: keyframing.c:123
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:28
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
static ulong * next
#define G(x, y, z)
static char * trim(char *str)
Definition: msgfmt.c:60
static unsigned a[3]
Definition: RandGen.cpp:78
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
static void area(int d1, int d2, int e1, int e2, float weights[2])
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken preview("preview", pxr::TfToken::Immortal)
void SEQ_prefetch_stop(Scene *scene)
Definition: prefetch.c:254
bool SEQ_render_is_muted(const ListBase *channels, const Sequence *seq)
Definition: render.c:2199
StripElem * SEQ_render_give_stripelem(const Scene *scene, Sequence *seq, int timeline_frame)
Definition: render.c:236
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:5155
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
Definition: rna_access.c:4874
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:4921
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
Definition: rna_access.c:4980
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2138
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
Definition: rna_access.c:5116
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4910
char * RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen, int *r_len)
Definition: rna_access.c:5129
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:5301
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:5015
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
Definition: rna_access.c:4992
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:3762
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
Definition: rna_access.c:3239
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3493
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3862
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3597
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
Definition: rna_define.c:3830
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3783
const EnumPropertyItem DummyRNA_NULL_items[]
Definition: rna_rna.c:26
const EnumPropertyItem rna_enum_strip_color_items[]
Definition: rna_sequencer.c:74
void SEQ_sequence_base_dupli_recursive(const Scene *scene_src, Scene *scene_dst, ListBase *nseqbase, const ListBase *seqbase, int dupe_flag, const int flag)
Definition: sequencer.c:613
ListBase * SEQ_active_seqbase_get(const Editing *ed)
Definition: sequencer.c:388
Sequence * SEQ_sequence_dupli_recursive(const Scene *scene_src, Scene *scene_dst, ListBase *new_seq_list, Sequence *seq, int dupe_flag)
Definition: sequencer.c:602
Editing * SEQ_editing_ensure(Scene *scene)
Definition: sequencer.c:246
void SEQ_meta_stack_set(const Scene *scene, Sequence *seqm)
Definition: sequencer.c:429
Sequence * SEQ_sequence_alloc(ListBase *lb, int timeline_frame, int machine, int type)
Definition: sequencer.c:113
Editing * SEQ_editing_get(const Scene *scene)
Definition: sequencer.c:241
Sequence * SEQ_meta_stack_pop(Editing *ed)
Definition: sequencer.c:453
void sequencer_image_seq_reserve_frames(wmOperator *op, StripElem *se, int len, int minframe, int numdigits)
int sequencer_image_seq_get_minmax_frame(wmOperator *op, int sfra, int *r_minframe, int *r_numdigits)
bool sequencer_view_preview_only_poll(const bContext *C)
bool ED_space_sequencer_check_show_strip(SpaceSeq *sseq)
static bool sequencer_strip_color_tag_set_poll(bContext *C)
int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequence **r_selseq1, Sequence **r_selseq2, Sequence **r_selseq3, const char **r_error_str)
static int sequencer_snap_exec(bContext *C, wmOperator *op)
static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
bool sequencer_strip_has_path_poll(bContext *C)
static int sequencer_change_scene_exec(bContext *C, wmOperator *op)
static int sequencer_mute_exec(bContext *C, wmOperator *op)
static void transseq_restore(TransSeq *ts, Sequence *seq)
static Sequence * find_next_prev_sequence(Scene *scene, Sequence *test, int lr, int sel)
void SEQUENCER_OT_strip_color_tag_set(struct wmOperatorType *ot)
static int slip_add_sequences_recursive(ListBase *seqbasep, Sequence **seq_array, bool *trim, int offset, bool do_trim)
void SEQUENCER_OT_copy(wmOperatorType *ot)
void SEQUENCER_OT_delete(wmOperatorType *ot)
bool ED_space_sequencer_check_show_imbuf(SpaceSeq *sseq)
void SEQUENCER_OT_rendersize(wmOperatorType *ot)
static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_unmute(struct wmOperatorType *ot)
void SEQUENCER_OT_snap(struct wmOperatorType *ot)
static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
EnumPropertyItem sequencer_prop_effect_types[]
void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot)
static int sequencer_delete_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void SEQUENCER_OT_gap_insert(struct wmOperatorType *ot)
void ED_sequencer_deselect_all(Scene *scene)
static void transseq_backup(TransSeq *ts, Sequence *seq)
static int sequencer_reload_exec(bContext *C, wmOperator *op)
bool ED_space_sequencer_maskedit_poll(bContext *C)
bool sequencer_view_has_preview_poll(bContext *C)
static int sequencer_slip_exec(bContext *C, wmOperator *op)
static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_mute(struct wmOperatorType *ot)
bool ED_space_sequencer_maskedit_mask_poll(bContext *C)
void SEQUENCER_OT_export_subtitles(struct wmOperatorType *ot)
static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *event)
static int sequencer_export_subtitles_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static int sequencer_paste_exec(bContext *C, wmOperator *op)
bool ED_space_sequencer_has_playback_animation(const struct SpaceSeq *sseq, const struct Scene *scene)
static int sequencer_change_path_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static void sequencer_delete_strip_data(bContext *C, Sequence *seq)
static int sequencer_strip_transform_clear_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_swap_data(wmOperatorType *ot)
static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op))
static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op))
static const EnumPropertyItem scale_fit_methods[]
static bool sequencer_refresh_all_poll(bContext *C)
void SEQUENCER_OT_slip(struct wmOperatorType *ot)
static bool sequencer_strip_change_scene_poll(bContext *C)
void SEQUENCER_OT_strip_transform_clear(struct wmOperatorType *ot)
static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
static int sequencer_slip_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void seq_copy_del_sound(Scene *scene, Sequence *seq)
struct Seq_get_text_cb_data Seq_get_text_cb_data
static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_images_separate(wmOperatorType *ot)
static void sequencer_split_ui(bContext *UNUSED(C), wmOperator *op)
static int sequencer_unmute_exec(bContext *C, wmOperator *op)
static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
static bool sequencer_fcurves_targets_color_strip(const FCurve *fcurve)
static int seq_cmp_time_startdisp_channel(void *thunk, const void *a, const void *b)
EnumPropertyItem prop_side_types[]
static bool sequencer_strip_is_text_poll(bContext *C)
static int sequencer_set_2d_cursor_exec(bContext *C, wmOperator *op)
static void sequencer_paste_animation(bContext *C)
static bool seq_get_text_strip_cb(Sequence *seq, void *user_data)
void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot)
void SEQUENCER_OT_offset_clear(wmOperatorType *ot)
static int sequencer_gap_insert_exec(bContext *C, wmOperator *op)
static int sequencer_strip_jump_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_gap_remove(struct wmOperatorType *ot)
static int sequencer_snap_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static bool strip_jump_internal(Scene *scene, const short side, const bool do_skip_mute, const bool do_center)
void SEQUENCER_OT_meta_make(wmOperatorType *ot)
void SEQUENCER_OT_split(struct wmOperatorType *ot)
static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
static int sequencer_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op)
static void sequencer_slip_apply_limits(const Scene *scene, SlipData *data, int *offset)
static int sequencer_change_scene_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void SEQUENCER_OT_unlock(struct wmOperatorType *ot)
void SEQUENCER_OT_duplicate(wmOperatorType *ot)
static bool sequencer_effect_poll(bContext *C)
void SEQUENCER_OT_set_range_to_strips(struct wmOperatorType *ot)
static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_lock(struct wmOperatorType *ot)
static int mouse_frame_side(View2D *v2d, short mouse_x, int frame)
static void sequencer_copy_animation(Scene *scene, Sequence *seq)
bool sequencer_edit_poll(bContext *C)
static bool sequencer_strip_jump_poll(bContext *C)
static int sequencer_strip_color_tag_set_exec(bContext *C, wmOperator *op)
struct SlipData SlipData
static bool seq_is_parent(Sequence *par, Sequence *seq)
static int slip_count_sequences_recursive(ListBase *seqbasep, bool first_level)
bool sequencer_view_strips_poll(bContext *C)
static void sequencer_slip_update_header(Scene *scene, ScrArea *area, SlipData *data, int offset)
bool sequencer_editing_initialized_and_active(bContext *C)
void SEQUENCER_OT_swap(wmOperatorType *ot)
static int sequencer_split_exec(bContext *C, wmOperator *op)
static int sequencer_change_path_exec(bContext *C, wmOperator *op)
static int sequencer_gap_remove_exec(bContext *C, wmOperator *op)
static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_paste(wmOperatorType *ot)
static int sequencer_set_range_to_strips_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_change_effect_input(struct wmOperatorType *ot)
void SEQUENCER_OT_meta_toggle(wmOperatorType *ot)
static const EnumPropertyItem prop_split_types[]
void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot)
void SEQUENCER_OT_change_path(struct wmOperatorType *ot)
void SEQUENCER_OT_change_scene(struct wmOperatorType *ot)
static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
struct TransSeq TransSeq
static const EnumPropertyItem prop_side_lr_types[]
static int sequencer_copy_exec(bContext *C, wmOperator *op)
bool ED_space_sequencer_check_show_maskedit(SpaceSeq *sseq, Scene *scene)
static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
static void sequencer_slip_recursively(Scene *scene, SlipData *data, int offset)
static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_cursor_set(wmOperatorType *ot)
static int sequencer_swap_exec(bContext *C, wmOperator *op)
static int sequencer_delete_exec(bContext *C, wmOperator *op)
static int sequencer_strip_transform_fit_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_strip_jump(wmOperatorType *ot)
static const EnumPropertyItem prop_change_effect_input_types[]
void SEQUENCER_OT_meta_separate(wmOperatorType *ot)
static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb)
void SEQUENCER_OT_strip_transform_fit(struct wmOperatorType *ot)
@ STRIP_TRANSFORM_ALL
@ STRIP_TRANSFORM_SCALE
@ STRIP_TRANSFORM_POSITION
@ STRIP_TRANSFORM_ROTATION
static const EnumPropertyItem transform_reset_properties[]
void SEQUENCER_OT_reload(struct wmOperatorType *ot)
static int sequencer_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot)
struct SeqCollection * selected_strips_from_context(struct bContext *C)
#define INT32_MAX
Definition: stdint.h:137
#define INT32_MIN
Definition: stdint.h:136
void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Sequence *seq, const bool lock_range)
Definition: strip_add.c:506
bool SEQ_edit_remove_gaps(Scene *scene, ListBase *seqbase, const int initial_frame, const bool remove_all_gaps)
Definition: strip_edit.c:490
void SEQ_edit_flag_for_removal(Scene *scene, ListBase *seqbase, Sequence *seq)
Definition: strip_edit.c:163
int SEQ_edit_sequence_swap(Scene *scene, Sequence *seq_a, Sequence *seq_b, const char **error_str)
Definition: strip_edit.c:40
Sequence * SEQ_edit_strip_split(Main *bmain, Scene *scene, ListBase *seqbase, Sequence *seq, const int timeline_frame, const eSeqSplitMethod method, const char **r_error)
Definition: strip_edit.c:409
void SEQ_edit_remove_flagged_sequences(Scene *scene, ListBase *seqbase)
Definition: strip_edit.c:180
bool SEQ_relations_render_loop_check(Sequence *seq_main, Sequence *seq)
void SEQ_relations_invalidate_cache_raw(Scene *scene, Sequence *seq)
void SEQ_relations_sequence_free_anim(Sequence *seq)
void SEQ_relations_invalidate_dependent(Scene *scene, Sequence *seq)
void SEQ_relations_free_imbuf(Scene *scene, ListBase *seqbase, bool for_render)
void SEQ_relations_invalidate_cache_preprocessed(Scene *scene, Sequence *seq)
Sequence * SEQ_select_active_get(Scene *scene)
Definition: strip_select.c:18
int SEQ_select_active_get_pair(Scene *scene, Sequence **r_seq_act, Sequence **r_seq_other)
Definition: strip_select.c:40
void SEQ_select_active_set(Scene *scene, Sequence *seq)
Definition: strip_select.c:29
void SEQ_time_right_handle_frame_set(const Scene *scene, Sequence *seq, int val)
Definition: strip_time.c:539
int SEQ_time_left_handle_frame_get(const Scene *UNUSED(scene), const Sequence *seq)
Definition: strip_time.c:506
void SEQ_time_left_handle_frame_set(const Scene *scene, Sequence *seq, int val)
Definition: strip_time.c:524
int SEQ_time_find_next_prev_edit(Scene *scene, int timeline_frame, const short side, const bool do_skip_mute, const bool do_center, const bool do_unselected)
Definition: strip_time.c:235
float SEQ_time_start_frame_get(const Sequence *seq)
Definition: strip_time.c:494
int SEQ_time_right_handle_frame_get(const Scene *scene, const Sequence *seq)
Definition: strip_time.c:515
bool SEQ_transform_seqbase_isolated_sel_check(ListBase *seqbase)
bool SEQ_transform_seqbase_shuffle(ListBase *seqbasep, Sequence *test, Scene *evil_scene)
bool SEQ_transform_is_locked(ListBase *channels, Sequence *seq)
bool SEQ_transform_test_overlap(const Scene *scene, ListBase *seqbasep, Sequence *test)
void SEQ_transform_fix_single_image_seq_offsets(const Scene *scene, Sequence *seq)
bool SEQ_transform_sequence_can_be_translated(Sequence *seq)
void SEQ_transform_translate_sequence(Scene *evil_scene, Sequence *seq, int delta)
void SEQ_image_preview_unit_from_px(const Scene *scene, const float co_src[2], float co_dst[2])
void SEQ_transform_offset_after_frame(Scene *scene, ListBase *seqbase, const int delta, const int timeline_frame)
short regiontype
bAction * action
ListBase seqbase
ListBase * seqbasep
Sequence * act_seq
ListBase metastack
char * rna_path
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
ListBase scenes
Definition: BKE_main.h:168
struct RenderData r
struct AnimData * adt
struct UnitSettings unit
ListBase markers
struct Scene * scene
struct Sequence * seq3
void * scene_sound
ListBase seqbase
struct bSound * sound
struct Sequence * seq1
struct Sequence * seq2
struct Sequence * next
int init_mouse[2]
bool * trim
float init_mouseloc[2]
NumInput num_input
TransSeq * ts
Sequence ** seq_array
float cursor[2]
char name[256]
StripTransform * transform
StripElem * stripdata
char dir[768]
int anim_endofs
int anim_startofs
float content_start
ListBase curves
char filepath[1024]
short val
Definition: WM_types.h:680
int mval[2]
Definition: WM_types.h:684
short type
Definition: WM_types.h:678
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:935
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
struct StructRNA * srna
Definition: WM_types.h:969
const char * description
Definition: WM_types.h:893
void(* ui)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:954
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
PropertyRNA * prop
Definition: WM_types.h:981
struct ReportList * reports
struct uiLayout * layout
struct PointerRNA * ptr
Mask * SEQ_active_mask_get(Scene *scene)
Definition: utils.c:440
void SEQ_set_scale_to_fit(const Sequence *seq, const int image_width, const int image_height, const int preview_width, const int preview_height, const eSeqImageFitMethod fit_method)
Definition: utils.c:492
void SEQ_sequence_base_unique_name_recursive(struct Scene *scene, ListBase *seqbasep, Sequence *seq)
Definition: utils.c:78
void SEQ_ensure_unique_name(Sequence *seq, Scene *scene)
Definition: utils.c:523
#define N_(msgid)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
@ RIGHTMOUSE
@ EVT_SPACEKEY
@ MOUSEMOVE
@ LEFTMOUSE
@ EVT_ESCKEY
@ EVT_RIGHTSHIFTKEY
@ EVT_LEFTSHIFTKEY
@ EVT_RETKEY
wmOperatorType * ot
Definition: wm_files.c:3479
void WM_operator_properties_filesel(wmOperatorType *ot, const int filter, const short type, const eFileSel_Action action, const eFileSel_Flag flag, const short display, const short sort)
int WM_operator_props_popup_confirm(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
int WM_enum_search_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))