From 617954c1438096810ce8e47f09c25c8311baac4d Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 27 Sep 2021 10:16:38 +0200 Subject: 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 --- source/blender/blenkernel/BKE_geometry_set.hh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'source/blender/blenkernel/BKE_geometry_set.hh') 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 geometry_set_; + std::shared_ptr geometry_set_; public: InstanceReference() = default; @@ -493,17 +494,10 @@ class InstanceReference { InstanceReference(GeometrySet geometry_set) : type_(Type::GeometrySet), - geometry_set_(std::make_unique(std::move(geometry_set))) + geometry_set_(std::make_shared(std::move(geometry_set))) { } - InstanceReference(const InstanceReference &src) : type_(src.type_), data_(src.data_) - { - if (src.type_ == Type::GeometrySet) { - geometry_set_ = std::make_unique(*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 references() const; + void remove_unused_references(); void ensure_geometry_instances(); GeometrySet &geometry_set_from_reference(const int reference_index); -- cgit v1.2.3