2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * Contributor(s): Blender Foundation, 2003-2009, Campbell Barton
23 * ***** END GPL LICENSE BLOCK *****
26 /** \file blender/editors/space_sequencer/sequencer_add.c
40 #include <sys/types.h>
42 #include "MEM_guardedalloc.h"
44 #include "BLI_blenlib.h"
46 #include "BLI_utildefines.h"
48 #include "DNA_scene_types.h"
49 #include "DNA_userdef_types.h"
51 #include "BKE_context.h"
52 #include "BKE_global.h"
54 #include "BKE_sequencer.h"
55 #include "BKE_report.h"
61 #include "RNA_define.h"
62 #include "RNA_enum_types.h"
64 /* for menu/popup icons etc etc*/
66 #include "ED_screen.h"
68 #include "UI_view2d.h"
70 #include "BKE_sound.h"
73 # include "AUD_C-API.h"
77 #include "sequencer_intern.h"
79 /* Generic functions, reused by add strip operators */
81 /* avoid passing multiple args and be more verbose */
82 #define SEQPROP_STARTFRAME (1<<0)
83 #define SEQPROP_ENDFRAME (1<<1)
84 #define SEQPROP_NOPATHS (1<<2)
85 #define SEQPROP_NOCHAN (1<<3)
89 static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
91 if(flag & SEQPROP_STARTFRAME)
92 RNA_def_int(ot->srna, "frame_start", 0, INT_MIN, INT_MAX, "Start Frame", "Start frame of the sequence strip", INT_MIN, INT_MAX);
94 if(flag & SEQPROP_ENDFRAME)
95 RNA_def_int(ot->srna, "frame_end", 0, INT_MIN, INT_MAX, "End Frame", "End frame for the color strip", INT_MIN, INT_MAX); /* not useual since most strips have a fixed length */
97 RNA_def_int(ot->srna, "channel", 1, 1, MAXSEQ, "Channel", "Channel to place this strip into", 1, MAXSEQ);
99 RNA_def_boolean(ot->srna, "replace_sel", 1, "Replace Selection", "replace the current selection");
101 RNA_def_boolean(ot->srna, "overlap", 0, "Allow Overlap", "Don't correct overlap on new sequence strips");
104 static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, const char *identifier)
106 if(RNA_struct_find_property(op->ptr, identifier)) {
107 Scene *scene= CTX_data_scene(C);
108 Sequence *last_seq= seq_active_get(scene);
109 if(last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) {
110 char path[sizeof(last_seq->strip->dir)];
111 BLI_strncpy(path, last_seq->strip->dir, sizeof(path));
112 BLI_path_abs(path, G.main->name);
113 RNA_string_set(op->ptr, identifier, path);
118 static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, wmEvent *event, int flag)
120 View2D *v2d= UI_view2d_fromcontext(C);
124 UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &mval_v2d[0], &mval_v2d[1]);
126 /* effect strips dont need a channel initialized from the mouse */
127 if(!(flag & SEQPROP_NOCHAN)) {
128 RNA_int_set(op->ptr, "channel", (int)mval_v2d[1]+0.5f);
131 RNA_int_set(op->ptr, "frame_start", (int)mval_v2d[0]);
133 if ((flag & SEQPROP_ENDFRAME) && RNA_property_is_set(op->ptr, "frame_end")==0)
134 RNA_int_set(op->ptr, "frame_end", (int)mval_v2d[0] + 25); // XXX arbitary but ok for now.
136 if (!(flag & SEQPROP_NOPATHS)) {
137 sequencer_generic_invoke_path__internal(C, op, "filepath");
138 sequencer_generic_invoke_path__internal(C, op, "directory");
142 static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
144 int relative= RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path");
146 memset(seq_load, 0, sizeof(SeqLoadInfo));
148 seq_load->start_frame= RNA_int_get(op->ptr, "frame_start");
149 seq_load->end_frame= seq_load->start_frame; /* un-set */
151 seq_load->channel= RNA_int_get(op->ptr, "channel");
152 seq_load->len= 1; // images only, if endframe isnt set!
154 if(RNA_struct_find_property(op->ptr, "filepath")) {
155 RNA_string_get(op->ptr, "filepath", seq_load->path); /* full path, file is set by the caller */
157 } else if (RNA_struct_find_property(op->ptr, "directory")) {
158 RNA_string_get(op->ptr, "directory", seq_load->path); /* full path, file is set by the caller */
162 if((is_file != -1) && relative)
163 BLI_path_rel(seq_load->path, G.main->name);
166 if (RNA_struct_find_property(op->ptr, "frame_end")) {
167 seq_load->end_frame = RNA_int_get(op->ptr, "frame_end");
170 if (RNA_struct_find_property(op->ptr, "replace_sel") && RNA_boolean_get(op->ptr, "replace_sel"))
171 seq_load->flag |= SEQ_LOAD_REPLACE_SEL;
173 if (RNA_struct_find_property(op->ptr, "cache") && RNA_boolean_get(op->ptr, "cache"))
174 seq_load->flag |= SEQ_LOAD_SOUND_CACHE;
176 if (RNA_struct_find_property(op->ptr, "sound") && RNA_boolean_get(op->ptr, "sound"))
177 seq_load->flag |= SEQ_LOAD_MOVIE_SOUND;
179 /* always use this for ops */
180 seq_load->flag |= SEQ_LOAD_FRAME_ADVANCE;
184 BLI_strncpy(seq_load->name, BLI_path_basename(seq_load->path), sizeof(seq_load->name));
186 else if(RNA_struct_find_property(op->ptr, "files")) {
187 /* used for image strip */
188 /* best guess, first images name */
189 RNA_BEGIN(op->ptr, itemptr, "files") {
190 char *name= RNA_string_get_alloc(&itemptr, "name", NULL, 0);
191 BLI_strncpy(seq_load->name, name, sizeof(seq_load->name));
199 /* add scene operator */
200 static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
202 Scene *scene= CTX_data_scene(C);
203 Editing *ed= seq_give_editing(scene, TRUE);
207 Sequence *seq; /* generic strip vars */
210 int start_frame, channel; /* operator props */
212 start_frame= RNA_int_get(op->ptr, "frame_start");
213 channel= RNA_int_get(op->ptr, "channel");
215 sce_seq= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
218 BKE_report(op->reports, RPT_ERROR, "Scene not found");
219 return OPERATOR_CANCELLED;
222 seq = alloc_sequence(ed->seqbasep, start_frame, channel);
223 seq->type= SEQ_SCENE;
224 seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
227 seq->sfra= sce_seq->r.sfra;
230 seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
231 strip->len = seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
234 strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
236 BLI_strncpy(seq->name+2, sce_seq->id.name+2, sizeof(seq->name)-2);
237 seqbase_unique_name_recursive(&ed->seqbase, seq);
239 seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + strip->len, 0);
241 calc_sequence_disp(scene, seq);
244 if (RNA_boolean_get(op->ptr, "replace_sel")) {
245 deselect_all_seq(scene);
246 seq_active_set(scene, seq);
250 if(RNA_boolean_get(op->ptr, "overlap") == FALSE) {
251 if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
254 WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
256 return OPERATOR_FINISHED;
260 static int sequencer_add_scene_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
262 if(!ED_operator_sequencer_active(C)) {
263 BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
264 return OPERATOR_CANCELLED;
267 if(!RNA_property_is_set(op->ptr, "scene"))
268 return WM_enum_search_invoke(C, op, event);
270 sequencer_generic_invoke_xy__internal(C, op, event, 0);
271 return sequencer_add_scene_strip_exec(C, op);
273 // return WM_menu_invoke(C, op, event);
277 void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot)
282 ot->name= "Add Scene Strip";
283 ot->idname= "SEQUENCER_OT_scene_strip_add";
284 ot->description= "Add a strip to the sequencer using a blender scene as a source";
287 ot->invoke= sequencer_add_scene_strip_invoke;
288 ot->exec= sequencer_add_scene_strip_exec;
290 ot->poll= ED_operator_scene_editable;
293 ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
295 sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
296 prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
297 RNA_def_enum_funcs(prop, RNA_scene_itemf);
301 static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFunc seq_load_func)
303 Scene *scene= CTX_data_scene(C); /* only for sound */
304 Editing *ed= seq_give_editing(scene, TRUE);
305 SeqLoadInfo seq_load;
308 const short overlap= RNA_boolean_get(op->ptr, "overlap");
310 seq_load_operator_info(&seq_load, op);
312 if (seq_load.flag & SEQ_LOAD_REPLACE_SEL)
313 deselect_all_seq(scene);
315 tot_files= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
319 char dir_only[FILE_MAX];
320 char file_only[FILE_MAX];
322 BLI_split_dir_part(seq_load.path, dir_only, sizeof(dir_only));
324 RNA_BEGIN(op->ptr, itemptr, "files") {
325 RNA_string_get(&itemptr, "name", file_only);
326 BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only);
328 seq= seq_load_func(C, ed->seqbasep, &seq_load);
330 if(overlap == FALSE) {
331 if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
338 seq= seq_load_func(C, ed->seqbasep, &seq_load);
340 if(overlap == FALSE) {
341 if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
345 if (seq_load.tot_success==0) {
346 BKE_reportf(op->reports, RPT_ERROR, "File \"%s\" could not be loaded", seq_load.path);
347 return OPERATOR_CANCELLED;
351 seq_update_muting(ed);
353 WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
355 return OPERATOR_FINISHED;
358 /* add movie operator */
359 static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
361 return sequencer_add_generic_strip_exec(C, op, sequencer_add_movie_strip);
365 static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
368 if(!ED_operator_sequencer_active(C)) {
369 BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
370 return OPERATOR_CANCELLED;
373 /* This is for drag and drop */
374 if(RNA_collection_length(op->ptr, "files") || RNA_property_is_set(op->ptr, "filepath")) {
375 sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_NOPATHS);
376 return sequencer_add_movie_strip_exec(C, op);
379 sequencer_generic_invoke_xy__internal(C, op, event, 0);
381 WM_event_add_fileselect(C, op);
382 return OPERATOR_RUNNING_MODAL;
384 //return sequencer_add_movie_strip_exec(C, op);
388 void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
392 ot->name= "Add Movie Strip";
393 ot->idname= "SEQUENCER_OT_movie_strip_add";
394 ot->description= "Add a movie strip to the sequencer";
397 ot->invoke= sequencer_add_movie_strip_invoke;
398 ot->exec= sequencer_add_movie_strip_exec;
400 ot->poll= ED_operator_scene_editable;
403 ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
405 WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES);
406 sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
407 RNA_def_boolean(ot->srna, "sound", TRUE, "Sound", "Load sound with the movie");
410 /* add sound operator */
412 static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op)
414 return sequencer_add_generic_strip_exec(C, op, sequencer_add_sound_strip);
417 static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
420 if(!ED_operator_sequencer_active(C)) {
421 BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
422 return OPERATOR_CANCELLED;
425 /* This is for drag and drop */
426 if(RNA_collection_length(op->ptr, "files") || RNA_property_is_set(op->ptr, "filepath")) {
427 sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_NOPATHS);
428 return sequencer_add_sound_strip_exec(C, op);
431 sequencer_generic_invoke_xy__internal(C, op, event, 0);
433 WM_event_add_fileselect(C, op);
434 return OPERATOR_RUNNING_MODAL;
436 //return sequencer_add_sound_strip_exec(C, op);
440 void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot)
444 ot->name= "Add Sound Strip";
445 ot->idname= "SEQUENCER_OT_sound_strip_add";
446 ot->description= "Add a sound strip to the sequencer";
449 ot->invoke= sequencer_add_sound_strip_invoke;
450 ot->exec= sequencer_add_sound_strip_exec;
452 ot->poll= ED_operator_scene_editable;
455 ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
457 WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES);
458 sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
459 RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory");
462 /* add image operator */
463 static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
465 /* cant use the generic function for this */
467 Scene *scene= CTX_data_scene(C); /* only for sound */
468 Editing *ed= seq_give_editing(scene, TRUE);
469 SeqLoadInfo seq_load;
475 seq_load_operator_info(&seq_load, op);
477 /* images are unique in how they handle this - 1 per strip elem */
478 seq_load.len= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
481 return OPERATOR_CANCELLED;
483 if(seq_load.flag & SEQ_LOAD_REPLACE_SEL)
484 deselect_all_seq(scene);
487 /* main adding function */
488 seq= sequencer_add_image_strip(C, ed->seqbasep, &seq_load);
490 se= strip->stripdata;
492 RNA_BEGIN(op->ptr, itemptr, "files") {
493 char *filename= RNA_string_get_alloc(&itemptr, "name", NULL, 0);
494 BLI_strncpy(se->name, filename, sizeof(se->name));
500 if(seq_load.len == 1) {
501 if(seq_load.start_frame < seq_load.end_frame) {
502 seq->endstill= seq_load.end_frame - seq_load.start_frame;
506 calc_sequence_disp(scene, seq);
510 /* last active name */
511 strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR-1);
513 if(RNA_boolean_get(op->ptr, "overlap") == FALSE) {
514 if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
517 WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
519 return OPERATOR_FINISHED;
522 static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
525 if(!ED_operator_sequencer_active(C)) {
526 BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
527 return OPERATOR_CANCELLED;
531 /* drag drop has set the names */
532 if(RNA_collection_length(op->ptr, "files")) {
533 sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME|SEQPROP_NOPATHS);
534 return sequencer_add_image_strip_exec(C, op);
537 sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME);
539 WM_event_add_fileselect(C, op);
540 return OPERATOR_RUNNING_MODAL;
544 void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
548 ot->name= "Add Image Strip";
549 ot->idname= "SEQUENCER_OT_image_strip_add";
550 ot->description= "Add an image or image sequence to the sequencer";
553 ot->invoke= sequencer_add_image_strip_invoke;
554 ot->exec= sequencer_add_image_strip_exec;
556 ot->poll= ED_operator_scene_editable;
559 ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
561 WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILES);
562 sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
566 /* add_effect_strip operator */
567 static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
569 Scene *scene= CTX_data_scene(C);
570 Editing *ed= seq_give_editing(scene, TRUE);
572 Sequence *seq; /* generic strip vars */
574 struct SeqEffectHandle sh;
576 int start_frame, end_frame, channel, type; /* operator props */
578 Sequence *seq1, *seq2, *seq3;
579 const char *error_msg;
581 start_frame= RNA_int_get(op->ptr, "frame_start");
582 end_frame= RNA_int_get(op->ptr, "frame_end");
583 channel= RNA_int_get(op->ptr, "channel");
585 type= RNA_enum_get(op->ptr, "type");
587 // XXX move to invoke
588 if(!seq_effect_find_selected(scene, NULL, type, &seq1, &seq2, &seq3, &error_msg)) {
589 BKE_report(op->reports, RPT_ERROR, error_msg);
590 return OPERATOR_CANCELLED;
593 /* If seq1 is NULL and no error was rasied it means the seq is standalone
594 * (like color strips) and we need to check its start and end frames are valid */
595 if (seq1==NULL && end_frame <= start_frame) {
596 BKE_report(op->reports, RPT_ERROR, "Start and end frame are not set");
597 return OPERATOR_CANCELLED;
600 seq = alloc_sequence(ed->seqbasep, start_frame, channel);
603 BLI_strncpy(seq->name+2, give_seqname(seq), sizeof(seq->name)-2);
604 seqbase_unique_name_recursive(&ed->seqbase, seq);
606 sh = get_sequence_effect(seq);
614 if (!seq1) { /* effect has no deps */
616 seq_tx_set_final_right(seq, end_frame);
619 seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE;
621 calc_sequence(scene, seq);
624 seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
625 strip->len = seq->len;
628 strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
630 if (seq->type==SEQ_PLUGIN) {
632 RNA_string_get(op->ptr, "filepath", path);
634 sh.init_plugin(seq, path);
636 if(seq->plugin==NULL) {
637 BLI_remlink(ed->seqbasep, seq);
638 seq_free_sequence(scene, seq);
639 BKE_reportf(op->reports, RPT_ERROR, "Sequencer plugin \"%s\" could not load", path);
640 return OPERATOR_CANCELLED;
642 } else if (seq->type == SEQ_COLOR) {
643 SolidColorVars *colvars= (SolidColorVars *)seq->effectdata;
644 RNA_float_get_array(op->ptr, "color", colvars->col);
645 seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
647 } else if (seq->type == SEQ_ADJUSTMENT) {
648 seq->blend_mode= SEQ_CROSS;
651 /* an unset channel is a special case where we automatically go above
652 * the other strips. */
653 if(!RNA_property_is_set(op->ptr, "channel")) {
655 int chan= MAX3( seq->seq1 ? seq->seq1->machine : 0,
656 seq->seq2 ? seq->seq2->machine : 0,
657 seq->seq3 ? seq->seq3->machine : 0);
663 if(RNA_boolean_get(op->ptr, "overlap") == FALSE) {
664 if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
667 update_changed_seq_and_deps(scene, seq, 1, 1); /* runs calc_sequence */
670 /* not sure if this is needed with update_changed_seq_and_deps.
671 * it was NOT called in blender 2.4x, but wont hurt */
674 if (RNA_boolean_get(op->ptr, "replace_sel")) {
675 deselect_all_seq(scene);
676 seq_active_set(scene, seq);
680 WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
682 return OPERATOR_FINISHED;
687 static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
689 short is_type_set= RNA_property_is_set(op->ptr, "type");
691 int prop_flag= SEQPROP_ENDFRAME;
693 if(!ED_operator_sequencer_active(C)) {
694 BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
695 return OPERATOR_CANCELLED;
699 type= RNA_enum_get(op->ptr, "type");
701 /* when invoking an effect strip which uses inputs,
702 * skip initialzing the channel from the mouse.
703 * Instead leave the property unset so exec() initializes it to be
704 * above the strips its applied to. */
705 if(get_sequence_effect_num_inputs(type) != 0) {
706 prop_flag |= SEQPROP_NOCHAN;
710 sequencer_generic_invoke_xy__internal(C, op, event, prop_flag);
712 if (is_type_set && type==SEQ_PLUGIN) {
713 /* only plugins need the file selector */
714 return WM_operator_filesel(C, op, event);
717 return sequencer_add_effect_strip_exec(C, op);
721 void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
724 ot->name= "Add Effect Strip";
725 ot->idname= "SEQUENCER_OT_effect_strip_add";
726 ot->description= "Add an effect to the sequencer, most are applied on top of existing strips";
729 ot->invoke= sequencer_add_effect_strip_invoke;
730 ot->exec= sequencer_add_effect_strip_exec;
732 ot->poll= ED_operator_scene_editable;
735 ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
737 WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
738 sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
739 RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
740 RNA_def_float_vector(ot->srna, "color", 3, NULL, 0.0f, 1.0f, "Color", "Initialize the strip with this color (only used when type='COLOR')", 0.0f, 1.0f);