diff options
author | Jacques Lucke <jacques@blender.org> | 2021-09-27 11:16:38 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-09-27 11:17:17 +0300 |
commit | 617954c1438096810ce8e47f09c25c8311baac4d (patch) | |
tree | 8cbca34265f3ee5a867bbe206520309055aab20f /source/blender/blenkernel/BKE_geometry_set.hh | |
parent | 547f7d23cafb682d3ac6d1348d70caef411ecc51 (diff) |
Geometry Nodes: new Instance on Points node
This adds a new Instance on Points node that is a replacement
for the old Point Instance node. Contrary to the old node,
it does not have a mode to instance objects or collections
directly. Instead, the node has to be used with an Object/
Collection Info to achieve the same effect.
Rotation and scale of the instances can be adjusted in the node
directly or can be controlled with a field to get some variation
between instances.
The node supports placing different instances on different points.
The user has control over which instance is placed on which point
using an Instance Index input. If that functionality is used, the
Instance Geometry has to contain multiple instances that can are
instanced separately.
Differential Revision: https://developer.blender.org/D12478
Diffstat (limited to 'source/blender/blenkernel/BKE_geometry_set.hh')
-rw-r--r-- | source/blender/blenkernel/BKE_geometry_set.hh | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh index 5fcdbc83e25..571c6c6a0a0 100644 --- a/source/blender/blenkernel/BKE_geometry_set.hh +++ b/source/blender/blenkernel/BKE_geometry_set.hh @@ -323,6 +323,7 @@ struct GeometrySet { bool has_instances() const; bool has_volume() const; bool has_curve() const; + bool has_realized_data() const; const Mesh *get_mesh_for_read() const; const PointCloud *get_pointcloud_for_read() const; @@ -478,7 +479,7 @@ class InstanceReference { Type type_ = Type::None; /** Depending on the type this is either null, an Object or Collection pointer. */ void *data_ = nullptr; - std::unique_ptr<GeometrySet> geometry_set_; + std::shared_ptr<GeometrySet> geometry_set_; public: InstanceReference() = default; @@ -493,17 +494,10 @@ class InstanceReference { InstanceReference(GeometrySet geometry_set) : type_(Type::GeometrySet), - geometry_set_(std::make_unique<GeometrySet>(std::move(geometry_set))) + geometry_set_(std::make_shared<GeometrySet>(std::move(geometry_set))) { } - InstanceReference(const InstanceReference &src) : type_(src.type_), data_(src.data_) - { - if (src.type_ == Type::GeometrySet) { - geometry_set_ = std::make_unique<GeometrySet>(*src.geometry_set_); - } - } - Type type() const { return type_; @@ -595,6 +589,7 @@ class InstancesComponent : public GeometryComponent { void add_instance(int instance_handle, const blender::float4x4 &transform, const int id = -1); blender::Span<InstanceReference> references() const; + void remove_unused_references(); void ensure_geometry_instances(); GeometrySet &geometry_set_from_reference(const int reference_index); |