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:
@@ -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());
|
||||
}
|
||||
|
||||
|
@@ -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());
|
||||
}
|
||||
|
@@ -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());
|
||||
}
|
||||
|
||||
|
@@ -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());
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
Reference in New Issue
Block a user