Blender V5.0
rna_sequencer_api.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10#include <cstring>
11
12#include "DNA_scene_types.h"
13#include "DNA_sequence_types.h"
14
15#include "RNA_define.hh"
16
17#include "RNA_enum_types.hh"
18#include "SEQ_edit.hh"
19#include "SEQ_sequencer.hh"
20
21#include "rna_internal.hh"
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_utils.hh" /* #BLI_path_split_dir_file */
31
32# include "BKE_image.hh"
33# include "BKE_mask.h"
34# include "BKE_movieclip.h"
35
36# include "BKE_report.hh"
37# include "BKE_sound.h"
38
39# include "IMB_imbuf.hh"
40# include "IMB_imbuf_types.hh"
41
42# include "SEQ_add.hh"
43# include "SEQ_edit.hh"
44# include "SEQ_effects.hh"
45# include "SEQ_relations.hh"
46# include "SEQ_render.hh"
47# include "SEQ_retiming.hh"
48# include "SEQ_time.hh"
49
50# include "WM_api.hh"
51
52static StripElem *rna_Strip_elem_from_frame(ID *id, Strip *self, int timeline_frame)
53{
54 Scene *scene = (Scene *)id;
55 return blender::seq::render_give_stripelem(scene, self, timeline_frame);
56}
57
58static void rna_Strip_swap_internal(ID *id,
59 Strip *strip_self,
60 ReportList *reports,
61 Strip *strip_other)
62{
63 const char *error_msg;
64 Scene *scene = (Scene *)id;
65
66 if (blender::seq::edit_strip_swap(scene, strip_self, strip_other, &error_msg) == false) {
67 BKE_report(reports, RPT_ERROR, error_msg);
68 }
69}
70
71static void rna_Strips_move_strip_to_meta(
72 ID *id, Strip *strip_self, Main *bmain, ReportList *reports, Strip *meta_dst)
73{
74 Scene *scene = (Scene *)id;
75 const char *error_msg;
76
77 /* Move strip to meta. */
78 if (!blender::seq::edit_move_strip_to_meta(scene, strip_self, meta_dst, &error_msg)) {
79 BKE_report(reports, RPT_ERROR, error_msg);
80 }
81
82 /* Update depsgraph. */
85
87
89}
90
91static Strip *rna_Strip_split(ID *id,
92 Strip *strip,
93 Main *bmain,
94 ReportList *reports,
95 int frame,
96 int split_method,
97 bool ignore_connections)
98{
99 Scene *scene = (Scene *)id;
100 ListBase *seqbase = blender::seq::get_seqbase_by_strip(scene, strip);
101
102 const char *error_msg = nullptr;
103 Strip *strip_split = blender::seq::edit_strip_split(bmain,
104 scene,
105 seqbase,
106 strip,
107 frame,
108 blender::seq::eSplitMethod(split_method),
109 ignore_connections,
110 &error_msg);
111 if (error_msg != nullptr) {
112 BKE_report(reports, RPT_ERROR, error_msg);
113 }
114
115 /* Update depsgraph. */
118
120
121 return strip_split;
122}
123
124static Strip *rna_Strip_parent_meta(ID *id, Strip *strip_self)
125{
126 Scene *scene = (Scene *)id;
128}
129
130static Strip *rna_Strips_new_clip(ID *id,
131 ListBase *seqbase,
132 Main *bmain,
133 const char *name,
134 MovieClip *clip,
135 int channel,
136 int frame_start)
137{
138 Scene *scene = (Scene *)id;
140 blender::seq::add_load_data_init(&load_data, name, nullptr, frame_start, channel);
141 load_data.clip = clip;
142 Strip *strip = blender::seq::add_movieclip_strip(scene, seqbase, &load_data);
143
147
148 return strip;
149}
150
151static Strip *rna_Strips_editing_new_clip(ID *id,
152 Editing *ed,
153 Main *bmain,
154 const char *name,
155 MovieClip *clip,
156 int channel,
157 int frame_start)
158{
159 return rna_Strips_new_clip(id, &ed->seqbase, bmain, name, clip, channel, frame_start);
160}
161
162static Strip *rna_Strips_meta_new_clip(ID *id,
163 Strip *strip,
164 Main *bmain,
165 const char *name,
166 MovieClip *clip,
167 int channel,
168 int frame_start)
169{
170 return rna_Strips_new_clip(id, &strip->seqbase, bmain, name, clip, channel, frame_start);
171}
172
173static Strip *rna_Strips_new_mask(ID *id,
174 ListBase *seqbase,
175 Main *bmain,
176 const char *name,
177 Mask *mask,
178 int channel,
179 int frame_start)
180{
181 Scene *scene = (Scene *)id;
183 blender::seq::add_load_data_init(&load_data, name, nullptr, frame_start, channel);
184 load_data.mask = mask;
185 Strip *strip = blender::seq::add_mask_strip(scene, seqbase, &load_data);
186
190
191 return strip;
192}
193static Strip *rna_Strips_editing_new_mask(
194 ID *id, Editing *ed, Main *bmain, const char *name, Mask *mask, int channel, int frame_start)
195{
196 return rna_Strips_new_mask(id, &ed->seqbase, bmain, name, mask, channel, frame_start);
197}
198
199static Strip *rna_Strips_meta_new_mask(
200 ID *id, Strip *strip, Main *bmain, const char *name, Mask *mask, int channel, int frame_start)
201{
202 return rna_Strips_new_mask(id, &strip->seqbase, bmain, name, mask, channel, frame_start);
203}
204
205static Strip *rna_Strips_new_scene(ID *id,
206 ListBase *seqbase,
207 Main *bmain,
208 const char *name,
209 Scene *sce_strip,
210 int channel,
211 int frame_start)
212{
213 Scene *scene = (Scene *)id;
215 blender::seq::add_load_data_init(&load_data, name, nullptr, frame_start, channel);
216 load_data.scene = sce_strip;
217 Strip *strip = blender::seq::add_scene_strip(scene, seqbase, &load_data);
218
222
223 return strip;
224}
225
226static Strip *rna_Strips_editing_new_scene(ID *id,
227 Editing *ed,
228 Main *bmain,
229 const char *name,
230 Scene *sce_strip,
231 int channel,
232 int frame_start)
233{
234 return rna_Strips_new_scene(id, &ed->seqbase, bmain, name, sce_strip, channel, frame_start);
235}
236
237static Strip *rna_Strips_meta_new_scene(ID *id,
238 Strip *strip,
239 Main *bmain,
240 const char *name,
241 Scene *sce_strip,
242 int channel,
243 int frame_start)
244{
245 return rna_Strips_new_scene(id, &strip->seqbase, bmain, name, sce_strip, channel, frame_start);
246}
247
248static Strip *rna_Strips_new_image(ID *id,
249 ListBase *seqbase,
250 Main *bmain,
251 ReportList *reports,
252 const char *name,
253 const char *file,
254 int channel,
255 int frame_start,
256 int fit_method)
257{
258 Scene *scene = (Scene *)id;
259
261 blender::seq::add_load_data_init(&load_data, name, file, frame_start, channel);
262 load_data.image.count = 1;
263 load_data.fit_method = eSeqImageFitMethod(fit_method);
264
265 char vt_old[64];
267
268 Strip *strip = blender::seq::add_image_strip(bmain, scene, seqbase, &load_data);
269
270 if (!STREQ(vt_old, scene->view_settings.view_transform)) {
271 BKE_reportf(reports,
273 "View transform set to %s (converted from %s)",
275 vt_old);
276 }
277
278 char dirpath[FILE_MAX], filename[FILE_MAXFILE];
279 BLI_path_split_dir_file(file, dirpath, sizeof(dirpath), filename, sizeof(filename));
281 blender::seq::add_image_load_file(scene, strip, 0, filename);
282 blender::seq::add_image_init_alpha_mode(bmain, scene, strip);
283
287
288 return strip;
289}
290
291static Strip *rna_Strips_editing_new_image(ID *id,
292 Editing *ed,
293 Main *bmain,
294 ReportList *reports,
295 const char *name,
296 const char *file,
297 int channel,
298 int frame_start,
299 int fit_method)
300{
301 return rna_Strips_new_image(
302 id, &ed->seqbase, bmain, reports, name, file, channel, frame_start, fit_method);
303}
304
305static Strip *rna_Strips_meta_new_image(ID *id,
306 Strip *strip,
307 Main *bmain,
308 ReportList *reports,
309 const char *name,
310 const char *file,
311 int channel,
312 int frame_start,
313 int fit_method)
314{
315 return rna_Strips_new_image(
316 id, &strip->seqbase, bmain, reports, name, file, channel, frame_start, fit_method);
317}
318
319static Strip *rna_Strips_new_movie(ID *id,
320 ListBase *seqbase,
321 Main *bmain,
322 ReportList *reports,
323 const char *name,
324 const char *file,
325 int channel,
326 int frame_start,
327 int fit_method)
328{
329 Scene *scene = (Scene *)id;
331 blender::seq::add_load_data_init(&load_data, name, file, frame_start, channel);
332 load_data.fit_method = eSeqImageFitMethod(fit_method);
333 load_data.allow_invalid_file = true;
334
335 char vt_old[64];
337 float fps_old = scene->r.frs_sec / scene->r.frs_sec_base;
338
339 Strip *strip = blender::seq::add_movie_strip(bmain, scene, seqbase, &load_data);
340
341 if (!STREQ(vt_old, scene->view_settings.view_transform)) {
342 BKE_reportf(reports,
344 "View transform set to %s (converted from %s)",
346 vt_old);
347 }
348
349 if (fps_old != scene->r.frs_sec / scene->r.frs_sec_base) {
350 BKE_reportf(reports,
352 "Scene frame rate set to %.4g (converted from %.4g)",
353 scene->r.frs_sec / scene->r.frs_sec_base,
354 fps_old);
355 }
356
360
361 return strip;
362}
363
364static Strip *rna_Strips_editing_new_movie(ID *id,
365 Editing *ed,
366 Main *bmain,
367 ReportList *reports,
368 const char *name,
369 const char *file,
370 int channel,
371 int frame_start,
372 int fit_method)
373{
374 return rna_Strips_new_movie(
375 id, &ed->seqbase, bmain, reports, name, file, channel, frame_start, fit_method);
376}
377
378static Strip *rna_Strips_meta_new_movie(ID *id,
379 Strip *strip,
380 Main *bmain,
381 ReportList *reports,
382 const char *name,
383 const char *file,
384 int channel,
385 int frame_start,
386 int fit_method)
387{
388 return rna_Strips_new_movie(
389 id, &strip->seqbase, bmain, reports, name, file, channel, frame_start, fit_method);
390}
391
392# ifdef WITH_AUDASPACE
393static Strip *rna_Strips_new_sound(ID *id,
394 ListBase *seqbase,
395 Main *bmain,
396 ReportList *reports,
397 const char *name,
398 const char *file,
399 int channel,
400 int frame_start)
401{
402 Scene *scene = (Scene *)id;
404 blender::seq::add_load_data_init(&load_data, name, file, frame_start, channel);
405 load_data.allow_invalid_file = true;
406 Strip *strip = blender::seq::add_sound_strip(bmain, scene, seqbase, &load_data);
407
408 if (strip == nullptr) {
409 BKE_report(reports, RPT_ERROR, "Strips.new_sound: unable to open sound file");
410 return nullptr;
411 }
412
416
417 return strip;
418}
419# else /* WITH_AUDASPACE */
420static Strip *rna_Strips_new_sound(ID * /*id*/,
421 ListBase * /*seqbase*/,
422 Main * /*bmain*/,
423 ReportList *reports,
424 const char * /*name*/,
425 const char * /*file*/,
426 int /*channel*/,
427 int /*frame_start*/)
428{
429 BKE_report(reports, RPT_ERROR, "Blender compiled without Audaspace support");
430 return nullptr;
431}
432# endif /* WITH_AUDASPACE */
433
434static Strip *rna_Strips_editing_new_sound(ID *id,
435 Editing *ed,
436 Main *bmain,
437 ReportList *reports,
438 const char *name,
439 const char *file,
440 int channel,
441 int frame_start)
442{
443 return rna_Strips_new_sound(id, &ed->seqbase, bmain, reports, name, file, channel, frame_start);
444}
445
446static Strip *rna_Strips_meta_new_sound(ID *id,
447 Strip *strip,
448 Main *bmain,
449 ReportList *reports,
450 const char *name,
451 const char *file,
452 int channel,
453 int frame_start)
454{
455 return rna_Strips_new_sound(
456 id, &strip->seqbase, bmain, reports, name, file, channel, frame_start);
457}
458
459/* Meta strip
460 * Possibility to create an empty meta to avoid plenty of meta toggling
461 * Created meta have a length equal to 1, must be set through the API. */
462static Strip *rna_Strips_new_meta(
463 ID *id, ListBase *seqbase, const char *name, int channel, int frame_start)
464{
465 Scene *scene = (Scene *)id;
467 blender::seq::add_load_data_init(&load_data, name, nullptr, frame_start, channel);
468 Strip *seqm = blender::seq::add_meta_strip(scene, seqbase, &load_data);
469
470 return seqm;
471}
472
473static Strip *rna_Strips_editing_new_meta(
474 ID *id, Editing *ed, const char *name, int channel, int frame_start)
475{
476 return rna_Strips_new_meta(id, &ed->seqbase, name, channel, frame_start);
477}
478
479static Strip *rna_Strips_meta_new_meta(
480 ID *id, Strip *strip, const char *name, int channel, int frame_start)
481{
482 return rna_Strips_new_meta(id, &strip->seqbase, name, channel, frame_start);
483}
484
485static Strip *rna_Strips_new_effect(ID *id,
486 ListBase *seqbase,
487 ReportList *reports,
488 const char *name,
489 int type,
490 int channel,
491 int frame_start,
492 int length,
493 Strip *input1,
494 Strip *input2)
495{
496 Scene *scene = (Scene *)id;
497 Strip *strip;
498 const int num_inputs = blender::seq::effect_get_num_inputs(type);
499
500 switch (num_inputs) {
501 case 0:
502 if (length <= 0) {
503 BKE_report(reports, RPT_ERROR, "Strips.new_effect: invalid length");
504 return nullptr;
505 }
506 break;
507 case 1:
508 if (input1 == nullptr) {
509 BKE_report(reports, RPT_ERROR, "Strips.new_effect: effect takes 1 input strip");
510 return nullptr;
511 }
512 break;
513 case 2:
514 if (input1 == nullptr || input2 == nullptr) {
515 BKE_report(reports, RPT_ERROR, "Strips.new_effect: effect takes 2 input strips");
516 return nullptr;
517 }
518 break;
519 default:
521 reports,
522 RPT_ERROR,
523 "Strips.new_effect: effect expects more than 2 inputs (%d, should never happen!)",
524 num_inputs);
525 return nullptr;
526 }
527
529 blender::seq::add_load_data_init(&load_data, name, nullptr, frame_start, channel);
530 load_data.effect.length = length;
531 load_data.effect.type = type;
532 load_data.effect.input1 = input1;
533 load_data.effect.input2 = input2;
534 strip = blender::seq::add_effect_strip(scene, seqbase, &load_data);
535
538
539 return strip;
540}
541
542static Strip *rna_Strips_editing_new_effect(ID *id,
543 Editing *ed,
544 ReportList *reports,
545 const char *name,
546 int type,
547 int channel,
548 int frame_start,
549 int length,
550 Strip *input1,
551 Strip *input2)
552{
553 return rna_Strips_new_effect(
554 id, &ed->seqbase, reports, name, type, channel, frame_start, length, input1, input2);
555}
556
557static Strip *rna_Strips_meta_new_effect(ID *id,
558 Strip *strip,
559 ReportList *reports,
560 const char *name,
561 int type,
562 int channel,
563 int frame_start,
564 int length,
565 Strip *input1,
566 Strip *input2)
567{
568 return rna_Strips_new_effect(
569 id, &strip->seqbase, reports, name, type, channel, frame_start, length, input1, input2);
570}
571
572static void rna_Strips_remove(
573 ID *id, ListBase *seqbase, Main *bmain, ReportList *reports, PointerRNA *strip_ptr)
574{
575 Strip *strip = static_cast<Strip *>(strip_ptr->data);
576 Scene *scene = (Scene *)id;
577
578 if (BLI_findindex(seqbase, strip) == -1) {
580 reports, RPT_ERROR, "Strip '%s' not in scene '%s'", strip->name + 2, scene->id.name + 2);
581 return;
582 }
583
584 blender::seq::edit_flag_for_removal(scene, seqbase, strip);
586 strip_ptr->invalidate();
587
591}
592
593static void rna_Strips_editing_remove(
594 ID *id, Editing *ed, Main *bmain, ReportList *reports, PointerRNA *strip_ptr)
595{
596 rna_Strips_remove(id, &ed->seqbase, bmain, reports, strip_ptr);
597}
598
599static void rna_Strips_meta_remove(
600 ID *id, Strip *strip, Main *bmain, ReportList *reports, PointerRNA *strip_ptr)
601{
602 rna_Strips_remove(id, &strip->seqbase, bmain, reports, strip_ptr);
603}
604
605static StripElem *rna_StripElements_append(ID *id, Strip *strip, const char *filename)
606{
607 Scene *scene = (Scene *)id;
608 StripElem *se;
609
610 strip->data->stripdata = se = static_cast<StripElem *>(
611 MEM_reallocN(strip->data->stripdata, sizeof(StripElem) * (strip->len + 1)));
612 se += strip->len;
613 STRNCPY(se->filename, filename);
614 strip->len++;
615
617
619
620 return se;
621}
622
623static void rna_StripElements_pop(ID *id, Strip *strip, ReportList *reports, int index)
624{
625 Scene *scene = (Scene *)id;
626 StripElem *new_se, *se;
627
628 if (strip->len == 1) {
629 BKE_report(reports, RPT_ERROR, "StripElements.pop: cannot pop the last element");
630 return;
631 }
632
633 /* python style negative indexing */
634 if (index < 0) {
635 index += strip->len;
636 }
637
638 if (strip->len <= index || index < 0) {
639 BKE_report(reports, RPT_ERROR, "StripElements.pop: index out of range");
640 return;
641 }
642
643 new_se = MEM_calloc_arrayN<StripElem>(size_t(strip->len) - 1, "StripElements_pop");
644 strip->len--;
645
646 if (strip->len == 1) {
648 }
649
650 se = strip->data->stripdata;
651 if (index > 0) {
652 memcpy(new_se, se, sizeof(StripElem) * index);
653 }
654
655 if (index < strip->len) {
656 memcpy(&new_se[index], &se[index + 1], sizeof(StripElem) * (strip->len - index));
657 }
658
659 MEM_freeN(strip->data->stripdata);
660 strip->data->stripdata = new_se;
661
663}
664
665static void rna_Strip_invalidate_cache_rnafunc(ID *id, Strip *self, int type)
666{
667 switch (type) {
670 break;
673 break;
674 }
675}
676
677static SeqRetimingKey *rna_Strip_retiming_keys_add(ID *id, Strip *strip, int timeline_frame)
678{
679 Scene *scene = (Scene *)id;
680
681 SeqRetimingKey *key = blender::seq::retiming_add_key(scene, strip, timeline_frame);
682
685 return key;
686}
687
688static void rna_Strip_retiming_keys_reset(ID *id, Strip *strip)
689{
690 Scene *scene = (Scene *)id;
691
693
696}
697
698#else
699
701{
702 FunctionRNA *func;
703 PropertyRNA *parm;
704
705 static const EnumPropertyItem strip_cache_type_items[] = {
706 {SEQ_CACHE_STORE_RAW, "RAW", 0, "Raw", ""},
707 {SEQ_CACHE_STORE_FINAL_OUT, "COMPOSITE", 0, "Composite", ""},
708 {0, nullptr, 0, nullptr, nullptr},
709 };
710
711 static const EnumPropertyItem strip_split_method_items[] = {
712 {blender::seq::SPLIT_SOFT, "SOFT", 0, "Soft", ""},
713 {blender::seq::SPLIT_HARD, "HARD", 0, "Hard", ""},
714 {0, nullptr, 0, nullptr, nullptr},
715 };
716
717 func = RNA_def_function(srna, "strip_elem_from_frame", "rna_Strip_elem_from_frame");
719 RNA_def_function_ui_description(func, "Return the strip element from a given frame or None");
720 parm = RNA_def_int(func,
721 "frame",
722 0,
723 -MAXFRAME,
724 MAXFRAME,
725 "Frame",
726 "The frame to get the strip element from",
727 -MAXFRAME,
728 MAXFRAME);
731 func,
732 RNA_def_pointer(func, "elem", "StripElement", "", "strip element of the current frame"));
733
734 func = RNA_def_function(srna, "swap", "rna_Strip_swap_internal");
737 parm = RNA_def_pointer(func, "other", "Strip", "Other", "");
739
740 func = RNA_def_function(srna, "move_to_meta", "rna_Strips_move_strip_to_meta");
742 parm = RNA_def_pointer(
743 func, "meta_sequence", "Strip", "Destination Meta Strip", "Meta to move the strip into");
745
746 func = RNA_def_function(srna, "parent_meta", "rna_Strip_parent_meta");
748 RNA_def_function_ui_description(func, "Parent meta");
749 /* return type */
750 parm = RNA_def_pointer(func, "sequence", "Strip", "", "Parent Meta");
751 RNA_def_function_return(func, parm);
752
753 func = RNA_def_function(srna, "invalidate_cache", "rna_Strip_invalidate_cache_rnafunc");
756 "Invalidate cached images for strip and all dependent strips");
757 parm = RNA_def_enum(func, "type", strip_cache_type_items, 0, "Type", "Cache Type");
759
760 func = RNA_def_function(srna, "split", "rna_Strip_split");
762 RNA_def_function_ui_description(func, "Split Strip");
763 parm = RNA_def_int(
764 func, "frame", 0, INT_MIN, INT_MAX, "", "Frame where to split the strip", INT_MIN, INT_MAX);
766 parm = RNA_def_enum(func, "split_method", strip_split_method_items, 0, "", "");
768 parm = RNA_def_boolean(
769 func, "ignore_connections", false, "", "Don't propagate split to connected strips");
770 /* Return type. */
771 parm = RNA_def_pointer(func, "sequence", "Strip", "", "Right side Strip");
772 RNA_def_function_return(func, parm);
773}
774
776{
777 StructRNA *srna;
778 PropertyRNA *parm;
779 FunctionRNA *func;
780
781 RNA_def_property_srna(cprop, "StripElements");
782 srna = RNA_def_struct(brna, "StripElements", nullptr);
783 RNA_def_struct_sdna(srna, "Strip");
784 RNA_def_struct_ui_text(srna, "StripElements", "Collection of StripElement");
785
786 func = RNA_def_function(srna, "append", "rna_StripElements_append");
788 RNA_def_function_ui_description(func, "Push an image from ImageStrip.directory");
789 parm = RNA_def_string(func, "filename", "File", 0, "", "Filepath to image");
791 /* return type */
792 parm = RNA_def_pointer(func, "elem", "StripElement", "", "New StripElement");
793 RNA_def_function_return(func, parm);
794
795 func = RNA_def_function(srna, "pop", "rna_StripElements_pop");
797 RNA_def_function_ui_description(func, "Pop an image off the collection");
798 parm = RNA_def_int(
799 func, "index", -1, INT_MIN, INT_MAX, "", "Index of image to remove", INT_MIN, INT_MAX);
801}
802
804{
805 StructRNA *srna = RNA_def_struct(brna, "RetimingKeys", nullptr);
806 RNA_def_struct_sdna(srna, "Strip");
807 RNA_def_struct_ui_text(srna, "RetimingKeys", "Collection of RetimingKey");
808
809 FunctionRNA *func = RNA_def_function(srna, "add", "rna_Strip_retiming_keys_add");
812 func, "timeline_frame", 0, -MAXFRAME, MAXFRAME, "Timeline Frame", "", -MAXFRAME, MAXFRAME);
813 RNA_def_function_ui_description(func, "Add retiming key");
814 /* return type */
815 PropertyRNA *parm = RNA_def_pointer(func, "retiming_key", "RetimingKey", "", "New RetimingKey");
816 RNA_def_function_return(func, parm);
817
818 func = RNA_def_function(srna, "reset", "rna_Strip_retiming_keys_reset");
820 RNA_def_function_ui_description(func, "Remove all retiming keys");
821}
822
823void RNA_api_strips(StructRNA *srna, const bool metastrip)
824{
825 PropertyRNA *parm;
826 FunctionRNA *func;
827
828 static const EnumPropertyItem strip_effect_items[] = {
829 {STRIP_TYPE_CROSS, "CROSS", 0, "Crossfade", "Fade out of one video, fading into another"},
830 {STRIP_TYPE_ADD, "ADD", 0, "Add", "Add together color channels from two videos"},
831 {STRIP_TYPE_SUB, "SUBTRACT", 0, "Subtract", "Subtract one strip's color from another"},
832 {STRIP_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", "Blend alpha on top of another video"},
833 {STRIP_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", "Blend alpha below another video"},
835 "GAMMA_CROSS",
836 0,
837 "Gamma Crossfade",
838 "Crossfade with color correction"},
839 {STRIP_TYPE_MUL, "MULTIPLY", 0, "Multiply", "Multiply color channels from two videos"},
840 {STRIP_TYPE_WIPE, "WIPE", 0, "Wipe", "Sweep a transition line across the frame"},
841 {STRIP_TYPE_GLOW, "GLOW", 0, "Glow", "Add blur and brightness to light areas"},
842 {STRIP_TYPE_COLOR, "COLOR", 0, "Color", "Add a simple color strip"},
843 {STRIP_TYPE_SPEED, "SPEED", 0, "Speed", "Timewarp video strips, modifying playback speed"},
844 {STRIP_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", "Control active camera angles"},
845 {STRIP_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", "Apply nondestructive effects"},
846 {STRIP_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", "Soften details along axes"},
847 {STRIP_TYPE_TEXT, "TEXT", 0, "Text", "Add a simple text strip"},
848 {STRIP_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", "Combine two strips using blend modes"},
849 {0, nullptr, 0, nullptr, nullptr},
850 };
851
852 const char *new_clip_func_name = "rna_Strips_editing_new_clip";
853 const char *new_mask_func_name = "rna_Strips_editing_new_mask";
854 const char *new_scene_func_name = "rna_Strips_editing_new_scene";
855 const char *new_image_func_name = "rna_Strips_editing_new_image";
856 const char *new_movie_func_name = "rna_Strips_editing_new_movie";
857 const char *new_sound_func_name = "rna_Strips_editing_new_sound";
858 const char *new_meta_func_name = "rna_Strips_editing_new_meta";
859 const char *new_effect_func_name = "rna_Strips_editing_new_effect";
860 const char *remove_func_name = "rna_Strips_editing_remove";
861
862 if (metastrip) {
863 new_clip_func_name = "rna_Strips_meta_new_clip";
864 new_mask_func_name = "rna_Strips_meta_new_mask";
865 new_scene_func_name = "rna_Strips_meta_new_scene";
866 new_image_func_name = "rna_Strips_meta_new_image";
867 new_movie_func_name = "rna_Strips_meta_new_movie";
868 new_sound_func_name = "rna_Strips_meta_new_sound";
869 new_meta_func_name = "rna_Strips_meta_new_meta";
870 new_effect_func_name = "rna_Strips_meta_new_effect";
871 remove_func_name = "rna_Strips_meta_remove";
872 }
873
874 func = RNA_def_function(srna, "new_clip", new_clip_func_name);
876 RNA_def_function_ui_description(func, "Add a new movie clip strip");
877 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
879 parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to add");
881 parm = RNA_def_int(func,
882 "channel",
883 0,
884 1,
886 "Channel",
887 "The channel for the new strip",
888 1,
891 parm = RNA_def_int(func,
892 "frame_start",
893 0,
894 -MAXFRAME,
895 MAXFRAME,
896 "",
897 "The start frame for the new strip",
898 -MAXFRAME,
899 MAXFRAME);
901 /* return type */
902 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
903 RNA_def_function_return(func, parm);
904
905 func = RNA_def_function(srna, "new_mask", new_mask_func_name);
907 RNA_def_function_ui_description(func, "Add a new mask strip");
908 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
910 parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to add");
912 parm = RNA_def_int(func,
913 "channel",
914 0,
915 1,
917 "Channel",
918 "The channel for the new strip",
919 1,
922 parm = RNA_def_int(func,
923 "frame_start",
924 0,
925 -MAXFRAME,
926 MAXFRAME,
927 "",
928 "The start frame for the new strip",
929 -MAXFRAME,
930 MAXFRAME);
932 /* return type */
933 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
934 RNA_def_function_return(func, parm);
935
936 func = RNA_def_function(srna, "new_scene", new_scene_func_name);
938 RNA_def_function_ui_description(func, "Add a new scene strip");
939 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
941 parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to add");
943 parm = RNA_def_int(func,
944 "channel",
945 0,
946 1,
948 "Channel",
949 "The channel for the new strip",
950 1,
953 parm = RNA_def_int(func,
954 "frame_start",
955 0,
956 -MAXFRAME,
957 MAXFRAME,
958 "",
959 "The start frame for the new strip",
960 -MAXFRAME,
961 MAXFRAME);
963 /* return type */
964 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
965 RNA_def_function_return(func, parm);
966
967 func = RNA_def_function(srna, "new_image", new_image_func_name);
969 RNA_def_function_ui_description(func, "Add a new image strip");
970 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
972 parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to image");
974 parm = RNA_def_int(func,
975 "channel",
976 0,
977 1,
979 "Channel",
980 "The channel for the new strip",
981 1,
984 parm = RNA_def_int(func,
985 "frame_start",
986 0,
987 -MAXFRAME,
988 MAXFRAME,
989 "",
990 "The start frame for the new strip",
991 -MAXFRAME,
992 MAXFRAME);
994 parm = RNA_def_enum(func,
995 "fit_method",
998 "Image Fit Method",
999 nullptr);
1000 /* return type */
1001 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
1002 RNA_def_function_return(func, parm);
1003
1004 func = RNA_def_function(srna, "new_movie", new_movie_func_name);
1006 RNA_def_function_ui_description(func, "Add a new movie strip");
1007 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
1009 parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
1011 parm = RNA_def_int(func,
1012 "channel",
1013 0,
1014 1,
1016 "Channel",
1017 "The channel for the new strip",
1018 1,
1021 parm = RNA_def_int(func,
1022 "frame_start",
1023 0,
1024 -MAXFRAME,
1025 MAXFRAME,
1026 "",
1027 "The start frame for the new strip",
1028 -MAXFRAME,
1029 MAXFRAME);
1031 parm = RNA_def_enum(func,
1032 "fit_method",
1035 "Image Fit Method",
1036 nullptr);
1037 /* return type */
1038 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
1039 RNA_def_function_return(func, parm);
1040
1041 func = RNA_def_function(srna, "new_sound", new_sound_func_name);
1043 RNA_def_function_ui_description(func, "Add a new sound strip");
1044 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
1046 parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
1048 parm = RNA_def_int(func,
1049 "channel",
1050 0,
1051 1,
1053 "Channel",
1054 "The channel for the new strip",
1055 1,
1058 parm = RNA_def_int(func,
1059 "frame_start",
1060 0,
1061 -MAXFRAME,
1062 MAXFRAME,
1063 "",
1064 "The start frame for the new strip",
1065 -MAXFRAME,
1066 MAXFRAME);
1068 /* return type */
1069 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
1070 RNA_def_function_return(func, parm);
1071
1072 func = RNA_def_function(srna, "new_meta", new_meta_func_name);
1074 RNA_def_function_ui_description(func, "Add a new meta strip");
1075 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
1077 parm = RNA_def_int(func,
1078 "channel",
1079 0,
1080 1,
1082 "Channel",
1083 "The channel for the new strip",
1084 1,
1087 parm = RNA_def_int(func,
1088 "frame_start",
1089 0,
1090 -MAXFRAME,
1091 MAXFRAME,
1092 "",
1093 "The start frame for the new strip",
1094 -MAXFRAME,
1095 MAXFRAME);
1097 /* return type */
1098 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
1099 RNA_def_function_return(func, parm);
1100
1101 func = RNA_def_function(srna, "new_effect", new_effect_func_name);
1103 RNA_def_function_ui_description(func, "Add a new effect strip");
1104 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
1106 parm = RNA_def_enum(func, "type", strip_effect_items, 0, "Type", "type for the new strip");
1108 parm = RNA_def_int(func,
1109 "channel",
1110 0,
1111 1,
1113 "Channel",
1114 "The channel for the new strip",
1115 1,
1117 /* don't use MAXFRAME since it makes importer scripts fail */
1119 parm = RNA_def_int(func,
1120 "frame_start",
1121 0,
1122 INT_MIN,
1123 INT_MAX,
1124 "",
1125 "The start frame for the new strip",
1126 INT_MIN,
1127 INT_MAX);
1129 RNA_def_int(func,
1130 "length",
1131 0,
1132 INT_MIN,
1133 INT_MAX,
1134 "",
1135 "Length of the strip in frames, or the length of each strip if multiple are added",
1136 INT_MIN,
1137 INT_MAX);
1138 RNA_def_pointer(func, "input1", "Strip", "", "First input strip for effect");
1139 RNA_def_pointer(func, "input2", "Strip", "", "Second input strip for effect");
1140 /* return type */
1141 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
1142 RNA_def_function_return(func, parm);
1143
1144 func = RNA_def_function(srna, "remove", remove_func_name);
1146 RNA_def_function_ui_description(func, "Remove a Strip");
1147 parm = RNA_def_pointer(func, "sequence", "Strip", "", "Strip to remove");
1150}
1151
1152#endif
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
@ RPT_ERROR
Definition BKE_report.hh:39
@ RPT_WARNING
Definition BKE_report.hh:38
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:586
#define FILE_MAXFILE
#define FILE_MAX
void BLI_path_split_dir_file(const char *filepath, char *dir, size_t dir_maxncpy, char *file, size_t file_maxncpy) ATTR_NONNULL(1
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:693
#define STRNCPY_UTF8(dst, src)
#define STREQ(a, b)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ ID_RECALC_SEQUENCER_STRIPS
Definition DNA_ID.h:1122
eSeqImageFitMethod
@ SEQ_USE_ORIGINAL_SIZE
#define MAXFRAME
@ SEQ_CACHE_STORE_RAW
@ SEQ_CACHE_STORE_FINAL_OUT
@ STRIP_TYPE_GAUSSIAN_BLUR
@ STRIP_TYPE_GAMCROSS
@ STRIP_TYPE_COLORMIX
@ STRIP_TYPE_WIPE
@ STRIP_TYPE_TEXT
@ STRIP_TYPE_ADD
@ STRIP_TYPE_GLOW
@ STRIP_TYPE_SUB
@ STRIP_TYPE_MUL
@ STRIP_TYPE_SPEED
@ STRIP_TYPE_COLOR
@ STRIP_TYPE_ADJUSTMENT
@ STRIP_TYPE_MULTICAM
@ STRIP_TYPE_ALPHAUNDER
@ STRIP_TYPE_CROSS
@ STRIP_TYPE_ALPHAOVER
@ SEQ_SINGLE_FRAME_CONTENT
#define MEM_reallocN(vmemh, len)
ParameterFlag
Definition RNA_types.hh:544
@ PARM_RNAPTR
Definition RNA_types.hh:547
@ PARM_REQUIRED
Definition RNA_types.hh:545
@ FUNC_USE_REPORTS
Definition RNA_types.hh:914
@ FUNC_USE_MAIN
Definition RNA_types.hh:912
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:889
PropertyFlag
Definition RNA_types.hh:300
@ PROP_THICK_WRAP
Definition RNA_types.hh:423
@ PROP_NEVER_NULL
Definition RNA_types.hh:377
#define ND_SEQUENCER
Definition WM_types.hh:437
#define NC_SCENE
Definition WM_types.hh:378
PyObject * self
float4 load_data(StoredFloat4 data)
float length(VecOp< float, D >) RET
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:123
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
Strip * lookup_meta_by_strip(Editing *ed, const Strip *key)
void relations_invalidate_cache(Scene *scene, Strip *strip)
void edit_remove_flagged_strips(Scene *scene, ListBase *seqbase)
void edit_flag_for_removal(Scene *scene, ListBase *seqbase, Strip *strip)
Editing * editing_get(const Scene *scene)
Definition sequencer.cc:286
ListBase * get_seqbase_by_strip(const Scene *scene, Strip *strip)
Strip * add_effect_strip(Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:166
void add_image_load_file(Scene *scene, Strip *strip, size_t strip_frame, const char *filename)
Definition strip_add.cc:202
void add_image_set_directory(Strip *strip, const char *dirpath)
Definition strip_add.cc:197
Strip * add_sound_strip(Main *, Scene *, ListBase *, LoadData *)
Definition strip_add.cc:374
void relations_invalidate_cache_raw(Scene *scene, Strip *strip)
void retiming_data_clear(Strip *strip)
Strip * add_meta_strip(Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:383
constexpr int MAX_CHANNELS
Strip * add_scene_strip(Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:131
bool edit_move_strip_to_meta(Scene *scene, Strip *src_strip, Strip *dst_stripm, const char **r_error_str)
void add_image_init_alpha_mode(Main *bmain, Scene *scene, Strip *strip)
Definition strip_add.cc:208
Strip * add_image_strip(Main *bmain, Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:239
Strip * add_movieclip_strip(Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:143
bool edit_strip_swap(Scene *scene, Strip *strip_a, Strip *strip_b, const char **r_error_str)
Definition strip_edit.cc:44
Strip * add_mask_strip(Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:155
Strip * edit_strip_split(Main *bmain, Scene *scene, ListBase *seqbase, Strip *strip, const int timeline_frame, const eSplitMethod method, const bool ignore_connections, const char **r_error)
void strip_lookup_invalidate(const Editing *ed)
SeqRetimingKey * retiming_add_key(const Scene *scene, Strip *strip, const int timeline_frame)
Strip * add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:401
void add_load_data_init(LoadData *load_data, const char *name, const char *path, const int start_frame, const int channel)
Definition strip_add.cc:62
StripElem * render_give_stripelem(const Scene *scene, const Strip *strip, int timeline_frame)
Definition render.cc:238
int effect_get_num_inputs(int strip_type)
Definition effects.cc:327
const char * name
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_function_flag(FunctionRNA *func, int flag)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
const EnumPropertyItem rna_enum_strip_scale_method_items[]
void RNA_api_strip(StructRNA *srna)
void RNA_api_strip_retiming_keys(BlenderRNA *brna)
void RNA_api_strips(StructRNA *srna, const bool metastrip)
void RNA_api_strip_elements(BlenderRNA *brna, PropertyRNA *cprop)
ListBase seqbase
Definition DNA_ID.h:414
char name[258]
Definition DNA_ID.h:432
void invalidate()
Definition RNA_types.hh:110
void * data
Definition RNA_types.hh:53
ColorManagedViewSettings view_settings
struct Editing * ed
struct RenderData r
StripElem * stripdata
char filename[256]
StripData * data
ListBase seqbase
char name[64]
uint len
void WM_main_add_notifier(uint type, void *reference)