diff options
author | Ton Roosendaal <ton@blender.org> | 2010-12-11 23:01:34 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2010-12-11 23:01:34 +0300 |
commit | 194449d03801d4c41df2a54e5564c67888ecf3d2 (patch) | |
tree | ab39c49796e025a721b5db7ffdd3d2a3a3e24a98 | |
parent | 02be76be29ae591a002f1fa6a1fa65b1215f4ed1 (diff) |
Sequencer:
Dropping in image/movie/sound strips was broken; it dropped
things in wrong location (frame 0), and without giving images proper
length.
The file path setting code for the operators here is complex...
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 62 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/space_sequencer.c | 1 |
2 files changed, 35 insertions, 28 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 807672623cd..adf1de8a125 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -73,9 +73,10 @@ /* Generic functions, reused by add strip operators */ /* avoid passing multiple args and be more verbose */ -#define SEQPROP_STARTFRAME 1<<0 -#define SEQPROP_ENDFRAME 1<<1 -#define SEQPROP_FILES 1<<2 +#define SEQPROP_STARTFRAME (1<<0) +#define SEQPROP_ENDFRAME (1<<1) +#define SEQPROP_FILES (1<<2) +#define SEQPROP_NOPATHS (1<<3) static void sequencer_generic_props__internal(wmOperatorType *ot, int flag) { @@ -127,8 +128,10 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w if ((flag & SEQPROP_ENDFRAME) && RNA_property_is_set(op->ptr, "frame_end")==0) RNA_int_set(op->ptr, "frame_end", (int)mval_v2d[0] + 25); // XXX arbitary but ok for now. - sequencer_generic_invoke_path__internal(C, op, "filepath"); - sequencer_generic_invoke_path__internal(C, op, "directory"); + if (!(flag & SEQPROP_NOPATHS)) { + sequencer_generic_invoke_path__internal(C, op, "filepath"); + sequencer_generic_invoke_path__internal(C, op, "directory"); + } } static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) @@ -344,23 +347,23 @@ 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; } - 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")) + if(RNA_collection_length(op->ptr, "files") || RNA_property_is_set(op->ptr, "filepath")) { + sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_NOPATHS); return sequencer_add_movie_strip_exec(C, op); - + } + sequencer_generic_invoke_xy__internal(C, op, event, 0); - + + if(!RNA_property_is_set(op->ptr, "relative_path")) + RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); + WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; @@ -399,23 +402,23 @@ 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; } - - 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")) + if(RNA_collection_length(op->ptr, "files") || RNA_property_is_set(op->ptr, "filepath")) { + sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_NOPATHS); return sequencer_add_sound_strip_exec(C, op); - + } + sequencer_generic_invoke_xy__internal(C, op, event, 0); - + + if(!RNA_property_is_set(op->ptr, "relative_path")) + RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); + WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; @@ -503,23 +506,26 @@ 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; } - if(!RNA_property_is_set(op->ptr, "relative_path")) - RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); + /* drag drop has set the names */ + if(RNA_collection_length(op->ptr, "files")) { + sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME|SEQPROP_NOPATHS); + return sequencer_add_image_strip_exec(C, op); + } + sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME); + + if(!RNA_property_is_set(op->ptr, "relative_path")) + RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; - - //return sequencer_add_image_strip_exec(C, op); } diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 84daf04e4aa..179db47ae12 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -334,6 +334,7 @@ static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop) RNA_string_set(drop->ptr, "directory", dir); + RNA_collection_clear(drop->ptr, "files"); RNA_collection_add(drop->ptr, "files", &itemptr); RNA_string_set(&itemptr, "name", file); } |