diff options
author | Hans Goudey <h.goudey@me.com> | 2021-02-02 02:17:39 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-02-02 02:17:39 +0300 |
commit | 5494ad43facbc946fdc3e044c632e7621c437339 (patch) | |
tree | 98685f6e77628b12bc66bed7aa342f7f15a3c7d5 /source/blender | |
parent | 8268e733f6c347872b1958b5115bd96fa592d3e9 (diff) |
Geometry Nodes: Output instanced geometry from the object info node
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_object_info.cc | 36 |
1 files changed, 8 insertions, 28 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 d713c191d5d..bc36ff809fa 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc @@ -69,35 +69,15 @@ static void geo_node_object_info_exec(GeoNodeExecParams params) quat_to_eul(rotation, quaternion); if (object != self_object) { - if (object->type == OB_MESH) { - Mesh *mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(object, false); - if (mesh != nullptr) { - BKE_mesh_wrapper_ensure_mdata(mesh); - - /* Make a copy because the life time of the other mesh might be shorter. */ - Mesh *copied_mesh = BKE_mesh_copy_for_eval(mesh, false); - - if (transform_space_relative) { - /* Transform into the local space of the object that is being modified. */ - BKE_mesh_transform(copied_mesh, transform, true); - } - - MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>(); - mesh_component.replace(copied_mesh); - mesh_component.copy_vertex_group_names_from_object(*object); - } + InstancesComponent &instances = geometry_set.get_component_for_write<InstancesComponent>(); + + if (transform_space_relative) { + instances.add_instance(object, transform); } - if (object->type == OB_VOLUME) { - InstancesComponent &instances = geometry_set.get_component_for_write<InstancesComponent>(); - - if (transform_space_relative) { - instances.add_instance(object, transform); - } - else { - float unit_transform[4][4]; - unit_m4(unit_transform); - instances.add_instance(object, unit_transform); - } + else { + float unit_transform[4][4]; + unit_m4(unit_transform); + instances.add_instance(object, unit_transform); } } } |