From 7293f6d4863a2f80fa38697f4e55ccdc0aec9e6b Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Tue, 24 Mar 2015 12:24:30 +0100 Subject: Cleanup - move proxy storage options to the proxy itself - also will enable more storage options, since seq->flag is running out of space --- release/scripts/startup/bl_ui/space_sequencer.py | 31 +++++++++++++---------- source/blender/blenkernel/intern/sequencer.c | 27 ++++++++++---------- source/blender/blenloader/intern/versioning_250.c | 6 ++++- source/blender/blenloader/intern/versioning_270.c | 26 +++++++++++++++++++ source/blender/makesdna/DNA_sequence_types.h | 13 +++++++--- source/blender/makesrna/intern/rna_sequencer.c | 19 +++++++------- 6 files changed, 81 insertions(+), 41 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 0be1bf0b90a..4f83cc03b10 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -915,42 +915,45 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel): strip = act_strip(context) - flow = layout.column_flow() - flow.prop(strip, "use_proxy_custom_directory") - flow.prop(strip, "use_proxy_custom_file") if strip.proxy: - if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file: - flow.prop(strip.proxy, "directory") - if strip.use_proxy_custom_file: - flow.prop(strip.proxy, "filepath") + proxy = strip.proxy + + flow = layout.column_flow() + flow.prop(proxy, "use_proxy_custom_directory") + flow.prop(proxy, "use_proxy_custom_file") + + if proxy.use_proxy_custom_directory and not proxy.use_proxy_custom_file: + flow.prop(proxy, "directory") + if proxy.use_proxy_custom_file: + flow.prop(proxy, "filepath") layout.label("Enabled Proxies:") enabled = "" row = layout.row() - if (strip.proxy.build_25): + if (proxy.build_25): enabled += "25% " - if (strip.proxy.build_50): + if (proxy.build_50): enabled += "50% " - if (strip.proxy.build_75): + if (proxy.build_75): enabled += "75% " - if (strip.proxy.build_100): + if (proxy.build_100): enabled += "100% " row.label(enabled) - if (strip.proxy.use_overwrite): + if (proxy.use_overwrite): layout.label("Overwrite On") else: layout.label("Overwrite Off") col = layout.column() col.label(text="Build JPEG quality") - col.prop(strip.proxy, "quality") + col.prop(proxy, "quality") if strip.type == 'MOVIE': col = layout.column() col.label(text="Use timecode index:") - col.prop(strip.proxy, "timecode") + col.prop(proxy, "timecode") col = layout.column() col.operator("sequencer.enable_proxies") diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index c45db303467..19120d4da93 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1362,7 +1362,7 @@ static void seq_open_anim_file(Sequence *seq, bool openfile) return; } - if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) { + if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR) { char dir[FILE_MAX]; BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir)); BLI_path_abs(dir, G.main->name); @@ -1377,7 +1377,8 @@ static bool seq_proxy_get_fname(Sequence *seq, int cfra, int render_size, char * int frameno; char dir[PROXY_MAXFILE]; - if (!seq->strip->proxy) { + StripProxy *proxy = seq->strip->proxy; + if (!proxy) { return false; } @@ -1389,7 +1390,7 @@ 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 (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR | SEQ_USE_PROXY_CUSTOM_FILE)) { + if (proxy->storage & (SEQ_STORAGE_PROXY_CUSTOM_DIR | SEQ_STORAGE_PROXY_CUSTOM_FILE)) { BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir)); } else if (seq->type == SEQ_TYPE_IMAGE) { @@ -1399,7 +1400,7 @@ static bool seq_proxy_get_fname(Sequence *seq, int cfra, int render_size, char * return false; } - if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { + if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { BLI_join_dirfile(name, PROXY_MAXFILE, dir, seq->strip->proxy->file); BLI_path_abs(name, G.main->name); @@ -1433,6 +1434,7 @@ static ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int c IMB_Proxy_Size psize = seq_rendersize_to_proxysize(context->preview_render_size); int size_flags; int render_size = context->preview_render_size; + StripProxy *proxy = seq->strip->proxy; /* dirty hack to distinguish 100% render size from PROXY_100 */ if (render_size == 99) { @@ -1443,32 +1445,31 @@ static ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int c return NULL; } - size_flags = seq->strip->proxy->build_size_flags; + size_flags = proxy->build_size_flags; /* only use proxies, if they are enabled (even if present!) */ if (psize == IMB_PROXY_NONE || ((size_flags & psize) != psize)) { return NULL; } - if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { + if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { int frameno = (int)give_stripelem_index(seq, cfra) + seq->anim_startofs; - if (seq->strip->proxy->anim == NULL) { + if (proxy->anim == NULL) { if (seq_proxy_get_fname(seq, cfra, render_size, name) == 0) { return NULL; } - seq->strip->proxy->anim = openanim(name, IB_rect, 0, - seq->strip->colorspace_settings.name); + proxy->anim = openanim(name, IB_rect, 0, seq->strip->colorspace_settings.name); } - if (seq->strip->proxy->anim == NULL) { + if (proxy->anim == NULL) { return NULL; } seq_open_anim_file(seq, true); - frameno = IMB_anim_index_get_frame_index(seq->anim, seq->strip->proxy->tc, frameno); + frameno = IMB_anim_index_get_frame_index(seq->anim, proxy->tc, frameno); - return IMB_anim_absolute(seq->strip->proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); + return IMB_anim_absolute(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); } if (seq_proxy_get_fname(seq, cfra, render_size, name) == 0) { @@ -1600,7 +1601,7 @@ void BKE_sequencer_proxy_rebuild(SeqIndexBuildContext *context, short *stop, sho } /* that's why it is called custom... */ - if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { + if (seq->strip->proxy && seq->strip->proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { return; } diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index 4125451ead9..7c148f1a2e9 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -797,13 +797,17 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) BLI_path_abs(str, main->name); seq->sound = sound_new_file(main, str); } +#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19) +#define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21) /* don't know, if anybody used that this way, but just in case, upgrade to new way... */ if ((seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) && !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)) { BLI_snprintf(seq->strip->proxy->dir, FILE_MAXDIR, "%s/BL_proxy", seq->strip->dir); } - } +#undef SEQ_USE_PROXY_CUSTOM_DIR +#undef SEQ_USE_PROXY_CUSTOM_FILE + } SEQ_END } } diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 9c8db6d6a9b..30070450bde 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -39,6 +39,7 @@ #include "DNA_cloth_types.h" #include "DNA_constraint_types.h" #include "DNA_sdna_types.h" +#include "DNA_sequence_types.h" #include "DNA_space_types.h" #include "DNA_screen_types.h" #include "DNA_object_types.h" @@ -53,6 +54,7 @@ #include "BKE_main.h" #include "BKE_modifier.h" #include "BKE_node.h" +#include "BKE_sequencer.h" #include "BKE_screen.h" #include "BLI_math.h" @@ -700,4 +702,28 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } FOREACH_NODETREE_END } + + if (!DNA_struct_elem_find(fd->filesdna, "Sequence", "char", "storage")) { + Scene *scene; + Sequence *seq; + +#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19) +#define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21) + + for (scene = main->scene.first; scene; scene = scene->id.next) { + SEQ_BEGIN (scene->ed, seq) { + if (seq->strip && seq->strip->proxy) { + if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) + seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_DIR; + if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) + seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_FILE; + } + } + SEQ_END + + printf("lala\n"); + } +#undef SEQ_USE_PROXY_CUSTOM_DIR +#undef SEQ_USE_PROXY_CUSTOM_FILE + } } diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index c6748cca8e1..34fceaef4c0 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -95,7 +95,8 @@ typedef struct StripProxy { short build_tc_flags; // time code flags (see below) of all tc indices // to build short build_flags; - char pad[6]; + char storage; + char pad[5]; } StripProxy; typedef struct Strip { @@ -354,9 +355,9 @@ enum { SEQ_USE_TRANSFORM = (1 << 16), SEQ_USE_CROP = (1 << 17), /* SEQ_USE_COLOR_BALANCE = (1 << 18), */ /* DEPRECATED */ - SEQ_USE_PROXY_CUSTOM_DIR = (1 << 19), + /* SEQ_USE_PROXY_CUSTOM_DIR = (1 << 19), */ /* DEPRECATED */ - SEQ_USE_PROXY_CUSTOM_FILE = (1 << 21), + /* SEQ_USE_PROXY_CUSTOM_FILE = (1 << 21), */ /* DEPRECATED */ SEQ_USE_EFFECT_DEFAULT_FADE = (1 << 22), SEQ_USE_LINEAR_MODIFIERS = (1 << 23), @@ -372,6 +373,12 @@ enum { SEQ_INVALID_EFFECT = (1 << 31), }; +/* StripProxy->storage */ +enum { + SEQ_STORAGE_PROXY_CUSTOM_FILE = (1 << 1), /* store proxy in custom directory */ + SEQ_STORAGE_PROXY_CUSTOM_DIR = (1 << 2) /* store proxy in custom file */ +}; + #if (DNA_DEPRECATED_GCC_POISON == 1) #pragma GCC poison SEQ_MAKE_PREMUL #endif diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 8ad7d313c1e..1844ce03284 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1222,6 +1222,15 @@ static void rna_def_strip_proxy(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Timecode", ""); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_tcindex_update"); + prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "storage", SEQ_STORAGE_PROXY_CUSTOM_DIR); + RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); + + prop = RNA_def_property(srna, "use_proxy_custom_file", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "storage", SEQ_STORAGE_PROXY_CUSTOM_FILE); + RNA_def_property_ui_text(prop, "Proxy Custom File", "Use a custom file to read proxy data from"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_color_balance(BlenderRNA *brna) @@ -1702,16 +1711,6 @@ static void rna_def_proxy(StructRNA *srna) prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "strip->proxy"); RNA_def_property_ui_text(prop, "Proxy", ""); - - prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY_CUSTOM_DIR); - RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); - - prop = RNA_def_property(srna, "use_proxy_custom_file", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY_CUSTOM_FILE); - RNA_def_property_ui_text(prop, "Proxy Custom File", "Use a custom file to read proxy data from"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_input(StructRNA *srna) -- cgit v1.2.3