diff --git a/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py index aaf9fe2ad6f..97d8ee8f205 100644 --- a/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py +++ b/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py @@ -1064,7 +1064,6 @@ def km_node_generic(_params): items.extend([ op_panel("TOPBAR_PT_name", {"type": 'RET', "value": 'PRESS'}, [("keep_open", False)]), - ("node.add_search", {"type": 'TAB', "value": 'PRESS'}, None), ]) return keymap diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 129453f7c1b..473608a956e 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -378,13 +378,6 @@ typedef struct bNodeType { */ NodeGatherSocketLinkOperationsFunction gather_link_search_ops; - /** - * Add to the list of search items gathered by the add-node search. The default behavior of - * adding a single item with the node name is usually enough, but node types can have any number - * of custom search items. - */ - NodeGatherAddOperationsFunction gather_add_node_search_ops; - /** True when the node cannot be muted. */ bool no_muting; diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt index 8f8887e8f36..fac04776f25 100644 --- a/source/blender/editors/space_node/CMakeLists.txt +++ b/source/blender/editors/space_node/CMakeLists.txt @@ -31,7 +31,6 @@ set(INC_SYS set(SRC add_menu_assets.cc - add_node_search.cc clipboard.cc drawnode.cc link_drag_search.cc diff --git a/source/blender/editors/space_node/add_node_search.cc b/source/blender/editors/space_node/add_node_search.cc deleted file mode 100644 index b779a743ac0..00000000000 --- a/source/blender/editors/space_node/add_node_search.cc +++ /dev/null @@ -1,314 +0,0 @@ -/* SPDX-FileCopyrightText: 2023 Blender Authors - * - * SPDX-License-Identifier: GPL-2.0-or-later */ - -#include - -#include "AS_asset_catalog.hh" -#include "AS_asset_library.hh" -#include "AS_asset_representation.hh" - -#include "BLI_listbase.h" -#include "BLI_string.h" -#include "BLI_string_search.hh" - -#include "DNA_space_types.h" - -#include "BKE_asset.h" -#include "BKE_context.h" -#include "BKE_idprop.h" -#include "BKE_lib_id.h" -#include "BKE_main.h" -#include "BKE_node_tree_update.h" -#include "BKE_screen.h" - -#include "DEG_depsgraph_build.h" - -#include "BLT_translation.h" - -#include "RNA_access.hh" - -#include "WM_api.hh" - -#include "NOD_add_node_search.hh" - -#include "ED_asset.hh" -#include "ED_node.hh" - -#include "node_intern.hh" - -struct bContext; - -namespace blender::ed::space_node { - -struct AddNodeSearchStorage { - float2 cursor; - bool use_transform; - Vector search_add_items; - char search[256]; - bool update_items_tag = true; -}; - -static void add_node_search_listen_fn(const wmRegionListenerParams *params, void *arg) -{ - AddNodeSearchStorage &storage = *static_cast(arg); - const wmNotifier *wmn = params->notifier; - - switch (wmn->category) { - case NC_ASSET: - if (wmn->data == ND_ASSET_LIST_READING) { - storage.update_items_tag = true; - } - break; - } -} - -static void search_items_for_asset_metadata(const bNodeTree &node_tree, - const asset_system::AssetRepresentation &asset, - nodes::GatherAddNodeSearchParams ¶ms) -{ - const AssetMetaData &asset_data = asset.get_metadata(); - const IDProperty *tree_type = BKE_asset_metadata_idprop_find(&asset_data, "type"); - if (tree_type == nullptr || IDP_Int(tree_type) != node_tree.type) { - return; - } - - params.add_single_node_item(IFACE_(asset.get_name().c_str()), - asset_data.description == nullptr ? "" : - IFACE_(asset_data.description), - [&asset](const bContext &C, bNodeTree &node_tree, bNode &node) { - Main &bmain = *CTX_data_main(&C); - node.flag &= ~NODE_OPTIONS; - node.id = asset::asset_local_id_ensure_imported(bmain, asset); - id_us_plus(node.id); - BKE_ntree_update_tag_node_property(&node_tree, &node); - DEG_relations_tag_update(&bmain); - }); -} - -static void gather_search_items_for_all_assets(const bContext &C, - const bNodeTree &node_tree, - Set &r_added_assets, - Vector &search_items) -{ - const bNodeType &group_node_type = *nodeTypeFind(node_tree.typeinfo->group_idname); - nodes::GatherAddNodeSearchParams params(C, group_node_type, node_tree, search_items); - - const AssetLibraryReference library_ref = asset_system::all_library_reference(); - - AssetFilterSettings filter_settings{}; - filter_settings.id_types = FILTER_ID_NT; - - ED_assetlist_storage_fetch(&library_ref, &C); - ED_assetlist_ensure_previews_job(&library_ref, &C); - ED_assetlist_iterate(library_ref, [&](asset_system::AssetRepresentation &asset) { - if (!ED_asset_filter_matches_asset(&filter_settings, asset)) { - return true; - } - if (!r_added_assets.add(asset.get_name())) { - /* If an asset with the same name has already been added, skip this. */ - return true; - } - search_items_for_asset_metadata(node_tree, asset, params); - return true; - }); -} - -static void gather_search_items_for_node_groups(const bContext &C, - const bNodeTree &node_tree, - const Set &local_assets, - Vector &search_items) -{ - const StringRefNull group_node_id = node_tree.typeinfo->group_idname; - const bNodeType &group_node_type = *nodeTypeFind(group_node_id.c_str()); - nodes::GatherAddNodeSearchParams params(C, group_node_type, node_tree, search_items); - - Main &bmain = *CTX_data_main(&C); - LISTBASE_FOREACH (bNodeTree *, node_group, &bmain.nodetrees) { - if (node_group->typeinfo->group_idname != group_node_id) { - continue; - } - if (local_assets.contains(node_group->id.name + 2)) { - continue; - } - if (!nodeGroupPoll(&node_tree, node_group, nullptr)) { - continue; - } - params.add_single_node_item( - node_group->id.name + 2, - "", - [node_group](const bContext &C, bNodeTree &node_tree, bNode &node) { - Main &bmain = *CTX_data_main(&C); - node.id = &node_group->id; - id_us_plus(node.id); - BKE_ntree_update_tag_node_property(&node_tree, &node); - DEG_relations_tag_update(&bmain); - }); - } -} - -static void gather_add_node_operations(const bContext &C, - bNodeTree &node_tree, - Vector &r_search_items) -{ - NODE_TYPES_BEGIN (node_type) { - const char *disabled_hint; - if (node_type->poll && !node_type->poll(node_type, &node_tree, &disabled_hint)) { - continue; - } - if (node_type->add_ui_poll && !node_type->add_ui_poll(&C)) { - continue; - } - if (!node_type->gather_add_node_search_ops) { - continue; - } - nodes::GatherAddNodeSearchParams params(C, *node_type, node_tree, r_search_items); - node_type->gather_add_node_search_ops(params); - } - NODE_TYPES_END; - - /* Use a set to avoid adding items for node groups that are also assets. Using data-block - * names is a crutch, since different assets may have the same name. However, an alternative - * using #AssetRepresentation::local_id() didn't work in this case. */ - Set added_assets; - gather_search_items_for_all_assets(C, node_tree, added_assets, r_search_items); - gather_search_items_for_node_groups(C, node_tree, added_assets, r_search_items); -} - -static void add_node_search_update_fn( - const bContext *C, void *arg, const char *str, uiSearchItems *items, const bool is_first) -{ - AddNodeSearchStorage &storage = *static_cast(arg); - if (storage.update_items_tag) { - bNodeTree *node_tree = CTX_wm_space_node(C)->edittree; - storage.search_add_items.clear(); - gather_add_node_operations(*C, *node_tree, storage.search_add_items); - storage.update_items_tag = false; - } - - string_search::StringSearch search; - - for (nodes::AddNodeItem &item : storage.search_add_items) { - search.add(item.ui_name, &item, item.weight); - } - - /* Don't filter when the menu is first opened, but still run the search - * so the items are in the same order they will appear in while searching. */ - const char *string = is_first ? "" : str; - const Vector filtered_items = search.query(string); - - for (nodes::AddNodeItem *item : filtered_items) { - if (!UI_search_item_add(items, item->ui_name.c_str(), item, ICON_NONE, 0, 0)) { - break; - } - } -} - -static void add_node_search_exec_fn(bContext *C, void *arg1, void *arg2) -{ - Main &bmain = *CTX_data_main(C); - SpaceNode &snode = *CTX_wm_space_node(C); - bNodeTree &node_tree = *snode.edittree; - AddNodeSearchStorage &storage = *static_cast(arg1); - nodes::AddNodeItem *item = static_cast(arg2); - if (item == nullptr) { - return; - } - - node_deselect_all(node_tree); - item->add_fn(*C, node_tree, storage.cursor); - - /* Ideally it would be possible to tag the node tree in some way so it updates only after the - * translate operation is finished, but normally moving nodes around doesn't cause updates. */ - ED_node_tree_propagate_change(C, &bmain, &node_tree); - - if (storage.use_transform) { - wmOperatorType *ot = WM_operatortype_find("NODE_OT_translate_attach_remove_on_cancel", true); - BLI_assert(ot); - PointerRNA ptr; - WM_operator_properties_create_ptr(&ptr, ot); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr, nullptr); - WM_operator_properties_free(&ptr); - } -} - -static ARegion *add_node_search_tooltip_fn( - bContext *C, ARegion *region, const rcti *item_rect, void * /*arg*/, void *active) -{ - const nodes::AddNodeItem *item = static_cast(active); - - uiSearchItemTooltipData tooltip_data{}; - - STRNCPY(tooltip_data.description, TIP_(item->description.c_str())); - - return UI_tooltip_create_from_search_item_generic(C, region, item_rect, &tooltip_data); -} - -static void add_node_search_free_fn(void *arg) -{ - AddNodeSearchStorage *storage = static_cast(arg); - delete storage; -} - -static uiBlock *create_search_popup_block(bContext *C, ARegion *region, void *arg_op) -{ - AddNodeSearchStorage &storage = *(AddNodeSearchStorage *)arg_op; - - uiBlock *block = UI_block_begin(C, region, "_popup", UI_EMBOSS); - UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); - UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); - - uiBut *but = uiDefSearchBut(block, - storage.search, - 0, - ICON_VIEWZOOM, - sizeof(storage.search), - 10, - 10, - UI_searchbox_size_x(), - UI_UNIT_Y, - 0, - 0, - ""); - UI_but_func_search_set_sep_string(but, UI_MENU_ARROW_SEP); - UI_but_func_search_set(but, - nullptr, - add_node_search_update_fn, - &storage, - false, - add_node_search_free_fn, - add_node_search_exec_fn, - nullptr); - UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT); - UI_but_func_search_set_tooltip(but, add_node_search_tooltip_fn); - UI_but_func_search_set_listen(but, add_node_search_listen_fn); - - /* Fake button to hold space for the search items. */ - uiDefBut(block, - UI_BTYPE_LABEL, - 0, - "", - 10, - 10 - UI_searchbox_size_y(), - UI_searchbox_size_x(), - UI_searchbox_size_y(), - nullptr, - 0, - 0, - 0, - 0, - nullptr); - - const int offset[2] = {0, -UI_UNIT_Y}; - UI_block_bounds_set_popup(block, 0.3f * U.widget_unit, offset); - return block; -} - -void invoke_add_node_search_menu(bContext &C, const float2 &cursor, const bool use_transform) -{ - AddNodeSearchStorage *storage = new AddNodeSearchStorage{cursor, use_transform}; - /* Use the "_ex" variant with `can_refresh` false to avoid a double free when closing Blender. */ - UI_popup_block_invoke_ex(&C, create_search_popup_block, storage, nullptr, false); -} - -} // namespace blender::ed::space_node diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc index 8a3751d5eed..c572458b2f1 100644 --- a/source/blender/editors/space_node/node_add.cc +++ b/source/blender/editors/space_node/node_add.cc @@ -1023,37 +1023,4 @@ void NODE_OT_new_node_tree(wmOperatorType *ot) /** \} */ -/* -------------------------------------------------------------------- */ -/** \name Add Node Search - * \{ */ - -static int node_add_search_invoke(bContext *C, wmOperator *op, const wmEvent *event) -{ - const ARegion ®ion = *CTX_wm_region(C); - - float2 cursor; - UI_view2d_region_to_view(®ion.v2d, event->mval[0], event->mval[1], &cursor.x, &cursor.y); - - invoke_add_node_search_menu(*C, cursor, RNA_boolean_get(op->ptr, "use_transform")); - - return OPERATOR_FINISHED; -} - -void NODE_OT_add_search(wmOperatorType *ot) -{ - ot->name = "Search and Add Node"; - ot->idname = "NODE_OT_add_search"; - ot->description = "Search for nodes and add one to the active tree"; - - ot->invoke = node_add_search_invoke; - ot->poll = ED_operator_node_editable; - - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - RNA_def_boolean( - ot->srna, "use_transform", true, "Use Transform", "Start moving the node after adding it"); -} - -/** \} */ - } // namespace blender::ed::space_node diff --git a/source/blender/editors/space_node/node_intern.hh b/source/blender/editors/space_node/node_intern.hh index 5875dd7fd5b..adcf0d63ca7 100644 --- a/source/blender/editors/space_node/node_intern.hh +++ b/source/blender/editors/space_node/node_intern.hh @@ -274,7 +274,6 @@ bNode *add_node(const bContext &C, StringRef idname, const float2 &location); bNode *add_static_node(const bContext &C, int type, const float2 &location); void NODE_OT_add_reroute(wmOperatorType *ot); -void NODE_OT_add_search(wmOperatorType *ot); void NODE_OT_add_group(wmOperatorType *ot); void NODE_OT_add_group_asset(wmOperatorType *ot); void NODE_OT_add_object(wmOperatorType *ot); @@ -403,10 +402,6 @@ void invoke_node_link_drag_add_menu(bContext &C, bNodeSocket &socket, const float2 &cursor); -/* `add_node_search.cc` */ - -void invoke_add_node_search_menu(bContext &C, const float2 &cursor, bool use_transform); - /* `add_menu_assets.cc` */ MenuType add_catalog_assets_menu_type(); diff --git a/source/blender/editors/space_node/node_ops.cc b/source/blender/editors/space_node/node_ops.cc index b738bdda5fd..ba3444e60fa 100644 --- a/source/blender/editors/space_node/node_ops.cc +++ b/source/blender/editors/space_node/node_ops.cc @@ -77,7 +77,6 @@ void node_operatortypes() WM_operatortype_append(NODE_OT_backimage_fit); WM_operatortype_append(NODE_OT_backimage_sample); - WM_operatortype_append(NODE_OT_add_search); WM_operatortype_append(NODE_OT_add_group); WM_operatortype_append(NODE_OT_add_group_asset); WM_operatortype_append(NODE_OT_add_object); diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 4dce0eabf28..7cd01e716a6 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -76,7 +76,6 @@ set(INC_SYS ) set(SRC - intern/add_node_search.cc intern/derived_node_tree.cc intern/geometry_nodes_execute.cc intern/geometry_nodes_lazy_function.cc @@ -94,7 +93,6 @@ set(SRC intern/node_util.cc intern/socket_search_link.cc - NOD_add_node_search.hh NOD_common.h NOD_composite.h NOD_derived_node_tree.hh diff --git a/source/blender/nodes/NOD_add_node_search.hh b/source/blender/nodes/NOD_add_node_search.hh deleted file mode 100644 index c0ac57c239c..00000000000 --- a/source/blender/nodes/NOD_add_node_search.hh +++ /dev/null @@ -1,74 +0,0 @@ -/* SPDX-FileCopyrightText: 2023 Blender Authors - * - * SPDX-License-Identifier: GPL-2.0-or-later */ - -#pragma once - -#include - -#include "BLI_function_ref.hh" -#include "BLI_math_vector_types.hh" -#include "BLI_string_ref.hh" -#include "BLI_vector.hh" - -#include "DNA_node_types.h" /* Necessary for eNodeSocketInOut. */ - -#include "NOD_node_declaration.hh" - -struct bContext; - -namespace blender::nodes { - -struct AddNodeItem { - using AddFn = - std::function(const bContext &C, bNodeTree &node_tree, float2 cursor)>; - std::string ui_name; - std::string description; - int weight = 0; - AddFn add_fn; -}; - -class GatherAddNodeSearchParams { - using AfterAddFn = std::function; - const bContext &C_; - const bNodeType &node_type_; - const bNodeTree &node_tree_; - Vector &r_items; - - public: - GatherAddNodeSearchParams(const bContext &C, - const bNodeType &node_type, - const bNodeTree &node_tree, - Vector &r_items) - : C_(C), node_type_(node_type), node_tree_(node_tree), r_items(r_items) - { - } - - const bContext &context() const - { - return C_; - } - - const bNodeTree &node_tree() const - { - return node_tree_; - } - - const bNodeType &node_type() const - { - return node_type_; - } - - /** - * \param weight: Used to customize the order when multiple search items match. - */ - void add_single_node_item(std::string ui_name, - std::string description, - AfterAddFn after_add_fn = {}, - int weight = 0); - void add_item(AddNodeItem item); -}; - -void search_node_add_ops_for_basic_node(GatherAddNodeSearchParams ¶ms); - -} // namespace blender::nodes diff --git a/source/blender/nodes/composite/node_composite_util.cc b/source/blender/nodes/composite/node_composite_util.cc index cbe7a837bdd..34bdb5c26a8 100644 --- a/source/blender/nodes/composite/node_composite_util.cc +++ b/source/blender/nodes/composite/node_composite_util.cc @@ -8,7 +8,6 @@ #include "BKE_node_runtime.hh" -#include "NOD_add_node_search.hh" #include "NOD_socket_search_link.hh" #include "node_composite_util.hh" @@ -37,5 +36,4 @@ void cmp_node_type_base(bNodeType *ntype, int type, const char *name, short ncla ntype->updatefunc = cmp_node_update_default; ntype->insert_link = node_insert_link_default; ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; - ntype->gather_add_node_search_ops = blender::nodes::search_node_add_ops_for_basic_node; } diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc index 8830cecf8f9..fc8458b78b4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc @@ -431,7 +431,6 @@ void register_node_type_cmp_cryptomatte_legacy() node_type_storage( &ntype, "NodeCryptomatte", file_ns::node_free_cryptomatte, file_ns::node_copy_cryptomatte); ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; ntype.get_compositor_operation = legacy_file_ns::get_compositor_operation; ntype.realtime_compositor_unsupported_message = N_( "Node not supported in the Viewport compositor"); diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc b/source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc index a2c04963161..67241d59bd0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc @@ -59,7 +59,6 @@ void register_node_type_cmp_sephsva() &ntype, CMP_NODE_SEPHSVA_LEGACY, "Separate HSVA (Legacy)", NODE_CLASS_CONVERTER); ntype.declare = file_ns::cmp_node_sephsva_declare; ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; nodeRegisterType(&ntype); @@ -111,7 +110,6 @@ void register_node_type_cmp_combhsva() &ntype, CMP_NODE_COMBHSVA_LEGACY, "Combine HSVA (Legacy)", NODE_CLASS_CONVERTER); ntype.declare = file_ns::cmp_node_combhsva_declare; ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc b/source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc index 771b740035a..cb9cad6a63d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc @@ -59,7 +59,6 @@ void register_node_type_cmp_seprgba() &ntype, CMP_NODE_SEPRGBA_LEGACY, "Separate RGBA (Legacy)", NODE_CLASS_CONVERTER); ntype.declare = file_ns::cmp_node_seprgba_declare; ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; nodeRegisterType(&ntype); @@ -111,7 +110,6 @@ void register_node_type_cmp_combrgba() &ntype, CMP_NODE_COMBRGBA_LEGACY, "Combine RGBA (Legacy)", NODE_CLASS_CONVERTER); ntype.declare = file_ns::cmp_node_combrgba_declare; ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc b/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc index 8ee25f1a1fa..cb53845c02a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc @@ -87,7 +87,6 @@ void register_node_type_cmp_sepycca() ntype.declare = file_ns::cmp_node_sepycca_declare; ntype.initfunc = file_ns::node_composit_init_mode_sepycca; ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; nodeRegisterType(&ntype); @@ -173,7 +172,6 @@ void register_node_type_cmp_combycca() ntype.declare = file_ns::cmp_node_combycca_declare; ntype.initfunc = file_ns::node_composit_init_mode_combycca; ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc b/source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc index 4e1b2835c5c..501a7b22809 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc @@ -59,7 +59,6 @@ void register_node_type_cmp_sepyuva() &ntype, CMP_NODE_SEPYUVA_LEGACY, "Separate YUVA (Legacy)", NODE_CLASS_CONVERTER); ntype.declare = file_ns::cmp_node_sepyuva_declare; ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; nodeRegisterType(&ntype); @@ -111,7 +110,6 @@ void register_node_type_cmp_combyuva() &ntype, CMP_NODE_COMBYUVA_LEGACY, "Combine YUVA (Legacy)", NODE_CLASS_CONVERTER); ntype.declare = file_ns::cmp_node_combyuva_declare; ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/function/node_function_util.cc b/source/blender/nodes/function/node_function_util.cc index 70cee854733..33c7eeff0ed 100644 --- a/source/blender/nodes/function/node_function_util.cc +++ b/source/blender/nodes/function/node_function_util.cc @@ -5,7 +5,6 @@ #include "node_function_util.hh" #include "node_util.hh" -#include "NOD_add_node_search.hh" #include "NOD_socket_search_link.hh" static bool fn_node_poll_default(const bNodeType * /*ntype*/, @@ -26,5 +25,4 @@ void fn_node_type_base(bNodeType *ntype, int type, const char *name, short nclas ntype->poll = fn_node_poll_default; ntype->insert_link = node_insert_link_default; ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; - ntype->gather_add_node_search_ops = blender::nodes::search_node_add_ops_for_basic_node; } diff --git a/source/blender/nodes/geometry/node_geometry_util.cc b/source/blender/nodes/geometry/node_geometry_util.cc index 67615a95c2a..5e59ec6a46a 100644 --- a/source/blender/nodes/geometry/node_geometry_util.cc +++ b/source/blender/nodes/geometry/node_geometry_util.cc @@ -14,7 +14,6 @@ #include "BKE_mesh_runtime.hh" #include "BKE_pointcloud.h" -#include "NOD_add_node_search.hh" #include "NOD_rna_define.hh" #include "NOD_socket_search_link.hh" @@ -59,13 +58,6 @@ bool check_tool_context_and_error(GeoNodeExecParams ¶ms) return true; } -void search_link_ops_for_for_tool_node(GatherAddNodeSearchParams ¶ms) -{ - const SpaceNode &snode = *CTX_wm_space_node(¶ms.context()); - if (snode.geometry_nodes_type == SNODE_GEOMETRY_TOOL) { - search_node_add_ops_for_basic_node(params); - } -} void search_link_ops_for_tool_node(GatherLinkSearchOpParams ¶ms) { if (params.space_node().geometry_nodes_type == SNODE_GEOMETRY_TOOL) { @@ -122,5 +114,4 @@ void geo_node_type_base(bNodeType *ntype, int type, const char *name, short ncla ntype->poll = geo_node_poll_default; ntype->insert_link = node_insert_link_default; ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; - ntype->gather_add_node_search_ops = blender::nodes::search_node_add_ops_for_basic_node; } diff --git a/source/blender/nodes/geometry/node_geometry_util.hh b/source/blender/nodes/geometry/node_geometry_util.hh index b922922839a..363c80a2d83 100644 --- a/source/blender/nodes/geometry/node_geometry_util.hh +++ b/source/blender/nodes/geometry/node_geometry_util.hh @@ -34,7 +34,6 @@ bool geo_node_poll_default(const bNodeType *ntype, namespace blender::nodes { bool check_tool_context_and_error(GeoNodeExecParams ¶ms); -void search_link_ops_for_for_tool_node(GatherAddNodeSearchParams ¶ms); void search_link_ops_for_tool_node(GatherLinkSearchOpParams ¶ms); void transform_mesh(Mesh &mesh, diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_signed_distance.cc b/source/blender/nodes/geometry/nodes/node_geo_input_signed_distance.cc index ca82966d7a5..5220b44a2f3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_signed_distance.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_signed_distance.cc @@ -2,7 +2,6 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ -#include "NOD_add_node_search.hh" #include "NOD_socket_search_link.hh" #include "node_geometry_util.hh" @@ -14,13 +13,6 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output("Signed Distance").field_source(); } -static void search_node_add_ops(GatherAddNodeSearchParams ¶ms) -{ - if (U.experimental.use_new_volume_nodes) { - blender::nodes::search_node_add_ops_for_basic_node(params); - } -} - static void search_link_ops(GatherLinkSearchOpParams ¶ms) { if (U.experimental.use_new_volume_nodes) { @@ -41,7 +33,6 @@ static void node_register() geo_node_type_base(&ntype, GEO_NODE_INPUT_SIGNED_DISTANCE, "Signed Distance", NODE_CLASS_INPUT); ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; - ntype.gather_add_node_search_ops = search_node_add_ops; ntype.gather_link_search_ops = search_link_ops; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_mean_filter_sdf_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_mean_filter_sdf_volume.cc index 93cd70110c3..1d47c844ba2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mean_filter_sdf_volume.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mean_filter_sdf_volume.cc @@ -14,7 +14,6 @@ #include "DNA_node_types.h" -#include "NOD_add_node_search.hh" #include "NOD_socket_search_link.hh" #include "UI_interface.hh" @@ -32,13 +31,6 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output("Volume").translation_context(BLT_I18NCONTEXT_ID_ID); } -static void search_node_add_ops(GatherAddNodeSearchParams ¶ms) -{ - if (U.experimental.use_new_volume_nodes) { - blender::nodes::search_node_add_ops_for_basic_node(params); - } -} - static void search_link_ops(GatherLinkSearchOpParams ¶ms) { if (U.experimental.use_new_volume_nodes) { @@ -100,7 +92,6 @@ static void node_register() blender::bke::node_type_size(&ntype, 160, 120, 700); ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; - ntype.gather_add_node_search_ops = search_node_add_ops; ntype.gather_link_search_ops = search_link_ops; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_sdf_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_sdf_volume.cc index 5615f7f510e..f61f91b9993 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_sdf_volume.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_sdf_volume.cc @@ -17,7 +17,6 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" -#include "NOD_add_node_search.hh" #include "NOD_socket_search_link.hh" #include "NOD_rna_define.hh" @@ -46,13 +45,6 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output("Volume").translation_context(BLT_I18NCONTEXT_ID_ID); } -static void search_node_add_ops(GatherAddNodeSearchParams ¶ms) -{ - if (U.experimental.use_new_volume_nodes) { - blender::nodes::search_node_add_ops_for_basic_node(params); - } -} - static void search_link_ops(GatherLinkSearchOpParams ¶ms) { if (U.experimental.use_new_volume_nodes) { @@ -200,7 +192,6 @@ static void node_register() ntype.updatefunc = node_update; ntype.geometry_node_execute = node_geo_exec; ntype.draw_buttons = node_layout; - ntype.gather_add_node_search_ops = search_node_add_ops; ntype.gather_link_search_ops = search_link_ops; node_type_storage( &ntype, "NodeGeometryMeshToVolume", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/geometry/nodes/node_geo_offset_sdf_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_offset_sdf_volume.cc index bb1347a287c..825244b005b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_offset_sdf_volume.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_offset_sdf_volume.cc @@ -14,7 +14,6 @@ #include "DNA_node_types.h" -#include "NOD_add_node_search.hh" #include "NOD_socket_search_link.hh" #include "UI_interface.hh" @@ -31,13 +30,6 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output("Volume").translation_context(BLT_I18NCONTEXT_ID_ID); } -static void search_node_add_ops(GatherAddNodeSearchParams ¶ms) -{ - if (U.experimental.use_new_volume_nodes) { - blender::nodes::search_node_add_ops_for_basic_node(params); - } -} - static void search_link_ops(GatherLinkSearchOpParams ¶ms) { if (U.experimental.use_new_volume_nodes) { @@ -94,7 +86,6 @@ static void node_register() geo_node_type_base(&ntype, GEO_NODE_OFFSET_SDF_VOLUME, "Offset SDF Volume", NODE_CLASS_GEOMETRY); ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; - ntype.gather_add_node_search_ops = search_node_add_ops; ntype.gather_link_search_ops = search_link_ops; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_sdf_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_sdf_volume.cc index 81e10044b55..9c5f6c2363c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_points_to_sdf_volume.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_sdf_volume.cc @@ -10,7 +10,6 @@ #include "GEO_points_to_volume.hh" -#include "NOD_add_node_search.hh" #include "NOD_socket_search_link.hh" #include "NOD_rna_define.hh" @@ -46,13 +45,6 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output("Volume").translation_context(BLT_I18NCONTEXT_ID_ID); } -static void search_node_add_ops(GatherAddNodeSearchParams ¶ms) -{ - if (U.experimental.use_new_volume_nodes) { - blender::nodes::search_node_add_ops_for_basic_node(params); - } -} - static void search_link_ops(GatherLinkSearchOpParams ¶ms) { if (U.experimental.use_new_volume_nodes) { @@ -147,7 +139,6 @@ static void node_register() ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; ntype.draw_buttons = node_layout; - ntype.gather_add_node_search_ops = search_node_add_ops; ntype.gather_link_search_ops = search_link_ops; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_repeat_input.cc b/source/blender/nodes/geometry/nodes/node_geo_repeat_input.cc index 0ce244e2c43..3c6e21577c9 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_repeat_input.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_repeat_input.cc @@ -87,7 +87,6 @@ static void node_register() geo_node_type_base(&ntype, GEO_NODE_REPEAT_INPUT, "Repeat Input", NODE_CLASS_INTERFACE); ntype.initfunc = node_init; ntype.declare_dynamic = node_declare_dynamic; - ntype.gather_add_node_search_ops = nullptr; ntype.gather_link_search_ops = nullptr; ntype.insert_link = node_insert_link; node_type_storage( diff --git a/source/blender/nodes/geometry/nodes/node_geo_repeat_output.cc b/source/blender/nodes/geometry/nodes/node_geo_repeat_output.cc index f7832eea692..c32eeb4ea1a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_repeat_output.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_repeat_output.cc @@ -12,7 +12,6 @@ #include "UI_interface.hh" #include "UI_resources.hh" -#include "NOD_add_node_search.hh" #include "NOD_geometry.hh" #include "NOD_socket.hh" @@ -128,38 +127,6 @@ static void node_declare_dynamic(const bNodeTree & /*node_tree*/, socket_declarations_for_repeat_items(storage.items_span(), r_declaration); } -static void search_node_add_ops(GatherAddNodeSearchParams ¶ms) -{ - AddNodeItem item; - item.ui_name = IFACE_("Repeat Zone"); - item.description = TIP_("Add new repeat input and output nodes to the node tree"); - item.add_fn = [](const bContext &C, bNodeTree &node_tree, float2 cursor) { - bNode *input = nodeAddNode(&C, &node_tree, "GeometryNodeRepeatInput"); - bNode *output = nodeAddNode(&C, &node_tree, "GeometryNodeRepeatOutput"); - static_cast(input->storage)->output_node_id = output->identifier; - - NodeRepeatItem &item = node_storage(*output).items[0]; - - update_node_declaration_and_sockets(node_tree, *input); - update_node_declaration_and_sockets(node_tree, *output); - - const std::string identifier = item.identifier_str(); - nodeAddLink(&node_tree, - input, - nodeFindSocket(input, SOCK_OUT, identifier.c_str()), - output, - nodeFindSocket(output, SOCK_IN, identifier.c_str())); - - input->locx = cursor.x / UI_SCALE_FAC - 150; - input->locy = cursor.y / UI_SCALE_FAC + 20; - output->locx = cursor.x / UI_SCALE_FAC + 150; - output->locy = cursor.y / UI_SCALE_FAC + 20; - - return Vector({input, output}); - }; - params.add_item(std::move(item)); -} - static void node_init(bNodeTree * /*tree*/, bNode *node) { NodeGeometryRepeatOutput *data = MEM_cnew(__func__); @@ -245,7 +212,6 @@ static void node_register() geo_node_type_base(&ntype, GEO_NODE_REPEAT_OUTPUT, "Repeat Output", NODE_CLASS_INTERFACE); ntype.initfunc = node_init; ntype.declare_dynamic = node_declare_dynamic; - ntype.gather_add_node_search_ops = search_node_add_ops; ntype.insert_link = node_insert_link; node_type_storage(&ntype, "NodeGeometryRepeatOutput", node_free_storage, node_copy_storage); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_volume.cc index 2327d8e625f..0dcb46ad470 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sample_volume.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sample_volume.cc @@ -10,7 +10,6 @@ #include "BLI_virtual_array.hh" -#include "NOD_add_node_search.hh" #include "NOD_socket_search_link.hh" #include "node_geometry_util.hh" @@ -63,14 +62,6 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output("Value", "Value_Int").dependent_field({5}); } -static void search_node_add_ops(GatherAddNodeSearchParams ¶ms) -{ - if (!U.experimental.use_new_volume_nodes) { - return; - } - blender::nodes::search_node_add_ops_for_basic_node(params); -} - static std::optional other_socket_type_to_grid_type( const eNodeSocketDatatype type) { @@ -429,7 +420,6 @@ static void node_register() ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; ntype.draw_buttons = node_layout; - ntype.gather_add_node_search_ops = search_node_add_ops; ntype.gather_link_search_ops = search_link_ops; ntype.geometry_node_execute = node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_sdf_volume_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_sdf_volume_sphere.cc index a707f87a133..0c3bbcaa679 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sdf_volume_sphere.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sdf_volume_sphere.cc @@ -14,7 +14,6 @@ #include "BKE_volume.h" #include "BKE_volume_openvdb.hh" -#include "NOD_add_node_search.hh" #include "NOD_socket_search_link.hh" namespace blender::nodes::node_geo_sdf_volume_sphere_cc { @@ -31,13 +30,6 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output("Volume").translation_context(BLT_I18NCONTEXT_ID_ID); } -static void search_node_add_ops(GatherAddNodeSearchParams ¶ms) -{ - if (U.experimental.use_new_volume_nodes) { - blender::nodes::search_node_add_ops_for_basic_node(params); - } -} - static void search_link_ops(GatherLinkSearchOpParams ¶ms) { if (U.experimental.use_new_volume_nodes) { @@ -95,7 +87,6 @@ static void node_register() ntype.declare = node_declare; blender::bke::node_type_size(&ntype, 180, 120, 300); ntype.geometry_node_execute = node_geo_exec; - ntype.gather_add_node_search_ops = search_node_add_ops; ntype.gather_link_search_ops = search_link_ops; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc index 1d495cee006..41a355ef915 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc @@ -258,7 +258,6 @@ static void node_register() ntype.initfunc = node_init; ntype.declare_dynamic = node_declare_dynamic; ntype.insert_link = node_insert_link; - ntype.gather_add_node_search_ops = nullptr; ntype.gather_link_search_ops = nullptr; node_type_storage(&ntype, "NodeGeometrySimulationInput", diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc index a9203e22667..2ca51a7c30e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc @@ -28,8 +28,6 @@ #include "DNA_mesh_types.h" #include "DNA_pointcloud_types.h" -#include "NOD_add_node_search.hh" - #include "BLT_translation.h" #include "node_geometry_util.hh" @@ -788,39 +786,6 @@ static void node_declare_dynamic(const bNodeTree & /*node_tree*/, socket_declarations_for_simulation_items({storage.items, storage.items_num}, r_declaration); } -static void search_node_add_ops(GatherAddNodeSearchParams ¶ms) -{ - AddNodeItem item; - item.ui_name = IFACE_("Simulation Zone"); - item.description = TIP_("Add a new simulation input and output nodes to the node tree"); - item.add_fn = [](const bContext &C, bNodeTree &node_tree, float2 cursor) { - bNode *input = nodeAddNode(&C, &node_tree, "GeometryNodeSimulationInput"); - bNode *output = nodeAddNode(&C, &node_tree, "GeometryNodeSimulationOutput"); - static_cast(input->storage)->output_node_id = - output->identifier; - - NodeSimulationItem &item = node_storage(*output).items[0]; - - update_node_declaration_and_sockets(node_tree, *input); - update_node_declaration_and_sockets(node_tree, *output); - - nodeAddLink( - &node_tree, - input, - nodeFindSocket(input, SOCK_OUT, socket_identifier_for_simulation_item(item).c_str()), - output, - nodeFindSocket(output, SOCK_IN, socket_identifier_for_simulation_item(item).c_str())); - - input->locx = cursor.x / UI_SCALE_FAC - 150; - input->locy = cursor.y / UI_SCALE_FAC + 20; - output->locx = cursor.x / UI_SCALE_FAC + 150; - output->locy = cursor.y / UI_SCALE_FAC + 20; - - return Vector({input, output}); - }; - params.add_item(std::move(item)); -} - static void node_init(bNodeTree * /*tree*/, bNode *node) { NodeGeometrySimulationOutput *data = MEM_cnew(__func__); @@ -913,7 +878,6 @@ static void node_register() &ntype, GEO_NODE_SIMULATION_OUTPUT, "Simulation Output", NODE_CLASS_INTERFACE); ntype.initfunc = node_init; ntype.declare_dynamic = node_declare_dynamic; - ntype.gather_add_node_search_ops = search_node_add_ops; ntype.gather_link_search_ops = nullptr; ntype.insert_link = node_insert_link; node_type_storage(&ntype, "NodeGeometrySimulationOutput", node_free_storage, node_copy_storage); diff --git a/source/blender/nodes/geometry/nodes/node_geo_tool_3d_cursor.cc b/source/blender/nodes/geometry/nodes/node_geo_tool_3d_cursor.cc index 5757966cd03..db9ddb56a27 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_tool_3d_cursor.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_tool_3d_cursor.cc @@ -40,7 +40,6 @@ static void node_register() geo_node_type_base(&ntype, GEO_NODE_TOOL_3D_CURSOR, "3D Cursor", NODE_CLASS_INPUT); ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; - ntype.gather_add_node_search_ops = search_link_ops_for_for_tool_node; ntype.gather_link_search_ops = search_link_ops_for_tool_node; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_tool_face_set.cc b/source/blender/nodes/geometry/nodes/node_geo_tool_face_set.cc index 5b903b00d29..9f0a064c196 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_tool_face_set.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_tool_face_set.cc @@ -29,7 +29,6 @@ static void node_register() geo_node_type_base(&ntype, GEO_NODE_TOOL_FACE_SET, "Face Set", NODE_CLASS_INPUT); ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; - ntype.gather_add_node_search_ops = search_link_ops_for_for_tool_node; ntype.gather_link_search_ops = search_link_ops_for_tool_node; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_tool_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_tool_selection.cc index 8841cb3018a..420da2f4803 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_tool_selection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_tool_selection.cc @@ -62,7 +62,6 @@ static void node_register() geo_node_type_base(&ntype, GEO_NODE_TOOL_SELECTION, "Selection", NODE_CLASS_INPUT); ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; - ntype.gather_add_node_search_ops = search_link_ops_for_for_tool_node; ntype.gather_link_search_ops = search_link_ops_for_tool_node; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_tool_set_face_set.cc b/source/blender/nodes/geometry/nodes/node_geo_tool_set_face_set.cc index 52e0bc882ad..6dd0f0f46b5 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_tool_set_face_set.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_tool_set_face_set.cc @@ -60,7 +60,6 @@ static void node_register() geo_node_type_base(&ntype, GEO_NODE_TOOL_SET_FACE_SET, "Set Face Set", NODE_CLASS_GEOMETRY); ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; - ntype.gather_add_node_search_ops = search_link_ops_for_for_tool_node; ntype.gather_link_search_ops = search_link_ops_for_tool_node; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_tool_set_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_tool_set_selection.cc index 2eb5a9f72ac..f0814aca8f2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_tool_set_selection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_tool_set_selection.cc @@ -98,7 +98,6 @@ static void node_register() ntype.initfunc = node_init; ntype.geometry_node_execute = node_geo_exec; ntype.draw_buttons = node_layout; - ntype.gather_add_node_search_ops = search_link_ops_for_for_tool_node; ntype.gather_link_search_ops = search_link_ops_for_tool_node; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/intern/add_node_search.cc b/source/blender/nodes/intern/add_node_search.cc deleted file mode 100644 index f2b841a7129..00000000000 --- a/source/blender/nodes/intern/add_node_search.cc +++ /dev/null @@ -1,49 +0,0 @@ -/* SPDX-FileCopyrightText: 2023 Blender Authors - * - * SPDX-License-Identifier: GPL-2.0-or-later */ - -#include "BKE_node.hh" - -#include "BLT_translation.h" - -#include "NOD_add_node_search.hh" -#include "NOD_node_declaration.hh" - -namespace blender::nodes { - -void GatherAddNodeSearchParams::add_single_node_item(std::string ui_name, - std::string description, - AfterAddFn after_add_fn, - int weight) -{ - AddNodeItem item; - item.ui_name = std::move(ui_name); - item.description = std::move(description); - item.weight = weight; - item.add_fn = [after_add_fn = std::move(after_add_fn), node_type = node_type_]( - const bContext &C, bNodeTree &node_tree, const float2 cursor) { - bNode *new_node = nodeAddNode(&C, &node_tree, node_type.idname); - new_node->locx = cursor.x / UI_SCALE_FAC; - new_node->locy = cursor.y / UI_SCALE_FAC + 20; - nodeSetSelected(new_node, true); - nodeSetActive(&node_tree, new_node); - if (after_add_fn) { - after_add_fn(C, node_tree, *new_node); - } - return Vector{new_node}; - }; - r_items.append(std::move(item)); -} - -void GatherAddNodeSearchParams::add_item(AddNodeItem item) -{ - r_items.append(std::move(item)); -} - -void search_node_add_ops_for_basic_node(GatherAddNodeSearchParams ¶ms) -{ - params.add_single_node_item(IFACE_(params.node_type().ui_name), - TIP_(params.node_type().ui_description)); -} - -} // namespace blender::nodes diff --git a/source/blender/nodes/intern/node_common.cc b/source/blender/nodes/intern/node_common.cc index dee3e0b0a0e..f76b4554406 100644 --- a/source/blender/nodes/intern/node_common.cc +++ b/source/blender/nodes/intern/node_common.cc @@ -32,7 +32,6 @@ #include "MEM_guardedalloc.h" -#include "NOD_add_node_search.hh" #include "NOD_common.h" #include "NOD_node_declaration.hh" #include "NOD_register.hh" @@ -434,7 +433,6 @@ void register_node_type_frame() blender::bke::node_type_base(ntype, NODE_FRAME, "Frame", NODE_CLASS_LAYOUT); ntype->initfunc = node_frame_init; - ntype->gather_add_node_search_ops = blender::nodes::search_node_add_ops_for_basic_node; node_type_storage(ntype, "NodeFrame", node_free_standard_storage, node_copy_standard_storage); blender::bke::node_type_size(ntype, 150, 100, 0); ntype->flag |= NODE_BACKGROUND; @@ -465,7 +463,6 @@ void register_node_type_reroute() blender::bke::node_type_base(ntype, NODE_REROUTE, "Reroute", NODE_CLASS_LAYOUT); ntype->initfunc = node_reroute_init; - ntype->gather_add_node_search_ops = blender::nodes::search_node_add_ops_for_basic_node; nodeRegisterType(ntype); } @@ -706,7 +703,6 @@ void register_node_type_group_input() blender::bke::node_type_base(ntype, NODE_GROUP_INPUT, "Group Input", NODE_CLASS_INTERFACE); blender::bke::node_type_size(ntype, 140, 80, 400); - ntype->gather_add_node_search_ops = blender::nodes::search_node_add_ops_for_basic_node; ntype->declare_dynamic = blender::nodes::group_input_declare_dynamic; ntype->insert_link = blender::nodes::group_input_insert_link; @@ -731,7 +727,6 @@ void register_node_type_group_output() blender::bke::node_type_base(ntype, NODE_GROUP_OUTPUT, "Group Output", NODE_CLASS_INTERFACE); blender::bke::node_type_size(ntype, 140, 80, 400); - ntype->gather_add_node_search_ops = blender::nodes::search_node_add_ops_for_basic_node; ntype->declare_dynamic = blender::nodes::group_output_declare_dynamic; ntype->insert_link = blender::nodes::group_output_insert_link; diff --git a/source/blender/nodes/shader/node_shader_util.cc b/source/blender/nodes/shader/node_shader_util.cc index 8bda16bdcff..aa738e20c72 100644 --- a/source/blender/nodes/shader/node_shader_util.cc +++ b/source/blender/nodes/shader/node_shader_util.cc @@ -19,7 +19,6 @@ #include "node_shader_util.hh" -#include "NOD_add_node_search.hh" #include "NOD_socket_search_link.hh" #include "RE_engine.h" @@ -55,7 +54,6 @@ void sh_node_type_base(bNodeType *ntype, int type, const char *name, short nclas ntype->poll = sh_node_poll_default; ntype->insert_link = node_insert_link_default; ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; - ntype->gather_add_node_search_ops = blender::nodes::search_node_add_ops_for_basic_node; } void sh_fn_node_type_base(bNodeType *ntype, int type, const char *name, short nclass) @@ -63,7 +61,6 @@ void sh_fn_node_type_base(bNodeType *ntype, int type, const char *name, short nc sh_node_type_base(ntype, type, name, nclass); ntype->poll = sh_fn_poll_default; ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; - ntype->gather_add_node_search_ops = blender::nodes::search_node_add_ops_for_basic_node; } bool line_style_shader_nodes_poll(const bContext *C) diff --git a/source/blender/nodes/shader/nodes/node_shader_mix.cc b/source/blender/nodes/shader/nodes/node_shader_mix.cc index 072c3295b00..54ed933a6f2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mix.cc @@ -24,7 +24,6 @@ #include "FN_multi_function_builder.hh" -#include "NOD_add_node_search.hh" #include "NOD_multi_function.hh" #include "NOD_socket_search_link.hh" @@ -268,16 +267,6 @@ static void node_mix_gather_link_searches(GatherLinkSearchOpParams ¶ms) } } -static void gather_add_node_searches(GatherAddNodeSearchParams ¶ms) -{ - params.add_single_node_item(IFACE_("Mix"), params.node_type().ui_description); - params.add_single_node_item(IFACE_("Mix Color"), - params.node_type().ui_description, - [](const bContext & /*C*/, bNodeTree & /*node_tree*/, bNode &node) { - node_storage(node).data_type = SOCK_RGBA; - }); -} - static void node_mix_init(bNodeTree * /*tree*/, bNode *node) { NodeShaderMix *data = MEM_cnew(__func__); @@ -573,6 +562,5 @@ void register_node_type_sh_mix() ntype.draw_buttons = file_ns::sh_node_mix_layout; ntype.labelfunc = file_ns::sh_node_mix_label; ntype.gather_link_search_ops = file_ns::node_mix_gather_link_searches; - ntype.gather_add_node_search_ops = file_ns::gather_add_node_searches; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc index b6576c247f8..457ec46a091 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc @@ -164,6 +164,5 @@ void register_node_type_sh_mix_rgb() ntype.gpu_fn = file_ns::gpu_shader_mix_rgb; ntype.build_multi_function = file_ns::sh_node_mix_rgb_build_multi_function; ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc index 1d342e197da..625cbd15fc9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc @@ -41,7 +41,6 @@ void register_node_type_sh_sephsv() ntype.declare = file_ns::node_declare_sephsv; ntype.gpu_fn = file_ns::gpu_shader_sephsv; ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; nodeRegisterType(&ntype); } @@ -79,7 +78,6 @@ void register_node_type_sh_combhsv() ntype.declare = file_ns::node_declare_combhsv; ntype.gpu_fn = file_ns::gpu_shader_combhsv; ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc index e8cb0d9fe42..0805ac1bb5d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc @@ -85,7 +85,6 @@ void register_node_type_sh_seprgb() ntype.gpu_fn = file_ns::gpu_shader_seprgb; ntype.build_multi_function = file_ns::sh_node_seprgb_build_multi_function; ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; nodeRegisterType(&ntype); } @@ -131,7 +130,6 @@ void register_node_type_sh_combrgb() ntype.gpu_fn = file_ns::gpu_shader_combrgb; ntype.build_multi_function = file_ns::sh_node_combrgb_build_multi_function; ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc index 5b7bfb41966..83071288809 100644 --- a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc +++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc @@ -37,7 +37,6 @@ void register_node_type_sh_squeeze() sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value (Legacy)", NODE_CLASS_CONVERTER); ntype.gather_link_search_ops = nullptr; - ntype.gather_add_node_search_ops = nullptr; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::gpu_shader_squeeze; diff --git a/source/blender/nodes/texture/node_texture_util.cc b/source/blender/nodes/texture/node_texture_util.cc index 9715697bd95..ff356a14157 100644 --- a/source/blender/nodes/texture/node_texture_util.cc +++ b/source/blender/nodes/texture/node_texture_util.cc @@ -24,7 +24,6 @@ #include "BKE_node_runtime.hh" -#include "NOD_add_node_search.hh" #include "NOD_texture.h" #include "node_texture_util.hh" @@ -47,7 +46,6 @@ void tex_node_type_base(bNodeType *ntype, int type, const char *name, short ncla ntype->poll = tex_node_poll_default; ntype->insert_link = node_insert_link_default; - ntype->gather_add_node_search_ops = blender::nodes::search_node_add_ops_for_basic_node; } static void tex_call_delegate(TexDelegate *dg, float *out, TexParams *params, short thread)