Blender V5.3
node_function_util.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include <optional>
6
7#include "BLI_string.hh"
8
10#include "node_util.hh"
11
13
14namespace blender {
15
16static bool fn_node_poll_default(const bke::bNodeType * /*ntype*/,
17 const bNodeTree *ntree,
18 const char **r_disabled_hint)
19{
20 /* Function nodes are only supported in simulation node trees so far. */
21 if (!STREQ(ntree->idname, "GeometryNodeTree")) {
22 *r_disabled_hint = RPT_("Not a geometry node tree");
23 return false;
24 }
25 return true;
26}
27
29 UString idname,
30 const std::optional<int16_t> legacy_type)
31{
32 bke::node_type_base(*ntype, idname, legacy_type);
36}
37
38static bool fn_cmp_node_poll_default(const bke::bNodeType * /*ntype*/,
39 const bNodeTree *ntree,
40 const char **r_disabled_hint)
41{
42 if (!STR_ELEM(ntree->idname, "GeometryNodeTree", "CompositorNodeTree")) {
43 *r_disabled_hint = RPT_("Not a geometry or compositor node tree");
44 return false;
45 }
46 return true;
47}
48
50 UString idname,
51 const std::optional<int16_t> legacy_type)
52{
53 bke::node_type_base(*ntype, idname, legacy_type);
57}
58
59} // namespace blender
#define STR_ELEM(...)
#define RPT_(msgid)
#define STREQ(a, b)
void node_type_base(bNodeType &ntype, UString idname, std::optional< int16_t > legacy_type=std::nullopt)
Definition node.cc:5866
void search_link_ops_for_basic_node(GatherLinkSearchOpParams &params)
BMesh Iterators.
void fn_cmp_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
bool node_insert_link_default(bke::NodeInsertLinkParams &)
Definition node_util.cc:223
void fn_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
static bool fn_cmp_node_poll_default(const bke::bNodeType *, const bNodeTree *ntree, const char **r_disabled_hint)
static bool fn_node_poll_default(const bke::bNodeType *, const bNodeTree *ntree, const char **r_disabled_hint)
Defines a node type.
Definition BKE_node.hh:265
bool(*) poll(const bNodeType *ntype, const bNodeTree *nodetree, const char **r_disabled_hint)
Definition BKE_node.hh:352
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
Definition BKE_node.hh:409
bool(*) insert_link(NodeInsertLinkParams &params)
Definition BKE_node.hh:364