diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-04-20 17:33:10 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-04-22 15:11:51 +0300 |
commit | 62d10cd83324f066a11b4966bd29fc9579e5f76d (patch) | |
tree | c60b18bd4178e26da73464942f1ca9da10f7e52f /source/blender | |
parent | dc36e1fe39f87fabfc9e398139d20f935caf74c3 (diff) |
Placeholders for sequencer take one.
Placeholder images, means that the image sequence reserves a range for
images, displaying black while we wait for them to finish rendering.
This is meant as a feature to not break the layout of gooseberry
sequence edits while we wait for those frames to arrive.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 62 |
1 files changed, 53 insertions, 9 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 373095d68f9..ddb9d1196d5 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -30,6 +30,7 @@ #include <stdlib.h> #include <math.h> #include <string.h> +#include <ctype.h> #include "MEM_guardedalloc.h" @@ -763,11 +764,18 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) Strip *strip; StripElem *se; + int i; + bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders"); seq_load_operator_info(&seq_load, op); /* images are unique in how they handle this - 1 per strip elem */ - seq_load.len = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); + if (use_placeholders) { + seq_load.len = seq_load.end_frame - seq_load.start_frame; + } + else { + seq_load.len = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); + } if (seq_load.len == 0) return OPERATOR_CANCELLED; @@ -775,20 +783,54 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) if (seq_load.flag & SEQ_LOAD_REPLACE_SEL) ED_sequencer_deselect_all(scene); - /* main adding function */ seq = BKE_sequencer_add_image_strip(C, ed->seqbasep, &seq_load); strip = seq->strip; se = strip->stripdata; - RNA_BEGIN (op->ptr, itemptr, "files") - { - char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0); - BLI_strncpy(se->name, filename, sizeof(se->name)); - MEM_freeN(filename); - se++; + if (use_placeholders) { + char *filename = NULL, *filename_stripped; + RNA_BEGIN (op->ptr, itemptr, "files") + { + /* just get the first filename */ + filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0); + break; + } + RNA_END; + + filename_stripped = filename; + + if (filename_stripped) { + + /* strip numeric extensions */ + while (*filename_stripped && isdigit(*filename_stripped)) { + filename_stripped++; + } + + /* was the number really an extension? */ + if (*filename_stripped == '.') + filename_stripped++; + else { + filename_stripped = filename; + } + + for (i = 0; i < seq_load.len; i++, se++) { + BLI_snprintf(se->name, sizeof(se->name), "%04d.%s", seq_load.start_frame + i, filename_stripped); + } + + MEM_freeN(filename); + } + } + else { + RNA_BEGIN (op->ptr, itemptr, "files") + { + char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0); + BLI_strncpy(se->name, filename, sizeof(se->name)); + MEM_freeN(filename); + se++; + } + RNA_END; } - RNA_END; if (seq_load.len == 1) { if (seq_load.start_frame < seq_load.end_frame) { @@ -861,6 +903,8 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot) WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY); sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME | SEQPROP_ENDFRAME); + + RNA_def_boolean(ot->srna, "use_placeholders", false, "Use Placeholders", "Use placeholders for missing frames of the strip"); } |