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-02-19 14:29:37 +0300
committerJacques Lucke <jacques@blender.org>2021-02-19 14:31:38 +0300
commit14f1d8962f6c8ab609daff3cca1702b35eee5b68 (patch)
tree9b4e8014a1919e929bc127dc6caf4e0cea89d51d /source/blender/blenkernel/intern/geometry_set.cc
parented070dd51d4805f0af57acad02abf93ab80872a6 (diff)
Geometry Nodes: add method to get all geometry components in a set
Previously, functions would have to ask for every geometry type explicitely. Using a vector is return type is fine. In practice this will probably never allocate because of the small buffer optimization in vector.
Diffstat (limited to 'source/blender/blenkernel/intern/geometry_set.cc')
-rw-r--r--source/blender/blenkernel/intern/geometry_set.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/geometry_set.cc b/source/blender/blenkernel/intern/geometry_set.cc
index 74d8b9afd82..0274dfdbd1c 100644
--- a/source/blender/blenkernel/intern/geometry_set.cc
+++ b/source/blender/blenkernel/intern/geometry_set.cc
@@ -160,6 +160,18 @@ void GeometrySet::add(const GeometryComponent &component)
components_.add_new(component.type(), std::move(component_ptr));
}
+/**
+ * Get all geometry components in this geometry set for read-only access.
+ */
+Vector<const GeometryComponent *> GeometrySet::get_components_for_read() const
+{
+ Vector<const GeometryComponent *> components;
+ for (const GeometryComponentPtr &ptr : components_.values()) {
+ components.append(ptr.get());
+ }
+ return components;
+}
+
void GeometrySet::compute_boundbox_without_instances(float3 *r_min, float3 *r_max) const
{
const PointCloud *pointcloud = this->get_pointcloud_for_read();