Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/node_geometry_attribute_search.cc
| Show All 27 Lines | |||||
| #include "DNA_space_types.h" | #include "DNA_space_types.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #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 "ED_screen.h" | |||||
| #include "ED_undo.h" | #include "ED_undo.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_interface.hh" | #include "UI_interface.hh" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| Show All 15 Lines | |||||
| }; | }; | ||||
| /* This class must not have a destructor, since it is used by buttons and freed with #MEM_freeN. */ | /* This class must not have a destructor, since it is used by buttons and freed with #MEM_freeN. */ | ||||
| BLI_STATIC_ASSERT(std::is_trivially_destructible_v<AttributeSearchData>, ""); | BLI_STATIC_ASSERT(std::is_trivially_destructible_v<AttributeSearchData>, ""); | ||||
| static void attribute_search_update_fn( | static void attribute_search_update_fn( | ||||
| const bContext *C, void *arg, const char *str, uiSearchItems *items, const bool is_first) | const bContext *C, void *arg, const char *str, uiSearchItems *items, const bool is_first) | ||||
| { | { | ||||
| if (ED_screen_animation_playing(CTX_wm_manager(C))) { | |||||
| return; | |||||
| } | |||||
| AttributeSearchData *data = static_cast<AttributeSearchData *>(arg); | AttributeSearchData *data = static_cast<AttributeSearchData *>(arg); | ||||
| SpaceNode *snode = CTX_wm_space_node(C); | SpaceNode *snode = CTX_wm_space_node(C); | ||||
| const geo_log::NodeLog *node_log = geo_log::ModifierLog::find_node_by_node_editor_context( | const geo_log::NodeLog *node_log = geo_log::ModifierLog::find_node_by_node_editor_context( | ||||
| *snode, *data->node); | *snode, *data->node); | ||||
| if (node_log == nullptr) { | if (node_log == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| blender::Vector<const GeometryAttributeInfo *> infos = node_log->lookup_available_attributes(); | blender::Vector<const GeometryAttributeInfo *> infos = node_log->lookup_available_attributes(); | ||||
| blender::ui::attribute_search_add_items(str, true, infos, items, is_first); | blender::ui::attribute_search_add_items(str, true, infos, items, is_first); | ||||
| } | } | ||||
| static void attribute_search_exec_fn(bContext *C, void *data_v, void *item_v) | static void attribute_search_exec_fn(bContext *C, void *data_v, void *item_v) | ||||
| { | { | ||||
| if (ED_screen_animation_playing(CTX_wm_manager(C))) { | |||||
| return; | |||||
| } | |||||
| if (item_v == nullptr) { | if (item_v == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| AttributeSearchData *data = static_cast<AttributeSearchData *>(data_v); | AttributeSearchData *data = static_cast<AttributeSearchData *>(data_v); | ||||
| GeometryAttributeInfo *item = (GeometryAttributeInfo *)item_v; | GeometryAttributeInfo *item = (GeometryAttributeInfo *)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); | ||||
| ▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines | |||||