- menu for selecting add scenes for the sequencer.
[blender-staging.git] / source / blender / editors / space_sequencer / sequencer_add.c
1 /**
2  *
3  * ***** BEGIN GPL LICENSE BLOCK *****
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
20  * All rights reserved.
21  *
22  * Contributor(s): Blender Foundation, 2003-2009, Campbell Barton
23  *
24  * ***** END GPL LICENSE BLOCK *****
25  */
26
27 #include <stdlib.h>
28 #include <math.h>
29 #include <string.h>
30
31 #ifndef WIN32
32 #include <unistd.h>
33 #else
34 #include <io.h>
35 #endif
36 #include <sys/types.h>
37
38 #include "MEM_guardedalloc.h"
39
40 #include "BLI_blenlib.h"
41 #include "BLI_math.h"
42 #include "BLI_storage_types.h"
43
44 #include "IMB_imbuf_types.h"
45 #include "IMB_imbuf.h"
46
47 #include "DNA_ipo_types.h"
48 #include "DNA_curve_types.h"
49 #include "DNA_scene_types.h"
50 #include "DNA_screen_types.h"
51 #include "DNA_space_types.h"
52 #include "DNA_sequence_types.h"
53 #include "DNA_view2d_types.h"
54 #include "DNA_userdef_types.h"
55 #include "DNA_sound_types.h"
56
57 #include "BKE_context.h"
58 #include "BKE_global.h"
59 #include "BKE_image.h"
60 #include "BKE_library.h"
61 #include "BKE_main.h"
62 #include "BKE_plugin_types.h"
63 #include "BKE_sequencer.h"
64 #include "BKE_scene.h"
65 #include "BKE_utildefines.h"
66 #include "BKE_report.h"
67
68 #include "BIF_gl.h"
69 #include "BIF_glutil.h"
70
71 #include "WM_api.h"
72 #include "WM_types.h"
73
74 #include "RNA_access.h"
75 #include "RNA_define.h"
76 #include "RNA_enum_types.h"
77
78 /* for menu/popup icons etc etc*/
79 #include "UI_interface.h"
80 #include "UI_resources.h"
81
82 #include "ED_anim_api.h"
83 #include "ED_space_api.h"
84 #include "ED_types.h"
85 #include "ED_screen.h"
86 #include "ED_util.h"
87 #include "ED_fileselect.h"
88
89 #include "UI_interface.h"
90 #include "UI_resources.h"
91 #include "UI_view2d.h"
92
93 #include "BKE_sound.h"
94 #include "AUD_C-API.h"
95
96 /* own include */
97 #include "sequencer_intern.h"
98
99 /* Generic functions, reused by add strip operators */
100
101 /* avoid passing multiple args and be more verbose */
102 #define SEQPROP_STARTFRAME      1<<0
103 #define SEQPROP_ENDFRAME        1<<1
104 #define SEQPROP_FILES           1<<2
105
106 static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
107 {
108         RNA_def_string(ot->srna, "name", "", MAX_ID_NAME-2, "Name", "Name of the new sequence strip");
109
110         if(flag & SEQPROP_STARTFRAME)
111                 RNA_def_int(ot->srna, "start_frame", 0, INT_MIN, INT_MAX, "Start Frame", "Start frame of the sequence strip", INT_MIN, INT_MAX);
112         
113         if(flag & SEQPROP_ENDFRAME)
114                 RNA_def_int(ot->srna, "end_frame", 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 */
115         
116         RNA_def_int(ot->srna, "channel", 1, 1, MAXSEQ, "Channel", "Channel to place this strip into", 1, MAXSEQ);
117         
118         RNA_def_boolean(ot->srna, "replace_sel", 1, "Replace Selection", "replace the current selection");
119
120         if(flag & SEQPROP_FILES)
121                 RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
122 }
123
124 static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, wmEvent *event, int flag)
125 {
126         ARegion *ar= CTX_wm_region(C);
127         View2D *v2d= UI_view2d_fromcontext(C);
128         
129         short mval[2];  
130         float mval_v2d[2];
131         
132
133         mval[0]= event->x - ar->winrct.xmin;
134         mval[1]= event->y - ar->winrct.ymin;
135         
136         UI_view2d_region_to_view(v2d, mval[0], mval[1], &mval_v2d[0], &mval_v2d[1]);
137         
138         RNA_int_set(op->ptr, "channel", (int)mval_v2d[1]+0.5f);
139         RNA_int_set(op->ptr, "start_frame", (int)mval_v2d[0]);
140         
141         if ((flag & SEQPROP_ENDFRAME) && RNA_property_is_set(op->ptr, "end_frame")==0)
142                 RNA_int_set(op->ptr, "end_frame", (int)mval_v2d[0] + 25); // XXX arbitary but ok for now.
143         
144 }
145
146 static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
147 {
148         memset(seq_load, 0, sizeof(SeqLoadInfo));
149
150         seq_load->start_frame=  RNA_int_get(op->ptr, "start_frame");
151         seq_load->end_frame=    seq_load->start_frame; /* un-set */
152
153         seq_load->channel=              RNA_int_get(op->ptr, "channel");
154         seq_load->len=                  1; // images only, if endframe isnt set!
155
156         RNA_string_get(op->ptr, "name", seq_load->name+2);
157
158         RNA_string_get(op->ptr, "path", seq_load->path); /* full path, file is set by the caller */
159
160         if (RNA_struct_find_property(op->ptr, "end_frame")) {
161                 seq_load->end_frame = RNA_int_get(op->ptr, "end_frame");
162         }
163
164         if (RNA_struct_find_property(op->ptr, "replace_sel") && RNA_boolean_get(op->ptr, "replace_sel"))
165                 seq_load->flag |= SEQ_LOAD_REPLACE_SEL;
166
167         if (RNA_struct_find_property(op->ptr, "cache") && RNA_boolean_get(op->ptr, "cache"))
168                 seq_load->flag |= SEQ_LOAD_SOUND_CACHE;
169
170         if (RNA_struct_find_property(op->ptr, "sound") && RNA_boolean_get(op->ptr, "sound"))
171                 seq_load->flag |= SEQ_LOAD_MOVIE_SOUND;
172
173         /* always use this for ops */
174         seq_load->flag |= SEQ_LOAD_FRAME_ADVANCE;
175 }
176
177 /* add scene operator */
178 static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
179 {
180         Scene *scene= CTX_data_scene(C);
181         Editing *ed= seq_give_editing(scene, TRUE);
182         
183         Scene *sce_seq;
184
185         Sequence *seq;  /* generic strip vars */
186         Strip *strip;
187         StripElem *se;
188         
189         int start_frame, channel; /* operator props */
190         
191         start_frame= RNA_int_get(op->ptr, "start_frame");
192         channel= RNA_int_get(op->ptr, "channel");
193         
194         sce_seq= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
195         
196         if (sce_seq==NULL) {
197                 BKE_report(op->reports, RPT_ERROR, "Scene not found");
198                 return OPERATOR_CANCELLED;
199         }
200         
201         seq = alloc_sequence(ed->seqbasep, start_frame, channel);
202         
203         seq->type= SEQ_SCENE;
204         seq->scene= sce_seq;
205         
206         /* basic defaults */
207         seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
208         strip->len = seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
209         strip->us= 1;
210         
211         strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
212         
213         if(RNA_property_is_set(op->ptr, "name"))
214                 RNA_string_get(op->ptr, "name", seq->name+2);
215         else
216                 strcpy(seq->name+2, sce_seq->id.name+2);
217         
218         calc_sequence_disp(scene, seq);
219         sort_seq(scene);
220         
221         if (RNA_boolean_get(op->ptr, "replace_sel")) {
222                 deselect_all_seq(scene);
223                 active_seq_set(scene, seq);
224                 seq->flag |= SELECT;
225         }
226         
227         WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
228         
229         return OPERATOR_FINISHED;
230 }
231
232
233 static int sequencer_add_scene_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
234 {
235         if(ED_operator_sequencer_active(C)) {
236                 BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
237                 return OPERATOR_CANCELLED;
238         }
239
240         sequencer_generic_invoke_xy__internal(C, op, event, 0);
241         return sequencer_add_scene_strip_exec(C, op);
242         // needs a menu
243         // return WM_menu_invoke(C, op, event);
244 }
245
246
247 void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot)
248 {
249         PropertyRNA *prop;
250         
251         /* identifiers */
252         ot->name= "Add Scene Strip";
253         ot->idname= "SEQUENCER_OT_scene_strip_add";
254         ot->description= "Add a strip to the sequencer using a blender scene as a source";
255
256         /* api callbacks */
257         ot->invoke= sequencer_add_scene_strip_invoke;
258         ot->exec= sequencer_add_scene_strip_exec;
259
260         ot->poll= ED_operator_scene_editable;
261         
262         /* flags */
263         ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
264         
265         sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
266         prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
267         RNA_def_enum_funcs(prop, RNA_scene_itemf);
268         ot->prop= prop;
269 }
270
271 static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFunc seq_load_func)
272 {
273         Scene *scene= CTX_data_scene(C); /* only for sound */
274         Editing *ed= seq_give_editing(scene, TRUE);
275         SeqLoadInfo seq_load;
276         Sequence *seq;
277         int tot_files;
278
279         seq_load_operator_info(&seq_load, op);
280
281         if (seq_load.flag & SEQ_LOAD_REPLACE_SEL)
282                 deselect_all_seq(scene);
283
284         tot_files= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
285
286         if(tot_files) {
287                 /* multiple files */
288                 char dir_only[FILE_MAX];
289                 char file_only[FILE_MAX];
290
291                 BLI_split_dirfile(seq_load.path, dir_only, NULL);
292
293                 RNA_BEGIN(op->ptr, itemptr, "files") {
294                         RNA_string_get(&itemptr, "name", file_only);
295                         BLI_join_dirfile(seq_load.path, dir_only, file_only);
296
297                         seq= seq_load_func(C, ed->seqbasep, &seq_load);
298                 }
299                 RNA_END;
300         }
301         else {
302                 /* single file */
303                 seq= seq_load_func(C, ed->seqbasep, &seq_load);
304         }
305
306         if (seq_load.tot_success==0) {
307                 BKE_reportf(op->reports, RPT_ERROR, "File \"%s\" could not be loaded", seq_load.path);
308                 return OPERATOR_CANCELLED;
309         }
310
311         sort_seq(scene);
312         seq_update_muting(scene, ed);
313
314         WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
315
316         return OPERATOR_FINISHED;
317 }
318
319 /* add movie operator */
320 static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
321 {
322         return sequencer_add_generic_strip_exec(C, op, sequencer_add_movie_strip);
323 }
324
325
326 static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
327 {
328         if(ED_operator_sequencer_active(C)) {
329                 BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
330                 return OPERATOR_CANCELLED;
331         }
332
333         sequencer_generic_invoke_xy__internal(C, op, event, 0);
334         return WM_operator_filesel(C, op, event);
335         //return sequencer_add_movie_strip_exec(C, op);
336 }
337
338
339 void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
340 {
341         
342         /* identifiers */
343         ot->name= "Add Movie Strip";
344         ot->idname= "SEQUENCER_OT_movie_strip_add";
345         ot->description= "Add a movie strip to the sequencer";
346
347         /* api callbacks */
348         ot->invoke= sequencer_add_movie_strip_invoke;
349         ot->exec= sequencer_add_movie_strip_exec;
350
351         ot->poll= ED_operator_scene_editable;
352         
353         /* flags */
354         ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
355         
356         WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE);
357         sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILES);
358         RNA_def_boolean(ot->srna, "sound", TRUE, "Sound", "Load sound with the movie");
359 }
360
361 /* add sound operator */
362
363 static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op)
364 {
365         return sequencer_add_generic_strip_exec(C, op, sequencer_add_sound_strip);
366 }
367
368 static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
369 {
370         if(ED_operator_sequencer_active(C)) {
371                 BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
372                 return OPERATOR_CANCELLED;
373         }
374
375         sequencer_generic_invoke_xy__internal(C, op, event, 0);
376         return WM_operator_filesel(C, op, event);
377         //return sequencer_add_sound_strip_exec(C, op);
378 }
379
380
381 void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot)
382 {
383         
384         /* identifiers */
385         ot->name= "Add Sound Strip";
386         ot->idname= "SEQUENCER_OT_sound_strip_add";
387         ot->description= "Add a sound strip to the sequencer";
388
389         /* api callbacks */
390         ot->invoke= sequencer_add_sound_strip_invoke;
391         ot->exec= sequencer_add_sound_strip_exec;
392
393         ot->poll= ED_operator_scene_editable;
394         
395         /* flags */
396         ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
397         
398         WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE);
399         sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILES);
400         RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory.");
401 }
402
403 /* add image operator */
404 static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
405 {
406         /* cant use the generic function for this */
407
408         Scene *scene= CTX_data_scene(C); /* only for sound */
409         Editing *ed= seq_give_editing(scene, TRUE);
410         SeqLoadInfo seq_load;
411         Sequence *seq;
412
413         Strip *strip;
414         StripElem *se;
415
416         seq_load_operator_info(&seq_load, op);
417
418         /* images are unique in how they handle this - 1 per strip elem */
419         seq_load.len= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
420
421         if(seq_load.len==0)
422                 seq_load.len= 1;
423
424         if(seq_load.flag & SEQ_LOAD_REPLACE_SEL)
425                 deselect_all_seq(scene);
426
427         
428         /* main adding function */
429         seq= sequencer_add_image_strip(C, ed->seqbasep, &seq_load);
430         strip= seq->strip;
431         se= strip->stripdata;
432
433         if(seq_load.len > 1) {
434                 RNA_BEGIN(op->ptr, itemptr, "files") {
435                         RNA_string_get(&itemptr, "name", se->name);
436                         se++;
437                 }
438                 RNA_END;
439         }
440         else {
441                 BLI_split_dirfile(seq_load.path, NULL, se->name);
442                 if(seq_load.start_frame < seq_load.end_frame) {
443                         seq->endstill= seq_load.end_frame - seq_load.start_frame;
444                 }
445         }
446         
447         calc_sequence_disp(scene, seq);
448
449         sort_seq(scene);
450
451         /* last active name */
452         strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR-1);
453         
454         WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
455
456         return OPERATOR_FINISHED;
457 }
458
459 static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
460 {
461         if(ED_operator_sequencer_active(C)) {
462                 BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
463                 return OPERATOR_CANCELLED;
464         }
465
466         sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME);
467         return WM_operator_filesel(C, op, event);       
468         //return sequencer_add_image_strip_exec(C, op);
469 }
470
471
472 void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
473 {
474         
475         /* identifiers */
476         ot->name= "Add Image Strip";
477         ot->idname= "SEQUENCER_OT_image_strip_add";
478         ot->description= "Add an image or image sequence to the sequencer";
479
480         /* api callbacks */
481         ot->invoke= sequencer_add_image_strip_invoke;
482         ot->exec= sequencer_add_image_strip_exec;
483
484         ot->poll= ED_operator_scene_editable;
485         
486         /* flags */
487         ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
488         
489         WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE);
490         sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME|SEQPROP_FILES);
491 }
492
493
494 /* add_effect_strip operator */
495 static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
496 {
497         Scene *scene= CTX_data_scene(C);
498         Editing *ed= seq_give_editing(scene, TRUE);
499
500         Sequence *seq;  /* generic strip vars */
501         Strip *strip;
502         StripElem *se;
503         struct SeqEffectHandle sh;
504
505         int start_frame, end_frame, channel, type; /* operator props */
506         
507         Sequence *seq1, *seq2, *seq3;
508         char *error_msg;
509
510         start_frame= RNA_int_get(op->ptr, "start_frame");
511         end_frame= RNA_int_get(op->ptr, "end_frame");
512         channel= RNA_int_get(op->ptr, "channel");
513
514         type= RNA_enum_get(op->ptr, "type");
515         
516         // XXX We need unique names and move to invoke
517         if(!seq_effect_find_selected(scene, NULL, type, &seq1, &seq2, &seq3, &error_msg)) {
518                 BKE_report(op->reports, RPT_ERROR, error_msg);
519                 return OPERATOR_CANCELLED;
520         }
521
522         /* If seq1 is NULL and no error was rasied it means the seq is standalone
523          * (like color strips) and we need to check its start and end frames are valid */
524         if (seq1==NULL && end_frame <= start_frame) {
525                 BKE_report(op->reports, RPT_ERROR, "Start and end frame are not set");
526                 return OPERATOR_CANCELLED;
527         }
528
529         seq = alloc_sequence(ed->seqbasep, start_frame, channel);
530         seq->type= type;
531
532         if(RNA_property_is_set(op->ptr, "name"))
533                 RNA_string_get(op->ptr, "name", seq->name+2);
534         else
535                 strcpy(seq->name+2, give_seqname(seq));
536
537         seqbase_unique_name_recursive(&ed->seqbase, seq);
538
539         sh = get_sequence_effect(seq);
540
541         seq->seq1= seq1;
542         seq->seq2= seq2;
543         seq->seq3= seq3;
544
545         sh.init(seq);
546
547         if (!seq1) { /* effect has no deps */
548                 seq->len= 1;
549                 seq_tx_set_final_right(seq, end_frame);
550         }
551
552         seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE;
553
554         calc_sequence(scene, seq);
555         
556         /* basic defaults */
557         seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
558         strip->len = seq->len;
559         strip->us= 1;
560         if(seq->len>0)
561                 strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
562
563         if (seq->type==SEQ_PLUGIN) {
564                 char path[FILE_MAX];
565                 RNA_string_get(op->ptr, "path", path);
566
567                 sh.init_plugin(seq, path);
568
569                 if(seq->plugin==NULL) {
570                         BLI_remlink(ed->seqbasep, seq);
571                         seq_free_sequence(scene, seq);
572                         BKE_reportf(op->reports, RPT_ERROR, "Sequencer plugin \"%s\" could not load.", path);
573                         return OPERATOR_CANCELLED;
574                 }
575         }
576         else if (seq->type==SEQ_COLOR) {
577                 SolidColorVars *colvars= (SolidColorVars *)seq->effectdata;
578                 RNA_float_get_array(op->ptr, "color", colvars->col);
579         }
580
581         if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
582
583         update_changed_seq_and_deps(scene, seq, 1, 1); /* runs calc_sequence */
584
585
586         /* not sure if this is needed with update_changed_seq_and_deps.
587          * it was NOT called in blender 2.4x, but wont hurt */
588         sort_seq(scene); 
589
590         if (RNA_boolean_get(op->ptr, "replace_sel")) {
591                 deselect_all_seq(scene);
592                 active_seq_set(scene, seq);
593                 seq->flag |= SELECT;
594         }
595
596         WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
597
598         return OPERATOR_FINISHED;
599 }
600
601
602 /* add color */
603 static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
604 {
605         if(ED_operator_sequencer_active(C)) {
606                 BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
607                 return OPERATOR_CANCELLED;
608         }
609
610         sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME);
611
612         if (RNA_property_is_set(op->ptr, "type") && RNA_enum_get(op->ptr, "type")==SEQ_PLUGIN) {
613                 /* only plugins need the file selector */
614                 return WM_operator_filesel(C, op, event);
615         }
616         else {
617                 return sequencer_add_effect_strip_exec(C, op);
618         }
619 }
620
621 void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
622 {
623         /* identifiers */
624         ot->name= "Add Effect Strip";
625         ot->idname= "SEQUENCER_OT_effect_strip_add";
626         ot->description= "Add an effect to the sequencer, most are applied on top of existing strips";
627
628         /* api callbacks */
629         ot->invoke= sequencer_add_effect_strip_invoke;
630         ot->exec= sequencer_add_effect_strip_exec;
631
632         ot->poll= ED_operator_scene_editable;
633         
634         /* flags */
635         ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
636         
637         WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE);
638         sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
639         RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
640         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);
641 }