Commit: d58072caf4abb254d5e5f0e3b9de9bef775f287a
Author: Jacques Lucke
Date: Tue Jul 12 16:26:50 2022 +0200
Branches: master
https://developer.blender.org/rBd58072caf4abb254d5e5f0e3b9de9bef775f287a
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.
===================================================================
M source/blender/blenkernel/intern/geometry_component_curve.cc
M source/blender/blenkernel/intern/geometry_component_curves.cc
M source/blender/blenkernel/intern/geometry_component_mesh.cc
M source/blender/blenkernel/intern/geometry_component_pointcloud.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/geometry_component_curve.cc
b/source/blender/blenkernel/intern/geometry_component_curve.cc
index 0d899ec7b06..22f105af0f1 100644
--- a/source/blender/blenkernel/intern/geometry_component_curve.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curve.cc
@@ -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());
}
diff --git a/source/blender/blenkernel/intern/geometry_component_curves.cc
b/source/blender/blenkernel/intern/geometry_component_curves.cc
index 34c17bedc2c..f803b08e740 100644
--- a/source/blender/blenkernel/intern/geometry_component_curves.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curves.cc
@@ -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());
}
diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc
b/source/blender/blenkernel/intern/geometry_component_mesh.cc
index cb36b9b19f7..cf6681a69be 100644
--- a/source/blender/blenkernel/intern/geometry_component_mesh.cc
+++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc
@@ -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());
}
diff --git a/source/blender/blenkernel/intern/geometry_component_pointcloud.cc
b/source/blender/blenkernel/intern/geometry_component_pointcloud.cc
index b439a9ba7f8..ccc97f92dbc 100644
--- a/source/blender/blenkernel/intern/geometry_component_pointcloud.cc
+++ b/source/blender/blenkernel/intern/geometry_component_pointcloud.cc
@@ -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());
}
/** \} */
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs