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:
parent
67e5edbaa3
commit
20224369d9
Notes:
blender-bot
2023-02-14 08:29:54 +01:00
Referenced by issue #87142, Geo-Nodes Output/Input getting Confused by plug and unplug
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue