[Bf-blender-cvs] [f225ea86c7a] compositor-cryptomatte-workflow: Merge branch 'master' into compositor-cryptomatte-workflow
Jeroen Bakker
noreply at git.blender.org
Wed Mar 3 13:49:55 CET 2021
Commit: f225ea86c7a3df2f50547c43d5755db2afeebe2a
Author: Jeroen Bakker
Date: Wed Mar 3 13:49:49 2021 +0100
Branches: compositor-cryptomatte-workflow
https://developer.blender.org/rBf225ea86c7a3df2f50547c43d5755db2afeebe2a
Merge branch 'master' into compositor-cryptomatte-workflow
===================================================================
===================================================================
diff --cc source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
index 1a3338b1476,84cd84e41c7..0b0f3724938
--- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
@@@ -27,57 -25,42 +27,54 @@@
#include "BLI_dynstr.h"
#include "BLI_hash_mm3.h"
#include "BLI_utildefines.h"
-#include "node_composite_util.h"
+
+#include "BKE_context.h"
+#include "BKE_cryptomatte.h"
+#include "BKE_global.h"
+#include "BKE_lib_id.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
- #include <optional>
-
extern "C" {
- static std::optional<CryptomatteEntry *> cryptomatte_find(const NodeCryptomatte &n,
- float encoded_hash)
+ static CryptomatteEntry *cryptomatte_find(const NodeCryptomatte &n, float encoded_hash)
{
LISTBASE_FOREACH (CryptomatteEntry *, entry, &n.entries) {
if (entry->encoded_hash == encoded_hash) {
- return std::make_optional(entry);
+ return entry;
}
}
- return std::nullopt;
+ return nullptr;
}
-static void cryptomatte_add(NodeCryptomatte &n, float f)
+static void cryptomatte_add(Main *bmain, NodeCryptomatte &n, float encoded_hash)
{
/* Check if entry already exist. */
- if (cryptomatte_find(n, f)) {
+ if (cryptomatte_find(n, encoded_hash)) {
return;
}
+
CryptomatteEntry *entry = static_cast<CryptomatteEntry *>(
MEM_callocN(sizeof(CryptomatteEntry), __func__));
- entry->encoded_hash = f;
+ entry->encoded_hash = encoded_hash;
+ BKE_cryptomatte_find_name(bmain, encoded_hash, entry->name, sizeof(entry->name));
+
BLI_addtail(&n.entries, entry);
}
-static void cryptomatte_remove(NodeCryptomatte &n, float f)
+static void cryptomatte_remove(NodeCryptomatte &n, float encoded_hash)
{
- std::optional<CryptomatteEntry *> entry = cryptomatte_find(n, encoded_hash);
- CryptomatteEntry *entry = cryptomatte_find(n, f);
++ CryptomatteEntry *entry = cryptomatte_find(n, encoded_hash);
if (!entry) {
return;
}
- BLI_remlink(&n.entries, entry.value());
- MEM_freeN(entry.value());
+ BLI_remlink(&n.entries, entry);
+ MEM_freeN(entry);
}
-static bNodeSocketTemplate outputs[] = {
+static bNodeSocketTemplate cmp_node_cryptomatte_in[] = {
+ {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, {-1, ""}};
+
+static bNodeSocketTemplate cmp_node_cryptomatte_out[] = {
{SOCK_RGBA, N_("Image")},
{SOCK_FLOAT, N_("Matte")},
{SOCK_RGBA, N_("Pick")},
More information about the Bf-blender-cvs
mailing list