Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_node_ui_storage.hh
| Show All 14 Lines | |||||
| */ | */ | ||||
| #pragma once | #pragma once | ||||
| #include <mutex> | #include <mutex> | ||||
| #include "BLI_hash.hh" | #include "BLI_hash.hh" | ||||
| #include "BLI_map.hh" | #include "BLI_map.hh" | ||||
| #include "BLI_multi_value_map.hh" | |||||
| #include "BLI_session_uuid.h" | #include "BLI_session_uuid.h" | ||||
| #include "BLI_set.hh" | #include "BLI_set.hh" | ||||
| #include "DNA_ID.h" | #include "DNA_ID.h" | ||||
| #include "DNA_customdata_types.h" | #include "DNA_customdata_types.h" | ||||
| #include "DNA_modifier_types.h" | #include "DNA_modifier_types.h" | ||||
| #include "DNA_session_uuid_types.h" | #include "DNA_session_uuid_types.h" | ||||
| ▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
| }; | }; | ||||
| struct NodeWarning { | struct NodeWarning { | ||||
| NodeWarningType type; | NodeWarningType type; | ||||
| std::string message; | std::string message; | ||||
| }; | }; | ||||
| struct AvailableAttributeInfo { | struct AvailableAttributeInfo { | ||||
| std::string name; | |||||
| AttributeDomain domain; | AttributeDomain domain; | ||||
| CustomDataType data_type; | CustomDataType data_type; | ||||
| uint64_t hash() const | uint64_t hash() const | ||||
| { | { | ||||
| uint64_t domain_hash = (uint64_t)domain; | return blender::get_default_hash(name); | ||||
| uint64_t data_type_hash = (uint64_t)data_type; | |||||
| return (domain_hash * 33) ^ (data_type_hash * 89); | |||||
| } | } | ||||
| friend bool operator==(const AvailableAttributeInfo &a, const AvailableAttributeInfo &b) | friend bool operator==(const AvailableAttributeInfo &a, const AvailableAttributeInfo &b) | ||||
| { | { | ||||
| return a.domain == b.domain && a.data_type == b.data_type; | return a.name == b.name; | ||||
| } | } | ||||
| }; | }; | ||||
| struct NodeUIStorage { | struct NodeUIStorage { | ||||
| blender::Vector<NodeWarning> warnings; | blender::Vector<NodeWarning> warnings; | ||||
| blender::MultiValueMap<std::string, AvailableAttributeInfo> attribute_hints; | blender::Set<AvailableAttributeInfo> attribute_hints; | ||||
| }; | }; | ||||
| struct NodeTreeUIStorage { | struct NodeTreeUIStorage { | ||||
| blender::Map<NodeTreeEvaluationContext, blender::Map<std::string, NodeUIStorage>> context_map; | blender::Map<NodeTreeEvaluationContext, blender::Map<std::string, NodeUIStorage>> context_map; | ||||
| std::mutex context_map_mutex; | std::mutex context_map_mutex; | ||||
| /** | |||||
| * Attribute search uses this to store the fake info for the string typed into a node, in order | |||||
| * to pass the info to the execute callback that sets node socket values. This is mutable since | |||||
| * we can count on only one attribute search being open at a time, and there is no real data | |||||
| * stored here. | |||||
| */ | |||||
| mutable AvailableAttributeInfo dummy_info_for_search; | |||||
| }; | }; | ||||
| const NodeUIStorage *BKE_node_tree_ui_storage_get_from_context(const bContext *C, | const NodeUIStorage *BKE_node_tree_ui_storage_get_from_context(const bContext *C, | ||||
| const bNodeTree &ntree, | const bNodeTree &ntree, | ||||
| const bNode &node); | const bNode &node); | ||||
| void BKE_nodetree_ui_storage_free_for_context(bNodeTree &ntree, | void BKE_nodetree_ui_storage_free_for_context(bNodeTree &ntree, | ||||
| const NodeTreeEvaluationContext &context); | const NodeTreeEvaluationContext &context); | ||||
| Show All 13 Lines | |||||