[Bf-blender-cvs] [a180c8e] master: Allow multiple strips to use the same directory when custom proxy directory is used.

Antony Riakiotakis noreply at git.blender.org
Wed Mar 25 12:05:55 CET 2015


Commit: a180c8e2ed6ce62e6a15d28a0bb7f60bb58bc0cb
Author: Antony Riakiotakis
Date:   Wed Mar 25 12:05:34 2015 +0100
Branches: master
https://developer.blender.org/rBa180c8e2ed6ce62e6a15d28a0bb7f60bb58bc0cb

Allow multiple strips to use the same directory when custom proxy
directory is used.

This is done by appending the name of the file as extra folder. Existing
projects may need to regenerate their proxies but it should be possible
now to have all proxies nicely in the same custom folder.

Next commits will include operators to copy directory settings between
selected strips, making the process faster.

===================================================================

M	source/blender/blenkernel/intern/sequencer.c
M	source/blender/imbuf/IMB_imbuf.h
M	source/blender/imbuf/intern/indexer.c
M	source/blender/makesdna/DNA_sequence_types.h

===================================================================

diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 19120d4..eb7736f 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1364,7 +1364,11 @@ static void seq_open_anim_file(Sequence *seq, bool openfile)
 
 	if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR) {
 		char dir[FILE_MAX];
+		char fname[FILE_MAXFILE];
 		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);
+
 		BLI_path_abs(dir, G.main->name);
 
 		IMB_anim_set_index_dir(seq->anim, dir);
@@ -1390,8 +1394,14 @@ 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 | SEQ_STORAGE_PROXY_CUSTOM_FILE)) {
+	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)) {
+		char fname[FILE_MAXFILE];
 		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);
 	}
 	else if (seq->type == SEQ_TYPE_IMAGE) {
 		BLI_snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir);
@@ -1402,7 +1412,7 @@ static bool seq_proxy_get_fname(Sequence *seq, int cfra, int render_size, char *
 
 	if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) {
 		BLI_join_dirfile(name, PROXY_MAXFILE,
-		                 dir, seq->strip->proxy->file);
+		                 dir, proxy->file);
 		BLI_path_abs(name, G.main->name);
 
 		return true;
@@ -1436,15 +1446,15 @@ static ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int c
 	int render_size = context->preview_render_size;
 	StripProxy *proxy = seq->strip->proxy;
 
+	if (!(seq->flag & SEQ_USE_PROXY)) {
+		return NULL;
+	}
+
 	/* dirty hack to distinguish 100% render size from PROXY_100 */
 	if (render_size == 99) {
 		render_size = 100;
 	}
 
-	if (!(seq->flag & SEQ_USE_PROXY)) {
-		return NULL;
-	}
-
 	size_flags = proxy->build_size_flags;
 
 	/* only use proxies, if they are enabled (even if present!) */
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index 447a14b..1868230 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -240,6 +240,7 @@ typedef enum IMB_Proxy_Size {
 
 /* defaults to BL_proxy within the directory of the animation */
 void IMB_anim_set_index_dir(struct anim *anim, const char *dir);
+void IMB_anim_get_fname(struct anim *anim, char *file, int size);
 
 int IMB_anim_index_get_frame_index(struct anim *anim, IMB_Timecode_Type tc,
                                    int position);
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index d028174..183159f 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -374,6 +374,13 @@ static void get_index_dir(struct anim *anim, char *index_dir, size_t index_dir_l
 	}
 }
 
+void IMB_anim_get_fname(struct anim *anim, char *file, int size)
+{
+	char fname[FILE_MAXFILE];
+	BLI_split_dirfile(anim->name, file, fname, size, sizeof(fname));
+	BLI_strncpy(file, fname, size);
+}
+
 static void get_proxy_filename(struct anim *anim, IMB_Proxy_Size preview_size,
                                char *fname, bool temp)
 {
@@ -381,8 +388,8 @@ static void get_proxy_filename(struct anim *anim, IMB_Proxy_Size preview_size,
 	int i = IMB_proxy_size_to_array_index(preview_size);
 
 	char proxy_name[256];
-	char proxy_temp_name[256];
 	char stream_suffix[20];
+	const char *name = (temp) ? "proxy_%d%s_part.avi" : "proxy_%d%s.avi";
 	
 	stream_suffix[0] = 0;
 
@@ -390,15 +397,12 @@ static void get_proxy_filename(struct anim *anim, IMB_Proxy_Size preview_size,
 		BLI_snprintf(stream_suffix, sizeof(stream_suffix), "_st%d", anim->streamindex);
 	}
 
-	BLI_snprintf(proxy_name, sizeof(proxy_name), "proxy_%d%s.avi",
-	             (int) (proxy_fac[i] * 100), stream_suffix);
-	BLI_snprintf(proxy_temp_name, sizeof(proxy_temp_name), "proxy_%d%s_part.avi",
+	BLI_snprintf(proxy_name, sizeof(proxy_name), name,
 	             (int) (proxy_fac[i] * 100), stream_suffix);
 
 	get_index_dir(anim, index_dir, sizeof(index_dir));
 
-	BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, 
-	                 temp ? proxy_temp_name : proxy_name);
+	BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, proxy_name);
 }
 
 static void get_tc_filename(struct anim *anim, IMB_Timecode_Type tc,
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 34fceae..c4de93e 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -376,7 +376,7 @@ enum {
 /* 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 */
+	SEQ_STORAGE_PROXY_CUSTOM_DIR    = (1 << 2), /* store proxy in custom file */
 };
 
 #if (DNA_DEPRECATED_GCC_POISON == 1)




More information about the Bf-blender-cvs mailing list