Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_geometry_set.hh
| Show First 20 Lines • Show All 303 Lines • ▼ Show 20 Lines | void attribute_foreach(blender::Span<GeometryComponentType> component_types, | ||||
| AttributeForeachCallback callback) const; | AttributeForeachCallback callback) const; | ||||
| void gather_attributes_for_propagation( | void gather_attributes_for_propagation( | ||||
| blender::Span<GeometryComponentType> component_types, | blender::Span<GeometryComponentType> component_types, | ||||
| GeometryComponentType dst_component_type, | GeometryComponentType dst_component_type, | ||||
| bool include_instances, | bool include_instances, | ||||
| blender::Map<blender::bke::AttributeIDRef, AttributeKind> &r_attributes) const; | blender::Map<blender::bke::AttributeIDRef, AttributeKind> &r_attributes) const; | ||||
| using ForeachSubGeometryCallback = blender::FunctionRef<void(GeometrySet &geometry_set)>; | |||||
| void modify_geometry_sets(ForeachSubGeometryCallback callback); | |||||
| /* Utility methods for creation. */ | /* Utility methods for creation. */ | ||||
| static GeometrySet create_with_mesh( | static GeometrySet create_with_mesh( | ||||
| Mesh *mesh, GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | Mesh *mesh, GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | ||||
| static GeometrySet create_with_pointcloud( | static GeometrySet create_with_pointcloud( | ||||
| PointCloud *pointcloud, GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | PointCloud *pointcloud, GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | ||||
| static GeometrySet create_with_curve( | static GeometrySet create_with_curve( | ||||
| CurveEval *curve, GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | CurveEval *curve, GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | ||||
| ▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | enum class Type { | ||||
| Collection, | Collection, | ||||
| GeometrySet, | GeometrySet, | ||||
| }; | }; | ||||
| private: | private: | ||||
| Type type_ = Type::None; | Type type_ = Type::None; | ||||
| /** Depending on the type this is either null, an Object or Collection pointer. */ | /** Depending on the type this is either null, an Object or Collection pointer. */ | ||||
| void *data_ = nullptr; | void *data_ = nullptr; | ||||
| std::shared_ptr<GeometrySet> geometry_set_; | std::unique_ptr<GeometrySet> geometry_set_; | ||||
| public: | public: | ||||
| InstanceReference() = default; | InstanceReference() = default; | ||||
| InstanceReference(Object &object) : type_(Type::Object), data_(&object) | InstanceReference(Object &object) : type_(Type::Object), data_(&object) | ||||
| { | { | ||||
| } | } | ||||
| InstanceReference(Collection &collection) : type_(Type::Collection), data_(&collection) | InstanceReference(Collection &collection) : type_(Type::Collection), data_(&collection) | ||||
| { | { | ||||
| } | } | ||||
| InstanceReference(GeometrySet geometry_set) | InstanceReference(GeometrySet geometry_set) | ||||
| : type_(Type::GeometrySet), | : type_(Type::GeometrySet), | ||||
| geometry_set_(std::make_shared<GeometrySet>(std::move(geometry_set))) | geometry_set_(std::make_unique<GeometrySet>(std::move(geometry_set))) | ||||
| { | |||||
| } | |||||
| InstanceReference(const InstanceReference &other) : type_(other.type_), data_(other.data_) | |||||
| { | { | ||||
| if (other.geometry_set_) { | |||||
| geometry_set_ = std::make_unique<GeometrySet>(*other.geometry_set_); | |||||
| } | |||||
| } | |||||
| InstanceReference &operator=(const InstanceReference &other) | |||||
| { | |||||
| if (this == &other) { | |||||
| return *this; | |||||
| } | |||||
| this->~InstanceReference(); | |||||
| new (this) InstanceReference(other); | |||||
| return *this; | |||||
| } | } | ||||
| Type type() const | Type type() const | ||||
| { | { | ||||
| return type_; | return type_; | ||||
| } | } | ||||
| Object &object() const | Object &object() const | ||||
| ▲ Show 20 Lines • Show All 225 Lines • Show Last 20 Lines | |||||