Add a per node type callback for creating node add search operations,
similar to the way link drag search is implemented (11be151d58).
Currently the searchable strings have to be separate items in the list.
In a separate step, we can look into adding invisible searchable text
to search items if that's still necessary.
Resolves #102118
Pull Request #104794
26 lines
760 B
C++
26 lines
760 B
C++
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#include "BKE_node.h"
|
|
|
|
#include "BLT_translation.h"
|
|
|
|
#include "NOD_add_node_search.hh"
|
|
#include "NOD_node_declaration.hh"
|
|
|
|
namespace blender::nodes {
|
|
|
|
void GatherAddNodeSearchParams::add_item(std::string ui_name,
|
|
std::string description,
|
|
AddNodeInfo::AfterAddFn fn,
|
|
int weight)
|
|
{
|
|
r_items.append(AddNodeInfo{std::move(ui_name), std::move(description), std::move(fn), weight});
|
|
}
|
|
|
|
void search_node_add_ops_for_basic_node(GatherAddNodeSearchParams ¶ms)
|
|
{
|
|
params.add_item(IFACE_(params.node_type().ui_name), TIP_(params.node_type().ui_description));
|
|
}
|
|
|
|
} // namespace blender::nodes
|