diff options
author | Jacques Lucke <jacques@blender.org> | 2021-10-30 22:20:15 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-10-30 22:20:15 +0300 |
commit | 05cef9da889708761abf16d3ae8a8616e2a46e43 (patch) | |
tree | 2f217407a043067f9da398fea4cd37f383dd6e8b | |
parent | 43a53f97c437071d2bb1b19ece71ab5995eb3f74 (diff) |
cleanup
5 files changed, 16 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/geometry_component_curve.cc b/source/blender/blenkernel/intern/geometry_component_curve.cc index 7f62a69c94a..0b80ff5acdf 100644 --- a/source/blender/blenkernel/intern/geometry_component_curve.cc +++ b/source/blender/blenkernel/intern/geometry_component_curve.cc @@ -483,14 +483,13 @@ static void set_spline_resolution(SplinePtr &spline, const int resolution) static GVArray make_resolution_read_attribute(const CurveEval &curve) { - return VArray<int>::ForDerivedSpan<SplinePtr, int, get_spline_resolution>(curve.splines()); + return VArray<int>::ForDerivedSpan<SplinePtr, get_spline_resolution>(curve.splines()); } static GVMutableArray make_resolution_write_attribute(CurveEval &curve) { return VMutableArray<int>:: - ForDerivedSpan<SplinePtr, int, get_spline_resolution, set_spline_resolution>( - curve.splines()); + ForDerivedSpan<SplinePtr, get_spline_resolution, set_spline_resolution>(curve.splines()); } static bool get_cyclic_value(const SplinePtr &spline) @@ -508,12 +507,12 @@ static void set_cyclic_value(SplinePtr &spline, const bool value) static GVArray make_cyclic_read_attribute(const CurveEval &curve) { - return VArray<bool>::ForDerivedSpan<SplinePtr, bool, get_cyclic_value>(curve.splines()); + return VArray<bool>::ForDerivedSpan<SplinePtr, get_cyclic_value>(curve.splines()); } static GVMutableArray make_cyclic_write_attribute(CurveEval &curve) { - return VMutableArray<bool>::ForDerivedSpan<SplinePtr, bool, get_cyclic_value, set_cyclic_value>( + return VMutableArray<bool>::ForDerivedSpan<SplinePtr, get_cyclic_value, set_cyclic_value>( curve.splines()); } diff --git a/source/blender/blenkernel/intern/geometry_component_instances.cc b/source/blender/blenkernel/intern/geometry_component_instances.cc index 1adc736c458..047bceda4fe 100644 --- a/source/blender/blenkernel/intern/geometry_component_instances.cc +++ b/source/blender/blenkernel/intern/geometry_component_instances.cc @@ -394,16 +394,16 @@ class InstancePositionAttributeProvider final : public BuiltinAttributeProvider const InstancesComponent &instances_component = static_cast<const InstancesComponent &>( component); Span<float4x4> transforms = instances_component.instance_transforms(); - return VArray<float3>::ForDerivedSpan<float4x4, float3, get_transform_position>(transforms); + return VArray<float3>::ForDerivedSpan<float4x4, get_transform_position>(transforms); } WriteAttributeLookup try_get_for_write(GeometryComponent &component) const final { InstancesComponent &instances_component = static_cast<InstancesComponent &>(component); MutableSpan<float4x4> transforms = instances_component.instance_transforms(); - return {VMutableArray<float3>:: - ForDerivedSpan<float4x4, float3, get_transform_position, set_transform_position>( - transforms), + return {VMutableArray<float3>::ForDerivedSpan<float4x4, + get_transform_position, + set_transform_position>(transforms), domain_}; } diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc index a7b7062090c..86a52b420b6 100644 --- a/source/blender/blenkernel/intern/geometry_component_mesh.cc +++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc @@ -896,7 +896,7 @@ namespace blender::bke { template<typename StructT, typename ElemT, ElemT (*GetFunc)(const StructT &)> static GVArray make_derived_read_attribute(const void *data, const int domain_size) { - return VArray<ElemT>::template ForDerivedSpan<StructT, ElemT, GetFunc>( + return VArray<ElemT>::template ForDerivedSpan<StructT, GetFunc>( Span<StructT>((const StructT *)data, domain_size)); } @@ -906,7 +906,7 @@ template<typename StructT, void (*SetFunc)(StructT &, ElemT)> static GVMutableArray make_derived_write_attribute(void *data, const int domain_size) { - return VMutableArray<ElemT>::template ForDerivedSpan<StructT, ElemT, GetFunc, SetFunc>( + return VMutableArray<ElemT>::template ForDerivedSpan<StructT, GetFunc, SetFunc>( MutableSpan<StructT>((StructT *)data, domain_size)); } diff --git a/source/blender/blenlib/BLI_virtual_array.hh b/source/blender/blenlib/BLI_virtual_array.hh index 20f36ba7664..1083427ce13 100644 --- a/source/blender/blenlib/BLI_virtual_array.hh +++ b/source/blender/blenlib/BLI_virtual_array.hh @@ -707,10 +707,10 @@ template<typename T> class VArray : public VArrayCommon<T> { return VArray::For<VArrayImpl_For_Func<T, decltype(get_func)>>(size, std::move(get_func)); } - template<typename StructT, typename ElemT, ElemT (*GetFunc)(const StructT &)> + template<typename StructT, T (*GetFunc)(const StructT &)> static VArray ForDerivedSpan(Span<StructT> values) { - return VArray::For<VArrayImpl_For_DerivedSpan<StructT, ElemT, GetFunc>>(values); + return VArray::For<VArrayImpl_For_DerivedSpan<StructT, T, GetFunc>>(values); } template<typename ContainerT> static VArray ForContainer(ContainerT container) @@ -765,13 +765,10 @@ template<typename T> class VMutableArray : public VArrayCommon<T> { return VMutableArray::For<VMutableArrayImpl_For_MutableSpan_final<T>>(values); } - template<typename StructT, - typename ElemT, - ElemT (*GetFunc)(const StructT &), - void (*SetFunc)(StructT &, ElemT)> + template<typename StructT, T (*GetFunc)(const StructT &), void (*SetFunc)(StructT &, T)> static VMutableArray ForDerivedSpan(MutableSpan<StructT> values) { - return VMutableArray::For<VMutableArrayImpl_For_DerivedSpan<StructT, ElemT, GetFunc, SetFunc>>( + return VMutableArray::For<VMutableArrayImpl_For_DerivedSpan<StructT, T, GetFunc, SetFunc>>( values); } diff --git a/source/blender/blenlib/tests/BLI_virtual_array_test.cc b/source/blender/blenlib/tests/BLI_virtual_array_test.cc index 4270700f063..9633dc4bdd2 100644 --- a/source/blender/blenlib/tests/BLI_virtual_array_test.cc +++ b/source/blender/blenlib/tests/BLI_virtual_array_test.cc @@ -134,14 +134,14 @@ TEST(virtual_array, DerivedSpan) vector.append({3, 4, 5}); vector.append({1, 1, 1}); { - VArray<int> varray = VArray<int>::ForDerivedSpan<std::array<int, 3>, int, get_x>(vector); + VArray<int> varray = VArray<int>::ForDerivedSpan<std::array<int, 3>, get_x>(vector); EXPECT_EQ(varray.size(), 2); EXPECT_EQ(varray[0], 3); EXPECT_EQ(varray[1], 1); } { VMutableArray<int> varray = - VMutableArray<int>::ForDerivedSpan<std::array<int, 3>, int, get_x, set_x>(vector); + VMutableArray<int>::ForDerivedSpan<std::array<int, 3>, get_x, set_x>(vector); EXPECT_EQ(varray.size(), 2); EXPECT_EQ(varray[0], 3); EXPECT_EQ(varray[1], 1); |