diff options
author | Jacques Lucke <jacques@blender.org> | 2020-12-11 20:00:37 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-12-11 20:00:37 +0300 |
commit | f5dc34ec9c05cc8f1163313baafe634f4798c29b (patch) | |
tree | b3cc27fc8009fc0180f4b35c5c3646cb2527a72c /source/blender/blenkernel/BKE_geometry_set.hh | |
parent | 5ced167336d49ef42e96e205c72d3935ff302a7e (diff) |
Geometry Nodes: support instancing collections
The Point Instance node can instance entire collections now.
Before, only individual collections were supported.
Randomly selecting objects from the collection on a per point basis
is not support, yet.
Last part of D9739.
Ref T82372.
Diffstat (limited to 'source/blender/blenkernel/BKE_geometry_set.hh')
-rw-r--r-- | source/blender/blenkernel/BKE_geometry_set.hh | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh index b7cb9320086..617e0c45ae4 100644 --- a/source/blender/blenkernel/BKE_geometry_set.hh +++ b/source/blender/blenkernel/BKE_geometry_set.hh @@ -35,6 +35,7 @@ struct Mesh; struct PointCloud; struct Object; +struct Collection; /* Each geometry component has a specific type. The type determines what kind of data the component * stores. Functions modifying a geometry will usually just modify a subset of the component types. @@ -358,7 +359,7 @@ class InstancesComponent : public GeometryComponent { blender::Vector<blender::float3> positions_; blender::Vector<blender::float3> rotations_; blender::Vector<blender::float3> scales_; - blender::Vector<const Object *> objects_; + blender::Vector<InstancedData> instanced_data_; public: InstancesComponent(); @@ -366,12 +367,20 @@ class InstancesComponent : public GeometryComponent { GeometryComponent *copy() const override; void clear(); - void add_instance(const Object *object, + void add_instance(Object *object, blender::float3 position, blender::float3 rotation = {0, 0, 0}, blender::float3 scale = {1, 1, 1}); + void add_instance(Collection *collection, + blender::float3 position, + blender::float3 rotation = {0, 0, 0}, + blender::float3 scale = {1, 1, 1}); + void add_instance(InstancedData data, + blender::float3 position, + blender::float3 rotation, + blender::float3 scale); - blender::Span<const Object *> objects() const; + blender::Span<InstancedData> instanced_data() const; blender::Span<blender::float3> positions() const; blender::Span<blender::float3> rotations() const; blender::Span<blender::float3> scales() const; |