This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/geometry/GEO_realize_instances.hh
Jacques Lucke 2ffd08e952 Geometry Nodes: deterministic anonymous attribute lifetimes
Previously, the lifetimes of anonymous attributes were determined by
reference counts which were non-deterministic when multiple threads
are used. Now the lifetimes of anonymous attributes are handled
more explicitly and deterministically. This is a prerequisite for any kind
of caching, because caching the output of nodes that do things
non-deterministically and have "invisible inputs" (reference counts)
doesn't really work.

For more details for how deterministic lifetimes are achieved, see D16858.

No functional changes are expected. Small performance changes are expected
as well (within few percent, anything larger regressions should be reported as
bugs).

Differential Revision: https://developer.blender.org/D16858
2023-01-05 14:05:30 +01:00

39 lines
1.5 KiB
C++

/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "BKE_geometry_set.hh"
namespace blender::geometry {
struct RealizeInstancesOptions {
/**
* The default is to generate new ids for every element (when there was any id attribute in the
* input). This avoids having a geometry that contains the same id many times.
* When this is `true` the ids on the original geometries are kept unchanged and ids on instances
* are ignored. Ids are zero initialized when the original geometry did not have an id.
*/
bool keep_original_ids = false;
/**
* When `true` the output geometry will contain all the generic attributes that existed on
* instances. Otherwise, instance attributes are ignored.
*/
bool realize_instance_attributes = true;
bke::AnonymousAttributePropagationInfo propagation_info;
};
/**
* Join all instances into a single geometry component for each geometry type. For example, all
* mesh instances (including the already realized mesh) are joined into a single mesh. The output
* geometry set does not contain any instances. If the input did not contain any instances, it is
* returned directly.
*
* The `id` attribute has special handling. If there is an id attribute on any component, the
* output will contain an `id` attribute as well. The output id is generated by mixing/hashing ids
* of instances and of the instanced geometry data.
*/
GeometrySet realize_instances(GeometrySet geometry_set, const RealizeInstancesOptions &options);
} // namespace blender::geometry