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...
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/* This is for drag and drop */
|
||||
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);
|
||||
|
||||
/* 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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/* This is for drag and drop */
|
||||
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);
|
||||
|
||||
/* 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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/* 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);
|
||||
|
||||
sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME);
|
||||
|
||||
WM_event_add_fileselect(C, op);
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
|
||||
//return sequencer_add_image_strip_exec(C, op);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user