Blender V4.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
5#include "BLI_string.h"
6
7#include "NOD_geometry.hh"
8#include "NOD_register.hh"
9#include "NOD_socket.hh"
10
11#include "BKE_node.hh"
12
13#include "BLT_translation.hh"
14
15#include "UI_resources.hh"
16
17static bool node_undefined_poll(const blender::bke::bNodeType * /*ntype*/,
18 const bNodeTree * /*nodetree*/,
19 const char ** /*r_disabled_hint*/)
20{
21 /* this type can not be added deliberately, it's just a placeholder */
22 return false;
23}
24
25/* register fallback types used for undefined tree, nodes, sockets */
27{
28 /* NOTE: these types are not registered in the type hashes,
29 * they are just used as placeholders in case the actual types are not registered.
30 */
31
33 STRNCPY(blender::bke::NodeTreeTypeUndefined.idname, "NodeTreeUndefined");
34 STRNCPY(blender::bke::NodeTreeTypeUndefined.ui_name, N_("Undefined"));
35 STRNCPY(blender::bke::NodeTreeTypeUndefined.ui_description, N_("Undefined Node Tree Type"));
36
38 &blender::bke::NodeTypeUndefined, "NodeUndefined", "Undefined", "UNDEFINED", 0);
40
41 STRNCPY(blender::bke::NodeSocketTypeUndefined.idname, "NodeSocketUndefined");
42 /* extra type info for standard socket types */
45
49}
50
52 public:
54 {
55 this->input_idname = "GeometryNodeSimulationInput";
56 this->output_idname = "GeometryNodeSimulationOutput";
60 }
61
62 const int &get_corresponding_output_id(const bNode &input_bnode) const override
63 {
64 BLI_assert(input_bnode.type == this->input_type);
65 return static_cast<NodeGeometrySimulationInput *>(input_bnode.storage)->output_node_id;
66 }
67};
68
70 public:
72 {
73 this->input_idname = "GeometryNodeRepeatInput";
74 this->output_idname = "GeometryNodeRepeatOutput";
78 }
79
80 const int &get_corresponding_output_id(const bNode &input_bnode) const override
81 {
82 BLI_assert(input_bnode.type == this->input_type);
83 return static_cast<NodeGeometryRepeatInput *>(input_bnode.storage)->output_node_id;
84 }
85};
86
88 public:
90 {
91 this->input_idname = "GeometryNodeForeachGeometryElementInput";
92 this->output_idname = "GeometryNodeForeachGeometryElementOutput";
96 }
97
98 const int &get_corresponding_output_id(const bNode &input_bnode) const override
99 {
100 BLI_assert(input_bnode.type == this->input_type);
101 return static_cast<NodeGeometryForeachGeometryElementInput *>(input_bnode.storage)
102 ->output_node_id;
103 }
104};
105
107{
108 static SimulationZoneType simulation_zone_type;
109 static RepeatZoneType repeat_zone_type;
110 static ForeachGeometryElementZoneType foreach_geometry_element_zone_type;
111 blender::bke::register_node_zone_type(simulation_zone_type);
113 blender::bke::register_node_zone_type(foreach_geometry_element_zone_type);
114}
115
#define GEO_NODE_FOREACH_GEOMETRY_ELEMENT_INPUT
Definition BKE_node.hh:1378
#define GEO_NODE_FOREACH_GEOMETRY_ELEMENT_OUTPUT
Definition BKE_node.hh:1379
#define GEO_NODE_SIMULATION_OUTPUT
Definition BKE_node.hh:1331
#define GEO_NODE_REPEAT_OUTPUT
Definition BKE_node.hh:1338
#define GEO_NODE_REPEAT_INPUT
Definition BKE_node.hh:1337
#define GEO_NODE_SIMULATION_INPUT
Definition BKE_node.hh:1330
#define BLI_assert(a)
Definition BLI_assert.h:50
#define STRNCPY(dst, src)
Definition BLI_string.h:593
@ NTREE_UNDEFINED
@ SOCK_CUSTOM
void register_shader_nodes()
void register_function_nodes()
void register_texture_nodes()
void register_geometry_nodes()
@ PROP_NONE
Definition RNA_types.hh:136
@ TH_NODE_ZONE_REPEAT
@ TH_NODE_ZONE_FOREACH_GEOMETRY_ELEMENT
@ TH_NODE_ZONE_SIMULATION
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:136
bNodeTreeType NodeTreeTypeUndefined
Definition node.cc:134
bNodeType NodeTypeUndefined
Definition node.cc:135
void register_node_zone_type(const bNodeZoneType &zone_type)
void node_type_base_custom(bNodeType *ntype, const char *idname, const char *name, const char *enum_name, short nclass)
Definition node.cc:4364
void register_node_type_group_output()
void register_node_type_group_input()
void register_node_type_frame()
void register_node_type_reroute()
void register_composite_nodes()
void register_node_tree_type_geo()
static void register_zone_types()
static bool node_undefined_poll(const blender::bke::bNodeType *, const bNodeTree *, const char **)
static void register_undefined_types()
void register_nodes()
void register_standard_node_socket_types()
void * storage
int16_t type
Defines a node type.
Definition BKE_node.hh:218
bool(* poll)(const bNodeType *ntype, const bNodeTree *nodetree, const char **r_disabled_hint)
Definition BKE_node.hh:299
#define N_(msgid)