Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/node_geometry_attribute_search.cc
| Show All 29 Lines | |||||
| #include "BKE_node_ui_storage.hh" | #include "BKE_node_ui_storage.hh" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_enum_types.h" | #include "RNA_enum_types.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "ED_undo.h" | |||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "node_intern.h" | #include "node_intern.h" | ||||
| using blender::IndexRange; | using blender::IndexRange; | ||||
| using blender::Map; | using blender::Map; | ||||
| using blender::Set; | using blender::Set; | ||||
| ▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | if (!attribute_search_item_add(items, *item)) { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| MEM_freeN(filtered_items); | MEM_freeN(filtered_items); | ||||
| BLI_string_search_free(search); | BLI_string_search_free(search); | ||||
| } | } | ||||
| static void attribute_search_exec_fn(bContext *UNUSED(C), void *data_v, void *item_v) | static void attribute_search_exec_fn(bContext *C, void *data_v, void *item_v) | ||||
| { | { | ||||
| AttributeSearchData *data = static_cast<AttributeSearchData *>(data_v); | AttributeSearchData *data = static_cast<AttributeSearchData *>(data_v); | ||||
| AvailableAttributeInfo *item = static_cast<AvailableAttributeInfo *>(item_v); | AvailableAttributeInfo *item = static_cast<AvailableAttributeInfo *>(item_v); | ||||
| bNodeSocket &socket = data->socket; | bNodeSocket &socket = data->socket; | ||||
| bNodeSocketValueString *value = static_cast<bNodeSocketValueString *>(socket.default_value); | bNodeSocketValueString *value = static_cast<bNodeSocketValueString *>(socket.default_value); | ||||
| BLI_strncpy(value->value, item->name.c_str(), MAX_NAME); | BLI_strncpy(value->value, item->name.c_str(), MAX_NAME); | ||||
| ED_undo_push(C, "Assign attribute name"); | |||||
| } | } | ||||
| void node_geometry_add_attribute_search_button(const bContext *C, | void node_geometry_add_attribute_search_button(const bContext *C, | ||||
| const bNodeTree *node_tree, | const bNodeTree *node_tree, | ||||
| const bNode *node, | const bNode *node, | ||||
| PointerRNA *socket_ptr, | PointerRNA *socket_ptr, | ||||
| uiLayout *layout) | uiLayout *layout) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines | |||||