Blender  V3.3
node_geo_separate_components.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 
6 
8 {
9  b.add_input<decl::Geometry>(N_("Geometry"));
10  b.add_output<decl::Geometry>(N_("Mesh"));
11  b.add_output<decl::Geometry>(N_("Point Cloud"));
12  b.add_output<decl::Geometry>(N_("Curve"));
13  b.add_output<decl::Geometry>(N_("Volume"));
14  b.add_output<decl::Geometry>(N_("Instances"));
15 }
16 
18 {
19  GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
20 
21  GeometrySet meshes;
22  GeometrySet point_clouds;
23  GeometrySet volumes;
25  GeometrySet instances;
26 
27  if (geometry_set.has<MeshComponent>()) {
28  meshes.add(*geometry_set.get_component_for_read<MeshComponent>());
29  }
30  if (geometry_set.has<PointCloudComponent>()) {
31  point_clouds.add(*geometry_set.get_component_for_read<PointCloudComponent>());
32  }
33  if (geometry_set.has<CurveComponent>()) {
34  curves.add(*geometry_set.get_component_for_read<CurveComponent>());
35  }
36  if (geometry_set.has<VolumeComponent>()) {
37  volumes.add(*geometry_set.get_component_for_read<VolumeComponent>());
38  }
39  if (geometry_set.has<InstancesComponent>()) {
40  instances.add(*geometry_set.get_component_for_read<InstancesComponent>());
41  }
42 
43  params.set_output("Mesh", meshes);
44  params.set_output("Point Cloud", point_clouds);
45  params.set_output("Curve", curves);
46  params.set_output("Volume", volumes);
47  params.set_output("Instances", instances);
48 }
49 
50 } // namespace blender::nodes::node_geo_separate_components_cc
51 
53 {
55 
56  static bNodeType ntype;
57 
59  &ntype, GEO_NODE_SEPARATE_COMPONENTS, "Separate Components", NODE_CLASS_GEOMETRY);
62  nodeRegisterType(&ntype);
63 }
#define GEO_NODE_SEPARATE_COMPONENTS
Definition: BKE_node.h:1407
#define NODE_CLASS_GEOMETRY
Definition: BKE_node.h:359
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to curves
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
static void node_declare(NodeDeclarationBuilder &b)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_geo_separate_components()
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
bool has(const GeometryComponentType component_type) const
const GeometryComponent * get_component_for_read(GeometryComponentType component_type) const
void add(const GeometryComponent &component)
Defines a node type.
Definition: BKE_node.h:226
NodeGeometryExecFunction geometry_node_execute
Definition: BKE_node.h:316
NodeDeclareFunction declare
Definition: BKE_node.h:324
#define N_(msgid)