This implements the design detailed in T92696 to support virtual
filenames for UDIM textures. Currently, the following 2 substitution
tokens are supported:
| Token | Meaning | Support |
|---|---|---|
| <UDIM> | 1001 + u-tile + v-tile * 10 | MaterialX / USD / OIIO |
| <UVTILE> | Equivalent to u<u-tile + 1>_v<v-tile + 1> | MaterialX |
Example for u-tile of 3 and v-tile of 1:
filename.<UDIM>_ver0023.png --> filename.1014_ver0023.png
filename.<UVTILE>_ver0023.png --> filename.u4_v2_ver0023.png
For image loading, the existing workflow is unaffected. A user can
select one or more image files, belonging to one or more UDIM tile sets,
and have Blender load them all as it does today. Now the <UVTILE> format
is "guessed" just as the <UDIM> format was guessed before.
If guessing fails, the user can simply go into the Image Editor and type
the proper substitution in the filename. Once typing is complete,
Blender will reload the files and correctly fill the tiles. This
workflow is new as attempting to fix the guessing in current versions
did not really work and the user was often stuck with a confusing
situation.
For image saving, the existing workflow is changed slightly. When saving
currently, a user has to be sure to type the filename of the first tile
(e.g. filename.1001.png) to save the entire UDIM set. The number could
differ if they start at a different tile etc. This is confusing. Now,
the user should type a filename containing the appropriate substitution
token. By default Blender will fill in a default name using the <UDIM>
token but the user is free to save out images using <UVTILE> if they
wish.
Notes
The design task mentions better support for importers/exporters like
USD which require handling of the virtual filepaths natively. Better
support is still planned but not included in this patch and will be
added later. Probably after D13297 lands.
The choice of the 2 substitution tokens supported was based solely on
what USD/MaterialX requires and which are rather prevalent in the
ecosystem already. More tokens can be added in the future if a strong
need arises for them.