26 b.use_custom_socket_order();
27 b.allow_any_socket_order();
28 b.add_default_layout();
30 .supported_type({GeometryComponent::Type::Curve, GeometryComponent::Type::GreasePencil})
32 b.add_output<
decl::Geometry>(
"Curve").propagate_all().align_with_previous();
38 .make_available([](
bNode &node) {
47 .make_available([](
bNode &node) {
51 auto &start_len =
b.add_input<
decl::Float>(
"Start",
"Start_001")
54 .make_available([](
bNode &node) {
58 auto &end_len =
b.add_input<
decl::Float>(
"End",
"End_001")
62 .make_available([](
bNode &node) {
67 const bNode *node =
b.node_or_null();
68 if (node !=
nullptr) {
98 bNode &node =
params.add_node(
"GeometryNodeTrimCurve");
99 node_storage(node).mode =
mode;
138 evaluator.
add(selection_field);
139 evaluator.
add(start_field);
140 evaluator.
add(end_field);
184 for (
const int layer_index : grease_pencil.layers().index_range()) {
185 Drawing *drawing = grease_pencil.get_eval_drawing(grease_pencil.layer(layer_index));
186 if (drawing ==
nullptr) {
191 grease_pencil, AttrDomain::Curve, layer_index};
225 geometry_set, mode, selection_field, start_field, end_field, attribute_filter);
233 geometry_set, mode, selection_field, start_field, end_field, attribute_filter);
237 params.set_output(
"Curve", std::move(geometry_set));
247 "Find the endpoint positions using a factor of each spline's length"},
252 "Find the endpoint positions using a length from the start of each spline"},
253 {0,
nullptr, 0,
nullptr,
nullptr},
259 "How to find endpoint positions for the trimmed spline",
269 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
@ GEO_NODE_CURVE_RESAMPLE_LENGTH
GeometryNodeCurveSampleMode
@ GEO_NODE_CURVE_SAMPLE_FACTOR
@ GEO_NODE_CURVE_SAMPLE_LENGTH
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
BMesh const char void * data
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
static void remember_deformed_positions_if_necessary(GeometrySet &geometry)
Vector< SocketDeclaration * > inputs
Vector< SocketDeclaration * > outputs
void operator()(LinkSearchOpParams ¶ms)
GeometryNodeCurveSampleMode mode
void * MEM_callocN(size_t len, const char *str)
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(uiLayout *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)
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 Curves * get_curves() const
bool has_grease_pencil() const
void replace_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
GreasePencil * get_grease_pencil_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)
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
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)