33 .make_available([](
bNode &node) {
42 .make_available([](
bNode &node) {
46 auto &start_len =
b.add_input<
decl::Float>(
"Start",
"Start_001")
49 .make_available([](
bNode &node) {
53 auto &end_len =
b.add_input<
decl::Float>(
"End",
"End_001")
57 .make_available([](
bNode &node) {
63 const bNode *node =
b.node_or_null();
64 if (node !=
nullptr) {
94 bNode &node =
params.add_node(
"GeometryNodeTrimCurve");
95 node_storage(node).mode =
mode;
134 evaluator.add(selection_field);
135 evaluator.add(start_field);
136 evaluator.add(end_field);
137 evaluator.evaluate();
139 const IndexMask selection = evaluator.get_evaluated_as_mask(0);
140 const VArray<float> starts = evaluator.get_evaluated<
float>(1);
141 const VArray<float> ends = evaluator.get_evaluated<
float>(2);
143 if (selection.is_empty()) {
178 using namespace bke::greasepencil;
180 for (
const int layer_index : grease_pencil.layers().index_range()) {
181 Drawing *drawing = grease_pencil.get_eval_drawing(grease_pencil.layer(layer_index));
182 if (drawing ==
nullptr) {
187 grease_pencil, AttrDomain::Curve, layer_index};
221 geometry_set, mode, selection_field, start_field, end_field, attribute_filter);
229 geometry_set, mode, selection_field, start_field, end_field, attribute_filter);
233 params.set_output(
"Curve", std::move(geometry_set));
243 "Find the endpoint positions using a factor of each spline's length"},
248 "Find the endpoint positions using a length from the start of each spline"},
249 {0,
nullptr, 0,
nullptr,
nullptr},
255 "How to find endpoint positions for the trimmed spline",
Low-level operations for curves.
Low-level operations for grease pencil.
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_GEOMETRY
@ 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)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
static void remember_deformed_positions_if_necessary(GeometrySet &geometry)
bke::CurvesGeometry & strokes_for_write()
const bke::CurvesGeometry & strokes() const
void tag_topology_changed()
Vector< SocketDeclaration * > inputs
Vector< SocketDeclaration * > outputs
void operator()(LinkSearchOpParams ¶ms)
GeometryNodeCurveSampleMode mode
local_group_size(16, 16) .push_constant(Type b
void curves_copy_parameters(const Curves &src, Curves &dst)
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void node_register_type(bNodeType *ntype)
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)
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, int type, const char *name, short nclass)
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)
void modify_geometry_sets(ForeachSubGeometryCallback callback)
GreasePencil * get_grease_pencil_for_write()
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare