Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-06-28 14:13:52 +0300
committerJacques Lucke <jacques@blender.org>2021-06-28 14:16:32 +0300
commit7d281a4f7d354d270fc9c9f3c7a65b4409362aa0 (patch)
tree6a749a4833bdf543a10d95881fcca52ba310248b /source/blender/nodes/geometry
parentf7e2559fd649610881b1749b6d30cc2ba9fcbdb6 (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/nodes/geometry')
-rw-r--r--source/blender/nodes/geometry/node_geometry_exec.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_attribute_randomize.cc1
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc6
5 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/nodes/geometry/node_geometry_exec.cc b/source/blender/nodes/geometry/node_geometry_exec.cc
index a24a6d7ad21..8bf7680c835 100644
--- a/source/blender/nodes/geometry/node_geometry_exec.cc
+++ b/source/blender/nodes/geometry/node_geometry_exec.cc
@@ -17,7 +17,7 @@
#include "FN_cpp_type_make.hh"
#include "NOD_geometry_exec.hh"
-MAKE_CPP_TYPE(GeometrySet, GeometrySet);
+MAKE_CPP_TYPE(GeometrySet, GeometrySet, CPPTypeFlags::Printable);
namespace blender::nodes {
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc
index 7b40456b180..60b5b91db19 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc
@@ -130,7 +130,7 @@ static void attribute_convert_calc(GeometryComponent &component,
const CPPType *cpp_type = bke::custom_data_type_to_cpp_type(result_type);
BLI_assert(cpp_type != nullptr);
- cpp_type->copy_to_initialized_n(source_span.data(), result_span.data(), result_span.size());
+ cpp_type->copy_assign_n(source_span.data(), result_span.data(), result_span.size());
result_attribute.save();
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_randomize.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_randomize.cc
index eeb77abd624..15d419a003a 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_randomize.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_randomize.cc
@@ -189,6 +189,7 @@ Array<uint32_t> get_geometry_element_ids_as_uints(const GeometryComponent &compo
if (hash_attribute) {
BLI_assert(hashes.size() == hash_attribute->size());
const CPPType &cpp_type = hash_attribute->type();
+ BLI_assert(cpp_type.is_hashable());
GVArray_GSpan items{*hash_attribute};
threading::parallel_for(hashes.index_range(), 512, [&](IndexRange range) {
for (const int i : range) {
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
index 2725c625913..e37822bd262 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
@@ -298,7 +298,7 @@ static void copy_spline_domain_attributes(const CurveComponent &curve_component,
if (size != 0) {
BUFFER_FOR_CPP_TYPE_VALUE(type, buffer);
spline_attribute->get(i, buffer);
- type.fill_initialized(buffer, result[offset], size);
+ type.fill_assign_n(buffer, result[offset], size);
}
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
index bc758b59987..730cf08feaa 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
@@ -208,7 +208,7 @@ static void fill_new_attribute(Span<const GeometryComponent *> src_components,
GVArray_GSpan src_span{*read_attribute};
const void *src_buffer = src_span.data();
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;
}
@@ -353,7 +353,7 @@ static void ensure_control_point_attribute(const StringRef name,
BUFFER_FOR_CPP_TYPE_VALUE(type, buffer);
current_curve_attribute->get(spline_index_in_component, buffer);
- type.fill_initialized(buffer, new_attribute->data(), new_attribute->size());
+ type.fill_assign_n(buffer, new_attribute->data(), new_attribute->size());
}
}
@@ -392,7 +392,7 @@ static void ensure_spline_attribute(const StringRef name,
GVArray_GSpan src_span{*read_attribute};
const void *src_buffer = src_span.data();
- type.copy_to_initialized_n(src_buffer, result_attribute[offset], size);
+ type.copy_assign_n(src_buffer, result_attribute[offset], size);
offset += size;
}