Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Yurkovich <jesse.y@gmail.com>2022-04-17 00:18:08 +0300
committerJesse Yurkovich <jesse.y@gmail.com>2022-04-17 00:18:08 +0300
commit98eb11156854e102a0405af1a64b2266eea22368 (patch)
treefb62ea8efb84189d6c4ed6b866a4fd7942df4773
parent2b191cd2b41b7eaa794ef8d7f702482ab3d1b6eb (diff)
Fix T97366: Misdetection of numbers as UDIMs in certain filepaths
In some circumstances singular files with numbers in their name (like turntable-1080p.png or frame-1042.png) might be detected as a UDIM. The root cause in this particular instance was because `BKE_image_get_tile_info` believed this file to be a tiled texture and replaced the filename with a tokenized version of it. However, later on, the code inside `image_open_single` did not believe it was tiled because only 1 file was detected and our tiled textures require at least 2. This discrepancy lead to the broken filename situation. This was a regression since rB180b66ae8a1f as that introduced the tokenization changes. Differential Revision: https://developer.blender.org/D14667
-rw-r--r--source/blender/blenkernel/intern/image.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc
index 482537d7fa9..53ec148fd2d 100644
--- a/source/blender/blenkernel/intern/image.cc
+++ b/source/blender/blenkernel/intern/image.cc
@@ -3106,7 +3106,7 @@ bool BKE_image_get_tile_info(char *filepath, ListBase *tiles, int *r_tile_start,
eUDIM_TILE_FORMAT tile_format;
char *udim_pattern = BKE_image_get_tile_strformat(filename, &tile_format);
- bool is_udim = true;
+ bool all_valid_udim = true;
int min_udim = IMA_UDIM_MAX + 1;
int max_udim = 0;
int id;
@@ -3124,7 +3124,7 @@ bool BKE_image_get_tile_info(char *filepath, ListBase *tiles, int *r_tile_start,
}
if (id < 1001 || id > IMA_UDIM_MAX) {
- is_udim = false;
+ all_valid_udim = false;
break;
}
@@ -3135,7 +3135,10 @@ bool BKE_image_get_tile_info(char *filepath, ListBase *tiles, int *r_tile_start,
BLI_filelist_free(dirs, dirs_num);
MEM_SAFE_FREE(udim_pattern);
- if (is_udim && min_udim <= IMA_UDIM_MAX) {
+ /* Ensure that all discovered UDIMs are valid and that there's at least 2 files in total.
+ * Downstream code checks the range value to determine tiled-ness; it's important we match that
+ * expectation here too (T97366). */
+ if (all_valid_udim && min_udim <= IMA_UDIM_MAX && max_udim > min_udim) {
BLI_join_dirfile(filepath, FILE_MAX, dirname, filename);
*r_tile_start = min_udim;