15 .
description(
"The index of the control point to evaluate. Defaults to the current index")
16 .structure_type(StructureType::Field);
18 .structure_type(StructureType::Field)
19 .
description(
"The number of control points along the curve to traverse");
21 .structure_type(StructureType::Field)
22 .propagate_references()
24 "Whether the input control point plus the offset is a valid index of the "
27 .structure_type(StructureType::Field)
28 .propagate_references()
30 "The index of the control point plus the offset within the entire "
42 index_(std::move(
index)),
43 offset_(std::move(offset))
61 evaluator.
add(index_);
62 evaluator.
add(offset_);
69 [&](
const int i_selection) {
70 const int point = std::clamp(indices[i_selection], 0,
curves.points_num() - 1);
71 const int curve = parent_curves[point];
72 const IndexRange curve_points = points_by_curve[curve];
73 const int shifted_point = point + offsets[i_selection];
76 const int point_index_in_curve = shifted_point - curve_points.
start();
82 output[i_selection] = std::clamp(shifted_point, 0,
curves.points_num() - 1);
104 index_(std::move(
index)),
105 offset_(std::move(offset))
123 evaluator.
add(index_);
124 evaluator.
add(offset_);
131 [&](
const int i_selection) {
132 const int i_point = indices[i_selection];
133 if (!
curves.points_range().contains(i_point)) {
134 output[i_selection] =
false;
138 const int i_curve = parent_curves[i_point];
139 const IndexRange curve_points = points_by_curve[i_curve];
140 if (cyclic[i_curve]) {
141 output[i_selection] =
true;
144 output[i_selection] = curve_points.
contains(i_point + offsets[i_selection]);
177 ntype.
ui_name =
"Offset Point in Curve";
178 ntype.
ui_description =
"Offset a control point index within its curve";
Low-level operations for curves.
#define GEO_NODE_OFFSET_POINT_IN_CURVE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
constexpr int64_t size() const
constexpr int64_t start() const
constexpr bool contains(int64_t value) const
static VArray from_container(ContainerT container)
int add(GField field, GVArray *varray_ptr)
const GVArray & get_evaluated(const int field_index) 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 node_register_type(bNodeType &ntype)
constexpr ParallelGrainSize grain_size(int grain_size)
T mod_periodic(const T &a, const T &b)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
static void node_register()
@ NODE_DEFAULT_INPUT_INDEX_FIELD
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
static constexpr int _160
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
NodeDeclareFunction declare