Blender  V3.3
BKE_cryptomatte.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2020 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 #include <optional>
11 #include <string>
12 
13 #include "BKE_cryptomatte.h"
14 
15 #include "BLI_map.hh"
16 #include "BLI_string_ref.hh"
17 
18 #include "BKE_cryptomatte.h"
19 
20 struct ID;
21 
23 
33 std::string BKE_cryptomatte_meta_data_key(const StringRef layer_name,
34  const StringRefNull key_name);
35 
52 
55 
57  CryptomatteHash(const char *name, int name_len);
59 
60  std::string hex_encoded() const;
73  float float_encoded() const;
74 };
75 
78 
79 #ifdef WITH_CXX_GUARDEDALLOC
80  MEM_CXX_CLASS_ALLOC_FUNCS("cryptomatte:CryptomatteLayer")
81 #endif
82 
83  static std::unique_ptr<CryptomatteLayer> read_from_manifest(blender::StringRefNull manifest);
84  uint32_t add_ID(const struct ID &id);
85  void add_hash(blender::StringRef name, CryptomatteHash cryptomatte_hash);
86  std::string manifest() const;
87 
88  std::optional<std::string> operator[](float encoded_hash) const;
89 };
90 
94 
101 
102  /* C type callback function (StampCallback). */
103  static void extract_layer_names(void *_data, const char *propname, char *propvalue, int len);
104  /* C type callback function (StampCallback). */
105  static void extract_layer_manifest(void *_data, const char *propname, char *propvalue, int len);
106 };
107 
109  const CryptomatteSession &session);
110 
113  {
114  BKE_cryptomatte_free(session);
115  }
116 };
117 
118 using CryptomatteSessionPtr = std::unique_ptr<CryptomatteSession, CryptomatteSessionDeleter>;
119 
120 } // namespace blender::bke::cryptomatte
void BKE_cryptomatte_free(struct CryptomatteSession *session)
Definition: cryptomatte.cc:150
int len
Definition: draw_manager.c:108
StringRef BKE_cryptomatte_extract_layer_name(const StringRef render_pass_name)
Definition: cryptomatte.cc:475
std::string BKE_cryptomatte_meta_data_key(const StringRef layer_name, const StringRefNull key_name)
Definition: cryptomatte.cc:470
std::unique_ptr< CryptomatteSession, CryptomatteSessionDeleter > CryptomatteSessionPtr
const blender::Vector< std::string > & BKE_cryptomatte_layer_names_get(const CryptomatteSession &session)
Definition: cryptomatte.cc:622
unsigned int uint32_t
Definition: stdint.h:80
Definition: DNA_ID.h:368
static CryptomatteHash from_hex_encoded(blender::StringRef hex_encoded)
Definition: cryptomatte.cc:493
void add_hash(blender::StringRef name, CryptomatteHash cryptomatte_hash)
Definition: cryptomatte.cc:541
blender::Map< std::string, CryptomatteHash > hashes
static std::unique_ptr< CryptomatteLayer > read_from_manifest(blender::StringRefNull manifest)
Definition: cryptomatte.cc:522
std::optional< std::string > operator[](float encoded_hash) const
Definition: cryptomatte.cc:546
uint32_t add_ID(const struct ID &id)
Definition: cryptomatte.cc:530
static void extract_layer_names(void *_data, const char *propname, char *propvalue, int len)
Definition: cryptomatte.cc:580
static blender::StringRef extract_layer_hash(blender::StringRefNull key)
Definition: cryptomatte.cc:562
static void extract_layer_manifest(void *_data, const char *propname, char *propvalue, int len)
Definition: cryptomatte.cc:598
blender::Map< std::string, std::string > hash_to_layer_name