31 {GeometryComponent::Type::Curve, GeometryComponent::Type::GreasePencil});
37 .make_available([](
bNode &node) {
45 .make_available([](
bNode &node) {
53 const bNode *node =
b.node_or_null();
54 if (node !=
nullptr) {
81 for (const int i : range) {
82 rotations[i] = math::to_quaternion(
83 math::from_orthonormal_axes<float4x4>(normals[i], tangents[i]));
96 if (iter.
domain != AttrDomain::Curve) {
105 point_attributes.
add(iter.
name,
140 pointcloud->attributes_for_write());
163 if (!pointcloud_by_layer.
is_empty()) {
165 for (
PointCloud *pointcloud : pointcloud_by_layer) {
201 std::optional<std::string> rotation_anonymous_id =
202 params.get_output_anonymous_attribute_id_if_needed(
"Rotation");
203 const bool need_tangent_and_normal = bool(rotation_anonymous_id);
204 std::optional<std::string> tangent_anonymous_id =
205 params.get_output_anonymous_attribute_id_if_needed(
"Tangent", need_tangent_and_normal);
206 std::optional<std::string> normal_anonymous_id =
207 params.get_output_anonymous_attribute_id_if_needed(
"Normal", need_tangent_and_normal);
210 resample_attributes.
tangent_id = tangent_anonymous_id;
211 resample_attributes.
normal_id = normal_anonymous_id;
220 src_curves_id->geometry.wrap(),
224 resample_attributes);
226 dst_curves, attribute_filter, resample_attributes, rotation_anonymous_id);
227 geometry.replace_pointcloud(pointcloud);
231 for (
const int layer_index : grease_pencil->layers().index_range()) {
233 grease_pencil->layer(layer_index));
234 if (drawing ==
nullptr) {
242 resample_attributes);
244 dst_curves, attribute_filter, resample_attributes, rotation_anonymous_id);
257 src_curves_id->geometry.wrap(),
261 resample_attributes);
263 dst_curves, attribute_filter, resample_attributes, rotation_anonymous_id);
264 geometry.replace_pointcloud(pointcloud);
268 for (
const int layer_index : grease_pencil->layers().index_range()) {
270 grease_pencil->layer(layer_index));
271 if (drawing ==
nullptr) {
279 resample_attributes);
281 dst_curves, attribute_filter, resample_attributes, rotation_anonymous_id);
293 src_curves_id->geometry.wrap(),
296 resample_attributes);
298 dst_curves, attribute_filter, resample_attributes, rotation_anonymous_id);
299 geometry.replace_pointcloud(pointcloud);
304 for (
const int layer_index : grease_pencil->layers().index_range()) {
306 grease_pencil->layer(layer_index));
307 if (drawing ==
nullptr) {
314 resample_attributes);
316 dst_curves, attribute_filter, resample_attributes, rotation_anonymous_id);
326 params.set_output(
"Points", std::move(geometry_set));
336 "Create points from the curve's evaluated points, based on the resolution attribute for "
337 "NURBS and Bézier splines"},
342 "Sample each spline by evenly distributing the specified number of points"},
347 "Sample each spline by splitting it into segments with the specified length"},
348 {0,
nullptr, 0,
nullptr,
nullptr},
354 "How to generate points from the input curve",
365 ntype.
ui_name =
"Curve to Points";
366 ntype.
ui_description =
"Generate a point cloud by sampling positions along curves";
CustomData interface, see also DNA_customdata_types.h.
Low-level operations for grease pencil.
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_CURVE_TO_POINTS
General operations for point clouds.
GeometryNodeCurveResampleMode
@ GEO_NODE_CURVE_RESAMPLE_LENGTH
@ GEO_NODE_CURVE_RESAMPLE_EVALUATED
@ GEO_NODE_CURVE_RESAMPLE_COUNT
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
BMesh const char void * data
constexpr int64_t size() const
constexpr bool is_empty() const
bool is_builtin(const StringRef attribute_id) const
void foreach_attribute(const FunctionRef< void(const AttributeIter &)> fn) const
GAttributeReader lookup(const StringRef attribute_id) const
eCustomDataType data_type
GAttributeReader get() const
AttributeAccessor attributes() const
void replace(Instances *instances, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
int add_reference(const InstanceReference &reference)
void add_instance(int instance_handle, const float4x4 &transform)
bke::MutableAttributeAccessor attributes_for_write()
bool add(const StringRef attribute_id, const AttrDomain domain, const eCustomDataType data_type, const AttributeInit &initializer)
GSpanAttributeWriter lookup_or_add_for_write_only_span(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type)
const bke::CurvesGeometry & strokes() const
static void remember_deformed_positions_if_necessary(GeometrySet &geometry)
static float normals[][3]
float length(VecOp< float, D >) RET
void * MEM_callocN(size_t len, const char *str)
void node_register_type(bNodeType &ntype)
void copy_attributes(const AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, MutableAttributeAccessor dst_attributes)
PointCloud * pointcloud_new_no_attributes(int totpoint)
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))
GField make_constant_field(const CPPType &type, const void *value)
CurvesGeometry resample_to_count(const CurvesGeometry &src_curves, const IndexMask &selection, const VArray< int > &counts, const ResampleCurvesOutputAttributeIDs &output_ids={})
CurvesGeometry resample_to_evaluated(const CurvesGeometry &src_curves, const IndexMask &selection, const ResampleCurvesOutputAttributeIDs &output_ids={})
bke::GeometrySet join_geometries(Span< bke::GeometrySet > geometries, const bke::AttributeFilter &attribute_filter, const std::optional< Span< bke::GeometryComponent::Type > > &component_types_to_join=std::nullopt)
CurvesGeometry resample_to_length(const CurvesGeometry &src_curves, const IndexMask &selection, const VArray< float > &sample_lengths, const ResampleCurvesOutputAttributeIDs &output_ids={}, bool keep_last_segment=false)
QuaternionBase< float > Quaternion
static void node_register()
static PointCloud * curves_to_points(const bke::CurvesGeometry &curves, const AttributeFilter &attribute_filter, const geometry::ResampleCurvesOutputAttributeIDs &resample_attributes, const std::optional< StringRef > &rotation_id)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
static void copy_curve_domain_attributes(const AttributeAccessor curve_attributes, const AttributeFilter &attribute_filter, MutableAttributeAccessor point_attributes)
static void node_init(bNodeTree *, bNode *node)
static void fill_rotation_attribute(const Span< float3 > tangents, const Span< float3 > normals, MutableSpan< math::Quaternion > rotations)
static void layer_pointclouds_to_instances(const Span< PointCloud * > pointcloud_by_layer, const AttributeFilter &attribute_filter, GeometrySet &geometry)
static void node_rna(StructRNA *srna)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
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 parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
VecBase< float, 3 > float3
std::optional< std::string > rotation_id
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)
static GeometrySet from_instances(Instances *instances, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
static GeometrySet from_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
static MatBase identity()
bool allow_skip(const StringRef name) const
void modify_geometry_sets(ForeachSubGeometryCallback callback)
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
std::optional< std::string > tangent_id
std::optional< std::string > normal_id
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)