18 .
description(
"The curve to retrieve data from. Defaults to the curve from the context");
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");
39 : bke::GeometryFieldInput(
CPPType::get<
int>(),
"Point of Curve"),
40 curve_index_(std::move(curve_index)),
41 sort_index_(std::move(sort_index)),
42 sort_weight_(std::move(sort_weight))
56 const OffsetIndices points_by_curve = curves.points_by_curve();
59 evaluator.
add(curve_index_);
60 evaluator.add(sort_index_);
62 const VArray<int> curve_indices = evaluator.get_evaluated<
int>(0);
63 const VArray<int> indices_in_sort = evaluator.get_evaluated<
int>(1);
67 point_evaluator.
add(sort_weight_);
68 point_evaluator.evaluate();
69 const VArray<float> all_sort_weights = point_evaluator.get_evaluated<
float>(0);
70 const bool use_sorting = !all_sort_weights.
is_single();
72 Array<int> point_of_curve(mask.min_array_size());
78 for (
const int selection_i : segment) {
79 const int curve_i = curve_indices[selection_i];
80 const int index_in_sort = indices_in_sort[selection_i];
81 if (!curves.curves_range().contains(curve_i)) {
82 point_of_curve[selection_i] = 0;
85 const IndexRange points = points_by_curve[curve_i];
87 const int index_in_sort_wrapped =
mod_i(index_in_sort, points.size());
100 std::stable_sort(sort_indices.
begin(), sort_indices.
end(), [&](
int a,
int b) {
101 return sort_weights[a] < sort_weights[b];
103 point_of_curve[selection_i] = points[sort_indices[index_in_sort_wrapped]];
106 point_of_curve[selection_i] = points[index_in_sort_wrapped];
116 curve_index_.node().for_each_field_input_recursive(fn);
123 return 26978695677882;
129 return typed->curve_index_ == curve_index_ && typed->sort_index_ == sort_index_ &&
130 typed->sort_weight_ == sort_weight_;
137 return AttrDomain::Curve;
149 const AttrDomain domain,
152 if (domain != AttrDomain::Curve) {
155 const OffsetIndices points_by_curve = curves.points_by_curve();
157 return points_by_curve[curve_i].size();
163 return 903847569873762;
173 return AttrDomain::Curve;
203 const AttrDomain domain,
211 return 2938459815345;
221 return AttrDomain::Curve;
228 if (
params.output_is_required(
"Total")) {
229 params.set_output(
"Total",
230 Field<int>(std::make_shared<bke::EvaluateAtIndexInput>(
232 Field<int>(std::make_shared<CurvePointCountInput>()),
233 AttrDomain::Curve)));
235 if (
params.output_is_required(
"Point Index")) {
239 params.set_output(
"Point Index",
Field<int>(std::make_shared<CurveStartPointInput>()));
242 params.set_output(
"Point Index",
243 Field<int>(std::make_shared<PointsOfCurveInput>(
244 curve_index, std::move(sort_index), std::move(sort_weight))));
253 &ntype, GEO_NODE_CURVE_TOPOLOGY_POINTS_OF_CURVE,
"Points of Curve",
NODE_CLASS_INPUT);
Low-level operations for curves.
MINLINE int mod_i(int i, int n)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
MutableSpan< T > as_mutable_span()
void reinitialize(const int64_t new_size)
void materialize_compressed(const IndexMask &mask, MutableSpan< T > r_span) const
static VArray ForContainer(ContainerT container)
static VArray ForFunc(const int64_t size, GetFunc get_func)
int add(GField field, GVArray *varray_ptr)
virtual void for_each_field_input_recursive(FunctionRef< void(const FieldInput &)> fn) const
bool depends_on_input() const
const FieldNode & node() const
local_group_size(16, 16) .push_constant(Type b
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
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, int type, const char *name, short nclass)
unsigned __int64 uint64_t
NodeGeometryExecFunction geometry_node_execute
NodeDeclareFunction declare