[Bf-blender-cvs] [c71d3a6] multiview: Removing option to use %, and use BLI_path_suffix instead of BLI_path_view
Dalai Felinto
noreply at git.blender.org
Thu Mar 5 19:09:20 CET 2015
Commit: c71d3a623220a5d22fb79c57319c8e96ff56e831
Author: Dalai Felinto
Date: Thu Mar 5 15:08:52 2015 -0300
Branches: multiview
https://developer.blender.org/rBc71d3a623220a5d22fb79c57319c8e96ff56e831
Removing option to use %, and use BLI_path_suffix instead of BLI_path_view
===================================================================
M source/blender/blenkernel/BKE_image.h
M source/blender/blenkernel/intern/image.c
M source/blender/blenkernel/intern/scene.c
M source/blender/blenkernel/intern/writeavi.c
M source/blender/blenkernel/intern/writeffmpeg.c
M source/blender/blenlib/BLI_path_util.h
M source/blender/blenlib/intern/path_util.c
M source/blender/quicktime/apple/qtkit_export.m
===================================================================
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index 82fa826..29ab6df 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -68,10 +68,10 @@ int BKE_imbuf_write(struct ImBuf *ibuf, const char *name, struct ImageFormat
int BKE_imbuf_write_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const bool is_copy);
void BKE_image_path_from_imformat(
char *string, const char *base, const char *relbase, int frame,
- const struct ImageFormatData *im_format, const bool use_ext, const bool use_frames, const char *view);
+ const struct ImageFormatData *im_format, const bool use_ext, const bool use_frames, const char *suffix);
void BKE_image_path_from_imtype(
char *string, const char *base, const char *relbase, int frame,
- const char imtype, const bool use_ext, const bool use_frames, const char *view);
+ const char imtype, const bool use_ext, const bool use_frames, const char *suffix);
int BKE_image_path_ensure_ext_from_imformat(char *string, const struct ImageFormatData *im_format);
int BKE_image_path_ensure_ext_from_imtype(char *string, const char imtype);
char BKE_image_ftype_to_imtype(const int ftype);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 6d126ab..c3b794e 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2248,7 +2248,8 @@ int BKE_imbuf_write_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, cons
static void do_makepicstring(char *string, const char *base, const char *relbase, int frame, const char imtype,
- const ImageFormatData *im_format, const short use_ext, const short use_frames, const char *view)
+ const ImageFormatData *im_format, const short use_ext, const short use_frames,
+ const char *suffix)
{
if (string == NULL) return;
BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */
@@ -2257,7 +2258,8 @@ static void do_makepicstring(char *string, const char *base, const char *relbase
if (use_frames)
BLI_path_frame(string, frame, 4);
- BLI_path_view(string, view);
+ if (suffix)
+ BLI_path_suffix(string, FILE_MAX, suffix, "");
if (use_ext)
do_add_image_extension(string, imtype, im_format);
@@ -2265,9 +2267,9 @@ static void do_makepicstring(char *string, const char *base, const char *relbase
void BKE_image_path_from_imformat(
char *string, const char *base, const char *relbase, int frame,
- const ImageFormatData *im_format, const bool use_ext, const bool use_frames, const char *view)
+ const ImageFormatData *im_format, const bool use_ext, const bool use_frames, const char *suffix)
{
- do_makepicstring(string, base, relbase, frame, im_format->imtype, im_format, use_ext, use_frames, view);
+ do_makepicstring(string, base, relbase, frame, im_format->imtype, im_format, use_ext, use_frames, suffix);
}
void BKE_image_path_from_imtype(
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 2eb7d85..690db39 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -2299,7 +2299,7 @@ void BKE_scene_view_filepath_get(const RenderData *rd, const char *filepath, con
BLI_strncpy(suffix, viewname, sizeof(suffix));
BLI_strncpy(r_filepath, filepath, FILE_MAX);
- BLI_path_view(r_filepath, suffix);
+ BLI_path_suffix(r_filepath, FILE_MAX, suffix, "");
}
const char *BKE_scene_view_suffix_get(const RenderData *rd, const char *viewname)
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index 8fb01d9..29af233 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -178,7 +178,7 @@ static void filepath_avi(char *string, RenderData *rd, const char *suffix)
}
}
- BLI_path_view(string, suffix);
+ BLI_path_suffix(string, FILE_MAX, suffix, "");
}
static int start_avi(void *context_v, Scene *UNUSED(scene), RenderData *rd, int rectx, int recty, const char *suffix, ReportList *reports)
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 35f86db..71be992 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -1082,7 +1082,7 @@ static void ffmpeg_filepath_get(FFMpegContext *context, char *string, RenderData
strcat(string, autosplit);
}
- BLI_path_view(string, suffix);
+ BLI_path_suffix(string, FILE_MAX, suffix, "");
}
void BKE_ffmpeg_filepath_get(char *string, RenderData *rd, const char *suffix)
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index ad8578c..d99df24 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -126,7 +126,6 @@ bool BLI_parent_dir(char *path) ATTR_NONNULL();
* \retval Returns true if the path was relative (started with "//").
*/
bool BLI_path_abs(char *path, const char *basepath) ATTR_NONNULL();
-bool BLI_path_view(char *path, const char *view) ATTR_NONNULL(1);
bool BLI_path_frame(char *path, int frame, int digits) ATTR_NONNULL();
bool BLI_path_frame_range(char *path, int sta, int end, int digits) ATTR_NONNULL();
bool BLI_path_frame_check_chars(const char *path) ATTR_NONNULL();
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 128383f..7273901 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -752,11 +752,11 @@ bool BLI_parent_dir(char *path)
}
/**
- * Looks for a sequence of special characters (e.g., #, %) in the last slash-separated component of *path,
+ * Looks for a sequence of "#" characters in the last slash-separated component of *path,
* returning the indexes of the first and one past the last character in the sequence in
* *char_start and *char_end respectively. Returns true if such a sequence was found.
*/
-static bool stringspecial_chars(const char *path, int *char_start, int *char_end, const char chr)
+static bool stringframe_chars(const char *path, int *char_start, int *char_end)
{
unsigned int ch_sta, ch_end, i;
/* Insert current frame: file### -> file001 */
@@ -765,10 +765,10 @@ static bool stringspecial_chars(const char *path, int *char_start, int *char_end
if (path[i] == '\\' || path[i] == '/') {
ch_end = 0; /* this is a directory name, don't use any hashes we found */
}
- else if (path[i] == chr) {
+ else if (path[i] == '#') {
ch_sta = i;
ch_end = ch_sta + 1;
- while (path[ch_end] == chr) {
+ while (path[ch_end] == '#') {
ch_end++;
}
i = ch_end - 1; /* keep searching */
@@ -821,7 +821,7 @@ bool BLI_path_frame(char *path, int frame, int digits)
if (digits)
ensure_digits(path, digits);
- if (stringspecial_chars(path, &ch_sta, &ch_end, '#')) { /* warning, ch_end is the last # +1 */
+ if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */
char tmp[FILE_MAX];
BLI_snprintf(tmp, sizeof(tmp),
"%.*s%.*d%s",
@@ -844,7 +844,7 @@ bool BLI_path_frame_range(char *path, int sta, int end, int digits)
if (digits)
ensure_digits(path, digits);
- if (stringspecial_chars(path, &ch_sta, &ch_end, '#')) { /* warning, ch_end is the last # +1 */
+ if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */
char tmp[FILE_MAX];
BLI_snprintf(tmp, sizeof(tmp),
"%.*s%.*d-%.*d%s",
@@ -855,88 +855,13 @@ bool BLI_path_frame_range(char *path, int sta, int end, int digits)
return false;
}
-/********************* multiview utils ********************/
-
-/**
- * Ensure *path contains at least one "%" character in its last slash-separated
- * component, appending one digits long if not.
- */
-static void ensure_view(char *path)
-{
- char *file = (char *)BLI_last_slash(path);
-
- if (file == NULL)
- file = path;
-
- /* if there is no '%' try to add one before the '.' if any */
- if (strrchr(file, '%') == NULL) {
- int len = strlen(file);
- char *period = strrchr(file, '.');
-
- /* found a period */
- if (period && period > file) {
- char *p = file;
- for (p = file + len + 1; p > period; p--) {
- *p = *(p - 1);
- }
- *p = '%';
- }
- /* no period, just add it to the end*/
- else {
- file[len++] = '%';
- file[len] = '\0';
- }
- }
-}
-
-/**
- * Removes any "%" character from path.
- */
-static void strip_view_char(char *path)
-{
- int i, j;
-
- for (i = 0, j = 0; i < strlen(path); i++, j++) {
- if (path[i] != '%')
- path[j] = path[i];
- else
- j--;
- }
-
- path[j] = '\0';
-}
-
-/**
- * Replaces "%" character sequence in last slash-separated component of *path
- * with view name.
- */
-bool BLI_path_view(char *path, const char *view)
-{
- int ch_sta, ch_end;
-
- if (view && view[0] != '\0')
- ensure_view(path);
-
- if (stringspecial_chars(path, &ch_sta, &ch_end, '%')) { /* warning, ch_end is the last # +1 */
- char tmp[FILE_MAX];
- const int len = BLI_snprintf(tmp, sizeof(tmp) - 1, "%.*s%s%s", ch_sta, path, view, path + ch_end);
-
- BLI_strncpy(path, tmp, len + 1);
- strip_view_char((char *) BLI_last_slash(path));
-
- return true;
- }
-
- return false;
-}
-
/**
* Check if we have '#' chars, usable for #BLI_path_frame, #BLI_path_frame_range
*/
bool BLI_path_frame_check_chars(const char *path)
{
int ch_sta, ch_end; /* dummy args */
- return stringspecial_chars(path, &ch_sta, &ch_end, '#');
+ return stringframe_chars(path, &ch_sta, &ch_end);
}
/**
diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m
index 4d87280..a282527 100644
--- a/source/blender/quicktime/apple/qtkit_export.m
+++ b/source/blender/quicktime/apple/qtkit_export.m
@@ -253,7 +253,7 @@ void filepath_qt(char *string, RenderData *rd, const char *suffix)
}
}
- BLI_path_view(string, suffix);
+ BLI_path_suffix(string, FILE_MAX, suffix, ""
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list