15 .
description(
"The index of the control point to evaluate. Defaults to the current index")
16 .structure_type(StructureType::Field);
18 "The number of control points along the curve to traverse");
20 .field_source_reference_all()
22 "Whether the input control point plus the offset is a valid index of the "
25 .field_source_reference_all()
27 "The index of the control point plus the offset within the entire "
38 : GeometryFieldInput(
CPPType::get<int>(),
"Offset Point in Curve"),
39 index_(std::move(index)),
40 offset_(std::move(offset))
59 evaluator.
add(index_);
60 evaluator.
add(offset_);
66 mask.foreach_index([&](
const int i_selection) {
68 const int curve = parent_curves[point];
69 const IndexRange curve_points = points_by_curve[curve];
70 const int shifted_point = point + offsets[i_selection];
73 const int point_index_in_curve = shifted_point - curve_points.
start();
86 index_.node().for_each_field_input_recursive(
fn);
87 offset_.node().for_each_field_input_recursive(
fn);
98 : GeometryFieldInput(
CPPType::get<bool>(),
"Offset Valid"),
99 index_(std::move(index)),
100 offset_(std::move(offset))
119 evaluator.
add(index_);
120 evaluator.
add(offset_);
126 mask.foreach_index([&](
const int i_selection) {
127 const int i_point =
indices[i_selection];
129 output[i_selection] =
false;
133 const int i_curve = parent_curves[i_point];
134 const IndexRange curve_points = points_by_curve[i_curve];
135 if (cyclic[i_curve]) {
136 output[i_selection] =
true;
139 output[i_selection] = curve_points.
contains(i_point + offsets[i_selection]);
146 index_.node().for_each_field_input_recursive(
fn);
147 offset_.node().for_each_field_input_recursive(
fn);
156 if (
params.output_is_required(
"Point Index")) {
157 Field<int> curve_point_field{std::make_shared<ControlPointNeighborFieldInput>(index, offset)};
158 params.set_output(
"Point Index", std::move(curve_point_field));
160 if (
params.output_is_required(
"Is Valid Offset")) {
161 Field<bool> valid_field{std::make_shared<OffsetValidFieldInput>(index, offset)};
162 params.set_output(
"Is Valid Offset", std::move(valid_field));
170 ntype.
ui_name =
"Offset Point in Curve";
171 ntype.
ui_description =
"Offset a control point index within its curve";
Low-level operations for curves.
#define GEO_NODE_OFFSET_POINT_IN_CURVE
@ NODE_DEFAULT_INPUT_INDEX_FIELD
#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)
Array< int > point_to_curve_map() const
OffsetIndices< int > points_by_curve() const
IndexRange points_range() const
VArray< bool > cyclic() const
int add(GField field, GVArray *varray_ptr)
const GVArray & get_evaluated(const int field_index) const
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void node_register_type(bNodeType &ntype)
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()
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