Geometry Nodes: store domain and data type in attribute hints
The information is not exposed in the attribute search yet.
This commit is contained in:
@@ -20,13 +20,17 @@
|
||||
|
||||
#include "BLI_hash.hh"
|
||||
#include "BLI_map.hh"
|
||||
#include "BLI_multi_value_map.hh"
|
||||
#include "BLI_session_uuid.h"
|
||||
#include "BLI_set.hh"
|
||||
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_customdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_session_uuid_types.h"
|
||||
|
||||
#include "BKE_attribute.h"
|
||||
|
||||
struct ModifierData;
|
||||
struct Object;
|
||||
struct bNode;
|
||||
@@ -77,9 +81,26 @@ struct NodeWarning {
|
||||
std::string message;
|
||||
};
|
||||
|
||||
struct AvailableAttributeInfo {
|
||||
AttributeDomain domain;
|
||||
CustomDataType data_type;
|
||||
|
||||
uint64_t hash() const
|
||||
{
|
||||
uint64_t domain_hash = (uint64_t)domain;
|
||||
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)
|
||||
{
|
||||
return a.domain == b.domain && a.data_type == b.data_type;
|
||||
}
|
||||
};
|
||||
|
||||
struct NodeUIStorage {
|
||||
blender::Vector<NodeWarning> warnings;
|
||||
blender::Set<std::string> attribute_name_hints;
|
||||
blender::MultiValueMap<std::string, AvailableAttributeInfo> attribute_hints;
|
||||
};
|
||||
|
||||
struct NodeTreeUIStorage {
|
||||
@@ -103,4 +124,6 @@ void BKE_nodetree_error_message_add(bNodeTree &ntree,
|
||||
void BKE_nodetree_attribute_hint_add(bNodeTree &ntree,
|
||||
const NodeTreeEvaluationContext &context,
|
||||
const bNode &node,
|
||||
const blender::StringRef attribute_name);
|
||||
const blender::StringRef attribute_name,
|
||||
const AttributeDomain domain,
|
||||
const CustomDataType data_type);
|
||||
|
||||
@@ -158,8 +158,11 @@ void BKE_nodetree_error_message_add(bNodeTree &ntree,
|
||||
void BKE_nodetree_attribute_hint_add(bNodeTree &ntree,
|
||||
const NodeTreeEvaluationContext &context,
|
||||
const bNode &node,
|
||||
const StringRef attribute_name)
|
||||
const StringRef attribute_name,
|
||||
const AttributeDomain domain,
|
||||
const CustomDataType data_type)
|
||||
{
|
||||
NodeUIStorage &node_ui_storage = node_ui_storage_ensure(ntree, context, node);
|
||||
node_ui_storage.attribute_name_hints.add_as(attribute_name);
|
||||
node_ui_storage.attribute_hints.add_as(attribute_name,
|
||||
AvailableAttributeInfo{domain, data_type});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user