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:
Hans Goudey 2021-11-11 11:47:19 -06:00
parent 393879f30c
commit f3bdabbe24
Notes: blender-bot 2023-02-14 05:50:03 +01:00
Referenced by commit f30e1fd2f0, Fix T93085: Incorrect geometry nodes modifier warning
1 changed files with 13 additions and 4 deletions

View File

@ -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,