diff options
author | Jesse Yurkovich <jesse.y@gmail.com> | 2021-08-18 07:42:28 +0300 |
---|---|---|
committer | Jesse Yurkovich <jesse.y@gmail.com> | 2021-08-18 07:44:36 +0300 |
commit | 400cb25fc77a4131033f69cf328a31cdcf81edb5 (patch) | |
tree | e88d1f14569ddefaa0fe2b75401498fbf84b9af6 /intern/cycles | |
parent | f41beca97787d017a437a63cc0da2ce991522dea (diff) |
UDIM: Support tile sets that do not start at 1001
Removes the artificial requirement that UDIM tile sets start at 1001.
Blender was already capable of handling sparse tile sets (non-contiguous
tiles) so the restriction around starting at 1001 was unnecessary in
general.
This required fixing a few UDIM-related python bugs around manually
updating the `tile_number` field on images as well. See the differential
for details. No script changes are necessary but they will now work,
correctly, in many more cases.
Differential Revision: https://developer.blender.org/D11859
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/blender/blender_util.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index 82da3512269..d441575e8af 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -246,7 +246,11 @@ static inline string image_user_file_path(BL::ImageUser &iuser, string filepath_str = string(filepath); if (load_tiled && ima.source() == BL::Image::source_TILED) { - string_replace(filepath_str, "1001", "<UDIM>"); + string udim; + if (ima.tiles.length() > 0) { + udim = to_string(ima.tiles[0].number()); + } + string_replace(filepath_str, udim, "<UDIM>"); } return filepath_str; } |