21 .
description(
"Grease Pencil data to convert to curves");
26 .description(
"Select the layers to convert");
29 .
description(
"Create a separate curve instance for every layer");
38 params.set_default_remaining_outputs();
43 const int layers_num = layers.
size();
48 evaluator.set_selection(selection_field);
50 const IndexMask layer_selection = evaluator.get_evaluated_selection_as_mask();
52 const int instances_num = layer_selection.
size();
53 if (instances_num == 0) {
54 params.set_default_remaining_outputs();
59 std::optional<int> empty_geometry_handle;
66 if (!empty_geometry_handle.has_value()) {
75 curves_id->
totcol = grease_pencil->material_array_num;
77 curves_geometry.
name = layer.name();
78 const int handle = instances->
add_reference(std::move(curves_geometry));
97 instances_attributes.
add(
102 *src_attribute.sharing_info});
105 if (!instances_attributes.
add(
121 AttrDomain::Instance))
123 layer_selection.
foreach_index([&](
const int layer_i,
const int instance_i) {
124 opacity_attribute.span[instance_i] = grease_pencil->layer(layer_i).opacity;
126 opacity_attribute.finish();
131 curves_geometry.
name = std::move(grease_pencil_geometry.
name);
133 const bool layers_as_instances =
params.extract_input<
bool>(
"Layers as Instances");
134 if (!layers_as_instances) {
137 options.attribute_filter = attribute_filter;
141 params.set_output(
"Curves", std::move(curves_geometry));
148 ntype.
ui_name =
"Grease Pencil to Curves";
149 ntype.
ui_description =
"Convert Grease Pencil layers into curve instances";
Low-level operations for curves.
Low-level operations for grease pencil.
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_GREASE_PENCIL_TO_CURVES
#define NOD_REGISTER_NODE(REGISTER_FUNC)
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
constexpr int64_t size() const
void foreach_attribute(const FunctionRef< void(const AttributeIter &)> fn) const
GAttributeReader get() const
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 AttrType data_type, const AttributeInit &initializer)
GSpanAttributeWriter lookup_or_add_for_write_only_span(StringRef attribute_id, AttrDomain domain, AttrType data_type)
GSpanAttributeWriter lookup_for_write_span(StringRef attribute_id)
const bke::CurvesGeometry & strokes() const
float4x4 local_transform() const
void foreach_index(Fn &&fn) const
CCL_NAMESPACE_BEGIN struct Options options
void * MEM_dupallocN(const void *vmemh)
void gather(const GVArray &src, const IndexMask &indices, GMutableSpan dst, int64_t grain_size=4096)
void node_type_size(bNodeType &ntype, int width, int minwidth, int maxwidth)
void node_register_type(bNodeType &ntype)
Curves * curves_new_nomain(int points_num, int curves_num)
RealizeInstancesResult realize_instances(bke::GeometrySet geometry_set, const RealizeInstancesOptions &options)
static void node_declare(NodeDeclarationBuilder &b)
static void node_geo_exec(GeoNodeExecParams params)
static void node_register()
MatBase< float, 4, 4 > float4x4
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
const ImplicitSharingInfo * sharing_info
const GreasePencil * get_grease_pencil() const
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
NodeDeclareFunction declare
bke::GeometrySet geometry
static GeometrySet from_instances(Instances *instances, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
static GeometrySet from_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)