Fix import grayscale EXR
Fix #27299
(cherry picked from commit f0562a5ef6
)
This commit is contained in:
parent
8f537cfa19
commit
59b2f02ac7
|
@ -107,22 +107,31 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idxR == -1) {
|
if (exr_header.num_channels == 1) {
|
||||||
ERR_PRINT("TinyEXR: R channel not found.");
|
// Grayscale channel only.
|
||||||
// @todo { free exr_image }
|
idxR = 0;
|
||||||
return ERR_FILE_CORRUPT;
|
idxG = 0;
|
||||||
}
|
idxB = 0;
|
||||||
|
idxA = 0;
|
||||||
|
} else {
|
||||||
|
// Assume RGB(A)
|
||||||
|
if (idxR == -1) {
|
||||||
|
ERR_PRINT("TinyEXR: R channel not found.");
|
||||||
|
// @todo { free exr_image }
|
||||||
|
return ERR_FILE_CORRUPT;
|
||||||
|
}
|
||||||
|
|
||||||
if (idxG == -1) {
|
if (idxG == -1) {
|
||||||
ERR_PRINT("TinyEXR: G channel not found.")
|
ERR_PRINT("TinyEXR: G channel not found.")
|
||||||
// @todo { free exr_image }
|
// @todo { free exr_image }
|
||||||
return ERR_FILE_CORRUPT;
|
return ERR_FILE_CORRUPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idxB == -1) {
|
if (idxB == -1) {
|
||||||
ERR_PRINT("TinyEXR: B channel not found.")
|
ERR_PRINT("TinyEXR: B channel not found.")
|
||||||
// @todo { free exr_image }
|
// @todo { free exr_image }
|
||||||
return ERR_FILE_CORRUPT;
|
return ERR_FILE_CORRUPT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// EXR image data loaded, now parse it into Godot-friendly image data
|
// EXR image data loaded, now parse it into Godot-friendly image data
|
||||||
|
|
Loading…
Reference in New Issue