Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/geometry_set.cc
| Show First 20 Lines • Show All 347 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void GeometrySet::replace_mesh(Mesh *mesh, GeometryOwnershipType ownership) | void GeometrySet::replace_mesh(Mesh *mesh, GeometryOwnershipType ownership) | ||||
| { | { | ||||
| if (mesh == nullptr) { | if (mesh == nullptr) { | ||||
| this->remove<MeshComponent>(); | this->remove<MeshComponent>(); | ||||
| return; | return; | ||||
| } | } | ||||
| if (mesh == this->get_mesh_for_read()) { | |||||
| return; | |||||
| } | |||||
| this->remove<MeshComponent>(); | |||||
| MeshComponent &component = this->get_component_for_write<MeshComponent>(); | MeshComponent &component = this->get_component_for_write<MeshComponent>(); | ||||
| component.replace(mesh, ownership); | component.replace(mesh, ownership); | ||||
| } | } | ||||
| void GeometrySet::replace_curve(CurveEval *curve, GeometryOwnershipType ownership) | void GeometrySet::replace_curve(CurveEval *curve, GeometryOwnershipType ownership) | ||||
| { | { | ||||
| if (curve == nullptr) { | if (curve == nullptr) { | ||||
| this->remove<CurveComponent>(); | this->remove<CurveComponent>(); | ||||
| return; | return; | ||||
| } | } | ||||
| if (curve == this->get_curve_for_read()) { | |||||
| return; | |||||
| } | |||||
| this->remove<CurveComponent>(); | |||||
| CurveComponent &component = this->get_component_for_write<CurveComponent>(); | CurveComponent &component = this->get_component_for_write<CurveComponent>(); | ||||
| component.replace(curve, ownership); | component.replace(curve, ownership); | ||||
| } | } | ||||
| void GeometrySet::replace_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership) | void GeometrySet::replace_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership) | ||||
| { | { | ||||
| if (pointcloud == nullptr) { | if (pointcloud == nullptr) { | ||||
| this->remove<PointCloudComponent>(); | this->remove<PointCloudComponent>(); | ||||
| return; | return; | ||||
| } | } | ||||
| if (pointcloud == this->get_pointcloud_for_read()) { | |||||
| return; | |||||
| } | |||||
| this->remove<PointCloudComponent>(); | |||||
| PointCloudComponent &component = this->get_component_for_write<PointCloudComponent>(); | PointCloudComponent &component = this->get_component_for_write<PointCloudComponent>(); | ||||
| component.replace(pointcloud, ownership); | component.replace(pointcloud, ownership); | ||||
| } | } | ||||
| void GeometrySet::replace_volume(Volume *volume, GeometryOwnershipType ownership) | void GeometrySet::replace_volume(Volume *volume, GeometryOwnershipType ownership) | ||||
| { | { | ||||
| if (volume == nullptr) { | if (volume == nullptr) { | ||||
| this->remove<VolumeComponent>(); | this->remove<VolumeComponent>(); | ||||
| return; | return; | ||||
| } | } | ||||
| if (volume == this->get_volume_for_read()) { | |||||
| return; | |||||
| } | |||||
| this->remove<VolumeComponent>(); | |||||
| VolumeComponent &component = this->get_component_for_write<VolumeComponent>(); | VolumeComponent &component = this->get_component_for_write<VolumeComponent>(); | ||||
| component.replace(volume, ownership); | component.replace(volume, ownership); | ||||
| } | } | ||||
| Mesh *GeometrySet::get_mesh_for_write() | Mesh *GeometrySet::get_mesh_for_write() | ||||
| { | { | ||||
| MeshComponent *component = this->get_component_ptr<MeshComponent>(); | MeshComponent *component = this->get_component_ptr<MeshComponent>(); | ||||
| return component == nullptr ? nullptr : component->get_for_write(); | return component == nullptr ? nullptr : component->get_for_write(); | ||||
| ▲ Show 20 Lines • Show All 199 Lines • Show Last 20 Lines | |||||