diff options
author | Hans Goudey <h.goudey@me.com> | 2022-07-20 02:01:04 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-07-20 02:01:04 +0300 |
commit | e9f82d3dc7eebadcc52fdc43858d060c3a8214b2 (patch) | |
tree | 7f1e24da1ad0da9cbe29f8be30f35ca6d90df319 /source/blender/blenkernel/intern/geometry_component_curves.cc | |
parent | 28985ccc05ff15dd22184863b8c57a0851fc9614 (diff) |
Curves: Remove redundant custom data pointers
These mutable pointers present problems with ownership in relation to
proper copy-on-write for attributes. The simplest solution is to just
remove them and retrieve the layers from `CustomData` when they are
needed. This also removes the complexity and redundancy of having to
update the pointers as the curves change. A similar change will apply
to meshes and point clouds.
One downside of this change is that it makes random access with RNA
slower. However, it's simple to just use the RNA attribute API instead,
which is unaffected. In this patch I updated Cycles to do that. With
the future attribute CoW changes, this generic approach makes sense
because Cycles can just request ownership of the existing arrays.
Differential Revision: https://developer.blender.org/D15486
Diffstat (limited to 'source/blender/blenkernel/intern/geometry_component_curves.cc')
-rw-r--r-- | source/blender/blenkernel/intern/geometry_component_curves.cc | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/geometry_component_curves.cc b/source/blender/blenkernel/intern/geometry_component_curves.cc index f803b08e740..2714c78e381 100644 --- a/source/blender/blenkernel/intern/geometry_component_curves.cc +++ b/source/blender/blenkernel/intern/geometry_component_curves.cc @@ -358,10 +358,7 @@ static ComponentAttributeProviders create_attribute_providers_for_curve() const CurvesGeometry &curves = *static_cast<const CurvesGeometry *>(owner); return curves.curves_num(); }, - [](void *owner) { - CurvesGeometry &curves = *static_cast<CurvesGeometry *>(owner); - curves.update_customdata_pointers(); - }}; + [](void * /*owner*/) {}}; static CustomDataAccessInfo point_access = { [](void *owner) -> CustomData * { CurvesGeometry &curves = *static_cast<CurvesGeometry *>(owner); @@ -375,10 +372,7 @@ static ComponentAttributeProviders create_attribute_providers_for_curve() const CurvesGeometry &curves = *static_cast<const CurvesGeometry *>(owner); return curves.points_num(); }, - [](void *owner) { - CurvesGeometry &curves = *static_cast<CurvesGeometry *>(owner); - curves.update_customdata_pointers(); - }}; + [](void * /*owner*/) {}}; static BuiltinCustomDataLayerProvider position("position", ATTR_DOMAIN_POINT, |