diff options
author | Hans Goudey <h.goudey@me.com> | 2021-11-11 20:47:19 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-11-11 20:47:19 +0300 |
commit | f3bdabbe24fe591dc90d62af373c01d06e8e4c8a (patch) | |
tree | 57d0027982c21427b8bfbf890371eae644cec1e9 /source | |
parent | 393879f30cc093a826f693a903155f95bcbfd34c (diff) |
Fix: Incorrect modifier warning with non-geometry input first
The code assumed that any geometry input that wasn't the first input
was a second geometry input. Fix by separating the warning for the
first input and for the number of geometry inputs.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/modifiers/intern/MOD_nodes.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index 3444be40a59..70f6020f5a9 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -1026,17 +1026,22 @@ static void check_property_socket_sync(const Object *ob, ModifierData *md) { NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(md); - int i = 0; + int geometry_socket_count = 0; + + int i; LISTBASE_FOREACH_INDEX (const bNodeSocket *, socket, &nmd->node_group->inputs, i) { /* The first socket is the special geometry socket for the modifier object. */ - if (i == 0 && socket->type == SOCK_GEOMETRY) { - continue; + if (i == 0) { + if (socket->type == SOCK_GEOMETRY) { + continue; + } + BKE_modifier_set_error(ob, md, "The first node group input must be a geometry"); } IDProperty *property = IDP_GetPropertyFromGroup(nmd->settings.properties, socket->identifier); if (property == nullptr) { if (socket->type == SOCK_GEOMETRY) { - BKE_modifier_set_error(ob, md, "Node group can only have one geometry input"); + geometry_socket_count++; } else { BKE_modifier_set_error(ob, md, "Missing property for input socket \"%s\"", socket->name); @@ -1050,6 +1055,10 @@ static void check_property_socket_sync(const Object *ob, ModifierData *md) continue; } } + + if (geometry_socket_count > 1) { + BKE_modifier_set_error(ob, md, "Node group can only have one geometry input"); + } } static void modifyGeometry(ModifierData *md, |