diff options
author | Jacques Lucke <jacques@blender.org> | 2021-06-28 14:13:52 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-06-28 14:16:32 +0300 |
commit | 7d281a4f7d354d270fc9c9f3c7a65b4409362aa0 (patch) | |
tree | 6a749a4833bdf543a10d95881fcca52ba310248b /source/blender/blenkernel | |
parent | f7e2559fd649610881b1749b6d30cc2ba9fcbdb6 (diff) |
Functions: improve CPPType
* Reduce code duplication.
* Give methods more standardized names (e.g. `move_to_initialized` -> `move_assign`).
* Support wrapping arbitrary C++ types, even those that e.g. are not copyable.
Diffstat (limited to 'source/blender/blenkernel')
4 files changed, 2 insertions, 18 deletions
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh index b2342a5fd96..82c9a31dfce 100644 --- a/source/blender/blenkernel/BKE_geometry_set.hh +++ b/source/blender/blenkernel/BKE_geometry_set.hh @@ -280,8 +280,6 @@ struct GeometrySet { void compute_boundbox_without_instances(blender::float3 *r_min, blender::float3 *r_max) const; friend std::ostream &operator<<(std::ostream &stream, const GeometrySet &geometry_set); - friend bool operator==(const GeometrySet &a, const GeometrySet &b); - uint64_t hash() const; void clear(); diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc index 8bbb3014dac..aa0af294bc3 100644 --- a/source/blender/blenkernel/intern/attribute_access.cc +++ b/source/blender/blenkernel/intern/attribute_access.cc @@ -1197,7 +1197,7 @@ static blender::bke::OutputAttribute create_output_attribute( cpp_type->size() * domain_size, cpp_type->alignment(), __func__); if (ignore_old_values) { /* This does nothing for trivially constructible types, but is necessary for correctness. */ - cpp_type->construct_default_n(data, domain); + cpp_type->default_construct_n(data, domain); } else { /* Fill the temporary array with values from the existing attribute. */ diff --git a/source/blender/blenkernel/intern/geometry_set.cc b/source/blender/blenkernel/intern/geometry_set.cc index 3d85118deee..07b4e715ea9 100644 --- a/source/blender/blenkernel/intern/geometry_set.cc +++ b/source/blender/blenkernel/intern/geometry_set.cc @@ -199,20 +199,6 @@ std::ostream &operator<<(std::ostream &stream, const GeometrySet &geometry_set) return stream; } -/* This generally should not be used. It is necessary currently, so that GeometrySet can by used by - * the CPPType system. */ -bool operator==(const GeometrySet &UNUSED(a), const GeometrySet &UNUSED(b)) -{ - return false; -} - -/* This generally should not be used. It is necessary currently, so that GeometrySet can by used by - * the CPPType system. */ -uint64_t GeometrySet::hash() const -{ - return reinterpret_cast<uint64_t>(this); -} - /* Remove all geometry components from the geometry set. */ void GeometrySet::clear() { diff --git a/source/blender/blenkernel/intern/geometry_set_instances.cc b/source/blender/blenkernel/intern/geometry_set_instances.cc index 6921b102b20..3c50b966f04 100644 --- a/source/blender/blenkernel/intern/geometry_set_instances.cc +++ b/source/blender/blenkernel/intern/geometry_set_instances.cc @@ -535,7 +535,7 @@ static void join_attributes(Span<GeometryInstanceGroup> set_groups, const void *src_buffer = src_span.data(); for (const int UNUSED(i) : set_group.transforms.index_range()) { void *dst_buffer = dst_span[offset]; - cpp_type->copy_to_initialized_n(src_buffer, dst_buffer, domain_size); + cpp_type->copy_assign_n(src_buffer, dst_buffer, domain_size); offset += domain_size; } } |