diff options
author | Hans Goudey <h.goudey@me.com> | 2021-09-28 19:36:28 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-09-28 19:36:28 +0300 |
commit | 44e4f077a9d7b5b609f6199874802675d75f7266 (patch) | |
tree | a9714f312e31638643a202ad16a5b4dab429ff3e /source/blender/blenkernel/intern/geometry_set.cc | |
parent | b32b38b3805fea5baec551acd1a98c4a58b2bb1c (diff) |
Geometry Nodes: Run nodes once on unique instance data
As described in T91672, often it can be much more efficient to run each
node only on the unique geometry of the instances, rather than realizing
all instances and potentially processing redundant data. Sometimes the
performance difference can be completely smooth vs. completely unusable.
Geometry nodes used to hide that choice from users by always realizing
instances, but recently we have decided to expose it. So this commit
makes nodes run once per unique reference in the entire tree of nested
instances in their input geometries, continuing the work started in
rB0559971ab377 and rBf94164d89629f0d2. For the old behavior, a realize
instances node can be added before the nodes, which is done in the
versioning code.
Differential Revision: https://developer.blender.org/D12656
Diffstat (limited to 'source/blender/blenkernel/intern/geometry_set.cc')
-rw-r--r-- | source/blender/blenkernel/intern/geometry_set.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/geometry_set.cc b/source/blender/blenkernel/intern/geometry_set.cc index 400e0fda518..0aac6ae3adf 100644 --- a/source/blender/blenkernel/intern/geometry_set.cc +++ b/source/blender/blenkernel/intern/geometry_set.cc @@ -318,6 +318,16 @@ bool GeometrySet::has_realized_data() const return this->get_component_for_read<InstancesComponent>() == nullptr; } +/* Return true if the geometry set has any component that isn't empty. */ +bool GeometrySet::is_empty() const +{ + if (components_.is_empty()) { + return true; + } + return !(this->has_mesh() || this->has_curve() || this->has_pointcloud() || + this->has_instances()); +} + /* Create a new geometry set that only contains the given mesh. */ GeometrySet GeometrySet::create_with_mesh(Mesh *mesh, GeometryOwnershipType ownership) { |