From 978609aa44659bbf4565ad413f5242654249fb22 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Sun, 11 Apr 2010 19:26:46 +0000 Subject: == Sequencer == Made custom proxy files a lot more sensible to select (upgraded to filepath get/setters) Changed semantics, since custom files don't make much sense without custom directories... --- source/blender/blenkernel/intern/sequencer.c | 3 +- source/blender/blenloader/intern/readfile.c | 11 +++++++ source/blender/makesrna/intern/rna_sequencer.c | 43 +++++++++++++++++++++++--- 3 files changed, 52 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 790087334c6..3cfbbd8ae6f 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1231,7 +1231,8 @@ static int seq_proxy_get_fname(Scene *scene, Sequence * seq, int cfra, char * na return FALSE; } - if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) { + if ((seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) + || (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE)) { strcpy(dir, seq->strip->proxy->dir); } else { if (seq->type == SEQ_IMAGE || seq->type == SEQ_MOVIE) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 3196de4243c..12ae08089da 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9646,6 +9646,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main) BLI_path_abs(str, G.sce); seq->sound = sound_new_file(main, str); } + /* 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)) + { + + snprintf(seq->strip->proxy->dir, + FILE_MAXDIR, "%s/BL_proxy", + seq->strip->dir); + } } } } diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index be6bb1f00b8..d99e5904920 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -341,6 +341,35 @@ static int rna_Sequence_filepath_length(PointerRNA *ptr) return strlen(path)+1; } +static void rna_Sequence_proxy_filepath_set(PointerRNA *ptr, const char *value) +{ + StripProxy *proxy= (StripProxy*)(ptr->data); + char dir[FILE_MAX], name[FILE_MAX]; + + BLI_split_dirfile(value, dir, name); + BLI_strncpy(proxy->dir, dir, sizeof(proxy->dir)); + BLI_strncpy(proxy->file, name, sizeof(proxy->file)); +} + +static void rna_Sequence_proxy_filepath_get(PointerRNA *ptr, char *value) +{ + StripProxy *proxy= (StripProxy*)(ptr->data); + char path[FILE_MAX]; + + BLI_join_dirfile(path, proxy->dir, proxy->file); + BLI_strncpy(value, path, strlen(path)+1); +} + +static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr) +{ + StripProxy *proxy= (StripProxy*)(ptr->data); + char path[FILE_MAX]; + + BLI_join_dirfile(path, proxy->dir, proxy->file); + return strlen(path)+1; +} + + /*static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value) { Sequence *seq= (Sequence*)(ptr->data); @@ -468,12 +497,13 @@ static void rna_def_strip_proxy(BlenderRNA *brna) prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "dir"); - RNA_def_property_ui_text(prop, "Directory", "Location to story the proxy file"); + RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - prop= RNA_def_property(srna, "file", PROP_STRING, PROP_DIRPATH); - RNA_def_property_string_sdna(prop, NULL, "file"); - RNA_def_property_ui_text(prop, "File", "Proxy file name"); + prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); + RNA_def_property_ui_text(prop, "Path", "Location of custom proxy file"); + RNA_def_property_string_funcs(prop, "rna_Sequence_proxy_filepath_get", "rna_Sequence_proxy_filepath_length", "rna_Sequence_proxy_filepath_set"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } @@ -844,6 +874,11 @@ static void rna_def_proxy(StructRNA *srna) 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, "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