diff options
-rw-r--r-- | source/blender/blenkernel/BKE_blender_version.h | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 25 | ||||
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc | 33 |
3 files changed, 45 insertions, 15 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 549651dff6f..c6fe02202a6 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -39,7 +39,7 @@ extern "C" { /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION -#define BLENDER_FILE_SUBVERSION 6 +#define BLENDER_FILE_SUBVERSION 7 /* Minimum Blender version that supports reading file written with the current * version. Older Blender versions will test this and show a warning if the file diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 8891197a7d9..78d60715aa5 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -735,6 +735,23 @@ static void version_node_socket_name(bNodeTree *ntree, } } +static void version_node_join_geometry_for_multi_input_socket(bNodeTree *ntree) +{ + LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) { + if (link->tonode->type == GEO_NODE_JOIN_GEOMETRY && !(link->tosock->flag & SOCK_MULTI_INPUT)) { + link->tosock = link->tonode->inputs.first; + } + } + LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { + if (node->type == GEO_NODE_JOIN_GEOMETRY) { + bNodeSocket *socket = node->inputs.first; + socket->flag |= SOCK_MULTI_INPUT; + socket->limit = 4095; + nodeRemoveSocket(ntree, node, socket->next); + } + } +} + /* NOLINTNEXTLINE: readability-function-size */ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) { @@ -1679,6 +1696,14 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + if (!MAIN_VERSION_ATLEAST(bmain, 293, 7)) { + FOREACH_NODETREE_BEGIN (bmain, ntree, id) { + if (ntree->type == NTREE_GEOMETRY) { + version_node_join_geometry_for_multi_input_socket(ntree); + } + } + FOREACH_NODETREE_END; + } /** * Versioning code until next subversion bump goes here. * 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)); } |