diff options
author | Jeroen Bakker <jeroen@blender.org> | 2020-12-15 14:17:31 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-12-15 14:17:31 +0300 |
commit | d8db5cb6003c84594f5c2f6a85a02f60bafe72c1 (patch) | |
tree | ff43e50ddcdea0a2726d0aec5beada5fed50308c /source | |
parent | ef2151d73de87b3e7be631b6712283a727f8d4a6 (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 75f2fca1096..87997198334 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -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); |