5#include "testing/testing.h"
19 ASSERT_EQ(
"cryptomatte/c7dbf5e/key",
21 ASSERT_EQ(
"cryptomatte/b990b65/𝓴𝓮𝔂",
27 ASSERT_EQ(
"ViewLayer.CryptoMaterial",
30 ASSERT_EQ(
"NoTrailingSampleNumber",
43 ASSERT_EQ(
"{\"Object\":\"0000007b\"}", layer.
manifest());
45 layer.
add_hash(
"Object2", 123245678);
46 ASSERT_EQ(
"{\"Object\":\"0000007b\",\"Object2\":\"0758946e\"}", layer.
manifest());
53 ASSERT_EQ(
"{\"\\\"Object\\\"\":\"0000007b\"}", layer.
manifest());
59 blender::bke::cryptomatte::CryptomatteLayer::read_from_manifest(
manifest)->
manifest());
67 R"({"Object":"12345678","Object2":"87654321"})");
69 R"( { "Object" : "12345678" , "Object2" : "87654321" } )");
72 R"({"Object\"01\"":"12345678","Object":"12345678","Object2":"87654321"})",
73 R"({"Object\"01\"":"12345678","Object":"12345678", "Object2":"87654321"})");
80 "cryptomatte/eb4c67b/conversion"));
83 "cryptomatte/qwerty/name"));
103 if (prop_name ==
"cryptomatte/67da54b/name") {
104 EXPECT_STREQ(
"layer1", propvalue);
106 else if (prop_name ==
"cryptomatte/67da54b/hash") {
107 EXPECT_STREQ(
"MurmurHash3_32", propvalue);
109 else if (prop_name ==
"cryptomatte/67da54b/conversion") {
110 EXPECT_STREQ(
"uint32_to_float32", propvalue);
112 else if (prop_name ==
"cryptomatte/67da54b/manifest") {
113 EXPECT_STREQ(R
"({"Object":"12345678"})", propvalue);
116 else if (prop_name ==
"cryptomatte/79b2306/name") {
117 EXPECT_STREQ(
"layer2", propvalue);
119 else if (prop_name ==
"cryptomatte/79b2306/hash") {
120 EXPECT_STREQ(
"MurmurHash3_32", propvalue);
122 else if (prop_name ==
"cryptomatte/79b2306/conversion") {
123 EXPECT_STREQ(
"uint32_to_float32", propvalue);
125 else if (prop_name ==
"cryptomatte/79b2306/manifest") {
126 EXPECT_STREQ(R
"({"Object2":"87654321"})", propvalue);
130 EXPECT_EQ(
"Unhandled", std::string(propname) +
": " + propvalue);
140 render_result,
"cryptomatte/qwerty/manifest", R
"({"Object":"12345678"})");
143 render_result,
"cryptomatte/uiop/manifest", R
"({"Object2":"87654321"})");
145 EXPECT_NE(session.get(), nullptr);
166 R
"({"/obj/instance1:instances:0":"0d54c6cc","/obj/instance1:instances:1":"293d9340","/obj/instance1:instances:110":"ccb9e1f2","/obj/instance1:instances:111":"f8dd3a48","/obj/instance1:instances:112":"a99e07a8","/obj/instance1:instances:113":"e75599a4","/obj/instance1:instances:114":"794200f3","/obj/instance1:instances:115":"2a3a1728","/obj/instance1:instances:116":"478544a1","/obj/instance1:instances:117":"b2bd969a","/obj/instance1:instances:10":"3a0c8681","/obj/instance1:instances:11":"01e5970d","/obj/box:polygons:1":"9d416418","/obj/instance1:instances:100":"2dcd2966","/obj/instance1:instances:101":"9331cd82","/obj/instance1:instances:102":"df50fccb","/obj/instance1:instances:103":"97f8590d","/obj/instance1:instances:104":"bbcd220d","/obj/instance1:instances:105":"4ae06139","/obj/instance1:instances:106":"8873d5ea","/obj/instance1:instances:107":"39d8af8d","/obj/instance1:instances:108":"bb11bd4e","/obj/instance1:instances:109":"a32bba35"})",
167 R"({"\/obj\/box:polygons:1":"9d416418","\/obj\/instance1:instances:0":"0d54c6cc","\/obj\/instance1:instances:1":"293d9340","\/obj\/instance1:instances:10":"3a0c8681","\/obj\/instance1:instances:100":"2dcd2966","\/obj\/instance1:instances:101":"9331cd82","\/obj\/instance1:instances:102":"df50fccb","\/obj\/instance1:instances:103":"97f8590d","\/obj\/instance1:instances:104":"bbcd220d","\/obj\/instance1:instances:105":"4ae06139","\/obj\/instance1:instances:106":"8873d5ea","\/obj\/instance1:instances:107":"39d8af8d","\/obj\/instance1:instances:108":"bb11bd4e","\/obj\/instance1:instances:109":"a32bba35","\/obj\/instance1:instances:11":"01e5970d","\/obj\/instance1:instances:110":"ccb9e1f2","\/obj\/instance1:instances:111":"f8dd3a48","\/obj\/instance1:instances:112":"a99e07a8","\/obj\/instance1:instances:113":"e75599a4","\/obj\/instance1:instances:114":"794200f3","\/obj\/instance1:instances:115":"2a3a1728","\/obj\/instance1:instances:116":"478544a1","\/obj\/instance1:instances:117":"b2bd969a","\/obj\/instance1:instance)");
void BKE_cryptomatte_store_metadata(const struct CryptomatteSession *session, struct RenderResult *render_result)
struct CryptomatteSession * BKE_cryptomatte_init_from_render_result(const struct RenderResult *render_result)
void BKE_stamp_info_callback(void *data, StampData *stamp_data, StampCallback callback, bool noskip)
void BKE_render_result_stamp_data(RenderResult *rr, const char *key, const char *value)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
Read Guarded memory(de)allocation.
constexpr bool startswith(StringRef prefix) const
void * MEM_callocN(size_t len, const char *str)
static void test_cryptomatte_manifest(std::string expected, std::string manifest)
static void validate_cryptomatte_session_from_stamp_data(void *, const char *propname, char *propvalue, int)
TEST(cryptomatte, meta_data_key)
StringRef BKE_cryptomatte_extract_layer_name(StringRef render_pass_name)
std::unique_ptr< CryptomatteSession, CryptomatteSessionDeleter > CryptomatteSessionPtr
std::string BKE_cryptomatte_meta_data_key(StringRef layer_name, StringRefNull key_name)
void RE_FreeRenderResult(RenderResult *rr)
struct StampData * stamp_data
void add_hash(blender::StringRef name, CryptomatteHash cryptomatte_hash)
std::string manifest() const
static blender::StringRef extract_layer_hash(blender::StringRefNull key)