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.
This commit is contained in:
2021-11-11 11:47:19 -06:00
parent 393879f30c
commit f3bdabbe24

View File

@@ -1026,17 +1026,22 @@ static void check_property_socket_sync(const Object *ob, ModifierData *md)
{ {
NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(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) { LISTBASE_FOREACH_INDEX (const bNodeSocket *, socket, &nmd->node_group->inputs, i) {
/* The first socket is the special geometry socket for the modifier object. */ /* The first socket is the special geometry socket for the modifier object. */
if (i == 0 && socket->type == SOCK_GEOMETRY) { if (i == 0) {
continue; 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); IDProperty *property = IDP_GetPropertyFromGroup(nmd->settings.properties, socket->identifier);
if (property == nullptr) { if (property == nullptr) {
if (socket->type == SOCK_GEOMETRY) { if (socket->type == SOCK_GEOMETRY) {
BKE_modifier_set_error(ob, md, "Node group can only have one geometry input"); geometry_socket_count++;
} }
else { else {
BKE_modifier_set_error(ob, md, "Missing property for input socket \"%s\"", socket->name); 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; 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, static void modifyGeometry(ModifierData *md,