Fix #109045: Allow images with more than 4 channels to load

Align behavior to what Cycles does in such cases which is to drop the
additional channels that are not supported.

This was a regression from aa3bdfd76a

Pull Request: https://projects.blender.org/blender/blender/pulls/109063
This commit is contained in:
Jesse Yurkovich
2023-06-20 21:32:54 +02:00
committed by Jesse Yurkovich
parent b84d4dd16d
commit 66a6ef0163

View File

@@ -178,11 +178,12 @@ static ImBuf *get_oiio_ibuf(ImageInput *in, const ReadContext &ctx, char colorsp
const ImageSpec &spec = in->spec();
const int width = spec.width;
const int height = spec.height;
const int channels = spec.nchannels;
const bool has_alpha = spec.alpha_channel != -1;
const bool is_float = spec.format.basesize() > 1;
if (channels < 1 || channels > 4) {
/* Only a maximum of 4 channels are supported by ImBuf. */
const int channels = spec.nchannels <= 4 ? spec.nchannels : 4;
if (channels < 1) {
return nullptr;
}