19 .supported_type(GeometryComponent::Type::Mesh)
35 const int second_vert = next_indices[first_vert];
36 if (first_vert == second_vert) {
39 if (second_vert < 0 || second_vert >= mesh.
verts_num) {
46 int current_vert = first_vert;
47 while (!visited[current_vert]) {
48 visited[current_vert] =
true;
49 vert_indices.
append(current_vert);
50 const int next_vert = next_indices[current_vert];
51 if (next_vert < 0 || next_vert >= mesh.
verts_num) {
54 current_vert = next_vert;
58 const int points_in_curve_num = vert_indices.
size() - curve_offsets.
last();
59 for (
const int vert_in_curve : vert_indices.
as_span().take_back(points_in_curve_num)) {
60 visited[vert_in_curve] =
false;
78 if (mesh ==
nullptr) {
79 geometry_set.
keep_only({GeometryComponent::Type::Edit});
91 if (start_verts.is_empty()) {
92 geometry_set.
keep_only({GeometryComponent::Type::Edit});
97 *mesh, start_verts, next_vert,
params.get_attribute_filter(
"Curves")));
98 geometry_set.
keep_only({GeometryComponent::Type::Curve, GeometryComponent::Type::Edit});
101 params.set_output(
"Curves", std::move(geometry_set));
109 ntype.
ui_name =
"Edge Paths to Curves";
110 ntype.
ui_description =
"Output curves following paths across mesh edges";
Low-level operations for curves.
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_EDGE_PATHS_TO_CURVES
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void append(const T &value)
const T & last(const int64_t n=0) const
Span< T > as_span() const
int add(GField field, GVArray *varray_ptr)
IndexMask get_evaluated_as_mask(int field_index)
const GVArray & get_evaluated(const int field_index) const
void foreach_index(Fn &&fn) const
void node_register_type(bNodeType &ntype)
Curves * curves_new_nomain(int points_num, int curves_num)
void foreach_real_geometry(bke::GeometrySet &geometry, FunctionRef< void(bke::GeometrySet &geometry_set)> fn)
bke::CurvesGeometry create_curve_from_vert_indices(const bke::AttributeAccessor &mesh_attributes, Span< int > vert_indices, Span< int > curve_offsets, IndexRange cyclic_curves, const bke::AttributeFilter &attribute_filter)
static void node_register()
static void node_declare(NodeDeclarationBuilder &b)
static Curves * edge_paths_to_curves_convert(const Mesh &mesh, const IndexMask &start_verts_mask, const Span< int > next_indices, const AttributeFilter &attribute_filter)
static void node_geo_exec(GeoNodeExecParams params)
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
void keep_only(Span< GeometryComponent::Type > component_types)
void replace_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
const Mesh * get_mesh() const
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
NodeDeclareFunction declare