[Bf-blender-cvs] [65c0c10070d] temp-geometry-nodes-attribute-search: Attribute Search: Fix interaction with buttons not working

Hans Goudey noreply at git.blender.org
Tue Feb 23 22:55:02 CET 2021


Commit: 65c0c10070deb585f58ad6c8550344508e5d12d3
Author: Hans Goudey
Date:   Tue Feb 23 15:54:55 2021 -0600
Branches: temp-geometry-nodes-attribute-search
https://developer.blender.org/rB65c0c10070deb585f58ad6c8550344508e5d12d3

Attribute Search: Fix interaction with buttons not working

When an "exec" function was set, the data argument was provided to
the button. This meant that two of these buttons won't be considered
"equal" over successive redraws, since the data is reallocated every time.
To maintain "active" status over redraws, that new-button to old-button
map needs to be valid,, and it wasn't so the buttons weren't active.

The take-away: search button arguments can not be reallocated for every
redraw if an exec function is provided.

Since I have since connected the search button to the "default_value"
RNA property, we don't actually need the manual "exec" function anyway,
so this commit just removes it.

===================================================================

M	source/blender/editors/space_node/node_geometry_attribute_search.cc

===================================================================

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 83b1b14b081..210ccf81b8b 100644
--- a/source/blender/editors/space_node/node_geometry_attribute_search.cc
+++ b/source/blender/editors/space_node/node_geometry_attribute_search.cc
@@ -115,17 +115,6 @@ static void attribute_search_update_fn(const bContext *C,
   BLI_string_search_free(search);
 }
 
-static void attribute_search_exec_fn(struct bContext *UNUSED(C), void *arg1, void *arg2)
-{
-  AttributeSearchData *data = static_cast<AttributeSearchData *>(arg1);
-  const std::string *attribute_name = static_cast<std::string *>(arg2);
-
-  bNodeSocketValueString *string_value = static_cast<bNodeSocketValueString *>(
-      data->socket.default_value);
-
-  BLI_strncpy(string_value->value, attribute_name->c_str(), 1024);
-}
-
 static void attribute_search_free_fn(void *arg)
 {
   AttributeSearchData *data = static_cast<AttributeSearchData *>(arg);
@@ -171,6 +160,6 @@ void button_add_attribute_search(
                          attribute_search_update_fn,
                          static_cast<void *>(data),
                          attribute_search_free_fn,
-                         attribute_search_exec_fn,
+                         nullptr,
                          nullptr);
 }



More information about the Bf-blender-cvs mailing list