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-05-04 11:16:24 +0300
committerJacques Lucke <jacques@blender.org>2021-05-04 11:16:24 +0300
commit4599cea15dcf7563bfbcb8be148ef5f89cf2dddd (patch)
tree041575dbb43b425fc04bfde4cb4676c4882c41e3 /source/blender/nodes/geometry/nodes/node_geo_object_info.cc
parente6bf272abd92e0b524ac35e81599075f21537c97 (diff)
Geometry Nodes: refactor instances component
The main goal of this refactor is to not store Object/Collection pointers for every individual instance. Instead instances now store a handle for the referenced data. The actual Object/Collection pointers are stored in a new `InstanceReference` class. This refactor also allows for some better optimizations further down the line, because one does not have to search through all instances anymore to find what data is instanced. Furthermore, this refactor makes it easier to support instancing `GeometrySet` or any other data that has to be owned by the `InstancesComponent`. Differential Revision: https://developer.blender.org/D11125
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_object_info.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_object_info.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
index bd42b4c11d6..de099b8062f 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
@@ -73,14 +73,15 @@ static void geo_node_object_info_exec(GeoNodeExecParams params)
if (object != self_object) {
InstancesComponent &instances = geometry_set.get_component_for_write<InstancesComponent>();
+ const int handle = instances.add_reference(*object);
if (transform_space_relative) {
- instances.add_instance(object, transform);
+ instances.add_instance(handle, transform);
}
else {
float unit_transform[4][4];
unit_m4(unit_transform);
- instances.add_instance(object, unit_transform);
+ instances.add_instance(handle, unit_transform);
}
}
}