diff options
author | Jesse Yurkovich <jesse.y@gmail.com> | 2022-08-04 08:00:52 +0300 |
---|---|---|
committer | Jesse Yurkovich <jesse.y@gmail.com> | 2022-08-04 08:00:52 +0300 |
commit | 72ab6faf5d80a3d26e5b6252e5b6f0041763209c (patch) | |
tree | 81250357e031716b6cac08da1a86da9fcfdc928d /source/blender/makesdna | |
parent | 646207c9afd54d8505f5ecb816ca5a90f52af1f6 (diff) |
Fix T97251: Store generated type information for each UDIM tile
Various situations can lead to un-saved UDIM tiles potentially losing
their contents. The most notable situation is a save and re-load of a
.blend file that has "generated" UDIM tiles that haven't been written to
disk yet. Normal "generated" images are reconstructed on demand in these
circumstances but UDIM tiles do not retain the information required for
reconstruction and empty tiles are presented to the user.
This patch stores the generated type information for each tile to solve
this particular issue. It also shifts the Image generation info into the
1st tile. The existing DNA fields are deprecated but RNA was modified as
to not break API compat.
There's two broad changes here that merit special callout:
- How to distinguish between a tile that should be reconstructed vs.
a tile that should remain empty because loading failed for the UDIMs
- How to better handle Image Source changes
The first issue is addressed as follows:
- Each time a tile is filled with generated content we set a new
IMA_GEN_TILE flag
- Each time a tile is saved to disk we remove the IMA_GEN_TILE flag
- When requesting an ibuf: If the ibuf is null, we check to see if
IMA_GEN_TILE is set. If it is set, go ahead and re-create the tile.
Otherwise, do nothing.
The second set of changes have to do with ensuring that information is
carried along as far as possible when the, sometimes destructive, act of
changing an Image Source is performed. Behavior should be a bit more
natural and expected now; though users will rarely, or should rarely, be
modifying this property. The full table describing the behavior is in
the differential.
Differential Revision: https://developer.blender.org/D14885
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_image_types.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index 6e4e515a0fe..f35c77f663b 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -92,8 +92,14 @@ typedef struct ImageTile { struct ImageTile_Runtime runtime; - char _pad[4]; int tile_number; + + /* for generated images */ + int gen_x, gen_y; + char gen_type, gen_flag; + short gen_depth; + float gen_color[4]; + char label[64]; } ImageTile; @@ -167,10 +173,10 @@ typedef struct Image { int lastused; /* for generated images */ - int gen_x, gen_y; - char gen_type, gen_flag; - short gen_depth; - float gen_color[4]; + int gen_x DNA_DEPRECATED, gen_y DNA_DEPRECATED; + char gen_type DNA_DEPRECATED, gen_flag DNA_DEPRECATED; + short gen_depth DNA_DEPRECATED; + float gen_color[4] DNA_DEPRECATED; /* display aspect - for UV editing images resized for faster openGL display */ float aspx, aspy; @@ -262,7 +268,8 @@ enum { /** #Image.gen_flag */ enum { - IMA_GEN_FLOAT = 1, + IMA_GEN_FLOAT = (1 << 0), + IMA_GEN_TILE = (1 << 1), }; /** #Image.alpha_mode */ |