Fix #36408: Setting `image.colorspace_settings.name` changes saved alpha
Issue was caused by reload caused by input colorspace change. For generated images generated alpha flags weren't saved to DNA, which lead to fallback from 32 bit depth to 24 when doing any kind reload of generated image. The same alpha loss happens when you save .blend file with generated images. Now added generated depth to DNA, so reload image and .blend file wouldn't loss alpha.
This commit is contained in:
parent
4fbe426151
commit
98e5e544b5
|
@ -723,6 +723,7 @@ Image *BKE_image_add_generated(Main *bmain, unsigned int width, unsigned int hei
|
|||
ima->gen_y = height;
|
||||
ima->gen_type = gen_type;
|
||||
ima->gen_flag |= (floatbuf ? IMA_GEN_FLOAT : 0);
|
||||
ima->gen_depth = depth;
|
||||
|
||||
ibuf = add_ibuf_size(width, height, ima->name, depth, floatbuf, gen_type, color, &ima->colorspace_settings);
|
||||
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
|
||||
|
@ -2996,7 +2997,8 @@ static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
|
|||
/* UV testgrid or black or solid etc */
|
||||
if (ima->gen_x == 0) ima->gen_x = 1024;
|
||||
if (ima->gen_y == 0) ima->gen_y = 1024;
|
||||
ibuf = add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 24, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type,
|
||||
if (ima->gen_depth == 0) ima->gen_depth = 24;
|
||||
ibuf = add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, ima->gen_depth, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type,
|
||||
color, &ima->colorspace_settings);
|
||||
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
|
||||
ima->ok = IMA_OK_LOADED;
|
||||
|
|
|
@ -106,7 +106,7 @@ typedef struct Image {
|
|||
/* for generated images */
|
||||
int gen_x, gen_y;
|
||||
char gen_type, gen_flag;
|
||||
char gen_pad[2];
|
||||
short gen_depth;
|
||||
|
||||
/* display aspect - for UV editing images resized for faster openGL display */
|
||||
float aspx, aspy;
|
||||
|
|
Loading…
Reference in New Issue