Fix: upward compatibility of cryptomatte matte id.

The matte_id is stored in a different structure in 2.92. This patch will
write the old matte_id field so the files can be opened correctly in
older versions.
This commit is contained in:
Jeroen Bakker 2020-12-15 12:17:31 +01:00
parent ef2151d73d
commit d8db5cb600
1 changed files with 6 additions and 0 deletions

View File

@ -60,6 +60,7 @@
#include "BKE_anim_data.h"
#include "BKE_animsys.h"
#include "BKE_colortools.h"
#include "BKE_cryptomatte.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_idtype.h"
@ -491,6 +492,10 @@ void ntreeBlendWrite(BlendWriter *writer, bNodeTree *ntree)
}
else if ((ntree->type == NTREE_COMPOSIT) && (node->type == CMP_NODE_CRYPTOMATTE)) {
NodeCryptomatte *nc = (NodeCryptomatte *)node->storage;
/* Update the matte_id so the files can be opened in versions that don't
* use `CryptomatteEntry`. */
MEM_SAFE_FREE(nc->matte_id);
nc->matte_id = BKE_cryptomatte_entries_to_matte_id(nc);
if (nc->matte_id) {
BLO_write_string(writer, nc->matte_id);
}
@ -498,6 +503,7 @@ void ntreeBlendWrite(BlendWriter *writer, bNodeTree *ntree)
BLO_write_struct(writer, CryptomatteEntry, entry);
}
BLO_write_struct_by_name(writer, node->typeinfo->storagename, node->storage);
MEM_SAFE_FREE(nc->matte_id);
}
else if (node->typeinfo != &NodeTypeUndefined) {
BLO_write_struct_by_name(writer, node->typeinfo->storagename, node->storage);