28 const AttrDomain domain,
33 evaluator.set_selection(selection_field);
35 const IndexMask selection = evaluator.get_evaluated_selection_as_mask();
36 if (selection.size() == domain_size) {
39 if (selection.is_empty()) {
43 if (domain == AttrDomain::Point) {
46 else if (domain == AttrDomain::Curve) {
61 evaluator.set_selection(selection_field);
63 const IndexMask selection = evaluator.get_evaluated_selection_as_mask();
64 if (selection.size() == src_pointcloud.
totpoint) {
67 if (selection.is_empty()) {
77 pointcloud->attributes_for_write());
91 const IndexMask selection = evaluator.get_evaluated_selection_as_mask();
92 if (selection.is_empty()) {
97 instances.remove(selection, attribute_filter);
102 const AttrDomain selection_domain,
109 evaluator.
add(selection_field);
137 if (selection.size() == attributes.domain_size(AttrDomain::Layer)) {
140 if (selection.is_empty()) {
147 selection.foreach_index([&](
const int index) {
149 dst_grease_pencil->duplicate_layer(src_layer);
151 dst_grease_pencil->remove_drawings_with_no_users();
158 dst_grease_pencil->attributes_for_write());
160 return dst_grease_pencil;
164 const AttrDomain domain,
170 bool some_valid_domain =
false;
172 if (domain == AttrDomain::Point) {
174 *points, selection, attribute_filter);
178 some_valid_domain =
true;
182 if (
ELEM(domain, AttrDomain::Point, AttrDomain::Edge, AttrDomain::Face)) {
184 *mesh, selection, domain, mode, attribute_filter);
189 if (active_layer !=
nullptr) {
199 if (render_layer !=
nullptr) {
209 some_valid_domain =
true;
213 if (
ELEM(domain, AttrDomain::Point, AttrDomain::Curve)) {
217 src_curves, field_context, selection, domain, attribute_filter);
219 if (dst_curves->points_num() == 0) {
228 some_valid_domain =
true;
233 if (domain == AttrDomain::Layer) {
236 grease_pencil, selection, attribute_filter);
237 if (dst_grease_pencil) {
240 some_valid_domain =
true;
242 else if (
ELEM(domain, AttrDomain::Point, AttrDomain::Curve)) {
244 for (
const int layer_index : grease_pencil.layers().index_range()) {
245 Drawing *drawing = grease_pencil.get_eval_drawing(grease_pencil.layer(layer_index));
246 if (drawing ==
nullptr) {
252 src_curves, field_context, selection, domain, attribute_filter);
258 some_valid_domain =
true;
263 if (domain == AttrDomain::Instance) {
265 some_valid_domain =
true;
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_named_layer(const CustomData *data, eCustomDataType type, blender::StringRef name)
void CustomData_set_layer_render(CustomData *data, eCustomDataType type, int n)
const char * CustomData_get_render_layer_name(const CustomData *data, eCustomDataType type)
const char * CustomData_get_active_layer_name(const CustomData *data, eCustomDataType type)
void CustomData_set_layer_active(CustomData *data, eCustomDataType type, int n)
Low-level operations for grease pencil.
void BKE_grease_pencil_copy_parameters(const GreasePencil &src, GreasePencil &dst)
void BKE_grease_pencil_duplicate_drawing_array(const GreasePencil *grease_pencil_src, GreasePencil *grease_pencil_dst)
GreasePencil * BKE_grease_pencil_new_nomain()
General operations for point clouds.
PointCloud * BKE_pointcloud_new_nomain(int totpoint)
#define BLI_assert_unreachable()
GeometryNodeDeleteGeometryMode
@ GEO_NODE_DELETE_GEOMETRY_MODE_EDGE_FACE
@ GEO_NODE_DELETE_GEOMETRY_MODE_ONLY_FACE
@ GEO_NODE_DELETE_GEOMETRY_MODE_ALL
int domain_size(const AttrDomain domain) const
AttributeAccessor attributes() const
bke::CurvesGeometry & strokes_for_write()
const bke::CurvesGeometry & strokes() const
void tag_topology_changed()
void set_selection(Field< bool > selection)
int add(GField field, GVArray *varray_ptr)
IndexMask get_evaluated_selection_as_mask() const
const GVArray & get_evaluated(const int field_index) const
CurvesGeometry curves_copy_curve_selection(const CurvesGeometry &curves, const IndexMask &curves_to_copy, const AttributeFilter &attribute_filter)
CurvesGeometry curves_copy_point_selection(const CurvesGeometry &curves, const IndexMask &points_to_copy, const AttributeFilter &attribute_filter)
void curves_copy_parameters(const Curves &src, Curves &dst)
void gather_attributes(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, const IndexMask &selection, MutableAttributeAccessor dst_attributes)
Curves * curves_new_nomain(int points_num, int curves_num)
static std::optional< PointCloud * > separate_point_cloud_selection(const PointCloud &src_pointcloud, const fn::Field< bool > &selection_field, const bke::AttributeFilter &attribute_filter)
static std::optional< bke::CurvesGeometry > separate_curves_selection(const bke::CurvesGeometry &src_curves, const fn::FieldContext &field_context, const fn::Field< bool > &selection_field, const AttrDomain domain, const bke::AttributeFilter &attribute_filter)
std::optional< Mesh * > mesh_copy_selection_keep_edges(const Mesh &mesh, const VArray< bool > &selection, bke::AttrDomain selection_domain, const bke::AttributeFilter &attribute_filter={})
std::optional< Mesh * > mesh_copy_selection_keep_verts(const Mesh &src_mesh, const VArray< bool > &selection, bke::AttrDomain selection_domain, const bke::AttributeFilter &attribute_filter={})
static std::optional< GreasePencil * > separate_grease_pencil_layer_selection(const GreasePencil &src_grease_pencil, const fn::Field< bool > &selection_field, const bke::AttributeFilter &attribute_filter)
static void delete_selected_instances(bke::GeometrySet &geometry_set, const fn::Field< bool > &selection_field, const bke::AttributeFilter &attribute_filter)
static std::optional< Mesh * > separate_mesh_selection(const Mesh &mesh, const fn::Field< bool > &selection_field, const AttrDomain selection_domain, const GeometryNodeDeleteGeometryMode mode, const bke::AttributeFilter &attribute_filter)
void separate_geometry(bke::GeometrySet &geometry_set, bke::AttrDomain domain, GeometryNodeDeleteGeometryMode mode, const fn::Field< bool > &selection_field, const bke::AttributeFilter &attribute_filter, bool &r_is_error)
std::optional< Mesh * > mesh_copy_selection(const Mesh &src_mesh, const VArray< bool > &selection, bke::AttrDomain selection_domain, const bke::AttributeFilter &attribute_filter={})
Instances * get_instances_for_write()
const GreasePencil * get_grease_pencil() const
void replace_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
bool has_realized_data() const
const Curves * get_curves() const
bool has_instances() const
void replace_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
const PointCloud * get_pointcloud() const
const Mesh * get_mesh() const
void remove(const GeometryComponent::Type component_type)
void replace_mesh(Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
GreasePencil * get_grease_pencil_for_write()
void replace_grease_pencil(GreasePencil *grease_pencil, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)