Blender  V2.93
node_geo_common.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #include "BKE_node.h"
18 
19 #include "NOD_geometry.h"
20 
21 #include "NOD_common.h"
22 #include "node_common.h"
23 #include "node_geometry_util.hh"
24 
26 {
27  static bNodeType ntype;
28 
29  node_type_base_custom(&ntype, "GeometryNodeGroup", "Group", NODE_CLASS_GROUP, 0);
30  ntype.type = NODE_GROUP;
35  ntype.rna_ext.srna = RNA_struct_find("GeometryNodeGroup");
36  BLI_assert(ntype.rna_ext.srna != nullptr);
38 
39  node_type_socket_templates(&ntype, nullptr, nullptr);
40  node_type_size(&ntype, 140, 60, 400);
43 
44  nodeRegisterType(&ntype);
45 }
46 
48 {
49  /* These methods can be overridden but need a default implementation otherwise. */
50  if (ntype->poll == nullptr) {
51  ntype->poll = geo_node_poll_default;
52  }
53  if (ntype->insert_link == nullptr) {
55  }
56  if (ntype->update_internal_links == nullptr) {
58  }
59 }
void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth)
Definition: node.cc:4565
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
Definition: node.cc:4527
void node_type_base_custom(struct bNodeType *ntype, const char *idname, const char *name, short nclass, short flag)
Definition: node.cc:4478
void node_type_group_update(struct bNodeType *ntype, void(*group_update_func)(struct bNodeTree *ntree, struct bNode *node))
Definition: node.cc:4629
#define NODE_CLASS_GROUP
Definition: BKE_node.h:339
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1298
void node_type_label(struct bNodeType *ntype, void(*labelfunc)(struct bNodeTree *ntree, struct bNode *, char *label, int maxlen))
#define BLI_assert(a)
Definition: BLI_assert.h:58
NODE_GROUP
void node_group_update(struct bNodeTree *ntree, struct bNode *node)
Definition: node_common.c:187
bool node_group_poll_instance(bNode *node, bNodeTree *nodetree, const char **disabled_hint)
Definition: node_common.c:82
void node_group_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
Definition: node_common.c:77
void register_node_type_geo_custom_group(bNodeType *ntype)
void register_node_type_geo_group(void)
bool geo_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree, const char **r_disabled_hint)
void node_insert_link_default(bNodeTree *ntree, bNode *node, bNodeLink *link)
Definition: node_util.c:305
void node_update_internal_links_default(bNodeTree *ntree, bNode *node)
Definition: node_util.c:503
void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type)
Definition: rna_access.c:1044
StructRNA * RNA_struct_find(const char *identifier)
Definition: rna_access.c:718
StructRNA * srna
Definition: RNA_types.h:681
Defines a node type.
Definition: BKE_node.h:221
bool(* poll)(struct bNodeType *ntype, struct bNodeTree *nodetree, const char **r_disabled_hint)
Definition: BKE_node.h:301
void(* update_internal_links)(struct bNodeTree *, struct bNode *node)
Definition: BKE_node.h:312
ExtensionRNA rna_ext
Definition: BKE_node.h:330
int type
Definition: BKE_node.h:225
void(* insert_link)(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link)
Definition: BKE_node.h:310
bool(* poll_instance)(struct bNode *node, struct bNodeTree *nodetree, const char **r_disabled_hint)
Definition: BKE_node.h:305