Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
| Show All 21 Lines | |||||
| extern "C" { | extern "C" { | ||||
| Mesh *triangulate_mesh(Mesh *mesh, | Mesh *triangulate_mesh(Mesh *mesh, | ||||
| const int quad_method, | const int quad_method, | ||||
| const int ngon_method, | const int ngon_method, | ||||
| const int min_vertices, | const int min_vertices, | ||||
| const int flag); | const int flag); | ||||
| } | } | ||||
| namespace blender::nodes { | namespace blender::nodes::node_geo_triangulate_cc { | ||||
| static void geo_node_triangulate_declare(NodeDeclarationBuilder &b) | static void geo_node_triangulate_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH); | b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH); | ||||
| b.add_input<decl::Int>(N_("Minimum Vertices")).default_value(4).min(4).max(10000); | b.add_input<decl::Int>(N_("Minimum Vertices")).default_value(4).min(4).max(10000); | ||||
| b.add_output<decl::Geometry>(N_("Mesh")); | b.add_output<decl::Geometry>(N_("Mesh")); | ||||
| } | } | ||||
| Show All 25 Lines | geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) { | ||||
| if (mesh_in != nullptr) { | if (mesh_in != nullptr) { | ||||
| Mesh *mesh_out = triangulate_mesh(mesh_in, quad_method, ngon_method, min_vertices, 0); | Mesh *mesh_out = triangulate_mesh(mesh_in, quad_method, ngon_method, min_vertices, 0); | ||||
| geometry_set.replace_mesh(mesh_out); | geometry_set.replace_mesh(mesh_out); | ||||
| } | } | ||||
| }); | }); | ||||
| params.set_output("Mesh", std::move(geometry_set)); | params.set_output("Mesh", std::move(geometry_set)); | ||||
| } | } | ||||
| } // namespace blender::nodes | } // namespace blender::nodes::node_geo_triangulate_cc | ||||
| void register_node_type_geo_triangulate() | void register_node_type_geo_triangulate() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_geo_triangulate_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| geo_node_type_base(&ntype, GEO_NODE_TRIANGULATE, "Triangulate", NODE_CLASS_GEOMETRY, 0); | geo_node_type_base(&ntype, GEO_NODE_TRIANGULATE, "Triangulate", NODE_CLASS_GEOMETRY, 0); | ||||
| ntype.declare = blender::nodes::geo_node_triangulate_declare; | ntype.declare = file_ns::geo_node_triangulate_declare; | ||||
| node_type_init(&ntype, blender::nodes::geo_triangulate_init); | node_type_init(&ntype, file_ns::geo_triangulate_init); | ||||
| ntype.geometry_node_execute = blender::nodes::geo_node_triangulate_exec; | ntype.geometry_node_execute = file_ns::geo_node_triangulate_exec; | ||||
| ntype.draw_buttons = blender::nodes::geo_node_triangulate_layout; | ntype.draw_buttons = file_ns::geo_node_triangulate_layout; | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||