diff options
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_add.c')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 01a99ed2b1f..e58e2ebb328 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -47,17 +47,10 @@ #include "BKE_context.h" #include "BKE_global.h" -#include "BKE_image.h" -#include "BKE_library.h" #include "BKE_main.h" -#include "BKE_plugin_types.h" #include "BKE_sequencer.h" -#include "BKE_scene.h" -#include "BKE_utildefines.h" #include "BKE_report.h" -#include "BIF_gl.h" -#include "BIF_glutil.h" #include "WM_api.h" #include "WM_types.h" @@ -181,7 +174,9 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) /* used for image strip */ /* best guess, first images name */ RNA_BEGIN(op->ptr, itemptr, "files") { - RNA_string_get(&itemptr, "name", seq_load->name); + char *name= RNA_string_get_alloc(&itemptr, "name", NULL, 0); + BLI_strncpy(seq_load->name, name, sizeof(seq_load->name)); + MEM_freeN(name); break; } RNA_END; @@ -341,6 +336,9 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op) static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent *event) { + if(RNA_collection_length(op->ptr, "files") || RNA_property_is_set(op->ptr, "filepath")) + return sequencer_add_movie_strip_exec(C, op); + if(!ED_operator_sequencer_active(C)) { BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); return OPERATOR_CANCELLED; @@ -349,6 +347,10 @@ static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent if(!RNA_property_is_set(op->ptr, "relative_path")) RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); + /* This is for drag and drop */ + if(RNA_property_is_set(op->ptr, "filepath")) + return sequencer_add_movie_strip_exec(C, op); + sequencer_generic_invoke_xy__internal(C, op, event, 0); WM_event_add_fileselect(C, op); @@ -389,6 +391,9 @@ static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op) static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent *event) { + if(RNA_collection_length(op->ptr, "files") || RNA_property_is_set(op->ptr, "filepath")) + return sequencer_add_sound_strip_exec(C, op); + if(!ED_operator_sequencer_active(C)) { BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); return OPERATOR_CANCELLED; @@ -397,6 +402,10 @@ static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent if(!RNA_property_is_set(op->ptr, "relative_path")) RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); + /* This is for drag and drop */ + if(RNA_property_is_set(op->ptr, "filepath")) + return sequencer_add_sound_strip_exec(C, op); + sequencer_generic_invoke_xy__internal(C, op, event, 0); WM_event_add_fileselect(C, op); @@ -486,6 +495,9 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent *event) { + if(RNA_collection_length(op->ptr, "files")) + return sequencer_add_image_strip_exec(C, op); + if(!ED_operator_sequencer_active(C)) { BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); return OPERATOR_CANCELLED; |