Geometry Nodes: Clarify modifier node group errors
This commit adds modifier error messages to some of the cases where the node group is configured improperly. It also clears the geometry set when there is an error with the node group. This is consistent to what we do in nodes themselves, and feels more intuitive than passing the input geometry through the node group silently. Fixes T87142
This commit is contained in:
@@ -1049,17 +1049,6 @@ static void check_property_socket_sync(const Object *ob, ModifierData *md)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
bool has_geometry_output = false;
|
||||
LISTBASE_FOREACH (const bNodeSocket *, socket, &nmd->node_group->outputs) {
|
||||
if (socket->type == SOCK_GEOMETRY) {
|
||||
has_geometry_output = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_geometry_output) {
|
||||
BKE_modifier_set_error(ob, md, "Node group must have a geometry output");
|
||||
}
|
||||
}
|
||||
|
||||
static void modifyGeometry(ModifierData *md,
|
||||
@@ -1078,6 +1067,7 @@ static void modifyGeometry(ModifierData *md,
|
||||
|
||||
if (tree.has_link_cycles()) {
|
||||
BKE_modifier_set_error(ctx->object, md, "Node group has cycles");
|
||||
geometry_set.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1085,17 +1075,23 @@ static void modifyGeometry(ModifierData *md,
|
||||
Span<const NodeRef *> input_nodes = root_tree_ref.nodes_by_type("NodeGroupInput");
|
||||
Span<const NodeRef *> output_nodes = root_tree_ref.nodes_by_type("NodeGroupOutput");
|
||||
if (output_nodes.size() != 1) {
|
||||
BKE_modifier_set_error(ctx->object, md, "Node group must have a single output node");
|
||||
geometry_set.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
const NodeRef &output_node = *output_nodes[0];
|
||||
Span<const InputSocketRef *> group_outputs = output_node.inputs().drop_back(1);
|
||||
if (group_outputs.is_empty()) {
|
||||
BKE_modifier_set_error(ctx->object, md, "Node group must have an output socket");
|
||||
geometry_set.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
const InputSocketRef *first_output_socket = group_outputs[0];
|
||||
if (first_output_socket->idname() != "NodeSocketGeometry") {
|
||||
BKE_modifier_set_error(ctx->object, md, "Node group's first output must be a geometry");
|
||||
geometry_set.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user