Blender V5.3
cryptomatte.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2020 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BKE_cryptomatte.h"
10#include "BKE_cryptomatte.hh"
11#include "BKE_image.hh"
12#include "BKE_layer.hh"
13#include "BKE_main.hh"
14#include "BKE_material.hh"
15
16#include "DNA_layer_types.h"
17#include "DNA_material_types.h"
18#include "DNA_node_types.h"
19#include "DNA_object_types.h"
20#include "DNA_scene_types.h"
21
22#include "BLI_dynstr.hh"
23#include "BLI_hash_mm3.hh"
24#include "BLI_listbase.hh"
25#include "BLI_string.hh"
26#include "BLI_string_utf8.hh"
27
28#include "RE_pipeline.h"
29
30#include "MEM_guardedalloc.h"
31
32#include <cctype>
33#include <cstring>
34#include <iomanip>
35#include <sstream>
36#include <string>
37
38namespace blender {
39
42 /* Layer names in order of creation. */
44
45 CryptomatteSession() = default;
46 CryptomatteSession(const Main *bmain);
47 CryptomatteSession(StampData *stamp_data);
48 CryptomatteSession(const ViewLayer *view_layer);
49 CryptomatteSession(const Scene *scene, bool build_meta_data = false);
50 void init(const ViewLayer *view_layer, bool build_meta_data = false);
51
52 bke::cryptomatte::CryptomatteLayer &add_layer(std::string layer_name);
53 std::optional<std::string> operator[](float encoded_hash) const;
54
55 MEM_CXX_CLASS_ALLOC_FUNCS("cryptomatte:CryptomatteSession")
56};
57
59{
60 if (!bmain->objects.is_empty()) {
62 for (Object &object : bmain->objects) {
63 objects.add_ID(object.id);
64 }
65
67 for (Object &object : bmain->objects) {
68 Object *asset_object = &object;
69 while (asset_object->parent != nullptr) {
70 asset_object = asset_object->parent;
71 }
72 assets.add_ID(asset_object->id);
73 }
74 }
75 if (!bmain->materials.is_empty()) {
77 for (Material &material : bmain->materials) {
78 materials.add_ID(material.id);
79 }
80 }
81}
82
97
99{
100 init(view_layer);
101}
102
103CryptomatteSession::CryptomatteSession(const Scene *scene, bool build_meta_data)
104{
105
106 for (const ViewLayer &view_layer : scene->view_layers) {
107 if (build_meta_data) {
109 }
110 init(&view_layer, build_meta_data);
111 }
112}
113
114void CryptomatteSession::init(const ViewLayer *view_layer, bool build_meta_data)
115{
118 if (cryptoflags == 0) {
119 cryptoflags = VIEW_LAYER_CRYPTOMATTE_ALL;
120 }
121
122 ListBaseT<Base> *object_bases = build_meta_data ? BKE_view_layer_object_bases_get(
123 const_cast<ViewLayer *>(view_layer)) :
124 nullptr;
125
126 if (cryptoflags & VIEW_LAYER_CRYPTOMATTE_OBJECT) {
127 bke::cryptomatte::CryptomatteLayer &objects = add_layer(StringRefNull(view_layer->name) + "." +
129
130 if (build_meta_data) {
131 for (Base &base : *object_bases) {
132 objects.add_ID(base.object->id);
133 }
134 }
135 }
136
137 if (cryptoflags & VIEW_LAYER_CRYPTOMATTE_ASSET) {
140
141 if (build_meta_data) {
142 for (Base &base : *object_bases) {
143 const Object *asset_object = base.object;
144 while (asset_object->parent != nullptr) {
145 asset_object = asset_object->parent;
146 }
147 assets.add_ID(asset_object->id);
148 }
149 }
150 }
151
152 if (cryptoflags & VIEW_LAYER_CRYPTOMATTE_MATERIAL) {
155
156 if (build_meta_data) {
157 for (Base &base : *object_bases) {
158 for (int i = 0; i < base.object->totcol; i++) {
159 Material *material = BKE_object_material_get(base.object, i + 1);
160 if (material) {
161 materials.add_ID(material->id);
162 }
163 }
164 }
165 }
166 }
167}
168
170{
171 if (!layer_names.contains(layer_name)) {
172 layer_names.append(layer_name);
173 }
174 return layers.lookup_or_add_default(layer_name);
175}
176
177std::optional<std::string> CryptomatteSession::operator[](float encoded_hash) const
178{
179 for (const bke::cryptomatte::CryptomatteLayer &layer : layers.values()) {
180 std::optional<std::string> result = layer[encoded_hash];
181 if (result) {
182 return result;
183 }
184 }
185 return std::nullopt;
186}
187
189{
190 CryptomatteSession *session = new CryptomatteSession();
191 return session;
192}
193
195{
196 CryptomatteSession *session = new CryptomatteSession(render_result->stamp_data);
197 return session;
198}
199
200CryptomatteSession *BKE_cryptomatte_init_from_scene(const Scene *scene, bool build_meta_data)
201{
202 CryptomatteSession *session = new CryptomatteSession(scene, build_meta_data);
203 return session;
204}
205
207{
208 CryptomatteSession *session = new CryptomatteSession(view_layer);
209 return session;
210}
211
212void BKE_cryptomatte_add_layer(CryptomatteSession *session, const char *layer_name)
213{
214 session->add_layer(layer_name);
215}
216
218{
219 BLI_assert(session != nullptr);
220 delete session;
221}
222
223uint32_t BKE_cryptomatte_hash(const char *name, const int name_len)
224{
226 return hash.hash;
227}
228
230 const char *layer_name,
231 const Object *object)
232{
233 bke::cryptomatte::CryptomatteLayer *layer = session->layers.lookup_ptr(layer_name);
235 return layer->add_ID(object->id);
236}
237
239 const char *layer_name,
240 const Material *material)
241{
242 if (material == nullptr) {
243 return 0.0f;
244 }
245 bke::cryptomatte::CryptomatteLayer *layer = session->layers.lookup_ptr(layer_name);
247 return layer->add_ID(material->id);
248}
249
251 const char *layer_name,
252 const Object *object)
253{
254 const Object *asset_object = object;
255 while (asset_object->parent != nullptr) {
256 asset_object = asset_object->parent;
257 }
258 return BKE_cryptomatte_object_hash(session, layer_name, asset_object);
259}
260
262{
263 return bke::cryptomatte::CryptomatteHash(cryptomatte_hash).float_encoded();
264}
265
267 const float encoded_hash,
268 char *r_name,
269 int name_maxncpy)
270{
271 std::optional<std::string> name = (*session)[encoded_hash];
272 if (!name) {
273 return false;
274 }
275
276 BLI_strncpy_utf8(r_name, name->c_str(), name_maxncpy);
277 return true;
278}
279
281{
282 DynStr *matte_id = BLI_dynstr_new();
283 bool first = true;
284 for (CryptomatteEntry &entry : node_storage->entries) {
285 if (!first) {
286 BLI_dynstr_append(matte_id, ",");
287 }
288 if (entry.name[0] != '\0') {
289 BLI_dynstr_nappend(matte_id, entry.name, sizeof(entry.name));
290 }
291 else {
292 BLI_dynstr_appendf(matte_id, "<%.9g>", entry.encoded_hash);
293 }
294 first = false;
295 }
296 char *result = BLI_dynstr_get_cstring(matte_id);
297 BLI_dynstr_free(matte_id);
298 return result;
299}
300
301void BKE_cryptomatte_matte_id_to_entries(NodeCryptomatte *node_storage, const char *matte_id)
302{
303 node_storage->entries.free_no_destruct();
304
305 if (matte_id == nullptr) {
306 MEM_SAFE_DELETE(node_storage->matte_id);
307 return;
308 }
309 /* Update the matte_id so the files can be opened in versions that don't
310 * use `CryptomatteEntry`. */
311 if (matte_id != node_storage->matte_id && node_storage->matte_id &&
312 STREQ(node_storage->matte_id, matte_id))
313 {
314 MEM_SAFE_DELETE(node_storage->matte_id);
315 node_storage->matte_id = MEM_dupalloc(matte_id);
316 }
317
318 std::istringstream ss(matte_id);
319 while (ss.good()) {
320 CryptomatteEntry *entry = nullptr;
321 std::string token;
322 getline(ss, token, ',');
323 /* Ignore empty tokens. */
324 if (!token.empty()) {
325 size_t first = token.find_first_not_of(' ');
326 size_t last = token.find_last_not_of(' ');
327 if (first == std::string::npos || last == std::string::npos) {
328 break;
329 }
330 token = token.substr(first, (last - first + 1));
331 if (*token.begin() == '<' && *(--token.end()) == '>') {
332 float encoded_hash = atof(token.substr(1, token.length() - 2).c_str());
333 entry = MEM_new<CryptomatteEntry>(__func__);
334 entry->encoded_hash = encoded_hash;
335 }
336 else {
337 const char *name = token.c_str();
338 int name_len = token.length();
339 entry = MEM_new<CryptomatteEntry>(__func__);
340 STRNCPY(entry->name, name);
341 uint32_t hash = BKE_cryptomatte_hash(name, name_len);
343 }
344 }
345 if (entry != nullptr) {
346 BLI_addtail(&node_storage->entries, entry);
347 }
348 }
349}
350
352{
353 return BLI_hash_mm3(reinterpret_cast<const uchar *>(name.data()), name.size(), 0);
354}
355
356static void add_render_result_meta_data(RenderResult *render_result,
357 const StringRef layer_name,
358 const StringRefNull key_name,
359 const StringRefNull value)
360{
362 render_result,
363 bke::cryptomatte::BKE_cryptomatte_meta_data_key(layer_name, key_name).c_str(),
364 value.data());
365}
366
368{
370 session->layers.items())
371 {
372 const StringRefNull layer_name(item.key);
373 const bke::cryptomatte::CryptomatteLayer &layer = item.value;
374
375 const std::string manifest = layer.manifest();
376
377 add_render_result_meta_data(render_result, layer_name, "name", layer_name);
378 add_render_result_meta_data(render_result, layer_name, "hash", "MurmurHash3_32");
379 add_render_result_meta_data(render_result, layer_name, "conversion", "uint32_to_float32");
380 add_render_result_meta_data(render_result, layer_name, "manifest", manifest);
381 }
382}
383
384namespace bke::cryptomatte {
385namespace manifest {
386constexpr StringRef WHITESPACES = " \t\n\v\f\r";
387
389{
390 size_t skip = ref.find_first_not_of(WHITESPACES);
391 if (skip == StringRef::not_found) {
392 return ref;
393 }
394 return ref.drop_prefix(skip);
395}
396
397static constexpr int quoted_string_len_(StringRef ref)
398{
399 int len = 1;
400 bool skip_next = false;
401 while (len < ref.size()) {
402 char current_char = ref[len];
403 if (skip_next) {
404 skip_next = false;
405 }
406 else {
407 if (current_char == '\\') {
408 skip_next = true;
409 }
410 if (current_char == '\"') {
411 len += 1;
412 break;
413 }
414 }
415 len += 1;
416 }
417 return len;
418}
419
420static std::string unquote_(const StringRef ref)
421{
422 std::ostringstream stream;
423 for (char c : ref) {
424 if (c != '\\') {
425 stream << c;
426 }
427 }
428 return stream.str();
429}
430
432{
433 StringRef ref = manifest;
434 ref = skip_whitespaces_(ref);
435 if (ref.is_empty() || ref.front() != '{') {
436 return false;
437 }
438 ref = ref.drop_prefix(1);
439 while (!ref.is_empty()) {
440 char front = ref.front();
441
442 if (front == '\"') {
443 const int quoted_name_len = quoted_string_len_(ref);
444 const int name_len = quoted_name_len - 2;
445 std::string name = unquote_(ref.substr(1, name_len));
446 ref = ref.drop_prefix(quoted_name_len);
447 ref = skip_whitespaces_(ref);
448
449 if (ref.is_empty()) {
450 return false;
451 }
452 char colon = ref.front();
453 if (colon != ':') {
454 return false;
455 }
456 ref = ref.drop_prefix(1);
457 ref = skip_whitespaces_(ref);
458
459 if (ref.is_empty() || ref.front() != '\"') {
460 return false;
461 }
462
463 const int quoted_hash_len = quoted_string_len_(ref);
464 if (quoted_hash_len < 2) {
465 return false;
466 }
467 const int hash_len = quoted_hash_len - 2;
469 ref = ref.drop_prefix(quoted_hash_len);
470 layer.add_hash(name, hash);
471 }
472 else if (front == ',') {
473 ref = ref.drop_prefix(1);
474 }
475 else if (front == '}') {
476 ref = ref.drop_prefix(1);
477 ref = skip_whitespaces_(ref);
478 break;
479 }
480 ref = skip_whitespaces_(ref);
481 }
482
483 if (!ref.is_empty()) {
484 return false;
485 }
486
487 return true;
488}
489
490static std::string to_manifest(const CryptomatteLayer *layer)
491{
492 std::stringstream manifest;
493
494 bool is_first = true;
495 const Map<std::string, CryptomatteHash> &const_map = layer->hashes;
496 manifest << "{";
497 for (MapItem<std::string, CryptomatteHash> item : const_map.items()) {
498 if (is_first) {
499 is_first = false;
500 }
501 else {
502 manifest << ",";
503 }
504 manifest << quoted(item.key) << ":\"" << item.value.hex_encoded() << "\"";
505 }
506 manifest << "}";
507 return manifest.str();
508}
509
510} // namespace manifest
511
512/* Return the hash of the given cryptomatte layer name.
513 *
514 * The cryptomatte specification limits the hash to 7 characters.
515 * The 7 position limitation solves issues when using cryptomatte together with OpenEXR.
516 * The specification suggests to use the first 7 chars of the hashed layer_name.
517 */
518static std::string cryptomatte_layer_name_hash(const StringRef layer_name)
519{
520 std::stringstream stream;
521 const uint32_t render_pass_identifier = cryptomatte_determine_identifier(layer_name);
522 stream << std::setfill('0') << std::setw(sizeof(uint32_t) * 2) << std::hex
523 << render_pass_identifier;
524 return stream.str().substr(0, 7);
525}
526
527std::string BKE_cryptomatte_meta_data_key(const StringRef layer_name, const StringRefNull key_name)
528{
529 return "cryptomatte/" + cryptomatte_layer_name_hash(layer_name) + "/" + key_name;
530}
531
533{
534 int64_t last_token = render_pass_name.size();
535 while (last_token > 0 && std::isdigit(render_pass_name[last_token - 1])) {
536 last_token -= 1;
537 }
538 return render_pass_name.substr(0, last_token);
539}
540
542
544{
546 std::istringstream(hex_encoded) >> std::hex >> result.hash;
547 return result;
548}
549
551{
552 std::stringstream encoded;
553 encoded << std::setfill('0') << std::setw(sizeof(uint32_t) * 2) << std::hex << hash;
554 return encoded.str();
555}
556
558{
559 std::unique_ptr<CryptomatteLayer> layer = std::make_unique<CryptomatteLayer>();
561 return layer;
562}
563
565{
566 const char *name = &id.name[2];
567 const int name_len = BLI_strnlen(name, MAX_NAME - 2);
568 uint32_t cryptohash_int = BKE_cryptomatte_hash(name, name_len);
569
570 add_hash(StringRef(name, name_len), cryptohash_int);
571
572 return cryptohash_int;
573}
574
576{
577 hashes.add_overwrite(name, cryptomatte_hash);
578}
579
580std::optional<std::string> CryptomatteLayer::operator[](float encoded_hash) const
581{
582 const Map<std::string, CryptomatteHash> &const_map = hashes;
583 for (MapItem<std::string, CryptomatteHash> item : const_map.items()) {
584 if (BKE_cryptomatte_hash_to_float(item.value.hash) == encoded_hash) {
585 return std::make_optional(item.key);
586 }
587 }
588 return std::nullopt;
589}
590
591std::string CryptomatteLayer::manifest() const
592{
594}
595
597{
598 BLI_assert(key.startswith("cryptomatte/"));
599
600 size_t start_index = key.find_first_of('/');
601 size_t end_index = key.find_last_of('/');
602 if (start_index == StringRef::not_found) {
603 return "";
604 }
605 if (end_index == StringRef::not_found) {
606 return "";
607 }
608 if (end_index <= start_index) {
609 return "";
610 }
611 return key.substr(start_index + 1, end_index - start_index - 1);
612}
613
615 const char *propname,
616 char *propvalue, // NOLINT
617 int /*propvalue_maxncpy*/)
618{
620
621 StringRefNull key(propname);
622 if (!key.startswith("cryptomatte/")) {
623 return;
624 }
625 if (!key.endswith("/name")) {
626 return;
627 }
628 StringRef layer_hash = extract_layer_hash(key);
629 data->hash_to_layer_name.add(layer_hash, propvalue);
630}
631
633 const char *propname,
634 char *propvalue, // NOLINT
635 int /*propvalue_maxncpy*/)
636{
638
639 StringRefNull key(propname);
640 if (!key.startswith("cryptomatte/")) {
641 return;
642 }
643 if (!key.endswith("/manifest")) {
644 return;
645 }
646 StringRef layer_hash = extract_layer_hash(key);
647 if (!data->hash_to_layer_name.contains(layer_hash)) {
648 return;
649 }
650
651 StringRef layer_name = data->hash_to_layer_name.lookup(layer_hash);
652 bke::cryptomatte::CryptomatteLayer &layer = data->session->add_layer(layer_name);
654}
655
657{
658 return session.layer_names;
659}
660
662{
663 return session.layers.lookup_ptr(layer_name);
664}
665
666} // namespace bke::cryptomatte
667} // namespace blender
General operations, lookup, etc. for materials.
A dynamically sized string ADT.
#define MAX_NAME
Definition DNA_defs.h:63
#define VIEW_LAYER_CRYPTOMATTE_ALL
Object is a sort of wrapper for general info.
#define RE_PASSNAME_CRYPTOMATTE_MATERIAL
#define RE_PASSNAME_CRYPTOMATTE_ASSET
#define RE_PASSNAME_CRYPTOMATTE_OBJECT
Read Blender memory allocation and freeing.
#define STREQ(a, b)
ItemIterator items() const &
Definition BLI_map.hh:902
constexpr StringRefNull()
constexpr StringRef drop_prefix(int64_t n) const
constexpr StringRef()
constexpr int64_t find_first_of(StringRef chars, int64_t pos=0) const
constexpr const char & front() const
constexpr bool startswith(StringRef prefix) const
static constexpr int64_t not_found
constexpr bool is_empty() const
constexpr int64_t size() const
constexpr int64_t find_first_not_of(StringRef chars, int64_t pos=0) const
constexpr StringRef substr(int64_t start, int64_t size) const
constexpr const char * data() const
constexpr int64_t find_last_of(StringRef chars, int64_t pos=INT64_MAX) const
constexpr bool endswith(StringRef suffix) const
#define layer
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
Definition math_dual.h:263
static constexpr StringRef skip_whitespaces_(StringRef ref)
static std::string unquote_(const StringRef ref)
static std::string to_manifest(const CryptomatteLayer *layer)
static bool from_manifest(CryptomatteLayer &layer, StringRefNull manifest)
static constexpr int quoted_string_len_(StringRef ref)
StringRef BKE_cryptomatte_extract_layer_name(StringRef render_pass_name)
const Vector< std::string > & BKE_cryptomatte_layer_names_get(const CryptomatteSession &session)
CryptomatteLayer * BKE_cryptomatte_layer_get(CryptomatteSession &session, StringRef layer_name)
static std::string cryptomatte_layer_name_hash(const StringRef layer_name)
std::string BKE_cryptomatte_meta_data_key(StringRef layer_name, StringRefNull key_name)
BMesh Iterators.
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
bool BKE_cryptomatte_find_name(const struct CryptomatteSession *session, float encoded_hash, char *r_name, int name_maxncpy)
void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format,...) ATTR_PRINTF_FORMAT(2
__int64 int64_t
Definition BKE_text.h:90
static void add_render_result_meta_data(RenderResult *render_result, const StringRef layer_name, const StringRefNull key_name, const StringRefNull value)
char * STRNCPY(char(&dst)[N], const char *src)
void BLI_dynstr_nappend(DynStr *__restrict ds, const char *cstr, int len) ATTR_NONNULL()
Definition BLI_dynstr.cc:77
uint32_t BLI_hash_mm3(const unsigned char *data, size_t len, uint32_t seed)
Definition hash_mm3.cc:75
struct CryptomatteSession * BKE_cryptomatte_init()
Material * BKE_object_material_get(Object *ob, short act)
struct CryptomatteSession * BKE_cryptomatte_init_from_scene(const struct Scene *scene, bool build_meta_data)
void BKE_render_result_stamp_data(RenderResult *rr, const char *key, const char *value)
static uint32_t cryptomatte_determine_identifier(const StringRef name)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
uint32_t BKE_cryptomatte_hash(const char *name, int name_len)
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL()
void BKE_cryptomatte_store_metadata(const struct CryptomatteSession *session, struct RenderResult *render_result)
unsigned int uint32_t
Definition BKE_text.h:81
void BLI_dynstr_append(DynStr *__restrict ds, const char *cstr) ATTR_NONNULL()
Definition BLI_dynstr.cc:58
struct CryptomatteSession * BKE_cryptomatte_init_from_view_layer(const struct ViewLayer *view_layer)
unsigned char uchar
Definition BKE_text.h:58
BMesh const char void * data
void BKE_cryptomatte_add_layer(struct CryptomatteSession *session, const char *layer_name)
bool BKE_view_layer_is_synced(const ViewLayer &view_layer)
int char char int int int int size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * BLI_dynstr_get_cstring(const DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
uint32_t BKE_cryptomatte_material_hash(struct CryptomatteSession *session, const char *layer_name, const struct Material *material)
void BKE_stamp_info_callback(void *data, StampData *stamp_data, StampCallback callback, bool noskip)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
char * BKE_cryptomatte_entries_to_matte_id(struct NodeCryptomatte *node_storage)
@ VIEW_LAYER_CRYPTOMATTE_ASSET
@ VIEW_LAYER_CRYPTOMATTE_MATERIAL
@ VIEW_LAYER_CRYPTOMATTE_OBJECT
uint32_t BKE_cryptomatte_object_hash(struct CryptomatteSession *session, const char *layer_name, const struct Object *object)
float BKE_cryptomatte_hash_to_float(uint32_t cryptomatte_hash)
struct CryptomatteSession * BKE_cryptomatte_init_from_render_result(const struct RenderResult *render_result)
DynStr * BLI_dynstr_new() ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition BLI_dynstr.cc:39
void BKE_cryptomatte_free(struct CryptomatteSession *session)
ListBaseT< Base > * BKE_view_layer_object_bases_get(ViewLayer *view_layer)
void BKE_cryptomatte_matte_id_to_entries(struct NodeCryptomatte *node_storage, const char *matte_id)
uint32_t BKE_cryptomatte_asset_hash(struct CryptomatteSession *session, const char *layer_name, const struct Object *object)
#define hash
Definition noise_c.cc:156
Map< std::string, bke::cryptomatte::CryptomatteLayer > layers
void init(const ViewLayer *view_layer, bool build_meta_data=false)
Vector< std::string > layer_names
bke::cryptomatte::CryptomatteLayer & add_layer(std::string layer_name)
std::optional< std::string > operator[](float encoded_hash) const
ListBaseT< Material > materials
Definition BKE_main.hh:392
ListBaseT< Object > objects
Definition BKE_main.hh:388
ListBaseT< CryptomatteEntry > entries
struct Object * parent
struct StampData * stamp_data
ListBaseT< ViewLayer > view_layers
eViewLayerCryptomatteFlags cryptomatte_flag
static CryptomatteHash from_hex_encoded(StringRef hex_encoded)
Map< std::string, CryptomatteHash > hashes
std::optional< std::string > operator[](float encoded_hash) const
static std::unique_ptr< CryptomatteLayer > read_from_manifest(StringRefNull manifest)
void add_hash(StringRef name, CryptomatteHash cryptomatte_hash)
static void extract_layer_manifest(void *_data, const char *propname, char *propvalue, int propvalue_maxncpy)
static StringRef extract_layer_hash(StringRefNull key)
static void extract_layer_names(void *_data, const char *propname, char *propvalue, int propvalue_maxncpy)