40 if (selection.
size() == domain_size) {
47 if (domain == AttrDomain::Point) {
50 if (domain == AttrDomain::Curve) {
81 pointcloud->attributes_for_write());
101 instances.
remove(selection, attribute_filter);
113 evaluator.
add(selection_field);
148 const int dst_layers_num = selection.
size();
152 dst_grease_pencil->add_layers_with_empty_drawings_for_eval(dst_layers_num);
154 selection.
foreach_index([&](
const int src_layer_i,
const int dst_layer_i) {
162 dst_layer.set_name(src_layer.name());
165 dst_drawing = *src_drawing;
174 dst_grease_pencil->attributes_for_write());
176 return dst_grease_pencil;
186 bool some_valid_domain =
false;
188 if (domain == AttrDomain::Point) {
190 *points, selection, attribute_filter);
194 some_valid_domain =
true;
198 if (
ELEM(domain, AttrDomain::Point, AttrDomain::Edge, AttrDomain::Face)) {
200 *
mesh, selection, domain, mode, attribute_filter);
204 some_valid_domain =
true;
208 if (
ELEM(domain, AttrDomain::Point, AttrDomain::Curve)) {
212 src_curves, field_context, selection, domain, attribute_filter);
214 if (dst_curves->is_empty()) {
223 some_valid_domain =
true;
232 if (dst_grease_pencil) {
235 some_valid_domain =
true;
239 for (
const int layer_index :
grease_pencil.layers().index_range()) {
241 if (drawing ==
nullptr) {
247 src_curves, field_context, selection, domain, attribute_filter);
253 some_valid_domain =
true;
260 some_valid_domain =
true;
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
Low-level operations for grease pencil.
General operations for point clouds.
#define BLI_assert_unreachable()
int domain_size(const AttrDomain domain) const
AttributeAccessor attributes() const
void remove(const IndexMask &mask, const AttributeFilter &attribute_filter)
int instances_num() 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
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) 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< 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={})
static std::optional< PointCloud * > separate_pointcloud_selection(const PointCloud &src_pointcloud, const fn::Field< bool > &selection_field, const bke::AttributeFilter &attribute_filter)
void BKE_grease_pencil_copy_layer_parameters(const bke::greasepencil::Layer &src, bke::greasepencil::Layer &dst)
void BKE_grease_pencil_copy_parameters(const GreasePencil &src, GreasePencil &dst)
GeometryNodeDeleteGeometryMode
@ GEO_NODE_DELETE_GEOMETRY_MODE_ALL
@ GEO_NODE_DELETE_GEOMETRY_MODE_ONLY_FACE
@ GEO_NODE_DELETE_GEOMETRY_MODE_EDGE_FACE
PointCloud * BKE_pointcloud_new_nomain(PointCloudType type, int totpoint)
GreasePencil * BKE_grease_pencil_new_nomain()
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)