1
1

Fix: missing geometry copy before modifying it

A geometry component may reference read-only geometry.
In this case it has to be copied before making changes to it.

This was caused by rBb876ce2a4a4638142.
This commit is contained in:
2022-07-12 16:26:50 +02:00
parent 47dd42485e
commit d58072caf4
4 changed files with 8 additions and 4 deletions

View File

@@ -1452,7 +1452,8 @@ std::optional<blender::bke::AttributeAccessor> CurveComponentLegacy::attributes(
std::optional<blender::bke::MutableAttributeAccessor> CurveComponentLegacy::attributes_for_write()
{
return blender::bke::MutableAttributeAccessor(curve_,
CurveEval *curve = this->get_for_write();
return blender::bke::MutableAttributeAccessor(curve,
blender::bke::get_curve_accessor_functions_ref());
}

View File

@@ -644,6 +644,7 @@ std::optional<blender::bke::AttributeAccessor> CurveComponent::attributes() cons
std::optional<blender::bke::MutableAttributeAccessor> CurveComponent::attributes_for_write()
{
return blender::bke::MutableAttributeAccessor(curves_ ? &curves_->geometry : nullptr,
Curves *curves = this->get_for_write();
return blender::bke::MutableAttributeAccessor(curves ? &curves->geometry : nullptr,
blender::bke::get_curves_accessor_functions_ref());
}

View File

@@ -1324,7 +1324,8 @@ std::optional<blender::bke::AttributeAccessor> MeshComponent::attributes() const
std::optional<blender::bke::MutableAttributeAccessor> MeshComponent::attributes_for_write()
{
return blender::bke::MutableAttributeAccessor(mesh_,
Mesh *mesh = this->get_for_write();
return blender::bke::MutableAttributeAccessor(mesh,
blender::bke::get_mesh_accessor_functions_ref());
}

View File

@@ -226,8 +226,9 @@ std::optional<blender::bke::AttributeAccessor> PointCloudComponent::attributes()
std::optional<blender::bke::MutableAttributeAccessor> PointCloudComponent::attributes_for_write()
{
PointCloud *pointcloud = this->get_for_write();
return blender::bke::MutableAttributeAccessor(
pointcloud_, blender::bke::get_pointcloud_accessor_functions_ref());
pointcloud, blender::bke::get_pointcloud_accessor_functions_ref());
}
/** \} */