diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2019-12-16 05:58:01 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2019-12-16 06:09:53 +0300 |
commit | 31ac2e292e5fc5d4d85d00d97645bfcb9cd4e6c2 (patch) | |
tree | ea8e2f273b8eb7ddc5bb951dc9ffaa613422e246 /intern/cycles/blender/blender_util.h | |
parent | 5a97a74c69c082d9360fc21b8c6b99fd24912f5f (diff) |
Cycles: Fix one-tile UDIM rendering
The code checked for the presence of more than one tile before
substituting the tile number into the filename, so if a one-tile
UDIM was used (or all but one tile were culled), the substitution
was skipped and as a result the file was not found.
With this change, the code explicitly tracks whether substitution
is required, avoiding this problem.
This also fixes another problem: The Environment texture never
does substitution since it doesn't support UDIMs, but before the
syncing code still inserted the placeholder into the filename if the
user selected a tiled background image.
Diffstat (limited to 'intern/cycles/blender/blender_util.h')
-rw-r--r-- | intern/cycles/blender/blender_util.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index efed96ec9f5..fa7646840c9 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -231,16 +231,24 @@ static inline int render_resolution_y(BL::RenderSettings &b_render) return b_render.resolution_y() * b_render.resolution_percentage() / 100; } -static inline string image_user_file_path(BL::ImageUser &iuser, BL::Image &ima, int cfra) +static inline string image_user_file_path(BL::ImageUser &iuser, + BL::Image &ima, + int cfra, + bool *is_tiled) { + if (is_tiled != NULL) { + *is_tiled = false; + } + char filepath[1024]; iuser.tile(0); BKE_image_user_frame_calc(NULL, iuser.ptr.data, cfra); BKE_image_user_file_path(iuser.ptr.data, ima.ptr.data, filepath); - if (ima.source() == BL::Image::source_TILED) { + if (ima.source() == BL::Image::source_TILED && is_tiled != NULL) { char *udim_id = strstr(filepath, "1001"); if (udim_id != NULL) { memcpy(udim_id, "%04d", 4); + *is_tiled = true; } } return string(filepath); |