17 .
description(
"The curve to retrieve data from. Defaults to the curve from the context")
18 .structure_type(StructureType::Field);
20 "Values used to sort the curve's points. Uses indices by default");
24 .
description(
"Which of the sorted points to output");
26 .field_source_reference_all()
27 .
description(
"A point of the curve, chosen by the sort index");
28 b.add_output<
decl::Int>(
"Total").field_source().reference_pass({0}).description(
29 "The number of points in the curve");
57 :
bke::GeometryFieldInput(
CPPType::get<int>(),
"Point of Curve"),
58 curve_index_(std::move(curve_index)),
59 sort_index_(std::move(sort_index)),
60 sort_weight_(std::move(sort_weight))
75 if (context.domain() == AttrDomain::Curve) {
82 evaluator.
add(curve_index_);
83 evaluator.
add(sort_index_);
90 point_evaluator.
add(sort_weight_);
93 const bool use_sorting = !all_sort_weights.
is_single();
101 for (
const int selection_i : segment) {
102 const int curve_i = curve_indices[selection_i];
103 const int index_in_sort = indices_in_sort[selection_i];
105 point_of_curve[selection_i] = 0;
108 const IndexRange points = points_by_curve[curve_i];
110 const int index_in_sort_wrapped =
mod_i(index_in_sort, points.
size());
123 std::stable_sort(sort_indices.
begin(), sort_indices.
end(), [&](
int a,
int b) {
124 return sort_weights[a] < sort_weights[b];
126 point_of_curve[selection_i] = points[sort_indices[index_in_sort_wrapped]];
129 point_of_curve[selection_i] = points[index_in_sort_wrapped];
139 curve_index_.node().for_each_field_input_recursive(
fn);
140 sort_index_.node().for_each_field_input_recursive(
fn);
141 sort_weight_.node().for_each_field_input_recursive(
fn);
146 return 26978695677882;
152 return typed->curve_index_ == curve_index_ && typed->sort_index_ == sort_index_ &&
153 typed->sort_weight_ == sort_weight_;
160 return AttrDomain::Curve;
175 if (domain != AttrDomain::Curve) {
178 const OffsetIndices points_by_curve = curves.points_by_curve();
180 return points_by_curve[curve_i].size();
186 return 903847569873762;
196 return AttrDomain::Curve;
203 if (
params.output_is_required(
"Total")) {
204 params.set_output(
"Total",
205 Field<int>(std::make_shared<bke::EvaluateAtIndexInput>(
207 Field<int>(std::make_shared<CurvePointCountInput>()),
208 AttrDomain::Curve)));
210 if (
params.output_is_required(
"Point Index")) {
211 params.set_output(
"Point Index",
212 Field<int>(std::make_shared<PointsOfCurveInput>(
223 ntype.
ui_name =
"Points of Curve";
Low-level operations for curves.
#define GEO_NODE_CURVE_TOPOLOGY_POINTS_OF_CURVE
MINLINE int mod_i(int i, int n)
@ NODE_DEFAULT_INPUT_INDEX_FIELD
#define NOD_REGISTER_NODE(REGISTER_FUNC)
unsigned long long int uint64_t
MutableSpan< T > as_mutable_span()
void reinitialize(const int64_t new_size)
constexpr int64_t size() const
constexpr bool contains(int64_t value) 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)
OffsetIndices< int > points_by_curve() const
IndexRange curves_range() const
int add(GField field, GVArray *varray_ptr)
const GVArray & get_evaluated(const int field_index) const
bool depends_on_input() const
const FieldNode & node() const
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void fill_index_range(MutableSpan< T > span, const T start=0)
void node_register_type(bNodeType &ntype)
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)
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
NodeDeclareFunction declare