diff options
author | Fabian Schempp <fabian_schempp> | 2021-02-11 09:23:15 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-02-11 09:23:15 +0300 |
commit | 9a9e19fdcc48622dba8f98c9afb10a6750ff22b0 (patch) | |
tree | 43f7211319783f60439f77bba9b32227f63b4495 /source/blender/nodes | |
parent | faad487b5825157cc953c54340647f71d3a06e9b (diff) |
Geometry Nodes: Use multi-input socket in join geometry node
This updates the join node to use the new multi-input socket from D10067.
The change just requires slightly changing the arguments of the exec
function, and changing the socket input list.
Note that this commit does not contain the UI changes, it only allows for
more input links, and combines the two sockets into one. The UI changes
will come next.
Reviewed By: Hans Goudey
Differential Revision: https://developer.blender.org/D10069
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc index 384094b6d8c..a56939a43c7 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc @@ -24,8 +24,16 @@ #include "node_geometry_util.hh" static bNodeSocketTemplate geo_node_join_geometry_in[] = { - {SOCK_GEOMETRY, N_("Geometry")}, - {SOCK_GEOMETRY, N_("Geometry")}, + {SOCK_GEOMETRY, + N_("Geometry"), + 0.0f, + 0.0f, + 0.0f, + 1.0f, + -1.0f, + 1.0f, + PROP_NONE, + SOCK_MULTI_INPUT}, {-1, ""}, }; @@ -252,11 +260,11 @@ static void join_components(Span<const VolumeComponent *> src_components, Geomet } template<typename Component> -static void join_component_type(Span<const GeometrySet *> src_geometry_sets, GeometrySet &result) +static void join_component_type(Span<GeometrySet> src_geometry_sets, GeometrySet &result) { Vector<const Component *> components; - for (const GeometrySet *geometry_set : src_geometry_sets) { - const Component *component = geometry_set->get_component_for_read<Component>(); + for (const GeometrySet &geometry_set : src_geometry_sets) { + const Component *component = geometry_set.get_component_for_read<Component>(); if (component != nullptr && !component->is_empty()) { components.append(component); } @@ -274,16 +282,13 @@ static void join_component_type(Span<const GeometrySet *> src_geometry_sets, Geo static void geo_node_join_geometry_exec(GeoNodeExecParams params) { - GeometrySet geometry_set_a = params.extract_input<GeometrySet>("Geometry"); - GeometrySet geometry_set_b = params.extract_input<GeometrySet>("Geometry_001"); - GeometrySet geometry_set_result; + Vector<GeometrySet> geometry_sets = params.extract_multi_input<GeometrySet>("Geometry"); - std::array<const GeometrySet *, 2> src_geometry_sets = {&geometry_set_a, &geometry_set_b}; - - join_component_type<MeshComponent>(src_geometry_sets, geometry_set_result); - join_component_type<PointCloudComponent>(src_geometry_sets, geometry_set_result); - join_component_type<InstancesComponent>(src_geometry_sets, geometry_set_result); - join_component_type<VolumeComponent>(src_geometry_sets, geometry_set_result); + GeometrySet geometry_set_result; + join_component_type<MeshComponent>(geometry_sets, geometry_set_result); + join_component_type<PointCloudComponent>(geometry_sets, geometry_set_result); + join_component_type<InstancesComponent>(geometry_sets, geometry_set_result); + join_component_type<VolumeComponent>(geometry_sets, geometry_set_result); params.set_output("Geometry", std::move(geometry_set_result)); } |