Fix #126567: Packed images are missing meta data

Blender doesn't read meta data of images in case they were packed, which
make things like image Cryptomatte fail. This is because the image
loading code didn't specify meta data reading for packed images, but did
for normal images.

To fix this, we also specify meta data reading for packed images. And
while at it, move all common IB flags in the same like to avoid such
differences in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/126602
This commit is contained in:
Omar Emara
2024-08-22 16:46:50 +02:00
committed by Omar Emara
parent bda0c27c05
commit 758401c672

View File

@@ -4192,15 +4192,13 @@ static ImBuf *load_image_single(Image *ima,
{
char filepath[FILE_MAX];
ImBuf *ibuf = nullptr;
int flag = IB_rect | IB_multilayer;
int flag = IB_rect | IB_multilayer | IB_metadata | imbuf_alpha_flags_for_image(ima);
*r_cache_ibuf = true;
const int tile_number = image_get_tile_number_from_iuser(ima, iuser);
/* is there a PackedFile with this image ? */
if (has_packed && !is_sequence) {
flag |= imbuf_alpha_flags_for_image(ima);
LISTBASE_FOREACH (ImagePackedFile *, imapf, &ima->packedfiles) {
if (imapf->view == view_id && imapf->tile_number == tile_number) {
if (imapf->packedfile) {
@@ -4238,8 +4236,6 @@ static ImBuf *load_image_single(Image *ima,
BKE_image_user_file_path(&iuser_t, ima, filepath);
/* read ibuf */
flag |= IB_metadata;
flag |= imbuf_alpha_flags_for_image(ima);
ibuf = IMB_loadiffname(filepath, flag, ima->colorspace_settings.name);
}