Geometry Nodes: support link drag search for Bake node
Fixes #124625. Pull Request: https://projects.blender.org/blender/blender/pulls/124659
This commit is contained in:
committed by
Jacques Lucke
parent
8fdb190278
commit
649fa05bcb
@@ -8,6 +8,7 @@
|
||||
#include "NOD_node_extra_info.hh"
|
||||
#include "NOD_rna_define.hh"
|
||||
#include "NOD_socket_items_ops.hh"
|
||||
#include "NOD_socket_search_link.hh"
|
||||
|
||||
#include "UI_interface.hh"
|
||||
#include "UI_resources.hh"
|
||||
@@ -654,6 +655,28 @@ static void node_layout_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
draw_data_blocks(C, layout, ctx.bake_rna);
|
||||
}
|
||||
|
||||
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
|
||||
{
|
||||
const eNodeSocketDatatype type = eNodeSocketDatatype(params.other_socket().type);
|
||||
if (type == SOCK_GEOMETRY) {
|
||||
params.add_item(IFACE_("Geometry"), [](LinkSearchOpParams ¶ms) {
|
||||
bNode &node = params.add_node("GeometryNodeBake");
|
||||
params.connect_available_socket(node, "Geometry");
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!BakeItemsAccessor::supports_socket_type(type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
params.add_item(IFACE_("Value"), [type](LinkSearchOpParams ¶ms) {
|
||||
bNode &node = params.add_node("GeometryNodeBake");
|
||||
socket_items::add_item_with_socket_type_and_name<BakeItemsAccessor>(
|
||||
node, type, params.socket.name);
|
||||
params.update_and_connect_available_socket(node, params.socket.name);
|
||||
});
|
||||
}
|
||||
|
||||
static void node_register()
|
||||
{
|
||||
static blender::bke::bNodeType ntype;
|
||||
@@ -666,6 +689,7 @@ static void node_register()
|
||||
ntype.draw_buttons_ex = node_layout_ex;
|
||||
ntype.get_extra_info = node_extra_info;
|
||||
ntype.register_operators = node_operators;
|
||||
ntype.gather_link_search_ops = node_gather_link_searches;
|
||||
blender::bke::node_type_storage(
|
||||
&ntype, "NodeGeometryBake", node_free_storage, node_copy_storage);
|
||||
blender::bke::nodeRegisterType(&ntype);
|
||||
|
||||
Reference in New Issue
Block a user