Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/cryptomatte.cc
| Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
| #include <string> | #include <string> | ||||
| #include <string_view> | #include <string_view> | ||||
| struct CryptomatteSession { | struct CryptomatteSession { | ||||
| blender::Map<std::string, blender::bke::cryptomatte::CryptomatteLayer> layers; | blender::Map<std::string, blender::bke::cryptomatte::CryptomatteLayer> layers; | ||||
| /* Layer names in order of creation. */ | /* Layer names in order of creation. */ | ||||
| blender::Vector<std::string> layer_names; | blender::Vector<std::string> layer_names; | ||||
| CryptomatteSession(); | CryptomatteSession() = default; | ||||
| CryptomatteSession(const Main *bmain); | CryptomatteSession(const Main *bmain); | ||||
| CryptomatteSession(StampData *stamp_data); | CryptomatteSession(StampData *stamp_data); | ||||
| CryptomatteSession(const Scene *scene); | CryptomatteSession(const Scene *scene); | ||||
| blender::bke::cryptomatte::CryptomatteLayer &add_layer(std::string layer_name); | blender::bke::cryptomatte::CryptomatteLayer &add_layer(std::string layer_name); | ||||
| std::optional<std::string> operator[](float encoded_hash) const; | std::optional<std::string> operator[](float encoded_hash) const; | ||||
| #ifdef WITH_CXX_GUARDEDALLOC | #ifdef WITH_CXX_GUARDEDALLOC | ||||
| MEM_CXX_CLASS_ALLOC_FUNCS("cryptomatte:CryptomatteSession") | MEM_CXX_CLASS_ALLOC_FUNCS("cryptomatte:CryptomatteSession") | ||||
| #endif | #endif | ||||
| }; | }; | ||||
| CryptomatteSession::CryptomatteSession() | |||||
| { | |||||
| } | |||||
| CryptomatteSession::CryptomatteSession(const Main *bmain) | CryptomatteSession::CryptomatteSession(const Main *bmain) | ||||
| { | { | ||||
| if (!BLI_listbase_is_empty(&bmain->objects)) { | if (!BLI_listbase_is_empty(&bmain->objects)) { | ||||
| blender::bke::cryptomatte::CryptomatteLayer &objects = add_layer("CryptoObject"); | blender::bke::cryptomatte::CryptomatteLayer &objects = add_layer("CryptoObject"); | ||||
| LISTBASE_FOREACH (ID *, id, &bmain->objects) { | LISTBASE_FOREACH (ID *, id, &bmain->objects) { | ||||
| objects.add_ID(*id); | objects.add_ID(*id); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 583 Lines • Show Last 20 Lines | |||||