2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2020-04-20 15:27:12 +02:00
|
|
|
|
2025-01-14 14:39:36 +01:00
|
|
|
#include <optional>
|
|
|
|
|
|
2020-07-07 18:23:33 +02:00
|
|
|
#include "node_function_util.hh"
|
2023-05-03 14:21:14 +02:00
|
|
|
#include "node_util.hh"
|
2020-04-20 15:27:12 +02:00
|
|
|
|
2021-12-15 09:51:57 -06:00
|
|
|
#include "NOD_socket_search_link.hh"
|
|
|
|
|
|
2024-05-13 16:07:12 +02:00
|
|
|
static bool fn_node_poll_default(const blender::bke::bNodeType * /*ntype*/,
|
2022-12-28 20:15:41 -05:00
|
|
|
const bNodeTree *ntree,
|
2021-04-12 18:43:23 +02:00
|
|
|
const char **r_disabled_hint)
|
2020-04-20 15:27:12 +02:00
|
|
|
{
|
|
|
|
|
/* Function nodes are only supported in simulation node trees so far. */
|
2021-04-12 18:43:23 +02:00
|
|
|
if (!STREQ(ntree->idname, "GeometryNodeTree")) {
|
2024-01-11 19:49:03 +01:00
|
|
|
*r_disabled_hint = RPT_("Not a geometry node tree");
|
2021-04-12 18:43:23 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
2020-04-20 15:27:12 +02:00
|
|
|
}
|
|
|
|
|
|
2025-01-14 14:39:36 +01:00
|
|
|
void fn_node_type_base(blender::bke::bNodeType *ntype,
|
|
|
|
|
std::string idname,
|
|
|
|
|
const std::optional<int16_t> legacy_type)
|
2020-04-20 15:27:12 +02:00
|
|
|
{
|
2025-02-19 13:44:11 +01:00
|
|
|
blender::bke::node_type_base(*ntype, idname, legacy_type);
|
2020-04-20 15:27:12 +02:00
|
|
|
ntype->poll = fn_node_poll_default;
|
2020-12-02 16:31:06 +01:00
|
|
|
ntype->insert_link = node_insert_link_default;
|
2021-12-15 09:51:57 -06:00
|
|
|
ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node;
|
2020-04-20 15:27:12 +02:00
|
|
|
}
|