26 b.use_custom_socket_order();
27 b.allow_any_socket_order();
28 b.add_default_layout();
32 b.add_output<
decl::Geometry>(
"Curve"_ustr).propagate_all_geometry().align_with_previous();
36 .evaluated_geometry_field();
44 .evaluated_geometry_field();
53 .evaluated_geometry_field();
54 auto &start_len =
b.add_input<
decl::Float>(
"Start"_ustr,
"Start_001"_ustr)
60 .evaluated_geometry_field();
61 auto &end_len =
b.add_input<
decl::Float>(
"End"_ustr,
"End_001"_ustr)
68 .evaluated_geometry_field();
71 if (
node !=
nullptr) {
141 evaluator.
add(selection_field);
142 evaluator.
add(start_field);
143 evaluator.
add(end_field);
187 for (
const int layer_index :
grease_pencil.layers().index_range()) {
189 if (drawing ==
nullptr) {
228 geometry_set, mode, selection_field, start_field, end_field, attribute_filter);
236 geometry_set, mode, selection_field, start_field, end_field, attribute_filter);
240 params.
set_output(
"Curve"_ustr, std::move(geometry_set));
250 "Find the endpoint positions using a factor of each spline's length"},
255 "Find the endpoint positions using a length from the start of each spline"},
256 {0,
nullptr, 0,
nullptr,
nullptr},
262 "How to find endpoint positions for the trimmed spline",
272 ntype.
ui_description =
"Shorten curves by removing portions at the start or end";
Low-level operations for curves.
Low-level operations for grease pencil.
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_TRIM_CURVE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
bke::CurvesGeometry & strokes_for_write()
const bke::CurvesGeometry & strokes() const
void tag_topology_changed()
int add(GField field, GVArray *varray_ptr)
IndexMask get_evaluated_as_mask(int field_index)
const GVArray & get_evaluated(const int field_index) const
const bke::bNodeType & node_type() const
void add_item(std::string socket_name, SocketLinkOperation::LinkSocketFn fn, int weight=0)
const bNodeTree & node_tree() const
const bNodeSocket & other_socket() const
eNodeSocketInOut in_out() const
NodeAttributeFilter get_attribute_filter(const UString output_identifier) const
T extract_input(const UString identifier)
const bNode & node() const
void set_output(const UString identifier, T &&value)
static void remember_deformed_positions_if_necessary(GeometrySet &geometry)
void update_and_connect_available_socket(bNode &new_node, UString socket_name)
bNode & add_node(UString idname)
Vector< SocketDeclaration * > inputs
Vector< SocketDeclaration * > outputs
void operator()(LinkSearchOpParams ¶ms)
GeometryNodeCurveSampleMode mode
#define storage(slot, qualifiers)
void curves_copy_parameters(const Curves &src, Curves &dst)
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))
Curves * curves_new_nomain(int points_num, int curves_num)
bke::CurvesGeometry trim_curves(const bke::CurvesGeometry &src_curves, const IndexMask &selection, const VArray< float > &starts, const VArray< float > &ends, GeometryNodeCurveSampleMode mode, const bke::AttributeFilter &attribute_filter)
void foreach_real_geometry(bke::GeometrySet &geometry, FunctionRef< void(bke::GeometrySet &geometry_set)> fn)
static void node_init(bNodeTree *, bNode *node)
static bool trim_curves(const bke::CurvesGeometry &src_curves, const GeometryNodeCurveSampleMode mode, const fn::FieldContext &field_context, Field< bool > &selection_field, Field< float > &start_field, Field< float > &end_field, const AttributeFilter &attribute_filter, bke::CurvesGeometry &dst_curves)
static void node_rna(StructRNA *srna)
static void node_register()
static void node_declare(NodeDeclarationBuilder &b)
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
static void geometry_set_curve_trim(GeometrySet &geometry_set, const GeometryNodeCurveSampleMode mode, Field< bool > &selection_field, Field< float > &start_field, Field< float > &end_field, const AttributeFilter &attribute_filter)
static void node_layout(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_geo_exec(GeoNodeExecParams params)
void search_link_ops_for_declarations(GatherLinkSearchOpParams ¶ms, Span< SocketDeclaration * > declarations)
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)
BMesh const char void * data
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
@ GEO_NODE_CURVE_RESAMPLE_LENGTH
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
GeometryNodeCurveSampleMode
@ GEO_NODE_CURVE_SAMPLE_LENGTH
@ GEO_NODE_CURVE_SAMPLE_FACTOR
bke::bNodeTreeType * typeinfo
const Curves * get_curves() const
bool has_grease_pencil() const
void replace_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
GreasePencil * get_grease_pencil_for_write()
bool(*) validate_link(eNodeSocketDatatype from, eNodeSocketDatatype to)
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare
nodes::NodeDeclaration * static_declaration
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)