28 b.use_custom_socket_order();
29 b.allow_any_socket_order();
30 b.add_default_layout();
32 const bNode *node =
b.node_or_null();
35 .supported_type(GeometryComponent::Type::Curve)
36 .description(
"Curves to change the handles on");
37 b.add_output<
decl::Geometry>(
"Curve").propagate_all().align_with_previous();
116 evaluator.
add(position_field);
117 evaluator.
add(offset_field);
141 selection.slice(range).foreach_index_optimized<int>([&](const int i) {
142 if (update_handle_types_for_movement(handle_types[i], handle_types_other[i])) {
148 std::logical_or<>());
151 for (
const int i : segment) {
155 new_positions[
i] + new_offsets[
i],
157 handle_positions_other[
i]);
162 curves.tag_topology_changed();
164 curves.calculate_bezier_auto_handles();
165 curves.tag_positions_changed();
178 std::atomic<bool> has_curves =
false;
179 std::atomic<bool> has_bezier =
false;
186 if (!attributes.
contains(
"handle_left") || !attributes.
contains(
"handle_right")) {
195 if (has_curves && !has_bezier) {
199 params.set_output(
"Curve", std::move(geometry_set));
207 "Whether to update left and right handles",
218 ntype.
ui_name =
"Set Handle Positions";
219 ntype.
ui_description =
"Set the positions for the handles of Bézier curves";
227 "NodeGeometrySetCurveHandlePositions",
Low-level operations for curves.
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_SET_CURVE_HANDLES
@ NODE_DEFAULT_INPUT_HANDLE_RIGHT_FIELD
@ NODE_DEFAULT_INPUT_HANDLE_LEFT_FIELD
GeometryNodeCurveHandleMode
@ GEO_NODE_CURVE_HANDLE_LEFT
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
BMesh const char void * data
bool contains(StringRef attribute_id) const
MutableSpan< int8_t > handle_types_right_for_write()
MutableSpan< float3 > handle_positions_left_for_write()
MutableSpan< float3 > handle_positions_right_for_write()
Span< float3 > positions() const
AttributeAccessor attributes() const
MutableSpan< int8_t > handle_types_left_for_write()
void set_selection(Field< bool > selection)
int add(GField field, GVArray *varray_ptr)
IndexMask get_evaluated_selection_as_mask() const
const GVArray & get_evaluated(const int field_index) const
IndexRange index_range() const
void * MEM_callocN(size_t len, const char *str)
void set_handle_position(const float3 &position, HandleType type, HandleType type_other, const float3 &new_handle, float3 &handle, float3 &handle_other)
void node_register_type(bNodeType &ntype)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void foreach_real_geometry(bke::GeometrySet &geometry, FunctionRef< void(bke::GeometrySet &geometry_set)> fn)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_init(bNodeTree *, bNode *node)
static void node_declare(NodeDeclarationBuilder &b)
static void node_register()
static void node_geo_exec(GeoNodeExecParams params)
static bool update_handle_types_for_movement(int8_t &type, int8_t &other)
static void set_position_in_component(Curves &curves_id, const GeometryNodeCurveHandleMode mode, const Field< bool > &selection_field, const Field< float3 > &position_field, const Field< float3 > &offset_field)
static void node_rna(StructRNA *srna)
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
Value parallel_reduce(IndexRange range, int64_t grain_size, const Value &identity, const Function &function, const Reduction &reduction)
VecBase< float, 3 > float3
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
const EnumPropertyItem rna_enum_node_geometry_curve_handle_side_items[]
Curves * get_curves_for_write()
std::string ui_description
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)