Blender  V3.3
rna_sequencer_api.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <string.h>
10 
11 #include "DNA_scene_types.h"
12 #include "DNA_sequence_types.h"
13 
14 #include "BLI_utildefines.h"
15 
16 #include "RNA_access.h"
17 #include "RNA_define.h"
18 
19 #include "SEQ_edit.h"
20 
21 #include "rna_internal.h"
22 
23 #ifdef RNA_RUNTIME
24 
25 //#include "DNA_anim_types.h"
26 # include "DNA_image_types.h"
27 # include "DNA_mask_types.h"
28 # include "DNA_sound_types.h"
29 
30 # include "BLI_path_util.h" /* BLI_split_dirfile */
31 
32 # include "BKE_image.h"
33 # include "BKE_mask.h"
34 # include "BKE_movieclip.h"
35 
36 # include "BKE_report.h"
37 # include "BKE_sound.h"
38 
39 # include "IMB_imbuf.h"
40 # include "IMB_imbuf_types.h"
41 
42 # include "SEQ_add.h"
43 # include "SEQ_edit.h"
44 # include "SEQ_effects.h"
45 # include "SEQ_relations.h"
46 # include "SEQ_render.h"
47 # include "SEQ_sequencer.h"
48 # include "SEQ_time.h"
49 
50 # include "WM_api.h"
51 
52 static StripElem *rna_Sequence_strip_elem_from_frame(ID *id, Sequence *self, int timeline_frame)
53 {
54  Scene *scene = (Scene *)id;
55  return SEQ_render_give_stripelem(scene, self, timeline_frame);
56 }
57 
58 static void rna_Sequence_swap_internal(ID *id,
59  Sequence *seq_self,
60  ReportList *reports,
61  Sequence *seq_other)
62 {
63  const char *error_msg;
64  Scene *scene = (Scene *)id;
65 
66  if (SEQ_edit_sequence_swap(scene, seq_self, seq_other, &error_msg) == 0) {
67  BKE_report(reports, RPT_ERROR, error_msg);
68  }
69 }
70 
71 static void rna_Sequences_move_strip_to_meta(
72  ID *id, Sequence *seq_self, Main *bmain, ReportList *reports, Sequence *meta_dst)
73 {
74  Scene *scene = (Scene *)id;
75  const char *error_msg;
76 
77  /* Move strip to meta. */
78  if (!SEQ_edit_move_strip_to_meta(scene, seq_self, meta_dst, &error_msg)) {
79  BKE_report(reports, RPT_ERROR, error_msg);
80  }
81 
82  /* Update depsgraph. */
85 
87 }
88 
89 static Sequence *rna_Sequence_split(
90  ID *id, Sequence *seq, Main *bmain, ReportList *reports, int frame, int split_method)
91 {
92  Scene *scene = (Scene *)id;
93  ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, seq);
94 
95  const char *error_msg = NULL;
97  bmain, scene, seqbase, seq, frame, split_method, &error_msg);
98  if (error_msg != NULL) {
99  BKE_report(reports, RPT_ERROR, error_msg);
100  }
101 
102  /* Update depsgraph. */
105 
107 
108  return r_seq;
109 }
110 
111 static Sequence *rna_Sequence_parent_meta(ID *id, Sequence *seq_self)
112 {
113  Scene *scene = (Scene *)id;
115 
116  return SEQ_find_metastrip_by_sequence(&ed->seqbase, NULL, seq_self);
117 }
118 
119 static Sequence *rna_Sequences_new_clip(ID *id,
120  ListBase *seqbase,
121  Main *bmain,
122  const char *name,
123  MovieClip *clip,
124  int channel,
125  int frame_start)
126 {
127  Scene *scene = (Scene *)id;
128  SeqLoadData load_data;
129  SEQ_add_load_data_init(&load_data, name, NULL, frame_start, channel);
130  load_data.clip = clip;
131  Sequence *seq = SEQ_add_movieclip_strip(scene, seqbase, &load_data);
132 
136 
137  return seq;
138 }
139 
140 static Sequence *rna_Sequences_editing_new_clip(ID *id,
141  Editing *ed,
142  Main *bmain,
143  const char *name,
144  MovieClip *clip,
145  int channel,
146  int frame_start)
147 {
148  return rna_Sequences_new_clip(id, &ed->seqbase, bmain, name, clip, channel, frame_start);
149 }
150 
151 static Sequence *rna_Sequences_meta_new_clip(ID *id,
152  Sequence *seq,
153  Main *bmain,
154  const char *name,
155  MovieClip *clip,
156  int channel,
157  int frame_start)
158 {
159  return rna_Sequences_new_clip(id, &seq->seqbase, bmain, name, clip, channel, frame_start);
160 }
161 
162 static Sequence *rna_Sequences_new_mask(ID *id,
163  ListBase *seqbase,
164  Main *bmain,
165  const char *name,
166  Mask *mask,
167  int channel,
168  int frame_start)
169 {
170  Scene *scene = (Scene *)id;
171  SeqLoadData load_data;
172  SEQ_add_load_data_init(&load_data, name, NULL, frame_start, channel);
173  load_data.mask = mask;
174  Sequence *seq = SEQ_add_mask_strip(scene, seqbase, &load_data);
175 
179 
180  return seq;
181 }
182 static Sequence *rna_Sequences_editing_new_mask(
183  ID *id, Editing *ed, Main *bmain, const char *name, Mask *mask, int channel, int frame_start)
184 {
185  return rna_Sequences_new_mask(id, &ed->seqbase, bmain, name, mask, channel, frame_start);
186 }
187 
188 static Sequence *rna_Sequences_meta_new_mask(
189  ID *id, Sequence *seq, Main *bmain, const char *name, Mask *mask, int channel, int frame_start)
190 {
191  return rna_Sequences_new_mask(id, &seq->seqbase, bmain, name, mask, channel, frame_start);
192 }
193 
194 static Sequence *rna_Sequences_new_scene(ID *id,
195  ListBase *seqbase,
196  Main *bmain,
197  const char *name,
198  Scene *sce_seq,
199  int channel,
200  int frame_start)
201 {
202  Scene *scene = (Scene *)id;
203  SeqLoadData load_data;
204  SEQ_add_load_data_init(&load_data, name, NULL, frame_start, channel);
205  load_data.scene = sce_seq;
206  Sequence *seq = SEQ_add_scene_strip(scene, seqbase, &load_data);
207 
211 
212  return seq;
213 }
214 
215 static Sequence *rna_Sequences_editing_new_scene(ID *id,
216  Editing *ed,
217  Main *bmain,
218  const char *name,
219  Scene *sce_seq,
220  int channel,
221  int frame_start)
222 {
223  return rna_Sequences_new_scene(id, &ed->seqbase, bmain, name, sce_seq, channel, frame_start);
224 }
225 
226 static Sequence *rna_Sequences_meta_new_scene(ID *id,
227  Sequence *seq,
228  Main *bmain,
229  const char *name,
230  Scene *sce_seq,
231  int channel,
232  int frame_start)
233 {
234  return rna_Sequences_new_scene(id, &seq->seqbase, bmain, name, sce_seq, channel, frame_start);
235 }
236 
237 static Sequence *rna_Sequences_new_image(ID *id,
238  ListBase *seqbase,
239  Main *bmain,
240  ReportList *UNUSED(reports),
241  const char *name,
242  const char *file,
243  int channel,
244  int frame_start,
245  int fit_method)
246 {
247  Scene *scene = (Scene *)id;
248 
249  SeqLoadData load_data;
250  SEQ_add_load_data_init(&load_data, name, file, frame_start, channel);
251  load_data.image.len = 1;
252  load_data.fit_method = fit_method;
253  Sequence *seq = SEQ_add_image_strip(bmain, scene, seqbase, &load_data);
254 
255  char dir[FILE_MAX], filename[FILE_MAX];
256  BLI_split_dirfile(file, dir, filename, sizeof(dir), sizeof(filename));
257  SEQ_add_image_set_directory(seq, dir);
258  SEQ_add_image_load_file(scene, seq, 0, filename);
260 
264 
265  return seq;
266 }
267 
268 static Sequence *rna_Sequences_editing_new_image(ID *id,
269  Editing *ed,
270  Main *bmain,
271  ReportList *reports,
272  const char *name,
273  const char *file,
274  int channel,
275  int frame_start,
276  int fit_method)
277 {
278  return rna_Sequences_new_image(
279  id, &ed->seqbase, bmain, reports, name, file, channel, frame_start, fit_method);
280 }
281 
282 static Sequence *rna_Sequences_meta_new_image(ID *id,
283  Sequence *seq,
284  Main *bmain,
285  ReportList *reports,
286  const char *name,
287  const char *file,
288  int channel,
289  int frame_start,
290  int fit_method)
291 {
292  return rna_Sequences_new_image(
293  id, &seq->seqbase, bmain, reports, name, file, channel, frame_start, fit_method);
294 }
295 
296 static Sequence *rna_Sequences_new_movie(ID *id,
297  ListBase *seqbase,
298  Main *bmain,
299  const char *name,
300  const char *file,
301  int channel,
302  int frame_start,
303  int fit_method)
304 {
305  Scene *scene = (Scene *)id;
306  SeqLoadData load_data;
307  SEQ_add_load_data_init(&load_data, name, file, frame_start, channel);
308  load_data.fit_method = fit_method;
309  load_data.allow_invalid_file = true;
310  Sequence *seq = SEQ_add_movie_strip(bmain, scene, seqbase, &load_data);
311 
315 
316  return seq;
317 }
318 
319 static Sequence *rna_Sequences_editing_new_movie(ID *id,
320  Editing *ed,
321  Main *bmain,
322  const char *name,
323  const char *file,
324  int channel,
325  int frame_start,
326  int fit_method)
327 {
328  return rna_Sequences_new_movie(
329  id, &ed->seqbase, bmain, name, file, channel, frame_start, fit_method);
330 }
331 
332 static Sequence *rna_Sequences_meta_new_movie(ID *id,
333  Sequence *seq,
334  Main *bmain,
335  const char *name,
336  const char *file,
337  int channel,
338  int frame_start,
339  int fit_method)
340 {
341  return rna_Sequences_new_movie(
342  id, &seq->seqbase, bmain, name, file, channel, frame_start, fit_method);
343 }
344 
345 # ifdef WITH_AUDASPACE
346 static Sequence *rna_Sequences_new_sound(ID *id,
347  ListBase *seqbase,
348  Main *bmain,
349  ReportList *reports,
350  const char *name,
351  const char *file,
352  int channel,
353  int frame_start)
354 {
355  Scene *scene = (Scene *)id;
356  SeqLoadData load_data;
357  SEQ_add_load_data_init(&load_data, name, file, frame_start, channel);
358  load_data.allow_invalid_file = true;
359  Sequence *seq = SEQ_add_sound_strip(bmain, scene, seqbase, &load_data);
360 
361  if (seq == NULL) {
362  BKE_report(reports, RPT_ERROR, "Sequences.new_sound: unable to open sound file");
363  return NULL;
364  }
365 
369 
370  return seq;
371 }
372 # else /* WITH_AUDASPACE */
373 static Sequence *rna_Sequences_new_sound(ID *UNUSED(id),
374  ListBase *UNUSED(seqbase),
375  Main *UNUSED(bmain),
376  ReportList *reports,
377  const char *UNUSED(name),
378  const char *UNUSED(file),
379  int UNUSED(channel),
380  int UNUSED(frame_start))
381 {
382  BKE_report(reports, RPT_ERROR, "Blender compiled without Audaspace support");
383  return NULL;
384 }
385 # endif /* WITH_AUDASPACE */
386 
387 static Sequence *rna_Sequences_editing_new_sound(ID *id,
388  Editing *ed,
389  Main *bmain,
390  ReportList *reports,
391  const char *name,
392  const char *file,
393  int channel,
394  int frame_start)
395 {
396  return rna_Sequences_new_sound(
397  id, &ed->seqbase, bmain, reports, name, file, channel, frame_start);
398 }
399 
400 static Sequence *rna_Sequences_meta_new_sound(ID *id,
401  Sequence *seq,
402  Main *bmain,
403  ReportList *reports,
404  const char *name,
405  const char *file,
406  int channel,
407  int frame_start)
408 {
409  return rna_Sequences_new_sound(
410  id, &seq->seqbase, bmain, reports, name, file, channel, frame_start);
411 }
412 
413 /* Meta sequence
414  * Possibility to create an empty meta to avoid plenty of meta toggling
415  * Created meta have a length equal to 1, must be set through the API. */
416 static Sequence *rna_Sequences_new_meta(
417  ID *id, ListBase *seqbase, const char *name, int channel, int frame_start)
418 {
419  Scene *scene = (Scene *)id;
420  SeqLoadData load_data;
421  SEQ_add_load_data_init(&load_data, name, NULL, frame_start, channel);
422  Sequence *seqm = SEQ_add_meta_strip(scene, seqbase, &load_data);
423 
424  return seqm;
425 }
426 
427 static Sequence *rna_Sequences_editing_new_meta(
428  ID *id, Editing *ed, const char *name, int channel, int frame_start)
429 {
430  return rna_Sequences_new_meta(id, &ed->seqbase, name, channel, frame_start);
431 }
432 
433 static Sequence *rna_Sequences_meta_new_meta(
434  ID *id, Sequence *seq, const char *name, int channel, int frame_start)
435 {
436  return rna_Sequences_new_meta(id, &seq->seqbase, name, channel, frame_start);
437 }
438 
439 static Sequence *rna_Sequences_new_effect(ID *id,
440  ListBase *seqbase,
441  ReportList *reports,
442  const char *name,
443  int type,
444  int channel,
445  int frame_start,
446  int frame_end,
447  Sequence *seq1,
448  Sequence *seq2,
449  Sequence *seq3)
450 {
451  Scene *scene = (Scene *)id;
452  Sequence *seq;
453  const int num_inputs = SEQ_effect_get_num_inputs(type);
454 
455  switch (num_inputs) {
456  case 0:
457  if (frame_end <= frame_start) {
458  BKE_report(reports, RPT_ERROR, "Sequences.new_effect: end frame not set");
459  return NULL;
460  }
461  break;
462  case 1:
463  if (seq1 == NULL) {
464  BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 1 input sequence");
465  return NULL;
466  }
467  break;
468  case 2:
469  if (seq1 == NULL || seq2 == NULL) {
470  BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 2 input sequences");
471  return NULL;
472  }
473  break;
474  case 3:
475  if (seq1 == NULL || seq2 == NULL || seq3 == NULL) {
476  BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 3 input sequences");
477  return NULL;
478  }
479  break;
480  default:
481  BKE_reportf(
482  reports,
483  RPT_ERROR,
484  "Sequences.new_effect: effect expects more than 3 inputs (%d, should never happen!)",
485  num_inputs);
486  return NULL;
487  }
488 
489  SeqLoadData load_data;
490  SEQ_add_load_data_init(&load_data, name, NULL, frame_start, channel);
491  load_data.effect.end_frame = frame_end;
492  load_data.effect.type = type;
493  load_data.effect.seq1 = seq1;
494  load_data.effect.seq2 = seq2;
495  load_data.effect.seq3 = seq3;
496  seq = SEQ_add_effect_strip(scene, seqbase, &load_data);
497 
500 
501  return seq;
502 }
503 
504 static Sequence *rna_Sequences_editing_new_effect(ID *id,
505  Editing *ed,
506  ReportList *reports,
507  const char *name,
508  int type,
509  int channel,
510  int frame_start,
511  int frame_end,
512  Sequence *seq1,
513  Sequence *seq2,
514  Sequence *seq3)
515 {
516  return rna_Sequences_new_effect(
517  id, &ed->seqbase, reports, name, type, channel, frame_start, frame_end, seq1, seq2, seq3);
518 }
519 
520 static Sequence *rna_Sequences_meta_new_effect(ID *id,
521  Sequence *seq,
522  ReportList *reports,
523  const char *name,
524  int type,
525  int channel,
526  int frame_start,
527  int frame_end,
528  Sequence *seq1,
529  Sequence *seq2,
530  Sequence *seq3)
531 {
532  return rna_Sequences_new_effect(
533  id, &seq->seqbase, reports, name, type, channel, frame_start, frame_end, seq1, seq2, seq3);
534 }
535 
536 static void rna_Sequences_remove(
537  ID *id, ListBase *seqbase, Main *bmain, ReportList *reports, PointerRNA *seq_ptr)
538 {
539  Sequence *seq = seq_ptr->data;
540  Scene *scene = (Scene *)id;
541 
542  if (BLI_findindex(seqbase, seq) == -1) {
543  BKE_reportf(
544  reports, RPT_ERROR, "Sequence '%s' not in scene '%s'", seq->name + 2, scene->id.name + 2);
545  return;
546  }
547 
548  SEQ_edit_flag_for_removal(scene, seqbase, seq);
550  RNA_POINTER_INVALIDATE(seq_ptr);
551 
555 }
556 
557 static void rna_Sequences_editing_remove(
558  ID *id, Editing *ed, Main *bmain, ReportList *reports, PointerRNA *seq_ptr)
559 {
560  rna_Sequences_remove(id, &ed->seqbase, bmain, reports, seq_ptr);
561 }
562 
563 static void rna_Sequences_meta_remove(
564  ID *id, Sequence *seq, Main *bmain, ReportList *reports, PointerRNA *seq_ptr)
565 {
566  rna_Sequences_remove(id, &seq->seqbase, bmain, reports, seq_ptr);
567 }
568 
569 static StripElem *rna_SequenceElements_append(ID *id, Sequence *seq, const char *filename)
570 {
571  Scene *scene = (Scene *)id;
572  StripElem *se;
573 
574  seq->strip->stripdata = se = MEM_reallocN(seq->strip->stripdata,
575  sizeof(StripElem) * (seq->len + 1));
576  se += seq->len;
577  BLI_strncpy(se->name, filename, sizeof(se->name));
578  seq->len++;
579 
581 
582  return se;
583 }
584 
585 static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports, int index)
586 {
587  Scene *scene = (Scene *)id;
588  StripElem *new_seq, *se;
589 
590  if (seq->len == 1) {
591  BKE_report(reports, RPT_ERROR, "SequenceElements.pop: cannot pop the last element");
592  return;
593  }
594 
595  /* python style negative indexing */
596  if (index < 0) {
597  index += seq->len;
598  }
599 
600  if (seq->len <= index || index < 0) {
601  BKE_report(reports, RPT_ERROR, "SequenceElements.pop: index out of range");
602  return;
603  }
604 
605  new_seq = MEM_callocN(sizeof(StripElem) * (seq->len - 1), "SequenceElements_pop");
606  seq->len--;
607 
608  se = seq->strip->stripdata;
609  if (index > 0) {
610  memcpy(new_seq, se, sizeof(StripElem) * index);
611  }
612 
613  if (index < seq->len) {
614  memcpy(&new_seq[index], &se[index + 1], sizeof(StripElem) * (seq->len - index));
615  }
616 
617  MEM_freeN(seq->strip->stripdata);
618  seq->strip->stripdata = new_seq;
619 
621 }
622 
623 static void rna_Sequence_invalidate_cache_rnafunc(ID *id, Sequence *self, int type)
624 {
625  switch (type) {
626  case SEQ_CACHE_STORE_RAW:
628  break;
631  break;
634  break;
635  }
636 }
637 
638 #else
639 
641 {
642  FunctionRNA *func;
643  PropertyRNA *parm;
644 
645  static const EnumPropertyItem seq_cahce_type_items[] = {
646  {SEQ_CACHE_STORE_RAW, "RAW", 0, "Raw", ""},
647  {SEQ_CACHE_STORE_PREPROCESSED, "PREPROCESSED", 0, "Preprocessed", ""},
648  {SEQ_CACHE_STORE_COMPOSITE, "COMPOSITE", 0, "Composite", ""},
649  {0, NULL, 0, NULL, NULL},
650  };
651 
652  static const EnumPropertyItem seq_split_method_items[] = {
653  {SEQ_SPLIT_SOFT, "SOFT", 0, "Soft", ""},
654  {SEQ_SPLIT_HARD, "HARD", 0, "Hard", ""},
655  {0, NULL, 0, NULL, NULL},
656  };
657 
658  func = RNA_def_function(srna, "strip_elem_from_frame", "rna_Sequence_strip_elem_from_frame");
660  RNA_def_function_ui_description(func, "Return the strip element from a given frame or None");
661  parm = RNA_def_int(func,
662  "frame",
663  0,
664  -MAXFRAME,
665  MAXFRAME,
666  "Frame",
667  "The frame to get the strip element from",
668  -MAXFRAME,
669  MAXFRAME);
672  func,
673  RNA_def_pointer(func, "elem", "SequenceElement", "", "strip element of the current frame"));
674 
675  func = RNA_def_function(srna, "swap", "rna_Sequence_swap_internal");
678  parm = RNA_def_pointer(func, "other", "Sequence", "Other", "");
680 
681  func = RNA_def_function(srna, "move_to_meta", "rna_Sequences_move_strip_to_meta");
683  parm = RNA_def_pointer(func,
684  "meta_sequence",
685  "Sequence",
686  "Destination Meta Sequence",
687  "Meta to move the strip into");
689 
690  func = RNA_def_function(srna, "parent_meta", "rna_Sequence_parent_meta");
692  RNA_def_function_ui_description(func, "Parent meta");
693  /* return type */
694  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "Parent Meta");
695  RNA_def_function_return(func, parm);
696 
697  func = RNA_def_function(srna, "invalidate_cache", "rna_Sequence_invalidate_cache_rnafunc");
700  "Invalidate cached images for strip and all dependent strips");
701  parm = RNA_def_enum(func, "type", seq_cahce_type_items, 0, "Type", "Cache Type");
703 
704  func = RNA_def_function(srna, "split", "rna_Sequence_split");
706  RNA_def_function_ui_description(func, "Split Sequence");
707  parm = RNA_def_int(
708  func, "frame", 0, INT_MIN, INT_MAX, "", "Frame where to split the strip", INT_MIN, INT_MAX);
710  parm = RNA_def_enum(func, "split_method", seq_split_method_items, 0, "", "");
712  /* Return type. */
713  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "Right side Sequence");
714  RNA_def_function_return(func, parm);
715 }
716 
718 {
719  StructRNA *srna;
720  PropertyRNA *parm;
721  FunctionRNA *func;
722 
723  RNA_def_property_srna(cprop, "SequenceElements");
724  srna = RNA_def_struct(brna, "SequenceElements", NULL);
725  RNA_def_struct_sdna(srna, "Sequence");
726  RNA_def_struct_ui_text(srna, "SequenceElements", "Collection of SequenceElement");
727 
728  func = RNA_def_function(srna, "append", "rna_SequenceElements_append");
730  RNA_def_function_ui_description(func, "Push an image from ImageSequence.directory");
731  parm = RNA_def_string(func, "filename", "File", 0, "", "Filepath to image");
733  /* return type */
734  parm = RNA_def_pointer(func, "elem", "SequenceElement", "", "New SequenceElement");
735  RNA_def_function_return(func, parm);
736 
737  func = RNA_def_function(srna, "pop", "rna_SequenceElements_pop");
739  RNA_def_function_ui_description(func, "Pop an image off the collection");
740  parm = RNA_def_int(
741  func, "index", -1, INT_MIN, INT_MAX, "", "Index of image to remove", INT_MIN, INT_MAX);
743 }
744 
745 void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, const bool metastrip)
746 {
747  StructRNA *srna;
748  PropertyRNA *parm;
749  FunctionRNA *func;
750 
751  static const EnumPropertyItem seq_effect_items[] = {
752  {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""},
753  {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
754  {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
755  {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
756  {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
757  {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
758  {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
759  {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
760  {SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", ""},
761  {SEQ_TYPE_GLOW, "GLOW", 0, "Glow", ""},
762  {SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
763  {SEQ_TYPE_COLOR, "COLOR", 0, "Color", ""},
764  {SEQ_TYPE_SPEED, "SPEED", 0, "Speed", ""},
765  {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
766  {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
767  {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
768  {SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
769  {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
770  {0, NULL, 0, NULL, NULL},
771  };
772 
773  static const EnumPropertyItem scale_fit_methods[] = {
774  {SEQ_SCALE_TO_FIT, "FIT", 0, "Scale to Fit", "Scale image so fits in preview"},
776  "FILL",
777  0,
778  "Scale to Fill",
779  "Scale image so it fills preview completely"},
780  {SEQ_STRETCH_TO_FILL, "STRETCH", 0, "Stretch to Fill", "Stretch image so it fills preview"},
781  {SEQ_USE_ORIGINAL_SIZE, "ORIGINAL", 0, "Use Original Size", "Don't scale the image"},
782  {0, NULL, 0, NULL, NULL},
783  };
784 
785  const char *new_clip_func_name = "rna_Sequences_editing_new_clip";
786  const char *new_mask_func_name = "rna_Sequences_editing_new_mask";
787  const char *new_scene_func_name = "rna_Sequences_editing_new_scene";
788  const char *new_image_func_name = "rna_Sequences_editing_new_image";
789  const char *new_movie_func_name = "rna_Sequences_editing_new_movie";
790  const char *new_sound_func_name = "rna_Sequences_editing_new_sound";
791  const char *new_meta_func_name = "rna_Sequences_editing_new_meta";
792  const char *new_effect_func_name = "rna_Sequences_editing_new_effect";
793  const char *remove_func_name = "rna_Sequences_editing_remove";
794 
795  if (metastrip) {
796  RNA_def_property_srna(cprop, "SequencesMeta");
797  srna = RNA_def_struct(brna, "SequencesMeta", NULL);
798  RNA_def_struct_sdna(srna, "Sequence");
799 
800  new_clip_func_name = "rna_Sequences_meta_new_clip";
801  new_mask_func_name = "rna_Sequences_meta_new_mask";
802  new_scene_func_name = "rna_Sequences_meta_new_scene";
803  new_image_func_name = "rna_Sequences_meta_new_image";
804  new_movie_func_name = "rna_Sequences_meta_new_movie";
805  new_sound_func_name = "rna_Sequences_meta_new_sound";
806  new_meta_func_name = "rna_Sequences_meta_new_meta";
807  new_effect_func_name = "rna_Sequences_meta_new_effect";
808  remove_func_name = "rna_Sequences_meta_remove";
809  }
810  else {
811  RNA_def_property_srna(cprop, "SequencesTopLevel");
812  srna = RNA_def_struct(brna, "SequencesTopLevel", NULL);
813  RNA_def_struct_sdna(srna, "Editing");
814  }
815 
816  RNA_def_struct_ui_text(srna, "Sequences", "Collection of Sequences");
817 
818  func = RNA_def_function(srna, "new_clip", new_clip_func_name);
820  RNA_def_function_ui_description(func, "Add a new movie clip sequence");
821  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
823  parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to add");
825  parm = RNA_def_int(
826  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
828  parm = RNA_def_int(func,
829  "frame_start",
830  0,
831  -MAXFRAME,
832  MAXFRAME,
833  "",
834  "The start frame for the new sequence",
835  -MAXFRAME,
836  MAXFRAME);
838  /* return type */
839  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
840  RNA_def_function_return(func, parm);
841 
842  func = RNA_def_function(srna, "new_mask", new_mask_func_name);
844  RNA_def_function_ui_description(func, "Add a new mask sequence");
845  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
847  parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to add");
849  parm = RNA_def_int(
850  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
852  parm = RNA_def_int(func,
853  "frame_start",
854  0,
855  -MAXFRAME,
856  MAXFRAME,
857  "",
858  "The start frame for the new sequence",
859  -MAXFRAME,
860  MAXFRAME);
862  /* return type */
863  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
864  RNA_def_function_return(func, parm);
865 
866  func = RNA_def_function(srna, "new_scene", new_scene_func_name);
868  RNA_def_function_ui_description(func, "Add a new scene sequence");
869  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
871  parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to add");
873  parm = RNA_def_int(
874  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
876  parm = RNA_def_int(func,
877  "frame_start",
878  0,
879  -MAXFRAME,
880  MAXFRAME,
881  "",
882  "The start frame for the new sequence",
883  -MAXFRAME,
884  MAXFRAME);
886  /* return type */
887  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
888  RNA_def_function_return(func, parm);
889 
890  func = RNA_def_function(srna, "new_image", new_image_func_name);
892  RNA_def_function_ui_description(func, "Add a new image sequence");
893  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
895  parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to image");
897  parm = RNA_def_int(
898  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
900  parm = RNA_def_int(func,
901  "frame_start",
902  0,
903  -MAXFRAME,
904  MAXFRAME,
905  "",
906  "The start frame for the new sequence",
907  -MAXFRAME,
908  MAXFRAME);
910  parm = RNA_def_enum(
911  func, "fit_method", scale_fit_methods, SEQ_USE_ORIGINAL_SIZE, "Image Fit Method", NULL);
913  /* return type */
914  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
915  RNA_def_function_return(func, parm);
916 
917  func = RNA_def_function(srna, "new_movie", new_movie_func_name);
919  RNA_def_function_ui_description(func, "Add a new movie sequence");
920  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
922  parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
924  parm = RNA_def_int(
925  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
927  parm = RNA_def_int(func,
928  "frame_start",
929  0,
930  -MAXFRAME,
931  MAXFRAME,
932  "",
933  "The start frame for the new sequence",
934  -MAXFRAME,
935  MAXFRAME);
937  parm = RNA_def_enum(
938  func, "fit_method", scale_fit_methods, SEQ_USE_ORIGINAL_SIZE, "Image Fit Method", NULL);
940  /* return type */
941  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
942  RNA_def_function_return(func, parm);
943 
944  func = RNA_def_function(srna, "new_sound", new_sound_func_name);
946  RNA_def_function_ui_description(func, "Add a new sound sequence");
947  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
949  parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
951  parm = RNA_def_int(
952  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
954  parm = RNA_def_int(func,
955  "frame_start",
956  0,
957  -MAXFRAME,
958  MAXFRAME,
959  "",
960  "The start frame for the new sequence",
961  -MAXFRAME,
962  MAXFRAME);
964  /* return type */
965  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
966  RNA_def_function_return(func, parm);
967 
968  func = RNA_def_function(srna, "new_meta", new_meta_func_name);
970  RNA_def_function_ui_description(func, "Add a new meta sequence");
971  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
973  parm = RNA_def_int(
974  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
976  parm = RNA_def_int(func,
977  "frame_start",
978  0,
979  -MAXFRAME,
980  MAXFRAME,
981  "",
982  "The start frame for the new sequence",
983  -MAXFRAME,
984  MAXFRAME);
986  /* return type */
987  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
988  RNA_def_function_return(func, parm);
989 
990  func = RNA_def_function(srna, "new_effect", new_effect_func_name);
992  RNA_def_function_ui_description(func, "Add a new effect sequence");
993  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
995  parm = RNA_def_enum(func, "type", seq_effect_items, 0, "Type", "type for the new sequence");
997  parm = RNA_def_int(
998  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
999  /* don't use MAXFRAME since it makes importer scripts fail */
1001  parm = RNA_def_int(func,
1002  "frame_start",
1003  0,
1004  INT_MIN,
1005  INT_MAX,
1006  "",
1007  "The start frame for the new sequence",
1008  INT_MIN,
1009  INT_MAX);
1011  RNA_def_int(func,
1012  "frame_end",
1013  0,
1014  INT_MIN,
1015  INT_MAX,
1016  "",
1017  "The end frame for the new sequence",
1018  INT_MIN,
1019  INT_MAX);
1020  RNA_def_pointer(func, "seq1", "Sequence", "", "Sequence 1 for effect");
1021  RNA_def_pointer(func, "seq2", "Sequence", "", "Sequence 2 for effect");
1022  RNA_def_pointer(func, "seq3", "Sequence", "", "Sequence 3 for effect");
1023  /* return type */
1024  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
1025  RNA_def_function_return(func, parm);
1026 
1027  func = RNA_def_function(srna, "remove", remove_func_name);
1029  RNA_def_function_ui_description(func, "Remove a Sequence");
1030  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "Sequence to remove");
1033 }
1034 
1035 #endif
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_split_dirfile(const char *string, char *dir, char *file, size_t dirlen, size_t filelen)
Definition: path_util.c:1465
#define FILE_MAX
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
#define UNUSED(x)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_SEQUENCER_STRIPS
Definition: DNA_ID.h:838
@ SEQ_SCALE_TO_FILL
@ SEQ_STRETCH_TO_FILL
@ SEQ_USE_ORIGINAL_SIZE
@ SEQ_SCALE_TO_FIT
#define MAXFRAME
@ SEQ_TYPE_TRANSFORM
@ SEQ_TYPE_CROSS
@ SEQ_TYPE_GLOW
@ SEQ_TYPE_COLORMIX
@ SEQ_TYPE_WIPE
@ SEQ_TYPE_OVERDROP
@ SEQ_TYPE_ALPHAUNDER
@ SEQ_TYPE_GAMCROSS
@ SEQ_TYPE_MULTICAM
@ SEQ_TYPE_MUL
@ SEQ_TYPE_GAUSSIAN_BLUR
@ SEQ_TYPE_ADD
@ SEQ_TYPE_ALPHAOVER
@ SEQ_TYPE_TEXT
@ SEQ_TYPE_SUB
@ SEQ_TYPE_SPEED
@ SEQ_TYPE_COLOR
@ SEQ_TYPE_ADJUSTMENT
@ SEQ_CACHE_STORE_PREPROCESSED
@ SEQ_CACHE_STORE_RAW
@ SEQ_CACHE_STORE_COMPOSITE
#define MAXSEQ
_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
Contains defines and structs used throughout the imbuf module.
#define MEM_reallocN(vmemh, len)
#define RNA_POINTER_INVALIDATE(ptr)
Definition: RNA_access.h:744
@ PARM_RNAPTR
Definition: RNA_types.h:354
@ PARM_PYFUNC_OPTIONAL
Definition: RNA_types.h:362
@ PARM_REQUIRED
Definition: RNA_types.h:352
@ FUNC_USE_REPORTS
Definition: RNA_types.h:663
@ FUNC_USE_MAIN
Definition: RNA_types.h:661
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:650
@ PROP_THICK_WRAP
Definition: RNA_types.h:285
@ PROP_NEVER_NULL
Definition: RNA_types.h:239
@ SEQ_SPLIT_SOFT
Definition: SEQ_edit.h:61
@ SEQ_SPLIT_HARD
Definition: SEQ_edit.h:62
#define ND_SEQUENCER
Definition: WM_types.h:385
#define NC_SCENE
Definition: WM_types.h:328
FILE * file
Scene scene
int len
Definition: draw_manager.c:108
int SEQ_effect_get_num_inputs(int seq_type)
Definition: effects.c:3741
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
StripElem * SEQ_render_give_stripelem(const Scene *scene, Sequence *seq, int timeline_frame)
Definition: render.c:236
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4170
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1526
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4312
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4273
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3474
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1237
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1048
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4347
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4342
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1028
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3687
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
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
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1518
void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, const bool metastrip)
void RNA_api_sequence_strip(StructRNA *srna)
void RNA_api_sequence_elements(BlenderRNA *brna, PropertyRNA *cprop)
Editing * SEQ_editing_get(const Scene *scene)
Definition: sequencer.c:241
static const EnumPropertyItem scale_fit_methods[]
Definition: sequencer_add.c:90
Sequence * SEQ_add_meta_strip(Scene *scene, ListBase *seqbase, SeqLoadData *load_data)
Definition: strip_add.c:357
void SEQ_add_image_load_file(Scene *scene, Sequence *seq, size_t strip_frame, char *filename)
Definition: strip_add.c:194
Sequence * SEQ_add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoadData *load_data)
Definition: strip_add.c:373
Sequence * SEQ_add_sound_strip(Main *UNUSED(bmain), Scene *UNUSED(scene), ListBase *UNUSED(seqbase), SeqLoadData *UNUSED(load_data))
Definition: strip_add.c:348
Sequence * SEQ_add_mask_strip(Scene *scene, ListBase *seqbase, struct SeqLoadData *load_data)
Definition: strip_add.c:149
Sequence * SEQ_add_image_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoadData *load_data)
Definition: strip_add.c:230
Sequence * SEQ_add_effect_strip(Scene *scene, ListBase *seqbase, struct SeqLoadData *load_data)
Definition: strip_add.c:161
Sequence * SEQ_add_movieclip_strip(Scene *scene, ListBase *seqbase, struct SeqLoadData *load_data)
Definition: strip_add.c:137
void SEQ_add_image_set_directory(Sequence *seq, char *path)
Definition: strip_add.c:189
void SEQ_add_image_init_alpha_mode(Sequence *seq)
Definition: strip_add.c:201
Sequence * SEQ_add_scene_strip(Scene *scene, ListBase *seqbase, struct SeqLoadData *load_data)
Definition: strip_add.c:125
void SEQ_add_load_data_init(SeqLoadData *load_data, const char *name, const char *path, const int start_frame, const int channel)
Definition: strip_add.c:58
bool SEQ_edit_move_strip_to_meta(Scene *scene, Sequence *src_seq, Sequence *dst_seqm, const char **error_str)
Definition: strip_edit.c:213
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
void SEQ_relations_invalidate_cache_raw(Scene *scene, Sequence *seq)
struct Sequence * SEQ_find_metastrip_by_sequence(ListBase *seqbase, Sequence *meta, Sequence *seq)
void SEQ_relations_invalidate_cache_preprocessed(Scene *scene, Sequence *seq)
void SEQ_relations_invalidate_cache_composite(Scene *scene, Sequence *seq)
ListBase seqbase
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
Definition: BKE_main.h:121
void * data
Definition: RNA_types.h:38
struct Sequence * seq2
Definition: SEQ_add.h:43
int len
Definition: SEQ_add.h:33
struct MovieClip * clip
Definition: SEQ_add.h:37
eSeqImageFitMethod fit_method
Definition: SEQ_add.h:47
struct Scene * scene
Definition: SEQ_add.h:36
struct Sequence * seq3
Definition: SEQ_add.h:44
struct SeqLoadData::@1176 effect
bool allow_invalid_file
Definition: SEQ_add.h:51
int end_frame
Definition: SEQ_add.h:34
struct SeqLoadData::@1175 image
struct Mask * mask
Definition: SEQ_add.h:38
int type
Definition: SEQ_add.h:40
struct Sequence * seq1
Definition: SEQ_add.h:42
ListBase seqbase
char name[256]
StripElem * stripdata
ListBase * SEQ_get_seqbase_by_seq(const Scene *scene, Sequence *seq)
Definition: utils.c:373
void WM_main_add_notifier(unsigned int type, void *reference)