Blender  V2.93
rna_sequencer_api.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 
25 #include "DNA_scene_types.h"
26 #include "DNA_sequence_types.h"
27 
28 #include "BLI_utildefines.h"
29 
30 #include "RNA_access.h"
31 #include "RNA_define.h"
32 
33 #include "rna_internal.h"
34 
35 #ifdef RNA_RUNTIME
36 
37 //#include "DNA_anim_types.h"
38 # include "DNA_image_types.h"
39 # include "DNA_mask_types.h"
40 # include "DNA_sound_types.h"
41 
42 # include "BLI_path_util.h" /* BLI_split_dirfile */
43 
44 # include "BKE_image.h"
45 # include "BKE_mask.h"
46 # include "BKE_movieclip.h"
47 
48 # include "BKE_report.h"
49 # include "BKE_sound.h"
50 
51 # include "IMB_imbuf.h"
52 # include "IMB_imbuf_types.h"
53 
54 # include "SEQ_add.h"
55 # include "SEQ_edit.h"
56 # include "SEQ_effects.h"
57 # include "SEQ_relations.h"
58 # include "SEQ_render.h"
59 # include "SEQ_sequencer.h"
60 
61 # include "WM_api.h"
62 
63 static void rna_Sequence_update_rnafunc(ID *id, Sequence *self, bool do_data)
64 {
65  if (do_data) {
66  SEQ_relations_update_changed_seq_and_deps((Scene *)id, self, true, true);
67  // new_tstripdata(self); /* need 2.6x version of this. */
68  }
69  SEQ_time_update_sequence((Scene *)id, self);
71 }
72 
73 static void rna_Sequence_swap_internal(Sequence *seq_self,
74  ReportList *reports,
75  Sequence *seq_other)
76 {
77  const char *error_msg;
78 
79  if (SEQ_edit_sequence_swap(seq_self, seq_other, &error_msg) == 0) {
80  BKE_report(reports, RPT_ERROR, error_msg);
81  }
82 }
83 
84 static void rna_Sequences_move_strip_to_meta(
85  ID *id, Sequence *seq_self, Main *bmain, ReportList *reports, Sequence *meta_dst)
86 {
87  Scene *scene = (Scene *)id;
88  const char *error_msg;
89 
90  /* Move strip to meta. */
91  if (!SEQ_edit_move_strip_to_meta(scene, seq_self, meta_dst, &error_msg)) {
92  BKE_report(reports, RPT_ERROR, error_msg);
93  }
94 
95  /* Update depsgraph. */
98 
100 }
101 
102 static Sequence *rna_Sequences_new_clip(ID *id,
103  ListBase *seqbase,
104  Main *bmain,
105  const char *name,
106  MovieClip *clip,
107  int channel,
108  int frame_start)
109 {
110  Scene *scene = (Scene *)id;
111  SeqLoadData load_data;
112  SEQ_add_load_data_init(&load_data, name, NULL, frame_start, channel);
113  load_data.clip = clip;
114  Sequence *seq = SEQ_add_movieclip_strip(scene, seqbase, &load_data);
115 
119 
120  return seq;
121 }
122 
123 static Sequence *rna_Sequences_editing_new_clip(ID *id,
124  Editing *ed,
125  Main *bmain,
126  const char *name,
127  MovieClip *clip,
128  int channel,
129  int frame_start)
130 {
131  return rna_Sequences_new_clip(id, &ed->seqbase, bmain, name, clip, channel, frame_start);
132 }
133 
134 static Sequence *rna_Sequences_meta_new_clip(ID *id,
135  Sequence *seq,
136  Main *bmain,
137  const char *name,
138  MovieClip *clip,
139  int channel,
140  int frame_start)
141 {
142  return rna_Sequences_new_clip(id, &seq->seqbase, bmain, name, clip, channel, frame_start);
143 }
144 
145 static Sequence *rna_Sequences_new_mask(ID *id,
146  ListBase *seqbase,
147  Main *bmain,
148  const char *name,
149  Mask *mask,
150  int channel,
151  int frame_start)
152 {
153  Scene *scene = (Scene *)id;
154  SeqLoadData load_data;
155  SEQ_add_load_data_init(&load_data, name, NULL, frame_start, channel);
156  load_data.mask = mask;
157  Sequence *seq = SEQ_add_mask_strip(scene, seqbase, &load_data);
158 
162 
163  return seq;
164 }
165 static Sequence *rna_Sequences_editing_new_mask(
166  ID *id, Editing *ed, Main *bmain, const char *name, Mask *mask, int channel, int frame_start)
167 {
168  return rna_Sequences_new_mask(id, &ed->seqbase, bmain, name, mask, channel, frame_start);
169 }
170 
171 static Sequence *rna_Sequences_meta_new_mask(
172  ID *id, Sequence *seq, Main *bmain, const char *name, Mask *mask, int channel, int frame_start)
173 {
174  return rna_Sequences_new_mask(id, &seq->seqbase, bmain, name, mask, channel, frame_start);
175 }
176 
177 static Sequence *rna_Sequences_new_scene(ID *id,
178  ListBase *seqbase,
179  Main *bmain,
180  const char *name,
181  Scene *sce_seq,
182  int channel,
183  int frame_start)
184 {
185  Scene *scene = (Scene *)id;
186  SeqLoadData load_data;
187  SEQ_add_load_data_init(&load_data, name, NULL, frame_start, channel);
188  load_data.scene = sce_seq;
189  Sequence *seq = SEQ_add_scene_strip(scene, seqbase, &load_data);
190 
194 
195  return seq;
196 }
197 
198 static Sequence *rna_Sequences_editing_new_scene(ID *id,
199  Editing *ed,
200  Main *bmain,
201  const char *name,
202  Scene *sce_seq,
203  int channel,
204  int frame_start)
205 {
206  return rna_Sequences_new_scene(id, &ed->seqbase, bmain, name, sce_seq, channel, frame_start);
207 }
208 
209 static Sequence *rna_Sequences_meta_new_scene(ID *id,
210  Sequence *seq,
211  Main *bmain,
212  const char *name,
213  Scene *sce_seq,
214  int channel,
215  int frame_start)
216 {
217  return rna_Sequences_new_scene(id, &seq->seqbase, bmain, name, sce_seq, channel, frame_start);
218 }
219 
220 static Sequence *rna_Sequences_new_image(ID *id,
221  ListBase *seqbase,
222  Main *bmain,
223  ReportList *UNUSED(reports),
224  const char *name,
225  const char *file,
226  int channel,
227  int frame_start,
228  int fit_method)
229 {
230  Scene *scene = (Scene *)id;
231 
232  SeqLoadData load_data;
233  SEQ_add_load_data_init(&load_data, name, file, frame_start, channel);
234  load_data.image.len = 1;
235  load_data.fit_method = fit_method;
236  Sequence *seq = SEQ_add_image_strip(bmain, scene, seqbase, &load_data);
237 
238  char dir[FILE_MAX], filename[FILE_MAX];
239  BLI_split_dirfile(file, dir, filename, sizeof(dir), sizeof(filename));
240  SEQ_add_image_set_directory(seq, dir);
241  SEQ_add_image_load_file(seq, 0, filename);
243 
247 
248  return seq;
249 }
250 
251 static Sequence *rna_Sequences_editing_new_image(ID *id,
252  Editing *ed,
253  Main *bmain,
254  ReportList *reports,
255  const char *name,
256  const char *file,
257  int channel,
258  int frame_start,
259  int fit_method)
260 {
261  return rna_Sequences_new_image(
262  id, &ed->seqbase, bmain, reports, name, file, channel, frame_start, fit_method);
263 }
264 
265 static Sequence *rna_Sequences_meta_new_image(ID *id,
266  Sequence *seq,
267  Main *bmain,
268  ReportList *reports,
269  const char *name,
270  const char *file,
271  int channel,
272  int frame_start,
273  int fit_method)
274 {
275  return rna_Sequences_new_image(
276  id, &seq->seqbase, bmain, reports, name, file, channel, frame_start, fit_method);
277 }
278 
279 static Sequence *rna_Sequences_new_movie(ID *id,
280  ListBase *seqbase,
281  Main *bmain,
282  const char *name,
283  const char *file,
284  int channel,
285  int frame_start,
286  int fit_method)
287 {
288  Scene *scene = (Scene *)id;
289  SeqLoadData load_data;
290  SEQ_add_load_data_init(&load_data, name, file, frame_start, channel);
291  load_data.fit_method = fit_method;
292  load_data.allow_invalid_file = true;
293  double video_start_offset;
294  Sequence *seq = SEQ_add_movie_strip(bmain, scene, seqbase, &load_data, &video_start_offset);
295 
299 
300  return seq;
301 }
302 
303 static Sequence *rna_Sequences_editing_new_movie(ID *id,
304  Editing *ed,
305  Main *bmain,
306  const char *name,
307  const char *file,
308  int channel,
309  int frame_start,
310  int fit_method)
311 {
312  return rna_Sequences_new_movie(
313  id, &ed->seqbase, bmain, name, file, channel, frame_start, fit_method);
314 }
315 
316 static Sequence *rna_Sequences_meta_new_movie(ID *id,
317  Sequence *seq,
318  Main *bmain,
319  const char *name,
320  const char *file,
321  int channel,
322  int frame_start,
323  int fit_method)
324 {
325  return rna_Sequences_new_movie(
326  id, &seq->seqbase, bmain, name, file, channel, frame_start, fit_method);
327 }
328 
329 # ifdef WITH_AUDASPACE
330 static Sequence *rna_Sequences_new_sound(ID *id,
331  ListBase *seqbase,
332  Main *bmain,
333  ReportList *reports,
334  const char *name,
335  const char *file,
336  int channel,
337  int frame_start)
338 {
339  Scene *scene = (Scene *)id;
340  SeqLoadData load_data;
341  SEQ_add_load_data_init(&load_data, name, file, frame_start, channel);
342  load_data.allow_invalid_file = true;
343  Sequence *seq = SEQ_add_sound_strip(bmain, scene, seqbase, &load_data, 0.0f);
344 
345  if (seq == NULL) {
346  BKE_report(reports, RPT_ERROR, "Sequences.new_sound: unable to open sound file");
347  return NULL;
348  }
349 
353 
354  return seq;
355 }
356 # else /* WITH_AUDASPACE */
357 static Sequence *rna_Sequences_new_sound(ID *UNUSED(id),
358  ListBase *UNUSED(seqbase),
359  Main *UNUSED(bmain),
360  ReportList *reports,
361  const char *UNUSED(name),
362  const char *UNUSED(file),
363  int UNUSED(channel),
364  int UNUSED(frame_start))
365 {
366  BKE_report(reports, RPT_ERROR, "Blender compiled without Audaspace support");
367  return NULL;
368 }
369 # endif /* WITH_AUDASPACE */
370 
371 static Sequence *rna_Sequences_editing_new_sound(ID *id,
372  Editing *ed,
373  Main *bmain,
374  ReportList *reports,
375  const char *name,
376  const char *file,
377  int channel,
378  int frame_start)
379 {
380  return rna_Sequences_new_sound(
381  id, &ed->seqbase, bmain, reports, name, file, channel, frame_start);
382 }
383 
384 static Sequence *rna_Sequences_meta_new_sound(ID *id,
385  Sequence *seq,
386  Main *bmain,
387  ReportList *reports,
388  const char *name,
389  const char *file,
390  int channel,
391  int frame_start)
392 {
393  return rna_Sequences_new_sound(
394  id, &seq->seqbase, bmain, reports, name, file, channel, frame_start);
395 }
396 
397 /* Meta sequence
398  * Possibility to create an empty meta to avoid plenty of meta toggling
399  * Created meta have a length equal to 1, must be set through the API. */
400 static Sequence *rna_Sequences_new_meta(
401  ID *id, ListBase *seqbase, const char *name, int channel, int frame_start)
402 {
403  Scene *scene = (Scene *)id;
404  SeqLoadData load_data;
405  SEQ_add_load_data_init(&load_data, name, NULL, frame_start, channel);
406  Sequence *seqm = SEQ_add_meta_strip(scene, seqbase, &load_data);
407 
408  return seqm;
409 }
410 
411 static Sequence *rna_Sequences_editing_new_meta(
412  ID *id, Editing *ed, const char *name, int channel, int frame_start)
413 {
414  return rna_Sequences_new_meta(id, &ed->seqbase, name, channel, frame_start);
415 }
416 
417 static Sequence *rna_Sequences_meta_new_meta(
418  ID *id, Sequence *seq, const char *name, int channel, int frame_start)
419 {
420  return rna_Sequences_new_meta(id, &seq->seqbase, name, channel, frame_start);
421 }
422 
423 static Sequence *rna_Sequences_new_effect(ID *id,
424  ListBase *seqbase,
425  ReportList *reports,
426  const char *name,
427  int type,
428  int channel,
429  int frame_start,
430  int frame_end,
431  Sequence *seq1,
432  Sequence *seq2,
433  Sequence *seq3)
434 {
435  Scene *scene = (Scene *)id;
436  Sequence *seq;
437  const int num_inputs = SEQ_effect_get_num_inputs(type);
438 
439  switch (num_inputs) {
440  case 0:
441  if (frame_end <= frame_start) {
442  BKE_report(reports, RPT_ERROR, "Sequences.new_effect: end frame not set");
443  return NULL;
444  }
445  break;
446  case 1:
447  if (seq1 == NULL) {
448  BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 1 input sequence");
449  return NULL;
450  }
451  break;
452  case 2:
453  if (seq1 == NULL || seq2 == NULL) {
454  BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 2 input sequences");
455  return NULL;
456  }
457  break;
458  case 3:
459  if (seq1 == NULL || seq2 == NULL || seq3 == NULL) {
460  BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 3 input sequences");
461  return NULL;
462  }
463  break;
464  default:
465  BKE_reportf(
466  reports,
467  RPT_ERROR,
468  "Sequences.new_effect: effect expects more than 3 inputs (%d, should never happen!)",
469  num_inputs);
470  return NULL;
471  }
472 
473  SeqLoadData load_data;
474  SEQ_add_load_data_init(&load_data, name, NULL, frame_start, channel);
475  load_data.effect.end_frame = frame_end;
476  load_data.effect.type = type;
477  load_data.effect.seq1 = seq1;
478  load_data.effect.seq2 = seq2;
479  load_data.effect.seq3 = seq3;
480  seq = SEQ_add_effect_strip(scene, seqbase, &load_data);
481 
484 
485  return seq;
486 }
487 
488 static Sequence *rna_Sequences_editing_new_effect(ID *id,
489  Editing *ed,
490  ReportList *reports,
491  const char *name,
492  int type,
493  int channel,
494  int frame_start,
495  int frame_end,
496  Sequence *seq1,
497  Sequence *seq2,
498  Sequence *seq3)
499 {
500  return rna_Sequences_new_effect(
501  id, &ed->seqbase, reports, name, type, channel, frame_start, frame_end, seq1, seq2, seq3);
502 }
503 
504 static Sequence *rna_Sequences_meta_new_effect(ID *id,
505  Sequence *seq,
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, &seq->seqbase, reports, name, type, channel, frame_start, frame_end, seq1, seq2, seq3);
518 }
519 
520 static void rna_Sequences_remove(
521  ID *id, ListBase *seqbase, Main *bmain, ReportList *reports, PointerRNA *seq_ptr)
522 {
523  Sequence *seq = seq_ptr->data;
524  Scene *scene = (Scene *)id;
525 
526  if (BLI_findindex(seqbase, seq) == -1) {
527  BKE_reportf(
528  reports, RPT_ERROR, "Sequence '%s' not in scene '%s'", seq->name + 2, scene->id.name + 2);
529  return;
530  }
531 
532  SEQ_edit_flag_for_removal(scene, seqbase, seq);
534  RNA_POINTER_INVALIDATE(seq_ptr);
535 
539 }
540 
541 static void rna_Sequences_editing_remove(
542  ID *id, Editing *ed, Main *bmain, ReportList *reports, PointerRNA *seq_ptr)
543 {
544  rna_Sequences_remove(id, &ed->seqbase, bmain, reports, seq_ptr);
545 }
546 
547 static void rna_Sequences_meta_remove(
548  ID *id, Sequence *seq, Main *bmain, ReportList *reports, PointerRNA *seq_ptr)
549 {
550  rna_Sequences_remove(id, &seq->seqbase, bmain, reports, seq_ptr);
551 }
552 
553 static StripElem *rna_SequenceElements_append(ID *id, Sequence *seq, const char *filename)
554 {
555  Scene *scene = (Scene *)id;
556  StripElem *se;
557 
558  seq->strip->stripdata = se = MEM_reallocN(seq->strip->stripdata,
559  sizeof(StripElem) * (seq->len + 1));
560  se += seq->len;
561  BLI_strncpy(se->name, filename, sizeof(se->name));
562  seq->len++;
563 
566 
567  return se;
568 }
569 
570 static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports, int index)
571 {
572  Scene *scene = (Scene *)id;
573  StripElem *new_seq, *se;
574 
575  if (seq->len == 1) {
576  BKE_report(reports, RPT_ERROR, "SequenceElements.pop: cannot pop the last element");
577  return;
578  }
579 
580  /* python style negative indexing */
581  if (index < 0) {
582  index += seq->len;
583  }
584 
585  if (seq->len <= index || index < 0) {
586  BKE_report(reports, RPT_ERROR, "SequenceElements.pop: index out of range");
587  return;
588  }
589 
590  new_seq = MEM_callocN(sizeof(StripElem) * (seq->len - 1), "SequenceElements_pop");
591  seq->len--;
592 
593  se = seq->strip->stripdata;
594  if (index > 0) {
595  memcpy(new_seq, se, sizeof(StripElem) * index);
596  }
597 
598  if (index < seq->len) {
599  memcpy(&new_seq[index], &se[index + 1], sizeof(StripElem) * (seq->len - index));
600  }
601 
602  MEM_freeN(seq->strip->stripdata);
603  seq->strip->stripdata = new_seq;
604 
606 
608 }
609 
610 static void rna_Sequence_invalidate_cache_rnafunc(ID *id, Sequence *self, int type)
611 {
612  switch (type) {
613  case SEQ_CACHE_STORE_RAW:
615  break;
618  break;
621  break;
622  }
623 }
624 
625 #else
626 
628 {
629  FunctionRNA *func;
630  PropertyRNA *parm;
631 
632  static const EnumPropertyItem seq_cahce_type_items[] = {
633  {SEQ_CACHE_STORE_RAW, "RAW", 0, "Raw", ""},
634  {SEQ_CACHE_STORE_PREPROCESSED, "PREPROCESSED", 0, "Preprocessed", ""},
635  {SEQ_CACHE_STORE_COMPOSITE, "COMPOSITE", 0, "Composite", ""},
636  {0, NULL, 0, NULL, NULL},
637  };
638 
639  func = RNA_def_function(srna, "update", "rna_Sequence_update_rnafunc");
641  RNA_def_function_ui_description(func, "Update the strip dimensions");
642  parm = RNA_def_boolean(func, "data", false, "Data", "Update strip data");
643 
644  func = RNA_def_function(srna, "strip_elem_from_frame", "SEQ_render_give_stripelem");
645  RNA_def_function_ui_description(func, "Return the strip element from a given frame or None");
646  parm = RNA_def_int(func,
647  "frame",
648  0,
649  -MAXFRAME,
650  MAXFRAME,
651  "Frame",
652  "The frame to get the strip element from",
653  -MAXFRAME,
654  MAXFRAME);
657  func,
658  RNA_def_pointer(func, "elem", "SequenceElement", "", "strip element of the current frame"));
659 
660  func = RNA_def_function(srna, "swap", "rna_Sequence_swap_internal");
662  parm = RNA_def_pointer(func, "other", "Sequence", "Other", "");
664 
665  func = RNA_def_function(srna, "move_to_meta", "rna_Sequences_move_strip_to_meta");
667  parm = RNA_def_pointer(func,
668  "meta_sequence",
669  "Sequence",
670  "Destination Meta Sequence",
671  "Meta to move the strip into");
673 
674  func = RNA_def_function(srna, "invalidate_cache", "rna_Sequence_invalidate_cache_rnafunc");
677  "Invalidate cached images for strip and all dependent strips");
678  parm = RNA_def_enum(func, "type", seq_cahce_type_items, 0, "Type", "Cache Type");
680 }
681 
683 {
684  StructRNA *srna;
685  PropertyRNA *parm;
686  FunctionRNA *func;
687 
688  RNA_def_property_srna(cprop, "SequenceElements");
689  srna = RNA_def_struct(brna, "SequenceElements", NULL);
690  RNA_def_struct_sdna(srna, "Sequence");
691  RNA_def_struct_ui_text(srna, "SequenceElements", "Collection of SequenceElement");
692 
693  func = RNA_def_function(srna, "append", "rna_SequenceElements_append");
695  RNA_def_function_ui_description(func, "Push an image from ImageSequence.directory");
696  parm = RNA_def_string(func, "filename", "File", 0, "", "Filepath to image");
698  /* return type */
699  parm = RNA_def_pointer(func, "elem", "SequenceElement", "", "New SequenceElement");
700  RNA_def_function_return(func, parm);
701 
702  func = RNA_def_function(srna, "pop", "rna_SequenceElements_pop");
704  RNA_def_function_ui_description(func, "Pop an image off the collection");
705  parm = RNA_def_int(
706  func, "index", -1, INT_MIN, INT_MAX, "", "Index of image to remove", INT_MIN, INT_MAX);
708 }
709 
710 void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, const bool metastrip)
711 {
712  StructRNA *srna;
713  PropertyRNA *parm;
714  FunctionRNA *func;
715 
716  static const EnumPropertyItem seq_effect_items[] = {
717  {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""},
718  {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
719  {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
720  {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
721  {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
722  {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
723  {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
724  {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
725  {SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", ""},
726  {SEQ_TYPE_GLOW, "GLOW", 0, "Glow", ""},
727  {SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
728  {SEQ_TYPE_COLOR, "COLOR", 0, "Color", ""},
729  {SEQ_TYPE_SPEED, "SPEED", 0, "Speed", ""},
730  {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
731  {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
732  {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
733  {SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
734  {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
735  {0, NULL, 0, NULL, NULL},
736  };
737 
738  static const EnumPropertyItem scale_fit_methods[] = {
739  {SEQ_SCALE_TO_FIT, "FIT", 0, "Scale to Fit", "Scale image so fits in preview"},
741  "FILL",
742  0,
743  "Scale to Fill",
744  "Scale image so it fills preview completely"},
745  {SEQ_STRETCH_TO_FILL, "STRETCH", 0, "Stretch to Fill", "Stretch image so it fills preview"},
746  {SEQ_USE_ORIGINAL_SIZE, "ORIGINAL", 0, "Use Original Size", "Don't scale the image"},
747  {0, NULL, 0, NULL, NULL},
748  };
749 
750  const char *new_clip_func_name = "rna_Sequences_editing_new_clip";
751  const char *new_mask_func_name = "rna_Sequences_editing_new_mask";
752  const char *new_scene_func_name = "rna_Sequences_editing_new_scene";
753  const char *new_image_func_name = "rna_Sequences_editing_new_image";
754  const char *new_movie_func_name = "rna_Sequences_editing_new_movie";
755  const char *new_sound_func_name = "rna_Sequences_editing_new_sound";
756  const char *new_meta_func_name = "rna_Sequences_editing_new_meta";
757  const char *new_effect_func_name = "rna_Sequences_editing_new_effect";
758  const char *remove_func_name = "rna_Sequences_editing_remove";
759 
760  if (metastrip) {
761  RNA_def_property_srna(cprop, "SequencesMeta");
762  srna = RNA_def_struct(brna, "SequencesMeta", NULL);
763  RNA_def_struct_sdna(srna, "Sequence");
764 
765  new_clip_func_name = "rna_Sequences_meta_new_clip";
766  new_mask_func_name = "rna_Sequences_meta_new_mask";
767  new_scene_func_name = "rna_Sequences_meta_new_scene";
768  new_image_func_name = "rna_Sequences_meta_new_image";
769  new_movie_func_name = "rna_Sequences_meta_new_movie";
770  new_sound_func_name = "rna_Sequences_meta_new_sound";
771  new_meta_func_name = "rna_Sequences_meta_new_meta";
772  new_effect_func_name = "rna_Sequences_meta_new_effect";
773  remove_func_name = "rna_Sequences_meta_remove";
774  }
775  else {
776  RNA_def_property_srna(cprop, "SequencesTopLevel");
777  srna = RNA_def_struct(brna, "SequencesTopLevel", NULL);
778  RNA_def_struct_sdna(srna, "Editing");
779  }
780 
781  RNA_def_struct_ui_text(srna, "Sequences", "Collection of Sequences");
782 
783  func = RNA_def_function(srna, "new_clip", new_clip_func_name);
785  RNA_def_function_ui_description(func, "Add a new movie clip sequence");
786  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
788  parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to add");
790  parm = RNA_def_int(
791  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
793  parm = RNA_def_int(func,
794  "frame_start",
795  0,
796  -MAXFRAME,
797  MAXFRAME,
798  "",
799  "The start frame for the new sequence",
800  -MAXFRAME,
801  MAXFRAME);
803  /* return type */
804  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
805  RNA_def_function_return(func, parm);
806 
807  func = RNA_def_function(srna, "new_mask", new_mask_func_name);
809  RNA_def_function_ui_description(func, "Add a new mask sequence");
810  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
812  parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to add");
814  parm = RNA_def_int(
815  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
817  parm = RNA_def_int(func,
818  "frame_start",
819  0,
820  -MAXFRAME,
821  MAXFRAME,
822  "",
823  "The start frame for the new sequence",
824  -MAXFRAME,
825  MAXFRAME);
827  /* return type */
828  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
829  RNA_def_function_return(func, parm);
830 
831  func = RNA_def_function(srna, "new_scene", new_scene_func_name);
833  RNA_def_function_ui_description(func, "Add a new scene sequence");
834  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
836  parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to add");
838  parm = RNA_def_int(
839  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
841  parm = RNA_def_int(func,
842  "frame_start",
843  0,
844  -MAXFRAME,
845  MAXFRAME,
846  "",
847  "The start frame for the new sequence",
848  -MAXFRAME,
849  MAXFRAME);
851  /* return type */
852  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
853  RNA_def_function_return(func, parm);
854 
855  func = RNA_def_function(srna, "new_image", new_image_func_name);
857  RNA_def_function_ui_description(func, "Add a new image sequence");
858  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
860  parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to image");
862  parm = RNA_def_int(
863  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
865  parm = RNA_def_int(func,
866  "frame_start",
867  0,
868  -MAXFRAME,
869  MAXFRAME,
870  "",
871  "The start frame for the new sequence",
872  -MAXFRAME,
873  MAXFRAME);
875  parm = RNA_def_enum(
876  func, "fit_method", scale_fit_methods, SEQ_USE_ORIGINAL_SIZE, "Image Fit Method", NULL);
878  /* return type */
879  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
880  RNA_def_function_return(func, parm);
881 
882  func = RNA_def_function(srna, "new_movie", new_movie_func_name);
884  RNA_def_function_ui_description(func, "Add a new movie sequence");
885  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
887  parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
889  parm = RNA_def_int(
890  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
892  parm = RNA_def_int(func,
893  "frame_start",
894  0,
895  -MAXFRAME,
896  MAXFRAME,
897  "",
898  "The start frame for the new sequence",
899  -MAXFRAME,
900  MAXFRAME);
902  parm = RNA_def_enum(
903  func, "fit_method", scale_fit_methods, SEQ_USE_ORIGINAL_SIZE, "Image Fit Method", NULL);
905  /* return type */
906  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
907  RNA_def_function_return(func, parm);
908 
909  func = RNA_def_function(srna, "new_sound", new_sound_func_name);
911  RNA_def_function_ui_description(func, "Add a new sound sequence");
912  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
914  parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
916  parm = RNA_def_int(
917  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
919  parm = RNA_def_int(func,
920  "frame_start",
921  0,
922  -MAXFRAME,
923  MAXFRAME,
924  "",
925  "The start frame for the new sequence",
926  -MAXFRAME,
927  MAXFRAME);
929  /* return type */
930  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
931  RNA_def_function_return(func, parm);
932 
933  func = RNA_def_function(srna, "new_meta", new_meta_func_name);
935  RNA_def_function_ui_description(func, "Add a new meta sequence");
936  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
938  parm = RNA_def_int(
939  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
941  parm = RNA_def_int(func,
942  "frame_start",
943  0,
944  -MAXFRAME,
945  MAXFRAME,
946  "",
947  "The start frame for the new sequence",
948  -MAXFRAME,
949  MAXFRAME);
951  /* return type */
952  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
953  RNA_def_function_return(func, parm);
954 
955  func = RNA_def_function(srna, "new_effect", new_effect_func_name);
957  RNA_def_function_ui_description(func, "Add a new effect sequence");
958  parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
960  parm = RNA_def_enum(func, "type", seq_effect_items, 0, "Type", "type for the new sequence");
962  parm = RNA_def_int(
963  func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
964  /* don't use MAXFRAME since it makes importer scripts fail */
966  parm = RNA_def_int(func,
967  "frame_start",
968  0,
969  INT_MIN,
970  INT_MAX,
971  "",
972  "The start frame for the new sequence",
973  INT_MIN,
974  INT_MAX);
976  RNA_def_int(func,
977  "frame_end",
978  0,
979  INT_MIN,
980  INT_MAX,
981  "",
982  "The end frame for the new sequence",
983  INT_MIN,
984  INT_MAX);
985  RNA_def_pointer(func, "seq1", "Sequence", "", "Sequence 1 for effect");
986  RNA_def_pointer(func, "seq2", "Sequence", "", "Sequence 2 for effect");
987  RNA_def_pointer(func, "seq3", "Sequence", "", "Sequence 3 for effect");
988  /* return type */
989  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
990  RNA_def_function_return(func, parm);
991 
992  func = RNA_def_function(srna, "remove", remove_func_name);
994  RNA_def_function_ui_description(func, "Remove a Sequence");
995  parm = RNA_def_pointer(func, "sequence", "Sequence", "", "Sequence to remove");
998 }
999 
1000 #endif
void BKE_report(ReportList *reports, ReportType type, const char *message)
Definition: report.c:104
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define FILE_MAX
void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen)
Definition: path_util.c:1654
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
#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:658
@ SEQ_SCALE_TO_FILL
@ SEQ_STRETCH_TO_FILL
@ SEQ_USE_ORIGINAL_SIZE
@ SEQ_SCALE_TO_FIT
#define MAXFRAME
@ SEQ_CACHE_STORE_PREPROCESSED
@ SEQ_CACHE_STORE_RAW
@ SEQ_CACHE_STORE_COMPOSITE
#define MAXSEQ
@ 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
_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:1425
@ PARM_RNAPTR
Definition: RNA_types.h:339
@ PARM_PYFUNC_OPTIONAL
Definition: RNA_types.h:347
@ PARM_REQUIRED
Definition: RNA_types.h:337
@ FUNC_USE_REPORTS
Definition: RNA_types.h:578
@ FUNC_USE_MAIN
Definition: RNA_types.h:576
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:565
@ PROP_THICK_WRAP
Definition: RNA_types.h:270
@ PROP_NEVER_NULL
Definition: RNA_types.h:225
#define ND_SEQUENCER
Definition: WM_types.h:337
#define NC_SCENE
Definition: WM_types.h:279
FILE * file
Scene scene
int SEQ_effect_get_num_inputs(int seq_type)
Definition: effects.c:4328
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3481
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4159
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1555
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4302
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4262
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3462
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1259
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1067
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4337
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4332
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1047
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:3675
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:3585
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:3771
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1547
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)
static const EnumPropertyItem scale_fit_methods[]
void SEQ_add_image_load_file(Sequence *seq, size_t strip_frame, char *filename)
Definition: strip_add.c:276
Sequence * SEQ_add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoadData *load_data, double *r_video_start_offset)
Definition: strip_add.c:508
Sequence * SEQ_add_meta_strip(Scene *scene, ListBase *seqbase, SeqLoadData *load_data)
Definition: strip_add.c:482
Sequence * SEQ_add_mask_strip(Scene *scene, ListBase *seqbase, struct SeqLoadData *load_data)
Definition: strip_add.c:200
Sequence * SEQ_add_image_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoadData *load_data)
Definition: strip_add.c:326
Sequence * SEQ_add_effect_strip(Scene *scene, ListBase *seqbase, struct SeqLoadData *load_data)
Definition: strip_add.c:221
Sequence * SEQ_add_movieclip_strip(Scene *scene, ListBase *seqbase, struct SeqLoadData *load_data)
Definition: strip_add.c:179
void SEQ_add_image_set_directory(Sequence *seq, char *path)
Definition: strip_add.c:264
void SEQ_add_image_init_alpha_mode(Sequence *seq)
Definition: strip_add.c:287
Sequence * SEQ_add_sound_strip(Main *UNUSED(bmain), Scene *UNUSED(scene), ListBase *UNUSED(seqbase), SeqLoadData *UNUSED(load_data), const double UNUSED(audio_offset))
Definition: strip_add.c:463
Sequence * SEQ_add_scene_strip(Scene *scene, ListBase *seqbase, struct SeqLoadData *load_data)
Definition: strip_add.c:158
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:82
bool SEQ_edit_move_strip_to_meta(Scene *scene, Sequence *src_seq, Sequence *dst_seqm, const char **error_str)
Definition: strip_edit.c:220
void SEQ_edit_flag_for_removal(Scene *scene, ListBase *seqbase, Sequence *seq)
Definition: strip_edit.c:176
int SEQ_edit_sequence_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
Definition: strip_edit.c:52
void SEQ_edit_remove_flagged_sequences(Scene *scene, ListBase *seqbase)
Definition: strip_edit.c:194
void SEQ_relations_invalidate_cache_raw(Scene *scene, Sequence *seq)
void SEQ_relations_update_changed_seq_and_deps(Scene *scene, Sequence *changed_seq, int len_change, int ibuf_change)
void SEQ_relations_invalidate_cache_preprocessed(Scene *scene, Sequence *seq)
void SEQ_relations_invalidate_cache_composite(Scene *scene, Sequence *seq)
void SEQ_time_update_sequence_bounds(Scene *scene, Sequence *seq)
Definition: strip_time.c:150
void SEQ_time_update_sequence(Scene *scene, Sequence *seq)
Definition: strip_time.c:197
ListBase seqbase
Definition: DNA_ID.h:273
char name[66]
Definition: DNA_ID.h:283
Definition: BKE_main.h:116
void * data
Definition: RNA_types.h:52
struct Sequence * seq2
Definition: SEQ_add.h:59
int len
Definition: SEQ_add.h:49
struct MovieClip * clip
Definition: SEQ_add.h:53
struct SeqLoadData::@1139 image
eSeqImageFitMethod fit_method
Definition: SEQ_add.h:63
struct Scene * scene
Definition: SEQ_add.h:52
struct Sequence * seq3
Definition: SEQ_add.h:60
bool allow_invalid_file
Definition: SEQ_add.h:67
int end_frame
Definition: SEQ_add.h:50
struct Mask * mask
Definition: SEQ_add.h:54
struct SeqLoadData::@1140 effect
int type
Definition: SEQ_add.h:56
struct Sequence * seq1
Definition: SEQ_add.h:58
ListBase seqbase
char name[256]
StripElem * stripdata
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
uint len
void WM_main_add_notifier(unsigned int type, void *reference)