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
17 /** \file
18 * \ingroup RNA
19 */
20
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_sequencer.h"
50 # include "BKE_sound.h"
51
52 # include "IMB_imbuf.h"
53 # include "IMB_imbuf_types.h"
54
55 # include "WM_api.h"
56
rna_Sequence_update_rnafunc(ID * id,Sequence * self,bool do_data)57 static void rna_Sequence_update_rnafunc(ID *id, Sequence *self, bool do_data)
58 {
59 if (do_data) {
60 BKE_sequencer_update_changed_seq_and_deps((Scene *)id, self, true, true);
61 // new_tstripdata(self); /* need 2.6x version of this. */
62 }
63 BKE_sequence_calc((Scene *)id, self);
64 BKE_sequence_calc_disp((Scene *)id, self);
65 }
66
rna_Sequence_swap_internal(Sequence * seq_self,ReportList * reports,Sequence * seq_other)67 static void rna_Sequence_swap_internal(Sequence *seq_self,
68 ReportList *reports,
69 Sequence *seq_other)
70 {
71 const char *error_msg;
72
73 if (BKE_sequence_swap(seq_self, seq_other, &error_msg) == 0) {
74 BKE_report(reports, RPT_ERROR, error_msg);
75 }
76 }
77
alloc_generic_sequence(Editing * ed,const char * name,int frame_start,int channel,int type,const char * file)78 static Sequence *alloc_generic_sequence(
79 Editing *ed, const char *name, int frame_start, int channel, int type, const char *file)
80 {
81 Sequence *seq;
82 StripElem *se;
83
84 seq = BKE_sequence_alloc(ed->seqbasep, frame_start, channel, type);
85
86 BLI_strncpy(seq->name + 2, name, sizeof(seq->name) - 2);
87 BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq);
88
89 Strip *strip = seq->strip;
90
91 if (file) {
92 strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem");
93 BLI_split_dirfile(file, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
94
95 BKE_sequence_init_colorspace(seq);
96 }
97 else {
98 strip->stripdata = NULL;
99 }
100
101 return seq;
102 }
103
rna_Sequences_new_clip(ID * id,Editing * ed,Main * bmain,const char * name,MovieClip * clip,int channel,int frame_start)104 static Sequence *rna_Sequences_new_clip(ID *id,
105 Editing *ed,
106 Main *bmain,
107 const char *name,
108 MovieClip *clip,
109 int channel,
110 int frame_start)
111 {
112 Scene *scene = (Scene *)id;
113 Sequence *seq;
114
115 seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MOVIECLIP, clip->filepath);
116 seq->clip = clip;
117 seq->len = BKE_movieclip_get_duration(clip);
118 id_us_plus((ID *)clip);
119
120 BKE_sequence_calc_disp(scene, seq);
121
122 DEG_relations_tag_update(bmain);
123 DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
124 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
125
126 return seq;
127 }
128
rna_Sequences_new_mask(ID * id,Editing * ed,Main * bmain,const char * name,Mask * mask,int channel,int frame_start)129 static Sequence *rna_Sequences_new_mask(
130 ID *id, Editing *ed, Main *bmain, const char *name, Mask *mask, int channel, int frame_start)
131 {
132 Scene *scene = (Scene *)id;
133 Sequence *seq;
134
135 seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MASK, mask->id.name);
136 seq->mask = mask;
137 seq->len = BKE_mask_get_duration(mask);
138 id_us_plus((ID *)mask);
139
140 BKE_sequence_calc_disp(scene, seq);
141 BKE_sequence_invalidate_cache_composite(scene, seq);
142
143 DEG_relations_tag_update(bmain);
144 DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
145 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
146
147 return seq;
148 }
149
rna_Sequences_new_scene(ID * id,Editing * ed,Main * bmain,const char * name,Scene * sce_seq,int channel,int frame_start)150 static Sequence *rna_Sequences_new_scene(ID *id,
151 Editing *ed,
152 Main *bmain,
153 const char *name,
154 Scene *sce_seq,
155 int channel,
156 int frame_start)
157 {
158 Scene *scene = (Scene *)id;
159 Sequence *seq;
160
161 seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SCENE, NULL);
162 seq->scene = sce_seq;
163 seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
164 id_us_plus((ID *)sce_seq);
165
166 BKE_sequence_calc_disp(scene, seq);
167 BKE_sequence_invalidate_cache_composite(scene, seq);
168
169 DEG_relations_tag_update(bmain);
170 DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
171 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
172
173 return seq;
174 }
175
rna_Sequences_new_image(ID * id,Editing * ed,Main * bmain,ReportList * reports,const char * name,const char * file,int channel,int frame_start)176 static Sequence *rna_Sequences_new_image(ID *id,
177 Editing *ed,
178 Main *bmain,
179 ReportList *reports,
180 const char *name,
181 const char *file,
182 int channel,
183 int frame_start)
184 {
185 Scene *scene = (Scene *)id;
186 Sequence *seq;
187
188 seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_IMAGE, file);
189 seq->len = 1;
190
191 if (seq->strip->stripdata->name[0] == '\0') {
192 BKE_report(reports, RPT_ERROR, "Sequences.new_image: unable to open image file");
193 BLI_remlink(&ed->seqbase, seq);
194 BKE_sequence_free(scene, seq, true);
195 return NULL;
196 }
197
198 BKE_sequence_calc_disp(scene, seq);
199 BKE_sequence_invalidate_cache_composite(scene, seq);
200
201 DEG_relations_tag_update(bmain);
202 DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
203 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
204
205 return seq;
206 }
207
rna_Sequences_new_movie(ID * id,Editing * ed,const char * name,const char * file,int channel,int frame_start)208 static Sequence *rna_Sequences_new_movie(
209 ID *id, Editing *ed, const char *name, const char *file, int channel, int frame_start)
210 {
211 Scene *scene = (Scene *)id;
212 Sequence *seq;
213 StripAnim *sanim;
214
215 seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MOVIE, file);
216
217 struct anim *an = openanim(file, IB_rect, 0, NULL);
218 if (an == NULL) {
219 /* Without anim, the strip gets duration 0, which makes it impossible to select in the UI. */
220 seq->len = 1;
221 }
222 else {
223 sanim = MEM_mallocN(sizeof(StripAnim), "Strip Anim");
224 BLI_addtail(&seq->anims, sanim);
225 sanim->anim = an;
226
227 seq->anim_preseek = IMB_anim_get_preseek(an);
228 seq->len = IMB_anim_get_duration(an, IMB_TC_RECORD_RUN);
229 }
230
231 BKE_sequence_calc_disp(scene, seq);
232 BKE_sequence_invalidate_cache_composite(scene, seq);
233
234 DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
235 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
236
237 return seq;
238 }
239
240 # ifdef WITH_AUDASPACE
rna_Sequences_new_sound(ID * id,Editing * ed,Main * bmain,ReportList * reports,const char * name,const char * file,int channel,int frame_start)241 static Sequence *rna_Sequences_new_sound(ID *id,
242 Editing *ed,
243 Main *bmain,
244 ReportList *reports,
245 const char *name,
246 const char *file,
247 int channel,
248 int frame_start)
249 {
250 Scene *scene = (Scene *)id;
251 Sequence *seq;
252
253 bSound *sound = BKE_sound_new_file(bmain, file);
254
255 SoundInfo info;
256 if (!BKE_sound_info_get(bmain, sound, &info)) {
257 BKE_id_free(bmain, sound);
258 BKE_report(reports, RPT_ERROR, "Sequences.new_sound: unable to open sound file");
259 return NULL;
260 }
261 seq = alloc_generic_sequence(
262 ed, name, frame_start, channel, SEQ_TYPE_SOUND_RAM, sound->filepath);
263 seq->sound = sound;
264 seq->len = ceil((double)info.length * FPS);
265
266 BKE_sequence_calc_disp(scene, seq);
267
268 DEG_relations_tag_update(bmain);
269 DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
270 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
271
272 return seq;
273 }
274 # else /* WITH_AUDASPACE */
rna_Sequences_new_sound(ID * UNUSED (id),Editing * UNUSED (ed),Main * UNUSED (bmain),ReportList * reports,const char * UNUSED (name),const char * UNUSED (file),int UNUSED (channel),int UNUSED (frame_start))275 static Sequence *rna_Sequences_new_sound(ID *UNUSED(id),
276 Editing *UNUSED(ed),
277 Main *UNUSED(bmain),
278 ReportList *reports,
279 const char *UNUSED(name),
280 const char *UNUSED(file),
281 int UNUSED(channel),
282 int UNUSED(frame_start))
283 {
284 BKE_report(reports, RPT_ERROR, "Blender compiled without Audaspace support");
285 return NULL;
286 }
287 # endif /* WITH_AUDASPACE */
288
rna_Sequences_new_effect(ID * id,Editing * ed,ReportList * reports,const char * name,int type,int channel,int frame_start,int frame_end,Sequence * seq1,Sequence * seq2,Sequence * seq3)289 static Sequence *rna_Sequences_new_effect(ID *id,
290 Editing *ed,
291 ReportList *reports,
292 const char *name,
293 int type,
294 int channel,
295 int frame_start,
296 int frame_end,
297 Sequence *seq1,
298 Sequence *seq2,
299 Sequence *seq3)
300 {
301 Scene *scene = (Scene *)id;
302 Sequence *seq;
303 struct SeqEffectHandle sh;
304 int num_inputs = BKE_sequence_effect_get_num_inputs(type);
305
306 switch (num_inputs) {
307 case 0:
308 if (frame_end <= frame_start) {
309 BKE_report(reports, RPT_ERROR, "Sequences.new_effect: end frame not set");
310 return NULL;
311 }
312 break;
313 case 1:
314 if (seq1 == NULL) {
315 BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 1 input sequence");
316 return NULL;
317 }
318 break;
319 case 2:
320 if (seq1 == NULL || seq2 == NULL) {
321 BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 2 input sequences");
322 return NULL;
323 }
324 break;
325 case 3:
326 if (seq1 == NULL || seq2 == NULL || seq3 == NULL) {
327 BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 3 input sequences");
328 return NULL;
329 }
330 break;
331 default:
332 BKE_reportf(
333 reports,
334 RPT_ERROR,
335 "Sequences.new_effect: effect expects more than 3 inputs (%d, should never happen!)",
336 num_inputs);
337 return NULL;
338 }
339
340 seq = alloc_generic_sequence(ed, name, frame_start, channel, type, NULL);
341
342 sh = BKE_sequence_get_effect(seq);
343
344 seq->seq1 = seq1;
345 seq->seq2 = seq2;
346 seq->seq3 = seq3;
347
348 sh.init(seq);
349
350 if (!seq1) { /* effect has no deps */
351 seq->len = 1;
352 BKE_sequence_tx_set_final_right(seq, frame_end);
353 }
354
355 seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE;
356
357 BKE_sequence_calc(scene, seq);
358 BKE_sequence_calc_disp(scene, seq);
359 BKE_sequence_invalidate_cache_composite(scene, seq);
360
361 DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
362 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
363
364 return seq;
365 }
366
rna_Sequences_remove(ID * id,Editing * ed,Main * bmain,ReportList * reports,PointerRNA * seq_ptr)367 static void rna_Sequences_remove(
368 ID *id, Editing *ed, Main *bmain, ReportList *reports, PointerRNA *seq_ptr)
369 {
370 Sequence *seq = seq_ptr->data;
371 Scene *scene = (Scene *)id;
372
373 if (BLI_findindex(&ed->seqbase, seq) == -1) {
374 BKE_reportf(
375 reports, RPT_ERROR, "Sequence '%s' not in scene '%s'", seq->name + 2, scene->id.name + 2);
376 return;
377 }
378
379 BKE_sequencer_flag_for_removal(scene, &ed->seqbase, seq);
380 BKE_sequencer_remove_flagged_sequences(scene, &ed->seqbase);
381 RNA_POINTER_INVALIDATE(seq_ptr);
382
383 DEG_relations_tag_update(bmain);
384 DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
385 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
386 }
387
rna_SequenceElements_append(ID * id,Sequence * seq,const char * filename)388 static StripElem *rna_SequenceElements_append(ID *id, Sequence *seq, const char *filename)
389 {
390 Scene *scene = (Scene *)id;
391 StripElem *se;
392
393 seq->strip->stripdata = se = MEM_reallocN(seq->strip->stripdata,
394 sizeof(StripElem) * (seq->len + 1));
395 se += seq->len;
396 BLI_strncpy(se->name, filename, sizeof(se->name));
397 seq->len++;
398
399 BKE_sequence_calc_disp(scene, seq);
400 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
401
402 return se;
403 }
404
rna_SequenceElements_pop(ID * id,Sequence * seq,ReportList * reports,int index)405 static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports, int index)
406 {
407 Scene *scene = (Scene *)id;
408 StripElem *new_seq, *se;
409
410 if (seq->len == 1) {
411 BKE_report(reports, RPT_ERROR, "SequenceElements.pop: cannot pop the last element");
412 return;
413 }
414
415 /* python style negative indexing */
416 if (index < 0) {
417 index += seq->len;
418 }
419
420 if (seq->len <= index || index < 0) {
421 BKE_report(reports, RPT_ERROR, "SequenceElements.pop: index out of range");
422 return;
423 }
424
425 new_seq = MEM_callocN(sizeof(StripElem) * (seq->len - 1), "SequenceElements_pop");
426 seq->len--;
427
428 se = seq->strip->stripdata;
429 if (index > 0) {
430 memcpy(new_seq, se, sizeof(StripElem) * index);
431 }
432
433 if (index < seq->len) {
434 memcpy(&new_seq[index], &se[index + 1], sizeof(StripElem) * (seq->len - index));
435 }
436
437 MEM_freeN(seq->strip->stripdata);
438 seq->strip->stripdata = new_seq;
439
440 BKE_sequence_calc_disp(scene, seq);
441
442 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
443 }
444
rna_Sequence_invalidate_cache_rnafunc(ID * id,Sequence * self,int type)445 static void rna_Sequence_invalidate_cache_rnafunc(ID *id, Sequence *self, int type)
446 {
447 switch (type) {
448 case SEQ_CACHE_STORE_RAW:
449 BKE_sequence_invalidate_cache_raw((Scene *)id, self);
450 break;
451 case SEQ_CACHE_STORE_PREPROCESSED:
452 BKE_sequence_invalidate_cache_preprocessed((Scene *)id, self);
453 break;
454 case SEQ_CACHE_STORE_COMPOSITE:
455 BKE_sequence_invalidate_cache_composite((Scene *)id, self);
456 break;
457 }
458 }
459
460 #else
461
RNA_api_sequence_strip(StructRNA * srna)462 void RNA_api_sequence_strip(StructRNA *srna)
463 {
464 FunctionRNA *func;
465 PropertyRNA *parm;
466
467 static const EnumPropertyItem seq_cahce_type_items[] = {
468 {SEQ_CACHE_STORE_RAW, "RAW", 0, "Raw", ""},
469 {SEQ_CACHE_STORE_PREPROCESSED, "PREPROCESSED", 0, "Preprocessed", ""},
470 {SEQ_CACHE_STORE_COMPOSITE, "COMPOSITE", 0, "Composite", ""},
471 {0, NULL, 0, NULL, NULL},
472 };
473
474 func = RNA_def_function(srna, "update", "rna_Sequence_update_rnafunc");
475 RNA_def_function_flag(func, FUNC_USE_SELF_ID);
476 RNA_def_function_ui_description(func, "Update the strip dimensions");
477 parm = RNA_def_boolean(func, "data", false, "Data", "Update strip data");
478
479 func = RNA_def_function(srna, "strip_elem_from_frame", "BKE_sequencer_give_stripelem");
480 RNA_def_function_ui_description(func, "Return the strip element from a given frame or None");
481 parm = RNA_def_int(func,
482 "frame",
483 0,
484 -MAXFRAME,
485 MAXFRAME,
486 "Frame",
487 "The frame to get the strip element from",
488 -MAXFRAME,
489 MAXFRAME);
490 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
491 RNA_def_function_return(
492 func,
493 RNA_def_pointer(func, "elem", "SequenceElement", "", "strip element of the current frame"));
494
495 func = RNA_def_function(srna, "swap", "rna_Sequence_swap_internal");
496 RNA_def_function_flag(func, FUNC_USE_REPORTS);
497 parm = RNA_def_pointer(func, "other", "Sequence", "Other", "");
498 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
499
500 func = RNA_def_function(srna, "invalidate_cache", "rna_Sequence_invalidate_cache_rnafunc");
501 RNA_def_function_flag(func, FUNC_USE_SELF_ID);
502 RNA_def_function_ui_description(func,
503 "Invalidate cached images for strip and all dependent strips");
504 parm = RNA_def_enum(func, "type", seq_cahce_type_items, 0, "Type", "Cache Type");
505 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
506 }
507
RNA_api_sequence_elements(BlenderRNA * brna,PropertyRNA * cprop)508 void RNA_api_sequence_elements(BlenderRNA *brna, PropertyRNA *cprop)
509 {
510 StructRNA *srna;
511 PropertyRNA *parm;
512 FunctionRNA *func;
513
514 RNA_def_property_srna(cprop, "SequenceElements");
515 srna = RNA_def_struct(brna, "SequenceElements", NULL);
516 RNA_def_struct_sdna(srna, "Sequence");
517 RNA_def_struct_ui_text(srna, "SequenceElements", "Collection of SequenceElement");
518
519 func = RNA_def_function(srna, "append", "rna_SequenceElements_append");
520 RNA_def_function_flag(func, FUNC_USE_SELF_ID);
521 RNA_def_function_ui_description(func, "Push an image from ImageSequence.directory");
522 parm = RNA_def_string(func, "filename", "File", 0, "", "Filepath to image");
523 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
524 /* return type */
525 parm = RNA_def_pointer(func, "elem", "SequenceElement", "", "New SequenceElement");
526 RNA_def_function_return(func, parm);
527
528 func = RNA_def_function(srna, "pop", "rna_SequenceElements_pop");
529 RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
530 RNA_def_function_ui_description(func, "Pop an image off the collection");
531 parm = RNA_def_int(
532 func, "index", -1, INT_MIN, INT_MAX, "", "Index of image to remove", INT_MIN, INT_MAX);
533 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
534 }
535
RNA_api_sequences(BlenderRNA * brna,PropertyRNA * cprop)536 void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
537 {
538 StructRNA *srna;
539 PropertyRNA *parm;
540 FunctionRNA *func;
541
542 static const EnumPropertyItem seq_effect_items[] = {
543 {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""},
544 {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
545 {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
546 {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
547 {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
548 {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
549 {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
550 {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
551 {SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", ""},
552 {SEQ_TYPE_GLOW, "GLOW", 0, "Glow", ""},
553 {SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
554 {SEQ_TYPE_COLOR, "COLOR", 0, "Color", ""},
555 {SEQ_TYPE_SPEED, "SPEED", 0, "Speed", ""},
556 {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
557 {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
558 {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
559 {SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
560 {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
561 {0, NULL, 0, NULL, NULL},
562 };
563
564 RNA_def_property_srna(cprop, "Sequences");
565 srna = RNA_def_struct(brna, "Sequences", NULL);
566 RNA_def_struct_sdna(srna, "Editing");
567 RNA_def_struct_ui_text(srna, "Sequences", "Collection of Sequences");
568
569 func = RNA_def_function(srna, "new_clip", "rna_Sequences_new_clip");
570 RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
571 RNA_def_function_ui_description(func, "Add a new movie clip sequence");
572 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
573 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
574 parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to add");
575 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
576 parm = RNA_def_int(
577 func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
578 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
579 parm = RNA_def_int(func,
580 "frame_start",
581 0,
582 -MAXFRAME,
583 MAXFRAME,
584 "",
585 "The start frame for the new sequence",
586 -MAXFRAME,
587 MAXFRAME);
588 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
589 /* return type */
590 parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
591 RNA_def_function_return(func, parm);
592
593 func = RNA_def_function(srna, "new_mask", "rna_Sequences_new_mask");
594 RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
595 RNA_def_function_ui_description(func, "Add a new mask sequence");
596 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
597 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
598 parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to add");
599 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
600 parm = RNA_def_int(
601 func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
602 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
603 parm = RNA_def_int(func,
604 "frame_start",
605 0,
606 -MAXFRAME,
607 MAXFRAME,
608 "",
609 "The start frame for the new sequence",
610 -MAXFRAME,
611 MAXFRAME);
612 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
613 /* return type */
614 parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
615 RNA_def_function_return(func, parm);
616
617 func = RNA_def_function(srna, "new_scene", "rna_Sequences_new_scene");
618 RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
619 RNA_def_function_ui_description(func, "Add a new scene sequence");
620 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
621 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
622 parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to add");
623 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
624 parm = RNA_def_int(
625 func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
626 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
627 parm = RNA_def_int(func,
628 "frame_start",
629 0,
630 -MAXFRAME,
631 MAXFRAME,
632 "",
633 "The start frame for the new sequence",
634 -MAXFRAME,
635 MAXFRAME);
636 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
637 /* return type */
638 parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
639 RNA_def_function_return(func, parm);
640
641 func = RNA_def_function(srna, "new_image", "rna_Sequences_new_image");
642 RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID | FUNC_USE_MAIN);
643 RNA_def_function_ui_description(func, "Add a new image sequence");
644 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
645 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
646 parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to image");
647 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
648 parm = RNA_def_int(
649 func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
650 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
651 parm = RNA_def_int(func,
652 "frame_start",
653 0,
654 -MAXFRAME,
655 MAXFRAME,
656 "",
657 "The start frame for the new sequence",
658 -MAXFRAME,
659 MAXFRAME);
660 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
661 /* return type */
662 parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
663 RNA_def_function_return(func, parm);
664
665 func = RNA_def_function(srna, "new_movie", "rna_Sequences_new_movie");
666 RNA_def_function_flag(func, FUNC_USE_SELF_ID);
667 RNA_def_function_ui_description(func, "Add a new movie sequence");
668 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
669 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
670 parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
671 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
672 parm = RNA_def_int(
673 func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
674 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
675 parm = RNA_def_int(func,
676 "frame_start",
677 0,
678 -MAXFRAME,
679 MAXFRAME,
680 "",
681 "The start frame for the new sequence",
682 -MAXFRAME,
683 MAXFRAME);
684 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
685 /* return type */
686 parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
687 RNA_def_function_return(func, parm);
688
689 func = RNA_def_function(srna, "new_sound", "rna_Sequences_new_sound");
690 RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID | FUNC_USE_MAIN);
691 RNA_def_function_ui_description(func, "Add a new sound sequence");
692 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
693 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
694 parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
695 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
696 parm = RNA_def_int(
697 func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
698 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
699 parm = RNA_def_int(func,
700 "frame_start",
701 0,
702 -MAXFRAME,
703 MAXFRAME,
704 "",
705 "The start frame for the new sequence",
706 -MAXFRAME,
707 MAXFRAME);
708 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
709 /* return type */
710 parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
711 RNA_def_function_return(func, parm);
712
713 func = RNA_def_function(srna, "new_effect", "rna_Sequences_new_effect");
714 RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
715 RNA_def_function_ui_description(func, "Add a new effect sequence");
716 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
717 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
718 parm = RNA_def_enum(func, "type", seq_effect_items, 0, "Type", "type for the new sequence");
719 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
720 parm = RNA_def_int(
721 func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
722 /* don't use MAXFRAME since it makes importer scripts fail */
723 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
724 parm = RNA_def_int(func,
725 "frame_start",
726 0,
727 INT_MIN,
728 INT_MAX,
729 "",
730 "The start frame for the new sequence",
731 INT_MIN,
732 INT_MAX);
733 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
734 RNA_def_int(func,
735 "frame_end",
736 0,
737 INT_MIN,
738 INT_MAX,
739 "",
740 "The end frame for the new sequence",
741 INT_MIN,
742 INT_MAX);
743 RNA_def_pointer(func, "seq1", "Sequence", "", "Sequence 1 for effect");
744 RNA_def_pointer(func, "seq2", "Sequence", "", "Sequence 2 for effect");
745 RNA_def_pointer(func, "seq3", "Sequence", "", "Sequence 3 for effect");
746 /* return type */
747 parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
748 RNA_def_function_return(func, parm);
749
750 func = RNA_def_function(srna, "remove", "rna_Sequences_remove");
751 RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS | FUNC_USE_MAIN);
752 RNA_def_function_ui_description(func, "Remove a Sequence");
753 parm = RNA_def_pointer(func, "sequence", "Sequence", "", "Sequence to remove");
754 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
755 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
756 }
757
758 #endif
759