Blender  V3.3
node_geometry_util.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include "node_geometry_util.hh"
4 #include "node_util.h"
5 
6 #include "DNA_mesh_types.h"
7 #include "DNA_meshdata_types.h"
8 
9 #include "BKE_mesh.h"
10 #include "BKE_mesh_runtime.h"
11 #include "BKE_pointcloud.h"
12 
14 
15 namespace blender::nodes {
16 
17 std::optional<eCustomDataType> node_data_type_to_custom_data_type(const eNodeSocketDatatype type)
18 {
19  switch (type) {
20  case SOCK_FLOAT:
21  return CD_PROP_FLOAT;
22  case SOCK_VECTOR:
23  return CD_PROP_FLOAT3;
24  case SOCK_RGBA:
25  return CD_PROP_COLOR;
26  case SOCK_BOOLEAN:
27  return CD_PROP_BOOL;
28  case SOCK_INT:
29  return CD_PROP_INT32;
30  case SOCK_STRING:
31  return CD_PROP_STRING;
32  default:
33  return {};
34  }
35 }
36 
37 std::optional<eCustomDataType> node_socket_to_custom_data_type(const bNodeSocket &socket)
38 {
39  return node_data_type_to_custom_data_type(static_cast<eNodeSocketDatatype>(socket.type));
40 }
41 
42 } // namespace blender::nodes
43 
46  const char **r_disabled_hint)
47 {
48  if (!STREQ(ntree->idname, "GeometryNodeTree")) {
49  *r_disabled_hint = TIP_("Not a geometry node tree");
50  return false;
51  }
52  return true;
53 }
54 
55 void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
56 {
57  node_type_base(ntype, type, name, nclass);
58  ntype->poll = geo_node_poll_default;
61 }
void node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass)
Definition: node.cc:4277
General operations for point clouds.
#define UNUSED(x)
#define STREQ(a, b)
#define TIP_(msgid)
@ CD_PROP_FLOAT
@ CD_PROP_FLOAT3
@ CD_PROP_COLOR
@ CD_PROP_INT32
@ CD_PROP_BOOL
@ CD_PROP_STRING
eNodeSocketDatatype
@ SOCK_INT
@ SOCK_VECTOR
@ SOCK_BOOLEAN
@ SOCK_FLOAT
@ SOCK_STRING
@ SOCK_RGBA
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
bNodeTree * ntree
void search_link_ops_for_basic_node(GatherLinkSearchOpParams &params)
std::optional< eCustomDataType > node_data_type_to_custom_data_type(const eNodeSocketDatatype type)
std::optional< eCustomDataType > node_socket_to_custom_data_type(const bNodeSocket &socket)
bool geo_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree, const char **r_disabled_hint)
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
void node_insert_link_default(bNodeTree *ntree, bNode *node, bNodeLink *link)
Definition: node_util.c:326
char idname[64]
Defines a node type.
Definition: BKE_node.h:226
bool(* poll)(struct bNodeType *ntype, struct bNodeTree *nodetree, const char **r_disabled_hint)
Definition: BKE_node.h:292
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
Definition: BKE_node.h:335
void(* insert_link)(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link)
Definition: BKE_node.h:301