From 400cb25fc77a4131033f69cf328a31cdcf81edb5 Mon Sep 17 00:00:00 2001 From: Jesse Yurkovich Date: Tue, 17 Aug 2021 21:42:28 -0700 Subject: 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 --- intern/cycles/blender/blender_util.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'intern/cycles') 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", ""); + string udim; + if (ima.tiles.length() > 0) { + udim = to_string(ima.tiles[0].number()); + } + string_replace(filepath_str, udim, ""); } return filepath_str; } -- cgit v1.2.3