17 .
description(
"The curve to retrieve data from. Defaults to the curve from the context")
18 .structure_type(StructureType::Field);
20 .structure_type(StructureType::Field)
22 .description(
"Values used to sort the curve's points. Uses indices by default");
24 .structure_type(StructureType::Field)
25 .
description(
"Which of the sorted points to output. Negative indexing is supported");
27 .structure_type(StructureType::Field)
28 .propagate_references()
29 .
description(
"A point of the curve, chosen by the sort index");
31 .structure_type(StructureType::Field)
32 .propagate_references({0})
33 .description(
"The number of points in the curve");
62 curve_index_(std::move(curve_index)),
63 sort_index_(std::move(sort_index)),
64 sort_weight_(std::move(sort_weight))
78 if (context.domain() == AttrDomain::Curve) {
85 evaluator.
add(curve_index_);
86 evaluator.
add(sort_index_);
93 point_evaluator.
add(sort_weight_);
96 const bool use_sorting = !all_sort_weights.
is_single();
105 for (
const int selection_i : segment) {
106 const int curve_i = curve_indices[selection_i];
107 const int index_in_sort = indices_in_sort[selection_i];
108 if (!
curves.curves_range().contains(curve_i)) {
109 point_of_curve[selection_i] = 0;
112 const IndexRange points = points_by_curve[curve_i];
114 const int index_in_sort_wrapped =
mod_i(index_in_sort, points.
size());
127 std::stable_sort(sort_indices.
begin(), sort_indices.
end(), [&](
int a,
int b) {
128 return sort_weights[a] < sort_weights[b];
130 point_of_curve[selection_i] = points[sort_indices[index_in_sort_wrapped]];
133 point_of_curve[selection_i] = points[index_in_sort_wrapped];
151 static constexpr int8_t id = 0;
153 hash.add(deep_hash_cache.
ensure(curve_index_));
154 hash.add(deep_hash_cache.
ensure(sort_index_));
155 hash.add(deep_hash_cache.
ensure(sort_weight_));
160 return AttrDomain::Curve;
172 if (domain != AttrDomain::Curve) {
177 return points_by_curve[curve_i].size();
183 static constexpr int8_t id = 0;
189 return AttrDomain::Curve;
216 ntype.
ui_name =
"Points of Curve";
Low-level operations for curves.
#define GEO_NODE_CURVE_TOPOLOGY_POINTS_OF_CURVE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
MutableSpan< T > as_mutable_span()
void reinitialize(const int64_t new_size)
constexpr int64_t size() const
void materialize_compressed(const IndexMask &mask, MutableSpan< T > r_span) const
static VArray from_func(const int64_t size, GetFunc get_func)
static VArray from_span(Span< T > values)
static VArray from_container(ContainerT container)
int add(GField field, GVArray *varray_ptr)
const GVArray & get_evaluated(const int field_index) const
bool depends_on_input() const
const InputT * get_input_if() const
static Field from_input(Args &&...args)
T extract_input(const UString identifier)
bool output_is_required(const UString identifier) const
void set_output(const UString identifier, T &&value)
void fill_index_range(MutableSpan< T > span, const T start=0)
void node_register_type(bNodeType &ntype)
constexpr ParallelGrainSize grain_size(int grain_size)
void evaluate_constant_field(const GField &field, void *r_value)
static void node_geo_exec(GeoNodeExecParams params)
static void node_register()
static bool use_start_point_special_case(const Field< int > &curve_index, const Field< int > &sort_index, const Field< float > &sort_weights)
static void node_declare(NodeDeclarationBuilder &b)
MINLINE int mod_i(int i, int n)
@ NODE_DEFAULT_INPUT_INDEX_FIELD
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
NodeDeclareFunction declare
UniqueHash ensure(const GFieldRef &field)