diff options
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_collection_info.cc')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_collection_info.cc | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc index 8991a26ba4b..b2dc4661e9c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc @@ -14,8 +14,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "node_geometry_util.hh" - #include "BLI_math_matrix.h" #include "DNA_collection_types.h" @@ -23,8 +21,19 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "node_geometry_util.hh" + static bNodeSocketTemplate geo_node_collection_info_in[] = { - {SOCK_COLLECTION, N_("Collection")}, + {SOCK_COLLECTION, + N_("Collection"), + 0.0f, + 0.0f, + 0.0f, + 0.0f, + 0.0f, + 0.0f, + PROP_NONE, + SOCK_HIDE_LABEL}, {-1, ""}, }; @@ -40,11 +49,17 @@ static void geo_node_collection_info_layout(uiLayout *layout, bContext *UNUSED(C namespace blender::nodes { +static void geo_node_collection_info_node_init(bNodeTree *UNUSED(tree), bNode *node) +{ + NodeGeometryCollectionInfo *data = (NodeGeometryCollectionInfo *)MEM_callocN( + sizeof(NodeGeometryCollectionInfo), __func__); + data->transform_space = GEO_NODE_TRANSFORM_SPACE_ORIGINAL; + node->storage = data; +} + static void geo_node_collection_info_exec(GeoNodeExecParams params) { - bke::PersistentCollectionHandle collection_handle = - params.extract_input<bke::PersistentCollectionHandle>("Collection"); - Collection *collection = params.handle_map().lookup(collection_handle); + Collection *collection = params.get_input<Collection *>("Collection"); GeometrySet geometry_set_out; @@ -58,10 +73,6 @@ static void geo_node_collection_info_exec(GeoNodeExecParams params) const bool transform_space_relative = (node_storage->transform_space == GEO_NODE_TRANSFORM_SPACE_RELATIVE); - InstancedData instance; - instance.type = INSTANCE_DATA_TYPE_COLLECTION; - instance.data.collection = collection; - InstancesComponent &instances = geometry_set_out.get_component_for_write<InstancesComponent>(); float transform_mat[4][4]; @@ -73,17 +84,11 @@ static void geo_node_collection_info_exec(GeoNodeExecParams params) mul_m4_m4_pre(transform_mat, self_object->imat); } - instances.add_instance(instance, transform_mat, -1); - params.set_output("Geometry", geometry_set_out); -} + const int handle = instances.add_reference(*collection); + instances.add_instance(handle, transform_mat, -1); -static void geo_node_collection_info_node_init(bNodeTree *UNUSED(tree), bNode *node) -{ - NodeGeometryCollectionInfo *data = (NodeGeometryCollectionInfo *)MEM_callocN( - sizeof(NodeGeometryCollectionInfo), __func__); - data->transform_space = GEO_NODE_TRANSFORM_SPACE_ORIGINAL; - node->storage = data; + params.set_output("Geometry", geometry_set_out); } } // namespace blender::nodes |