diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-03-26 19:54:16 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-03-26 19:54:16 +0300 |
commit | 4c7876c7408836fd22e076dc9a4b54216afc6f2e (patch) | |
tree | 2be0845c0e058ec4c536718c39cca24aac8a3a7b /source/blender | |
parent | d084967627c5d568c87c616cead4f468d9a21887 (diff) |
New option proxy placement, project directory.
There are two per-editor settings now, the Per-Strip setting (default)
and the Project setting.
The per strip setting basically uses the previous, per-strip options for
storing the proxies.
The project setting though will use a specified directory for -all-
proxies, or the blend file directory if no directory is given.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 50 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_sequence_types.h | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 25 |
3 files changed, 68 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 6fa39e8bbe0..ec78e155d98 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1330,7 +1330,7 @@ static double seq_rendersize_to_scale_factor(int size) return 0.25; } -static void seq_open_anim_file(Sequence *seq, bool openfile) +static void seq_open_anim_file(Editing *ed, Sequence *seq, bool openfile) { char name[FILE_MAX]; StripProxy *proxy; @@ -1362,10 +1362,22 @@ static void seq_open_anim_file(Sequence *seq, bool openfile) return; } - if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR) { + if ((proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR) || + (ed->proxy_storage == SEQ_EDIT_PROXY_DIR_STORAGE)) + { char dir[FILE_MAX]; char fname[FILE_MAXFILE]; - BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir)); + + if (ed->proxy_storage == SEQ_EDIT_PROXY_DIR_STORAGE) { + if (ed->proxy_dir[0] == 0) + BLI_strncpy(dir, "//", sizeof(dir)); + else + BLI_strncpy(dir, ed->proxy_dir, sizeof(dir)); + } + else { + BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir)); + } + IMB_anim_get_fname(seq->anim, fname, FILE_MAXFILE); BLI_path_append(dir, sizeof(dir), fname); @@ -1376,7 +1388,7 @@ static void seq_open_anim_file(Sequence *seq, bool openfile) } -static bool seq_proxy_get_fname(Sequence *seq, int cfra, int render_size, char *name) +static bool seq_proxy_get_fname(Editing *ed, Sequence *seq, int cfra, int render_size, char *name) { int frameno; char dir[PROXY_MAXFILE]; @@ -1394,7 +1406,17 @@ static bool seq_proxy_get_fname(Sequence *seq, int cfra, int render_size, char * * have both, a directory full of jpeg files and proxy avis, so * sorry folks, please rebuild your proxies... */ - if ((proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR) && (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE)) { + if (seq->anim && ed->proxy_storage == SEQ_EDIT_PROXY_DIR_STORAGE) { + char fname[FILE_MAXFILE]; + if (ed->proxy_dir[0] == 0) + BLI_strncpy(dir, "//", sizeof(dir)); + else + BLI_strncpy(dir, ed->proxy_dir, sizeof(dir)); + IMB_anim_get_fname(seq->anim, fname, FILE_MAXFILE); + BLI_path_append(dir, sizeof(dir), fname); + BLI_path_abs(name, G.main->name); + } + else if ((proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR) && (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE)) { BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir)); } else if (seq->anim && (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR)) { @@ -1410,7 +1432,9 @@ static bool seq_proxy_get_fname(Sequence *seq, int cfra, int render_size, char * return false; } - if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { + if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE && seq->anim && + ed->proxy_storage != SEQ_EDIT_PROXY_DIR_STORAGE) + { BLI_join_dirfile(name, PROXY_MAXFILE, dir, proxy->file); BLI_path_abs(name, G.main->name); @@ -1445,6 +1469,7 @@ static ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int c int size_flags; int render_size = context->preview_render_size; StripProxy *proxy = seq->strip->proxy; + Editing *ed = context->scene->ed; if (!(seq->flag & SEQ_USE_PROXY)) { return NULL; @@ -1465,7 +1490,7 @@ static ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int c if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { int frameno = (int)give_stripelem_index(seq, cfra) + seq->anim_startofs; if (proxy->anim == NULL) { - if (seq_proxy_get_fname(seq, cfra, render_size, name) == 0) { + if (seq_proxy_get_fname(ed, seq, cfra, render_size, name) == 0) { return NULL; } @@ -1475,14 +1500,14 @@ static ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int c return NULL; } - seq_open_anim_file(seq, true); + seq_open_anim_file(context->scene->ed, seq, true); frameno = IMB_anim_index_get_frame_index(seq->anim, proxy->tc, frameno); return IMB_anim_absolute(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); } - if (seq_proxy_get_fname(seq, cfra, render_size, name) == 0) { + if (seq_proxy_get_fname(ed, seq, cfra, render_size, name) == 0) { return NULL; } @@ -1507,8 +1532,9 @@ static void seq_proxy_build_frame(const SeqRenderData *context, Sequence *seq, i int rectx, recty; int ok; ImBuf *ibuf_tmp, *ibuf; + Editing *ed = context->scene->ed; - if (!seq_proxy_get_fname(seq, cfra, proxy_render_size, name)) { + if (!seq_proxy_get_fname(ed, seq, cfra, proxy_render_size, name)) { return; } @@ -1577,7 +1603,7 @@ SeqIndexBuildContext *BKE_sequencer_proxy_rebuild_context(Main *bmain, Scene *sc context->seq = nseq; if (nseq->type == SEQ_TYPE_MOVIE) { - seq_open_anim_file(nseq, true); + seq_open_anim_file(scene->ed, nseq, true); if (nseq->anim) { context->index_context = IMB_anim_index_rebuild_context(nseq->anim, @@ -2800,7 +2826,7 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, Sequence *s case SEQ_TYPE_MOVIE: { - seq_open_anim_file(seq, false); + seq_open_anim_file(context->scene->ed, seq, false); if (seq->anim) { IMB_Proxy_Size proxy_size = seq_rendersize_to_proxysize(context->preview_render_size); diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index c4de93efa6b..9a6d8a533b0 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -210,9 +210,10 @@ typedef struct Editing { Sequence *act_seq; char act_imagedir[1024]; /* 1024 = FILE_MAX */ char act_sounddir[1024]; /* 1024 = FILE_MAX */ + char proxy_dir[1024]; /* 1024 = FILE_MAX */ int over_ofs, over_cfra; - int over_flag, pad; + int over_flag, proxy_storage; rctf over_border; } Editing; @@ -327,6 +328,10 @@ typedef struct SequencerScopes { #define SEQ_STRIP_OFSBOTTOM 0.2f #define SEQ_STRIP_OFSTOP 0.8f +/* Editor->proxy_storage */ +/* store proxies in project directory */ +#define SEQ_EDIT_PROXY_DIR_STORAGE 1 + /* SpeedControlVars->flags */ #define SEQ_SPEED_INTEGRATE 1 /* #define SEQ_SPEED_BLEND 2 */ /* DEPRECATED */ diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index a0756d64d0d..231341ef554 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -134,6 +134,14 @@ static void rna_SequenceEditor_sequences_all_begin(CollectionPropertyIterator *i rna_iterator_listbase_begin(iter, &ed->seqbase, NULL); } +static void rna_SequenceEditor_update_cache(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) +{ + Editing *ed = (Editing *) ptr->id.data; + + BKE_sequencer_free_imbuf(scene, &ed->seqbase, false); +} + + static void rna_SequenceEditor_sequences_all_next(CollectionPropertyIterator *iter) { ListBaseIterator *internal = &iter->internal.listbase; @@ -1568,7 +1576,12 @@ static void rna_def_editor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - + + static const EnumPropertyItem editing_storage_items[] = { + {0, "PER_STRIP", 0, "Per Strip", "Store proxies using per strip settings"}, + {SEQ_EDIT_PROXY_DIR_STORAGE, "PROJECT", 0, "Project", "Store proxies using project directory"}, + {0, NULL, 0, NULL, NULL} + }; srna = RNA_def_struct(brna, "SequenceEditor", NULL); RNA_def_struct_ui_text(srna, "Sequence Editor", "Sequence editing data for a Scene datablock"); RNA_def_struct_ui_icon(srna, ICON_SEQUENCE); @@ -1616,6 +1629,16 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get", "rna_SequenceEditor_overlay_frame_set", NULL); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "proxy_storage", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, editing_storage_items); + RNA_def_property_ui_text(prop, "Proxy Storage", "How to store proxies for this project"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_update_cache"); + + prop = RNA_def_property(srna, "proxy_dir", PROP_STRING, PROP_DIRPATH); + RNA_def_property_string_sdna(prop, NULL, "proxy_dir"); + RNA_def_property_ui_text(prop, "Proxy Directory", ""); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_update_cache"); } static void rna_def_filter_video(StructRNA *srna) |