[Bf-blender-cvs] [f29ff7fb7e1] blender-v3.2-release: Fix T98152: Named Attribute node changes data type for non-existant attributes
Jacques Lucke
noreply at git.blender.org
Tue May 24 11:56:07 CEST 2022
Commit: f29ff7fb7e19d8e8dd5dd01ac527f0675467fbf2
Author: Jacques Lucke
Date: Tue May 24 11:55:31 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rBf29ff7fb7e19d8e8dd5dd01ac527f0675467fbf2
Fix T98152: Named Attribute node changes data type for non-existant attributes
Skip changing the data type in the node if it is not known.
===================================================================
M source/blender/editors/interface/interface_template_attribute_search.cc
M source/blender/editors/space_node/node_geometry_attribute_search.cc
M source/blender/nodes/NOD_geometry_nodes_eval_log.hh
===================================================================
diff --git a/source/blender/editors/interface/interface_template_attribute_search.cc b/source/blender/editors/interface/interface_template_attribute_search.cc
index 384e9d1794e..dc8f568d025 100644
--- a/source/blender/editors/interface/interface_template_attribute_search.cc
+++ b/source/blender/editors/interface/interface_template_attribute_search.cc
@@ -40,8 +40,8 @@ static StringRef attribute_domain_string(const AttributeDomain domain)
static bool attribute_search_item_add(uiSearchItems *items, const GeometryAttributeInfo &item)
{
- const StringRef data_type_name = attribute_data_type_string(item.data_type);
- const StringRef domain_name = attribute_domain_string(item.domain);
+ const StringRef data_type_name = attribute_data_type_string(*item.data_type);
+ const StringRef domain_name = attribute_domain_string(*item.domain);
std::string search_item_text = domain_name + " " + UI_MENU_ARROW_SEP + item.name + UI_SEP_CHAR +
data_type_name;
diff --git a/source/blender/editors/space_node/node_geometry_attribute_search.cc b/source/blender/editors/space_node/node_geometry_attribute_search.cc
index fee64da0459..9c0172cfabf 100644
--- a/source/blender/editors/space_node/node_geometry_attribute_search.cc
+++ b/source/blender/editors/space_node/node_geometry_attribute_search.cc
@@ -183,9 +183,9 @@ static void attribute_search_exec_fn(bContext *C, void *data_v, void *item_v)
BLI_assert(socket->type == SOCK_STRING);
/* For the attribute input node, also adjust the type and links connected to the output. */
- if (node->type == GEO_NODE_INPUT_NAMED_ATTRIBUTE) {
+ if (node->type == GEO_NODE_INPUT_NAMED_ATTRIBUTE && item->data_type.has_value()) {
NodeGeometryInputNamedAttribute &storage = *(NodeGeometryInputNamedAttribute *)node->storage;
- const CustomDataType new_type = data_type_in_attribute_input_node(item->data_type);
+ const CustomDataType new_type = data_type_in_attribute_input_node(*item->data_type);
if (new_type != storage.data_type) {
storage.data_type = new_type;
/* Make the output socket with the new type on the attribute input node active. */
diff --git a/source/blender/nodes/NOD_geometry_nodes_eval_log.hh b/source/blender/nodes/NOD_geometry_nodes_eval_log.hh
index 1ad859aa47b..43792a2d90a 100644
--- a/source/blender/nodes/NOD_geometry_nodes_eval_log.hh
+++ b/source/blender/nodes/NOD_geometry_nodes_eval_log.hh
@@ -89,8 +89,9 @@ class GFieldValueLog : public ValueLog {
struct GeometryAttributeInfo {
std::string name;
- AttributeDomain domain;
- CustomDataType data_type;
+ /** Can be empty when #name does not actually exist on a geometry yet. */
+ std::optional<AttributeDomain> domain;
+ std::optional<CustomDataType> data_type;
};
/** Contains information about a geometry set. In most cases this does not store the entire
More information about the Bf-blender-cvs
mailing list