diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.cc b/source/blender/nodes/composite/nodes/node_composite_glare.cc index 30dd36bde3e..332587a42ee 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.cc +++ b/source/blender/nodes/composite/nodes/node_composite_glare.cc @@ -212,6 +212,31 @@ static void node_update(bNodeTree *ntree, bNode *node) ntree, streaks_angle_input, glare_type == CMP_NODE_GLARE_STREAKS); } +class SocketSearchOp { + public: + CMPNodeGlareType type = CMP_NODE_GLARE_SIMPLE_STAR; + void operator()(LinkSearchOpParams ¶ms) + { + bNode &node = params.add_node("CompositorNodeGlare"); + node_storage(node).type = this->type; + params.update_and_connect_available_socket(node, "Image"); + } +}; + +static void gather_link_searches(GatherLinkSearchOpParams ¶ms) +{ + const eNodeSocketDatatype from_socket_type = eNodeSocketDatatype(params.other_socket().type); + if (!params.node_tree().typeinfo->validate_link(from_socket_type, SOCK_RGBA)) { + return; + } + + params.add_item(IFACE_("Simple Star"), SocketSearchOp{CMP_NODE_GLARE_SIMPLE_STAR}); + params.add_item(IFACE_("Fog Glow"), SocketSearchOp{CMP_NODE_GLARE_FOG_GLOW}); + params.add_item(IFACE_("Streaks"), SocketSearchOp{CMP_NODE_GLARE_STREAKS}); + params.add_item(IFACE_("Ghost"), SocketSearchOp{CMP_NODE_GLARE_GHOST}); + params.add_item(IFACE_("Bloom"), SocketSearchOp{CMP_NODE_GLARE_BLOOM}); +} + using namespace blender::compositor; class GlareOperation : public NodeOperation { @@ -2378,6 +2403,7 @@ void register_node_type_cmp_glare() ntype.declare = file_ns::cmp_node_glare_declare; ntype.updatefunc = file_ns::node_update; ntype.initfunc = file_ns::node_composit_init_glare; + ntype.gather_link_search_ops = file_ns::gather_link_searches; blender::bke::node_type_storage( &ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation;