17 .
description(
"The curve to retrieve data from. Defaults to the curve from the context");
19 "Values used to sort the curve's points. Uses indices by default");
23 .
description(
"Which of the sorted points to output");
25 .field_source_reference_all()
26 .
description(
"A point of the curve, chosen by the sort index");
27 b.add_output<
decl::Int>(
"Total").field_source().reference_pass({0}).description(
28 "The number of points in the curve");
56 :
bke::GeometryFieldInput(
CPPType::get<int>(),
"Point of Curve"),
57 curve_index_(std::move(curve_index)),
58 sort_index_(std::move(sort_index)),
59 sort_weight_(std::move(sort_weight))
74 if (context.domain() == AttrDomain::Curve) {
81 evaluator.
add(curve_index_);
82 evaluator.
add(sort_index_);
89 point_evaluator.
add(sort_weight_);
92 const bool use_sorting = !all_sort_weights.
is_single();
100 for (
const int selection_i : segment) {
101 const int curve_i = curve_indices[selection_i];
102 const int index_in_sort = indices_in_sort[selection_i];
104 point_of_curve[selection_i] = 0;
107 const IndexRange points = points_by_curve[curve_i];
109 const int index_in_sort_wrapped =
mod_i(index_in_sort, points.
size());
122 std::stable_sort(sort_indices.
begin(), sort_indices.
end(), [&](
int a,
int b) {
123 return sort_weights[a] < sort_weights[b];
125 point_of_curve[selection_i] = points[sort_indices[index_in_sort_wrapped]];
128 point_of_curve[selection_i] = points[index_in_sort_wrapped];
138 curve_index_.node().for_each_field_input_recursive(
fn);
139 sort_index_.node().for_each_field_input_recursive(
fn);
140 sort_weight_.node().for_each_field_input_recursive(
fn);
145 return 26978695677882;
151 return typed->curve_index_ == curve_index_ && typed->sort_index_ == sort_index_ &&
152 typed->sort_weight_ == sort_weight_;
159 return AttrDomain::Curve;
174 if (domain != AttrDomain::Curve) {
177 const OffsetIndices points_by_curve = curves.points_by_curve();
179 return points_by_curve[curve_i].size();
185 return 903847569873762;
195 return AttrDomain::Curve;
202 if (
params.output_is_required(
"Total")) {
203 params.set_output(
"Total",
204 Field<int>(std::make_shared<bke::EvaluateAtIndexInput>(
206 Field<int>(std::make_shared<CurvePointCountInput>()),
207 AttrDomain::Curve)));
209 if (
params.output_is_required(
"Point Index")) {
210 params.set_output(
"Point Index",
211 Field<int>(std::make_shared<PointsOfCurveInput>(
222 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 ForContainer(ContainerT container)
static VArray ForSpan(Span< T > values)
static VArray ForFunc(const int64_t size, GetFunc get_func)
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