Blender V5.3
node_register.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
8
9#include "NOD_composite.hh"
10#include "NOD_geometry.hh"
11#include "NOD_register.hh"
12#include "NOD_socket.hh"
13
14#include "BKE_node.hh"
16
17#include "BLT_translation.hh"
18
19#include "UI_resources.hh"
20
21namespace blender {
22
23static bool node_undefined_poll(const bke::bNodeType * /*ntype*/,
24 const bNodeTree * /*nodetree*/,
25 const char ** /*r_disabled_hint*/)
26{
27 /* this type can not be added deliberately, it's just a placeholder */
28 return false;
29}
30
31/* register fallback types used for undefined tree, nodes, sockets */
33{
34 /* NOTE: these types are not registered in the type hashes,
35 * they are just used as placeholders in case the actual types are not registered.
36 */
37
39 bke::NodeTreeTypeUndefined.idname = "NodeTreeUndefined"_ustr;
40 bke::NodeTreeTypeUndefined.ui_name = N_("Undefined");
41 bke::NodeTreeTypeUndefined.ui_description = N_("Undefined Node Tree Type");
42
43 bke::node_type_base_custom(bke::NodeTypeUndefined, "NodeUndefined", "Undefined", "UNDEFINED", 0);
45
46 bke::NodeSocketTypeUndefined.idname = "NodeSocketUndefined"_ustr;
47 /* extra type info for standard socket types */
50
51 bke::NodeSocketTypeUndefined.use_link_limits_of_type = true;
52 bke::NodeSocketTypeUndefined.input_link_limit = 0xFFF;
53 bke::NodeSocketTypeUndefined.output_link_limit = 0xFFF;
54}
55
57 public:
59 {
60 this->input_idname = "GeometryNodeSimulationInput"_ustr;
61 this->output_idname = "GeometryNodeSimulationOutput"_ustr;
65 }
66
67 const int &get_corresponding_output_id(const bNode &input_bnode) const override
68 {
69 BLI_assert(input_bnode.type_legacy == this->input_type);
70 return static_cast<NodeGeometrySimulationInput *>(input_bnode.storage)->output_node_id;
71 }
72};
73
75 public:
77 {
78 this->input_idname = "GeometryNodeRepeatInput"_ustr;
79 this->output_idname = "GeometryNodeRepeatOutput"_ustr;
83 }
84
85 const int &get_corresponding_output_id(const bNode &input_bnode) const override
86 {
87 BLI_assert(input_bnode.type_legacy == this->input_type);
88 return static_cast<NodeGeometryRepeatInput *>(input_bnode.storage)->output_node_id;
89 }
90};
91
93 public:
95 {
96 this->input_idname = "GeometryNodeForeachGeometryElementInput"_ustr;
97 this->output_idname = "GeometryNodeForeachGeometryElementOutput"_ustr;
101 }
102
103 const int &get_corresponding_output_id(const bNode &input_bnode) const override
104 {
105 BLI_assert(input_bnode.type_legacy == this->input_type);
106 return static_cast<NodeGeometryForeachGeometryElementInput *>(input_bnode.storage)
107 ->output_node_id;
108 }
109};
110
112 public:
114 {
115 this->input_idname = "NodeClosureInput"_ustr;
116 this->output_idname = "NodeClosureOutput"_ustr;
120 }
121
122 const int &get_corresponding_output_id(const bNode &input_bnode) const override
123 {
124 BLI_assert(input_bnode.type_legacy == this->input_type);
125 return static_cast<NodeClosureInput *>(input_bnode.storage)->output_node_id;
126 }
127};
128
130 public:
132 {
133 this->input_idname = "ShaderNodeLightIterInternalInput"_ustr;
134 this->output_idname = "ShaderNodeLightIterInternalOutput"_ustr;
138 }
139
140 const int &get_corresponding_output_id(const bNode &input_bnode) const override
141 {
142 BLI_assert(input_bnode.type_legacy == this->input_type);
143 return *reinterpret_cast<const int *>(&input_bnode.custom3);
144 }
145};
146
148{
149 static SimulationZoneType simulation_zone_type;
150 static RepeatZoneType repeat_zone_type;
151 static ForeachGeometryElementZoneType foreach_geometry_element_zone_type;
152 static ClosureZoneType closure_zone_type;
153 static LightIterInternalZoneType light_iter_internal_zone_type;
154 bke::register_node_zone_type(simulation_zone_type);
155 bke::register_node_zone_type(repeat_zone_type);
156 bke::register_node_zone_type(foreach_geometry_element_zone_type);
157 bke::register_node_zone_type(closure_zone_type);
158 bke::register_node_zone_type(light_iter_internal_zone_type);
159}
160
185
186} // namespace blender
#define SH_NODE_LIGHT_ITER_INTERNAL_OUTPUT
#define GEO_NODE_FOREACH_GEOMETRY_ELEMENT_INPUT
#define GEO_NODE_FOREACH_GEOMETRY_ELEMENT_OUTPUT
#define GEO_NODE_SIMULATION_OUTPUT
#define NODE_CLOSURE_OUTPUT
#define GEO_NODE_REPEAT_OUTPUT
#define SH_NODE_LIGHT_ITER_INTERNAL_INPUT
#define GEO_NODE_REPEAT_INPUT
#define GEO_NODE_SIMULATION_INPUT
#define NODE_CLOSURE_INPUT
const int & get_corresponding_output_id(const bNode &input_bnode) const override
const int & get_corresponding_output_id(const bNode &input_bnode) const override
const int & get_corresponding_output_id(const bNode &input_bnode) const override
const int & get_corresponding_output_id(const bNode &input_bnode) const override
const int & get_corresponding_output_id(const bNode &input_bnode) const override
bNodeSocketType NodeSocketTypeUndefined
Definition node.cc:135
bNodeTreeType NodeTreeTypeUndefined
Definition node.cc:133
bNodeType NodeTypeUndefined
Definition node.cc:134
void register_node_zone_type(const bNodeZoneType &zone_type)
void node_type_base_custom(bNodeType &ntype, StringRefNull idname, StringRefNull name, StringRefNull enum_name, short nclass)
Definition node.cc:5896
BMesh Iterators.
void register_compositor_nodes()
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void register_node_type_group_input()
void register_function_nodes()
@ TH_NODE_ZONE_SIMULATION
@ TH_NODE_ZONE_CLOSURE
@ TH_NODE_ZONE_REPEAT
@ TH_NODE_ZONE_FOREACH_GEOMETRY_ELEMENT
void register_texture_nodes()
void register_node_type_reroute()
void register_node_type_frame()
void register_node_type_group_output()
void register_geometry_nodes()
void register_node_tree_type_geo()
void register_nodes()
static bool node_undefined_poll(const bke::bNodeType *, const bNodeTree *, const char **)
static void register_zone_types()
void register_node_type_implicit_conversion()
static void register_undefined_types()
void register_node_tree_type_cmp()
void register_standard_node_socket_types()
void register_shader_nodes()
void register_node_type_comment()
Defines a node type.
Definition BKE_node.hh:265
#define N_(msgid)