Fix #132210: Cryptomatte doesn't work with image sequences

The Cryptomatte node doesn't work with image sequences that starts at a
non-zero frame. That's because the typename of the Cryptomatte is not
necessary updated at a frame that exists in the sequence, so the node
fails entirely.

To fix this, we always compute the typename at the frame of the first
image in the sequence.
This commit is contained in:
Omar Emara
2024-12-24 10:58:35 +02:00
parent f363b09e6e
commit 118dc65baa

View File

@@ -80,9 +80,13 @@ static blender::bke::cryptomatte::CryptomatteSessionPtr cryptomatte_init_from_no
}
BLI_assert(GS(image->id.name) == ID_IM);
NodeCryptomatte *node_cryptomatte = static_cast<NodeCryptomatte *>(node.storage);
ImageUser *iuser = &node_cryptomatte->iuser;
ImBuf *ibuf = BKE_image_acquire_ibuf(image, iuser, nullptr);
/* Construct an image user to retrieve the first image in the sequence, since the frame number
* might correspond to a non-existing image. We explicitly do not support the case where the
* image sequence has a changing structure. */
ImageUser image_user = {};
image_user.framenr = BKE_image_sequence_guess_offset(image);
ImBuf *ibuf = BKE_image_acquire_ibuf(image, &image_user, nullptr);
RenderResult *render_result = image->rr;
if (render_result) {
session = blender::bke::cryptomatte::CryptomatteSessionPtr(