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:
Diffstat (limited to 'source/blender/blenkernel/BKE_cryptomatte.hh')
-rw-r--r--source/blender/blenkernel/BKE_cryptomatte.hh34
1 files changed, 32 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_cryptomatte.hh b/source/blender/blenkernel/BKE_cryptomatte.hh
index 4631bb2616e..c1da0339359 100644
--- a/source/blender/blenkernel/BKE_cryptomatte.hh
+++ b/source/blender/blenkernel/BKE_cryptomatte.hh
@@ -23,11 +23,15 @@
#pragma once
+#include <optional>
#include <string>
+#include "BLI_map.hh"
#include "BLI_string_ref.hh"
-namespace blender {
+struct ID;
+
+namespace blender::bke::cryptomatte {
/* Format to a cryptomatte meta data key.
*
@@ -56,4 +60,30 @@ std::string BKE_cryptomatte_meta_data_key(const StringRef layer_name,
*/
StringRef BKE_cryptomatte_extract_layer_name(const StringRef render_pass_name);
-} // namespace blender
+struct CryptomatteHash {
+ uint32_t hash;
+
+ CryptomatteHash(uint32_t hash);
+ CryptomatteHash(const char *name, const int name_len);
+ static CryptomatteHash from_hex_encoded(blender::StringRef hex_encoded);
+
+ std::string hex_encoded() const;
+ float float_encoded() const;
+};
+
+struct CryptomatteLayer {
+ blender::Map<std::string, CryptomatteHash> hashes;
+
+#ifdef WITH_CXX_GUARDEDALLOC
+ MEM_CXX_CLASS_ALLOC_FUNCS("cryptomatte:CryptomatteLayer")
+#endif
+
+ static std::unique_ptr<CryptomatteLayer> read_from_manifest(blender::StringRefNull manifest);
+ uint32_t add_ID(const struct ID &id);
+ void add_hash(blender::StringRef name, CryptomatteHash cryptomatte_hash);
+ std::string manifest();
+
+ std::optional<std::string> operator[](float encoded_hash) const;
+};
+
+} // namespace blender::bke::cryptomatte