Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2020-12-15 14:17:31 +0300
committerJeroen Bakker <jeroen@blender.org>2020-12-15 14:17:31 +0300
commitd8db5cb6003c84594f5c2f6a85a02f60bafe72c1 (patch)
treeff43e50ddcdea0a2726d0aec5beada5fed50308c /source/blender/blenkernel
parentef2151d73de87b3e7be631b6712283a727f8d4a6 (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/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/node.c6
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);