Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_geometry_set.hh
| Show First 20 Lines • Show All 245 Lines • ▼ Show 20 Lines | |||||
| * | * | ||||
| * Copying a geometry set is a relatively cheap operation, because it does not copy the referenced | * Copying a geometry set is a relatively cheap operation, because it does not copy the referenced | ||||
| * geometry components. | * geometry components. | ||||
| */ | */ | ||||
| struct GeometrySet { | struct GeometrySet { | ||||
| private: | private: | ||||
| using GeometryComponentPtr = blender::UserCounter<class GeometryComponent>; | using GeometryComponentPtr = blender::UserCounter<class GeometryComponent>; | ||||
| blender::Map<GeometryComponentType, GeometryComponentPtr> components_; | blender::Map<GeometryComponentType, GeometryComponentPtr> components_; | ||||
| std::string name_; | |||||
| public: | public: | ||||
| GeometryComponent &get_component_for_write(GeometryComponentType component_type); | GeometryComponent &get_component_for_write(GeometryComponentType component_type); | ||||
| template<typename Component> Component &get_component_for_write() | template<typename Component> Component &get_component_for_write() | ||||
| { | { | ||||
| BLI_STATIC_ASSERT(is_geometry_component_v<Component>, ""); | BLI_STATIC_ASSERT(is_geometry_component_v<Component>, ""); | ||||
| return static_cast<Component &>(this->get_component_for_write(Component::static_type)); | return static_cast<Component &>(this->get_component_for_write(Component::static_type)); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | public: | ||||
| /* Utility methods for replacement. */ | /* Utility methods for replacement. */ | ||||
| void replace_mesh(Mesh *mesh, GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | void replace_mesh(Mesh *mesh, GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | ||||
| void replace_pointcloud(PointCloud *pointcloud, | void replace_pointcloud(PointCloud *pointcloud, | ||||
| GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | ||||
| void replace_volume(Volume *volume, | void replace_volume(Volume *volume, | ||||
| GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | ||||
| void replace_curve(CurveEval *curve, | void replace_curve(CurveEval *curve, | ||||
| GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | GeometryOwnershipType ownership = GeometryOwnershipType::Owned); | ||||
| std::string to_tooltip(int indentation = 0) const; | |||||
| void content_to_tooltip(std::stringstream &ss, int indentation) const; | |||||
| blender::StringRefNull name() const; | |||||
| void set_name(std::string name); | |||||
| }; | }; | ||||
| /** A geometry component that can store a mesh. */ | /** A geometry component that can store a mesh. */ | ||||
| class MeshComponent : public GeometryComponent { | class MeshComponent : public GeometryComponent { | ||||
| private: | private: | ||||
| Mesh *mesh_ = nullptr; | Mesh *mesh_ = nullptr; | ||||
| GeometryOwnershipType ownership_ = GeometryOwnershipType::Owned; | GeometryOwnershipType ownership_ = GeometryOwnershipType::Owned; | ||||
| ▲ Show 20 Lines • Show All 419 Lines • Show Last 20 Lines | |||||