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-14 18:14:21 +0300
committerJeroen Bakker <jeroen@blender.org>2020-12-14 18:14:38 +0300
commitf4df036bc497b134789b624efd9008c6f4b9c6c8 (patch)
treefd9537758878f679087ff6854b1913b129b3ded8 /source/blender/blenloader
parent07ce9910f7ccaa48ae28c35049dec598b6214b36 (diff)
Cryptomatte: Data structure in compositor node
This changes the way how the mattes are stored in the compositor node. This used to be a single string what was decoded/encoded when needed. The new data structure stores all entries in `CryptomatteEntry` and is converted to the old `matte_id` property on the fly. This is done for some future changes in the workflow where a more structured approach leads to less confusing and easier to read code.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/versioning_290.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index 4e642258899..6f055186702 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -52,6 +52,7 @@
#include "BKE_armature.h"
#include "BKE_collection.h"
#include "BKE_colortools.h"
+#include "BKE_cryptomatte.h"
#include "BKE_fcurve.h"
#include "BKE_gpencil.h"
#include "BKE_lib_id.h"
@@ -1280,5 +1281,24 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+
+ /* Convert `NodeCryptomatte->storage->matte_id` to `NodeCryptomatte->storage->entries` */
+ if (!DNA_struct_find(fd->filesdna, "CryptomatteEntry")) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+ if (scene->nodetree) {
+ LISTBASE_FOREACH (bNode *, node, &scene->nodetree->nodes) {
+ if (node->type == CMP_NODE_CRYPTOMATTE) {
+ NodeCryptomatte *storage = (NodeCryptomatte *)node->storage;
+ char *matte_id = storage->matte_id;
+ if (matte_id == NULL || strlen(storage->matte_id) == 0) {
+ continue;
+ }
+ BKE_cryptomatte_matte_id_to_entries(NULL, storage, storage->matte_id);
+ MEM_SAFE_FREE(storage->matte_id);
+ }
+ }
+ }
+ }
+ }
}
}