Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-06-05 20:11:35 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-06-05 20:11:35 +0400
commit07b3e41e18611cc5c7206d1400303104f73054fc (patch)
tree24114223e4430dcd5bd95560965797c85bce3529 /source/blender/editors/space_sequencer
parent45ed196344a7534c9965015ca653c90f5f00d97f (diff)
Blender file selector support for setting multiple selected files/dirs which operators can use.
This allows the sequencers Add-Image strip to work like it does in 2.4x. - as well as setting the "filename" operator property, operators can have collections called "files" and "dirs" which are set when available. - RNA_OperatorFileListElement as new collection type, its a bit redundant since each item only has a "name" property but its needed since we don't have a string array type. - the file selector now prints operators it runs. Tested with python, adding a list of images works to the sequencer works. bpy.ops.SEQUENCER_OT_image_strip_add(name="MyImages", start_frame=54, channel=2, filename="/somedir/", replace_sel=True, files=[{"name":"test1.png"}, {"name":"test2.png"}])
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 6e38ff053be..8373f588fb2 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -423,9 +423,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, TRUE);
-
- int tot_images= 1; //XXX FIXME, we need string arrays!
- //int a;
+ int tot_images;
char filename[FILE_MAX];
@@ -440,26 +438,30 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filename", filename);
- seq = alloc_sequence(ed->seqbasep, start_frame, channel);
-
+ seq = alloc_sequence(ed->seqbasep, start_frame, channel);
seq->type= SEQ_IMAGE;
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len = seq->len = tot_images;
+ BLI_split_dirfile_basic(filename, strip->dir, NULL);
+
+ tot_images= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
+
+ strip->len = seq->len = tot_images?tot_images:1;
strip->us= 1;
strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
-
- BLI_split_dirfile_basic(filename, strip->dir, se->name); // XXX se->name assignment should be moved into the loop below
-
-#if 0 // XXX
- for(a=0; a<seq->len; a++) {
- strncpy(se->name, name, FILE_MAXFILE-1);
- se++;
+ if(tot_images) {
+ RNA_BEGIN(op->ptr, itemptr, "files") {
+ RNA_string_get(&itemptr, "name", se->name);
+ se++;
+ }
+ RNA_END;
+ }
+ else {
+ BLI_split_dirfile_basic(filename, NULL, se->name);
}
-#endif
RNA_string_get(op->ptr, "name", seq->name);
@@ -507,6 +509,8 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILENAME);
+
+ RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
}