Blender V4.5
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 "SEQ_edit.hh"
18#include "SEQ_sequencer.hh"
19
20#include "rna_internal.hh"
21
22#ifdef RNA_RUNTIME
23
24// #include "DNA_anim_types.h"
25# include "DNA_image_types.h"
26# include "DNA_mask_types.h"
27# include "DNA_sound_types.h"
28
29# include "BLI_path_utils.hh" /* #BLI_path_split_dir_file */
30
31# include "BKE_image.hh"
32# include "BKE_mask.h"
33# include "BKE_movieclip.h"
34
35# include "BKE_report.hh"
36# include "BKE_sound.h"
37
38# include "IMB_imbuf.hh"
39# include "IMB_imbuf_types.hh"
40
41# include "SEQ_add.hh"
42# include "SEQ_edit.hh"
43# include "SEQ_effects.hh"
44# include "SEQ_relations.hh"
45# include "SEQ_render.hh"
46# include "SEQ_retiming.hh"
47# include "SEQ_time.hh"
48
49# include "WM_api.hh"
50
51static StripElem *rna_Strip_elem_from_frame(ID *id, Strip *self, int timeline_frame)
52{
53 Scene *scene = (Scene *)id;
54 return blender::seq::render_give_stripelem(scene, self, timeline_frame);
55}
56
57static void rna_Strip_swap_internal(ID *id,
58 Strip *strip_self,
60 Strip *strip_other)
61{
62 const char *error_msg;
63 Scene *scene = (Scene *)id;
64
65 if (blender::seq::edit_strip_swap(scene, strip_self, strip_other, &error_msg) == false) {
66 BKE_report(reports, RPT_ERROR, error_msg);
67 }
68}
69
70static void rna_Strips_move_strip_to_meta(
71 ID *id, Strip *strip_self, Main *bmain, ReportList *reports, Strip *meta_dst)
72{
73 Scene *scene = (Scene *)id;
74 const char *error_msg;
75
76 /* Move strip to meta. */
77 if (!blender::seq::edit_move_strip_to_meta(scene, strip_self, meta_dst, &error_msg)) {
78 BKE_report(reports, RPT_ERROR, error_msg);
79 }
80
81 /* Update depsgraph. */
84
86
88}
89
90static Strip *rna_Strip_split(ID *id,
91 Strip *strip,
92 Main *bmain,
94 int frame,
95 int split_method,
96 bool ignore_connections)
97{
98 Scene *scene = (Scene *)id;
99 ListBase *seqbase = blender::seq::get_seqbase_by_strip(scene, strip);
100
101 const char *error_msg = nullptr;
102 Strip *strip_split = blender::seq::edit_strip_split(bmain,
103 scene,
104 seqbase,
105 strip,
106 frame,
107 blender::seq::eSplitMethod(split_method),
108 ignore_connections,
109 &error_msg);
110 if (error_msg != nullptr) {
111 BKE_report(reports, RPT_ERROR, error_msg);
112 }
113
114 /* Update depsgraph. */
117
119
120 return strip_split;
121}
122
123static Strip *rna_Strip_parent_meta(ID *id, Strip *strip_self)
124{
125 Scene *scene = (Scene *)id;
127}
128
129static Strip *rna_Strips_new_clip(ID *id,
130 ListBase *seqbase,
131 Main *bmain,
132 const char *name,
133 MovieClip *clip,
134 int channel,
135 int frame_start)
136{
137 Scene *scene = (Scene *)id;
138 blender::seq::LoadData load_data;
139 blender::seq::add_load_data_init(&load_data, name, nullptr, frame_start, channel);
140 load_data.clip = clip;
141 Strip *strip = blender::seq::add_movieclip_strip(scene, seqbase, &load_data);
142
146
147 return strip;
148}
149
150static Strip *rna_Strips_editing_new_clip(ID *id,
151 Editing *ed,
152 Main *bmain,
153 const char *name,
154 MovieClip *clip,
155 int channel,
156 int frame_start)
157{
158 return rna_Strips_new_clip(id, &ed->seqbase, bmain, name, clip, channel, frame_start);
159}
160
161static Strip *rna_Strips_meta_new_clip(ID *id,
162 Strip *strip,
163 Main *bmain,
164 const char *name,
165 MovieClip *clip,
166 int channel,
167 int frame_start)
168{
169 return rna_Strips_new_clip(id, &strip->seqbase, bmain, name, clip, channel, frame_start);
170}
171
172static Strip *rna_Strips_new_mask(ID *id,
173 ListBase *seqbase,
174 Main *bmain,
175 const char *name,
176 Mask *mask,
177 int channel,
178 int frame_start)
179{
180 Scene *scene = (Scene *)id;
181 blender::seq::LoadData load_data;
182 blender::seq::add_load_data_init(&load_data, name, nullptr, frame_start, channel);
183 load_data.mask = mask;
184 Strip *strip = blender::seq::add_mask_strip(scene, seqbase, &load_data);
185
189
190 return strip;
191}
192static Strip *rna_Strips_editing_new_mask(
193 ID *id, Editing *ed, Main *bmain, const char *name, Mask *mask, int channel, int frame_start)
194{
195 return rna_Strips_new_mask(id, &ed->seqbase, bmain, name, mask, channel, frame_start);
196}
197
198static Strip *rna_Strips_meta_new_mask(
199 ID *id, Strip *strip, Main *bmain, const char *name, Mask *mask, int channel, int frame_start)
200{
201 return rna_Strips_new_mask(id, &strip->seqbase, bmain, name, mask, channel, frame_start);
202}
203
204static Strip *rna_Strips_new_scene(ID *id,
205 ListBase *seqbase,
206 Main *bmain,
207 const char *name,
208 Scene *sce_strip,
209 int channel,
210 int frame_start)
211{
212 Scene *scene = (Scene *)id;
213 blender::seq::LoadData load_data;
214 blender::seq::add_load_data_init(&load_data, name, nullptr, frame_start, channel);
215 load_data.scene = sce_strip;
216 Strip *strip = blender::seq::add_scene_strip(scene, seqbase, &load_data);
217
221
222 return strip;
223}
224
225static Strip *rna_Strips_editing_new_scene(ID *id,
226 Editing *ed,
227 Main *bmain,
228 const char *name,
229 Scene *sce_strip,
230 int channel,
231 int frame_start)
232{
233 return rna_Strips_new_scene(id, &ed->seqbase, bmain, name, sce_strip, channel, frame_start);
234}
235
236static Strip *rna_Strips_meta_new_scene(ID *id,
237 Strip *strip,
238 Main *bmain,
239 const char *name,
240 Scene *sce_strip,
241 int channel,
242 int frame_start)
243{
244 return rna_Strips_new_scene(id, &strip->seqbase, bmain, name, sce_strip, channel, frame_start);
245}
246
247static Strip *rna_Strips_new_image(ID *id,
248 ListBase *seqbase,
249 Main *bmain,
251 const char *name,
252 const char *file,
253 int channel,
254 int frame_start,
255 int fit_method)
256{
257 Scene *scene = (Scene *)id;
258
259 blender::seq::LoadData load_data;
260 blender::seq::add_load_data_init(&load_data, name, file, frame_start, channel);
261 load_data.image.len = 1;
262 load_data.fit_method = eSeqImageFitMethod(fit_method);
263
264 char vt_old[64];
265 STRNCPY(vt_old, scene->view_settings.view_transform);
266
267 Strip *strip = blender::seq::add_image_strip(bmain, scene, seqbase, &load_data);
268
269 if (!STREQ(vt_old, scene->view_settings.view_transform)) {
272 "View transform set to %s (converted from %s)",
274 vt_old);
275 }
276
277 char dirpath[FILE_MAX], filename[FILE_MAXFILE];
278 BLI_path_split_dir_file(file, dirpath, sizeof(dirpath), filename, sizeof(filename));
280 blender::seq::add_image_load_file(scene, strip, 0, filename);
282
286
287 return strip;
288}
289
290static Strip *rna_Strips_editing_new_image(ID *id,
291 Editing *ed,
292 Main *bmain,
294 const char *name,
295 const char *file,
296 int channel,
297 int frame_start,
298 int fit_method)
299{
300 return rna_Strips_new_image(
301 id, &ed->seqbase, bmain, reports, name, file, channel, frame_start, fit_method);
302}
303
304static Strip *rna_Strips_meta_new_image(ID *id,
305 Strip *strip,
306 Main *bmain,
308 const char *name,
309 const char *file,
310 int channel,
311 int frame_start,
312 int fit_method)
313{
314 return rna_Strips_new_image(
315 id, &strip->seqbase, bmain, reports, name, file, channel, frame_start, fit_method);
316}
317
318static Strip *rna_Strips_new_movie(ID *id,
319 ListBase *seqbase,
320 Main *bmain,
322 const char *name,
323 const char *file,
324 int channel,
325 int frame_start,
326 int fit_method)
327{
328 Scene *scene = (Scene *)id;
329 blender::seq::LoadData load_data;
330 blender::seq::add_load_data_init(&load_data, name, file, frame_start, channel);
331 load_data.fit_method = eSeqImageFitMethod(fit_method);
332 load_data.allow_invalid_file = true;
333
334 char vt_old[64];
335 STRNCPY(vt_old, scene->view_settings.view_transform);
336 float fps_old = scene->r.frs_sec / scene->r.frs_sec_base;
337
338 Strip *strip = blender::seq::add_movie_strip(bmain, scene, seqbase, &load_data);
339
340 if (!STREQ(vt_old, scene->view_settings.view_transform)) {
343 "View transform set to %s (converted from %s)",
345 vt_old);
346 }
347
348 if (fps_old != scene->r.frs_sec / scene->r.frs_sec_base) {
351 "Scene frame rate set to %.4g (converted from %.4g)",
352 scene->r.frs_sec / scene->r.frs_sec_base,
353 fps_old);
354 }
355
359
360 return strip;
361}
362
363static Strip *rna_Strips_editing_new_movie(ID *id,
364 Editing *ed,
365 Main *bmain,
367 const char *name,
368 const char *file,
369 int channel,
370 int frame_start,
371 int fit_method)
372{
373 return rna_Strips_new_movie(
374 id, &ed->seqbase, bmain, reports, name, file, channel, frame_start, fit_method);
375}
376
377static Strip *rna_Strips_meta_new_movie(ID *id,
378 Strip *strip,
379 Main *bmain,
381 const char *name,
382 const char *file,
383 int channel,
384 int frame_start,
385 int fit_method)
386{
387 return rna_Strips_new_movie(
388 id, &strip->seqbase, bmain, reports, name, file, channel, frame_start, fit_method);
389}
390
391# ifdef WITH_AUDASPACE
392static Strip *rna_Strips_new_sound(ID *id,
393 ListBase *seqbase,
394 Main *bmain,
396 const char *name,
397 const char *file,
398 int channel,
399 int frame_start)
400{
401 Scene *scene = (Scene *)id;
402 blender::seq::LoadData load_data;
403 blender::seq::add_load_data_init(&load_data, name, file, frame_start, channel);
404 load_data.allow_invalid_file = true;
405 Strip *strip = blender::seq::add_sound_strip(bmain, scene, seqbase, &load_data);
406
407 if (strip == nullptr) {
408 BKE_report(reports, RPT_ERROR, "Strips.new_sound: unable to open sound file");
409 return nullptr;
410 }
411
415
416 return strip;
417}
418# else /* WITH_AUDASPACE */
419static Strip *rna_Strips_new_sound(ID * /*id*/,
420 ListBase * /*seqbase*/,
421 Main * /*bmain*/,
423 const char * /*name*/,
424 const char * /*file*/,
425 int /*channel*/,
426 int /*frame_start*/)
427{
428 BKE_report(reports, RPT_ERROR, "Blender compiled without Audaspace support");
429 return nullptr;
430}
431# endif /* WITH_AUDASPACE */
432
433static Strip *rna_Strips_editing_new_sound(ID *id,
434 Editing *ed,
435 Main *bmain,
437 const char *name,
438 const char *file,
439 int channel,
440 int frame_start)
441{
442 return rna_Strips_new_sound(id, &ed->seqbase, bmain, reports, name, file, channel, frame_start);
443}
444
445static Strip *rna_Strips_meta_new_sound(ID *id,
446 Strip *strip,
447 Main *bmain,
449 const char *name,
450 const char *file,
451 int channel,
452 int frame_start)
453{
454 return rna_Strips_new_sound(
455 id, &strip->seqbase, bmain, reports, name, file, channel, frame_start);
456}
457
458/* Meta strip
459 * Possibility to create an empty meta to avoid plenty of meta toggling
460 * Created meta have a length equal to 1, must be set through the API. */
461static Strip *rna_Strips_new_meta(
462 ID *id, ListBase *seqbase, const char *name, int channel, int frame_start)
463{
464 Scene *scene = (Scene *)id;
465 blender::seq::LoadData load_data;
466 blender::seq::add_load_data_init(&load_data, name, nullptr, frame_start, channel);
467 Strip *seqm = blender::seq::add_meta_strip(scene, seqbase, &load_data);
468
469 return seqm;
470}
471
472static Strip *rna_Strips_editing_new_meta(
473 ID *id, Editing *ed, const char *name, int channel, int frame_start)
474{
475 return rna_Strips_new_meta(id, &ed->seqbase, name, channel, frame_start);
476}
477
478static Strip *rna_Strips_meta_new_meta(
479 ID *id, Strip *strip, const char *name, int channel, int frame_start)
480{
481 return rna_Strips_new_meta(id, &strip->seqbase, name, channel, frame_start);
482}
483
484static Strip *rna_Strips_new_effect(ID *id,
485 ListBase *seqbase,
487 const char *name,
488 int type,
489 int channel,
490 int frame_start,
491 int frame_end,
492 Strip *input1,
493 Strip *input2)
494{
495 Scene *scene = (Scene *)id;
496 Strip *strip;
497 const int num_inputs = blender::seq::effect_get_num_inputs(type);
498
499 switch (num_inputs) {
500 case 0:
501 if (frame_end <= frame_start) {
502 BKE_report(reports, RPT_ERROR, "Strips.new_effect: end frame not set");
503 return nullptr;
504 }
505 break;
506 case 1:
507 if (input1 == nullptr) {
508 BKE_report(reports, RPT_ERROR, "Strips.new_effect: effect takes 1 input strip");
509 return nullptr;
510 }
511 break;
512 case 2:
513 if (input1 == nullptr || input2 == nullptr) {
514 BKE_report(reports, RPT_ERROR, "Strips.new_effect: effect takes 2 input strips");
515 return nullptr;
516 }
517 break;
518 default:
520 reports,
521 RPT_ERROR,
522 "Strips.new_effect: effect expects more than 2 inputs (%d, should never happen!)",
523 num_inputs);
524 return nullptr;
525 }
526
527 blender::seq::LoadData load_data;
528 blender::seq::add_load_data_init(&load_data, name, nullptr, frame_start, channel);
529 load_data.effect.end_frame = frame_end;
530 load_data.effect.type = type;
531 load_data.effect.input1 = input1;
532 load_data.effect.input2 = input2;
533 strip = blender::seq::add_effect_strip(scene, seqbase, &load_data);
534
537
538 return strip;
539}
540
541static Strip *rna_Strips_editing_new_effect(ID *id,
542 Editing *ed,
544 const char *name,
545 int type,
546 int channel,
547 int frame_start,
548 int frame_end,
549 Strip *input1,
550 Strip *input2)
551{
552 return rna_Strips_new_effect(
553 id, &ed->seqbase, reports, name, type, channel, frame_start, frame_end, input1, input2);
554}
555
556static Strip *rna_Strips_meta_new_effect(ID *id,
557 Strip *strip,
559 const char *name,
560 int type,
561 int channel,
562 int frame_start,
563 int frame_end,
564 Strip *input1,
565 Strip *input2)
566{
567 return rna_Strips_new_effect(
568 id, &strip->seqbase, reports, name, type, channel, frame_start, frame_end, input1, input2);
569}
570
571static void rna_Strips_remove(
572 ID *id, ListBase *seqbase, Main *bmain, ReportList *reports, PointerRNA *strip_ptr)
573{
574 Strip *strip = static_cast<Strip *>(strip_ptr->data);
575 Scene *scene = (Scene *)id;
576
577 if (BLI_findindex(seqbase, strip) == -1) {
579 reports, RPT_ERROR, "Strip '%s' not in scene '%s'", strip->name + 2, scene->id.name + 2);
580 return;
581 }
582
583 blender::seq::edit_flag_for_removal(scene, seqbase, strip);
585 strip_ptr->invalidate();
586
590}
591
592static void rna_Strips_editing_remove(
593 ID *id, Editing *ed, Main *bmain, ReportList *reports, PointerRNA *strip_ptr)
594{
595 rna_Strips_remove(id, &ed->seqbase, bmain, reports, strip_ptr);
596}
597
598static void rna_Strips_meta_remove(
599 ID *id, Strip *strip, Main *bmain, ReportList *reports, PointerRNA *strip_ptr)
600{
601 rna_Strips_remove(id, &strip->seqbase, bmain, reports, strip_ptr);
602}
603
604static StripElem *rna_StripElements_append(ID *id, Strip *strip, const char *filename)
605{
606 Scene *scene = (Scene *)id;
607 StripElem *se;
608
609 strip->data->stripdata = se = static_cast<StripElem *>(
610 MEM_reallocN(strip->data->stripdata, sizeof(StripElem) * (strip->len + 1)));
611 se += strip->len;
612 STRNCPY(se->filename, filename);
613 strip->len++;
614
616
618
619 return se;
620}
621
622static void rna_StripElements_pop(ID *id, Strip *strip, ReportList *reports, int index)
623{
624 Scene *scene = (Scene *)id;
625 StripElem *new_se, *se;
626
627 if (strip->len == 1) {
628 BKE_report(reports, RPT_ERROR, "StripElements.pop: cannot pop the last element");
629 return;
630 }
631
632 /* python style negative indexing */
633 if (index < 0) {
634 index += strip->len;
635 }
636
637 if (strip->len <= index || index < 0) {
638 BKE_report(reports, RPT_ERROR, "StripElements.pop: index out of range");
639 return;
640 }
641
642 new_se = MEM_calloc_arrayN<StripElem>(size_t(strip->len) - 1, "StripElements_pop");
643 strip->len--;
644
645 if (strip->len == 1) {
647 }
648
649 se = strip->data->stripdata;
650 if (index > 0) {
651 memcpy(new_se, se, sizeof(StripElem) * index);
652 }
653
654 if (index < strip->len) {
655 memcpy(&new_se[index], &se[index + 1], sizeof(StripElem) * (strip->len - index));
656 }
657
658 MEM_freeN(strip->data->stripdata);
659 strip->data->stripdata = new_se;
660
662}
663
664static void rna_Strip_invalidate_cache_rnafunc(ID *id, Strip *self, int type)
665{
666 switch (type) {
669 break;
672 break;
673 }
674}
675
676static SeqRetimingKey *rna_Strip_retiming_keys_add(ID *id, Strip *strip, int timeline_frame)
677{
678 Scene *scene = (Scene *)id;
679
680 SeqRetimingKey *key = blender::seq::retiming_add_key(scene, strip, timeline_frame);
681
684 return key;
685}
686
687static void rna_Strip_retiming_keys_reset(ID *id, Strip *strip)
688{
689 Scene *scene = (Scene *)id;
690
692
695}
696
697#else
698
700{
701 FunctionRNA *func;
702 PropertyRNA *parm;
703
704 static const EnumPropertyItem strip_cache_type_items[] = {
705 {SEQ_CACHE_STORE_RAW, "RAW", 0, "Raw", ""},
706 {SEQ_CACHE_STORE_FINAL_OUT, "COMPOSITE", 0, "Composite", ""},
707 {0, nullptr, 0, nullptr, nullptr},
708 };
709
710 static const EnumPropertyItem strip_split_method_items[] = {
711 {blender::seq::SPLIT_SOFT, "SOFT", 0, "Soft", ""},
712 {blender::seq::SPLIT_HARD, "HARD", 0, "Hard", ""},
713 {0, nullptr, 0, nullptr, nullptr},
714 };
715
716 func = RNA_def_function(srna, "strip_elem_from_frame", "rna_Strip_elem_from_frame");
718 RNA_def_function_ui_description(func, "Return the strip element from a given frame or None");
719 parm = RNA_def_int(func,
720 "frame",
721 0,
722 -MAXFRAME,
723 MAXFRAME,
724 "Frame",
725 "The frame to get the strip element from",
726 -MAXFRAME,
727 MAXFRAME);
730 func,
731 RNA_def_pointer(func, "elem", "StripElement", "", "strip element of the current frame"));
732
733 func = RNA_def_function(srna, "swap", "rna_Strip_swap_internal");
736 parm = RNA_def_pointer(func, "other", "Strip", "Other", "");
738
739 func = RNA_def_function(srna, "move_to_meta", "rna_Strips_move_strip_to_meta");
741 parm = RNA_def_pointer(
742 func, "meta_sequence", "Strip", "Destination Meta Strip", "Meta to move the strip into");
744
745 func = RNA_def_function(srna, "parent_meta", "rna_Strip_parent_meta");
747 RNA_def_function_ui_description(func, "Parent meta");
748 /* return type */
749 parm = RNA_def_pointer(func, "sequence", "Strip", "", "Parent Meta");
750 RNA_def_function_return(func, parm);
751
752 func = RNA_def_function(srna, "invalidate_cache", "rna_Strip_invalidate_cache_rnafunc");
755 "Invalidate cached images for strip and all dependent strips");
756 parm = RNA_def_enum(func, "type", strip_cache_type_items, 0, "Type", "Cache Type");
758
759 func = RNA_def_function(srna, "split", "rna_Strip_split");
761 RNA_def_function_ui_description(func, "Split Strip");
762 parm = RNA_def_int(
763 func, "frame", 0, INT_MIN, INT_MAX, "", "Frame where to split the strip", INT_MIN, INT_MAX);
765 parm = RNA_def_enum(func, "split_method", strip_split_method_items, 0, "", "");
767 parm = RNA_def_boolean(
768 func, "ignore_connections", false, "", "Don't propagate split to connected strips");
769 /* Return type. */
770 parm = RNA_def_pointer(func, "sequence", "Strip", "", "Right side Strip");
771 RNA_def_function_return(func, parm);
772}
773
775{
776 StructRNA *srna;
777 PropertyRNA *parm;
778 FunctionRNA *func;
779
780 RNA_def_property_srna(cprop, "StripElements");
781 srna = RNA_def_struct(brna, "StripElements", nullptr);
782 RNA_def_struct_sdna(srna, "Strip");
783 RNA_def_struct_ui_text(srna, "StripElements", "Collection of StripElement");
784
785 func = RNA_def_function(srna, "append", "rna_StripElements_append");
787 RNA_def_function_ui_description(func, "Push an image from ImageStrip.directory");
788 parm = RNA_def_string(func, "filename", "File", 0, "", "Filepath to image");
790 /* return type */
791 parm = RNA_def_pointer(func, "elem", "StripElement", "", "New StripElement");
792 RNA_def_function_return(func, parm);
793
794 func = RNA_def_function(srna, "pop", "rna_StripElements_pop");
796 RNA_def_function_ui_description(func, "Pop an image off the collection");
797 parm = RNA_def_int(
798 func, "index", -1, INT_MIN, INT_MAX, "", "Index of image to remove", INT_MIN, INT_MAX);
800}
801
803{
804 StructRNA *srna = RNA_def_struct(brna, "RetimingKeys", nullptr);
805 RNA_def_struct_sdna(srna, "Strip");
806 RNA_def_struct_ui_text(srna, "RetimingKeys", "Collection of RetimingKey");
807
808 FunctionRNA *func = RNA_def_function(srna, "add", "rna_Strip_retiming_keys_add");
811 func, "timeline_frame", 0, -MAXFRAME, MAXFRAME, "Timeline Frame", "", -MAXFRAME, MAXFRAME);
812 RNA_def_function_ui_description(func, "Add retiming key");
813 /* return type */
814 PropertyRNA *parm = RNA_def_pointer(func, "retiming_key", "RetimingKey", "", "New RetimingKey");
815 RNA_def_function_return(func, parm);
816
817 func = RNA_def_function(srna, "reset", "rna_Strip_retiming_keys_reset");
819 RNA_def_function_ui_description(func, "Remove all retiming keys");
820}
821
822void RNA_api_strips(StructRNA *srna, const bool metastrip)
823{
824 PropertyRNA *parm;
825 FunctionRNA *func;
826
827 static const EnumPropertyItem strip_effect_items[] = {
828 {STRIP_TYPE_CROSS, "CROSS", 0, "Crossfade", "Fade out of one video, fading into another"},
829 {STRIP_TYPE_ADD, "ADD", 0, "Add", "Add together color channels from two videos"},
830 {STRIP_TYPE_SUB, "SUBTRACT", 0, "Subtract", "Subtract one strip's color from another"},
831 {STRIP_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", "Blend alpha on top of another video"},
832 {STRIP_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", "Blend alpha below another video"},
834 "GAMMA_CROSS",
835 0,
836 "Gamma Crossfade",
837 "Crossfade with color correction"},
838 {STRIP_TYPE_MUL, "MULTIPLY", 0, "Multiply", "Multiply color channels from two videos"},
839 {STRIP_TYPE_WIPE, "WIPE", 0, "Wipe", "Sweep a transition line across the frame"},
840 {STRIP_TYPE_GLOW, "GLOW", 0, "Glow", "Add blur and brightness to light areas"},
841 {STRIP_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", "Apply scale, rotation, or translation"},
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 static const EnumPropertyItem scale_fit_methods[] = {
853 {SEQ_SCALE_TO_FIT, "FIT", 0, "Scale to Fit", "Scale image so fits in preview"},
855 "FILL",
856 0,
857 "Scale to Fill",
858 "Scale image so it fills preview completely"},
859 {SEQ_STRETCH_TO_FILL, "STRETCH", 0, "Stretch to Fill", "Stretch image so it fills preview"},
860 {SEQ_USE_ORIGINAL_SIZE, "ORIGINAL", 0, "Use Original Size", "Don't scale the image"},
861 {0, nullptr, 0, nullptr, nullptr},
862 };
863
864 const char *new_clip_func_name = "rna_Strips_editing_new_clip";
865 const char *new_mask_func_name = "rna_Strips_editing_new_mask";
866 const char *new_scene_func_name = "rna_Strips_editing_new_scene";
867 const char *new_image_func_name = "rna_Strips_editing_new_image";
868 const char *new_movie_func_name = "rna_Strips_editing_new_movie";
869 const char *new_sound_func_name = "rna_Strips_editing_new_sound";
870 const char *new_meta_func_name = "rna_Strips_editing_new_meta";
871 const char *new_effect_func_name = "rna_Strips_editing_new_effect";
872 const char *remove_func_name = "rna_Strips_editing_remove";
873
874 if (metastrip) {
875 new_clip_func_name = "rna_Strips_meta_new_clip";
876 new_mask_func_name = "rna_Strips_meta_new_mask";
877 new_scene_func_name = "rna_Strips_meta_new_scene";
878 new_image_func_name = "rna_Strips_meta_new_image";
879 new_movie_func_name = "rna_Strips_meta_new_movie";
880 new_sound_func_name = "rna_Strips_meta_new_sound";
881 new_meta_func_name = "rna_Strips_meta_new_meta";
882 new_effect_func_name = "rna_Strips_meta_new_effect";
883 remove_func_name = "rna_Strips_meta_remove";
884 }
885
886 func = RNA_def_function(srna, "new_clip", new_clip_func_name);
888 RNA_def_function_ui_description(func, "Add a new movie clip strip");
889 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
891 parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to add");
893 parm = RNA_def_int(func,
894 "channel",
895 0,
896 1,
898 "Channel",
899 "The channel for the new strip",
900 1,
903 parm = RNA_def_int(func,
904 "frame_start",
905 0,
906 -MAXFRAME,
907 MAXFRAME,
908 "",
909 "The start frame for the new strip",
910 -MAXFRAME,
911 MAXFRAME);
913 /* return type */
914 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
915 RNA_def_function_return(func, parm);
916
917 func = RNA_def_function(srna, "new_mask", new_mask_func_name);
919 RNA_def_function_ui_description(func, "Add a new mask strip");
920 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
922 parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to add");
924 parm = RNA_def_int(func,
925 "channel",
926 0,
927 1,
929 "Channel",
930 "The channel for the new strip",
931 1,
934 parm = RNA_def_int(func,
935 "frame_start",
936 0,
937 -MAXFRAME,
938 MAXFRAME,
939 "",
940 "The start frame for the new strip",
941 -MAXFRAME,
942 MAXFRAME);
944 /* return type */
945 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
946 RNA_def_function_return(func, parm);
947
948 func = RNA_def_function(srna, "new_scene", new_scene_func_name);
950 RNA_def_function_ui_description(func, "Add a new scene strip");
951 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
953 parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to add");
955 parm = RNA_def_int(func,
956 "channel",
957 0,
958 1,
960 "Channel",
961 "The channel for the new strip",
962 1,
965 parm = RNA_def_int(func,
966 "frame_start",
967 0,
968 -MAXFRAME,
969 MAXFRAME,
970 "",
971 "The start frame for the new strip",
972 -MAXFRAME,
973 MAXFRAME);
975 /* return type */
976 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
977 RNA_def_function_return(func, parm);
978
979 func = RNA_def_function(srna, "new_image", new_image_func_name);
981 RNA_def_function_ui_description(func, "Add a new image strip");
982 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
984 parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to image");
986 parm = RNA_def_int(func,
987 "channel",
988 0,
989 1,
991 "Channel",
992 "The channel for the new strip",
993 1,
996 parm = RNA_def_int(func,
997 "frame_start",
998 0,
999 -MAXFRAME,
1000 MAXFRAME,
1001 "",
1002 "The start frame for the new strip",
1003 -MAXFRAME,
1004 MAXFRAME);
1006 parm = RNA_def_enum(
1007 func, "fit_method", scale_fit_methods, SEQ_USE_ORIGINAL_SIZE, "Image Fit Method", nullptr);
1008 /* return type */
1009 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
1010 RNA_def_function_return(func, parm);
1011
1012 func = RNA_def_function(srna, "new_movie", new_movie_func_name);
1014 RNA_def_function_ui_description(func, "Add a new movie strip");
1015 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
1017 parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
1019 parm = RNA_def_int(func,
1020 "channel",
1021 0,
1022 1,
1024 "Channel",
1025 "The channel for the new strip",
1026 1,
1029 parm = RNA_def_int(func,
1030 "frame_start",
1031 0,
1032 -MAXFRAME,
1033 MAXFRAME,
1034 "",
1035 "The start frame for the new strip",
1036 -MAXFRAME,
1037 MAXFRAME);
1039 parm = RNA_def_enum(
1040 func, "fit_method", scale_fit_methods, SEQ_USE_ORIGINAL_SIZE, "Image Fit Method", nullptr);
1041 /* return type */
1042 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
1043 RNA_def_function_return(func, parm);
1044
1045 func = RNA_def_function(srna, "new_sound", new_sound_func_name);
1047 RNA_def_function_ui_description(func, "Add a new sound strip");
1048 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
1050 parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
1052 parm = RNA_def_int(func,
1053 "channel",
1054 0,
1055 1,
1057 "Channel",
1058 "The channel for the new strip",
1059 1,
1062 parm = RNA_def_int(func,
1063 "frame_start",
1064 0,
1065 -MAXFRAME,
1066 MAXFRAME,
1067 "",
1068 "The start frame for the new strip",
1069 -MAXFRAME,
1070 MAXFRAME);
1072 /* return type */
1073 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
1074 RNA_def_function_return(func, parm);
1075
1076 func = RNA_def_function(srna, "new_meta", new_meta_func_name);
1078 RNA_def_function_ui_description(func, "Add a new meta strip");
1079 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
1081 parm = RNA_def_int(func,
1082 "channel",
1083 0,
1084 1,
1086 "Channel",
1087 "The channel for the new strip",
1088 1,
1091 parm = RNA_def_int(func,
1092 "frame_start",
1093 0,
1094 -MAXFRAME,
1095 MAXFRAME,
1096 "",
1097 "The start frame for the new strip",
1098 -MAXFRAME,
1099 MAXFRAME);
1101 /* return type */
1102 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
1103 RNA_def_function_return(func, parm);
1104
1105 func = RNA_def_function(srna, "new_effect", new_effect_func_name);
1107 RNA_def_function_ui_description(func, "Add a new effect strip");
1108 parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new strip");
1110 parm = RNA_def_enum(func, "type", strip_effect_items, 0, "Type", "type for the new strip");
1112 parm = RNA_def_int(func,
1113 "channel",
1114 0,
1115 1,
1117 "Channel",
1118 "The channel for the new strip",
1119 1,
1121 /* don't use MAXFRAME since it makes importer scripts fail */
1123 parm = RNA_def_int(func,
1124 "frame_start",
1125 0,
1126 INT_MIN,
1127 INT_MAX,
1128 "",
1129 "The start frame for the new strip",
1130 INT_MIN,
1131 INT_MAX);
1133 RNA_def_int(func,
1134 "frame_end",
1135 0,
1136 INT_MIN,
1137 INT_MAX,
1138 "",
1139 "The end frame for the new strip",
1140 INT_MIN,
1141 INT_MAX);
1142 RNA_def_pointer(func, "input1", "Strip", "", "First input strip for effect");
1143 RNA_def_pointer(func, "input2", "Strip", "", "Second input strip for effect");
1144 /* return type */
1145 parm = RNA_def_pointer(func, "sequence", "Strip", "", "New Strip");
1146 RNA_def_function_return(func, parm);
1147
1148 func = RNA_def_function(srna, "remove", remove_func_name);
1150 RNA_def_function_ui_description(func, "Remove a Strip");
1151 parm = RNA_def_pointer(func, "sequence", "Strip", "", "Strip to remove");
1154}
1155
1156#endif
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:126
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:688
#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:1030
eSeqImageFitMethod
@ SEQ_SCALE_TO_FILL
@ SEQ_STRETCH_TO_FILL
@ SEQ_USE_ORIGINAL_SIZE
@ SEQ_SCALE_TO_FIT
#define MAXFRAME
@ STRIP_TYPE_GAUSSIAN_BLUR
@ STRIP_TYPE_GAMCROSS
@ STRIP_TYPE_COLORMIX
@ STRIP_TYPE_WIPE
@ STRIP_TYPE_TEXT
@ STRIP_TYPE_ADD
@ STRIP_TYPE_TRANSFORM
@ 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_CACHE_STORE_RAW
@ SEQ_CACHE_STORE_FINAL_OUT
@ SEQ_SINGLE_FRAME_CONTENT
ParameterFlag
Definition RNA_types.hh:510
@ PARM_RNAPTR
Definition RNA_types.hh:513
@ PARM_REQUIRED
Definition RNA_types.hh:511
@ FUNC_USE_REPORTS
Definition RNA_types.hh:805
@ FUNC_USE_MAIN
Definition RNA_types.hh:803
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:792
PropertyFlag
Definition RNA_types.hh:286
@ PROP_THICK_WRAP
Definition RNA_types.hh:397
@ PROP_NEVER_NULL
Definition RNA_types.hh:351
#define ND_SEQUENCER
Definition WM_types.hh:434
#define NC_SCENE
Definition WM_types.hh:375
ReportList * reports
Definition WM_types.hh:1025
PyObject * self
#define MEM_reallocN(vmemh, len)
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)
void add_image_init_alpha_mode(Strip *strip)
Definition strip_add.cc:207
Editing * editing_get(const Scene *scene)
Definition sequencer.cc:272
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:165
void add_image_load_file(Scene *scene, Strip *strip, size_t strip_frame, const char *filename)
Definition strip_add.cc:201
void add_image_set_directory(Strip *strip, const char *dirpath)
Definition strip_add.cc:196
Strip * add_sound_strip(Main *, Scene *, ListBase *, LoadData *)
Definition strip_add.cc:370
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:379
constexpr int MAX_CHANNELS
Strip * add_scene_strip(Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:130
bool edit_move_strip_to_meta(Scene *scene, Strip *src_strip, Strip *dst_stripm, const char **r_error_str)
Strip * add_image_strip(Main *bmain, Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:238
Strip * add_movieclip_strip(Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:142
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:154
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:397
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:61
StripElem * render_give_stripelem(const Scene *scene, const Strip *strip, int timeline_frame)
Definition render.cc:234
int effect_get_num_inputs(int strip_type)
Definition effects.cc:286
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)
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:404
char name[66]
Definition DNA_ID.h:415
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]
eSeqImageFitMethod fit_method
Definition SEQ_add.hh:55
struct blender::seq::LoadData::@122240022272052120321215271261271275102156175102 effect
struct blender::seq::LoadData::@040370310161133255324147242161304341014322202023 image
uint len
void WM_main_add_notifier(uint type, void *reference)