Fix: Incorrect warning in curve to mesh node with instances

The node was setting a warning when used with instances on input,
even though it worked fine.

Differential Revision: https://developer.blender.org/D12718
This commit is contained in:
Vitor Boschi 2021-09-30 18:27:58 -05:00 committed by Hans Goudey
parent 66fe1c79f3
commit 3a59ddb292
1 changed files with 11 additions and 11 deletions

View File

@ -33,17 +33,8 @@ static void geo_node_curve_to_mesh_declare(NodeDeclarationBuilder &b)
}
static void geometry_set_curve_to_mesh(GeometrySet &geometry_set,
const GeometrySet &profile_set,
const GeoNodeExecParams &params)
const GeometrySet &profile_set)
{
if (!geometry_set.has_curve()) {
if (!geometry_set.is_empty()) {
params.error_message_add(NodeWarningType::Warning,
TIP_("No curve data available in curve input"));
}
return;
}
const CurveEval *profile_curve = profile_set.get_curve_for_read();
if (profile_curve == nullptr) {
@ -73,11 +64,20 @@ static void geo_node_curve_to_mesh_exec(GeoNodeExecParams params)
TIP_("No curve data available in the profile input"));
}
bool has_curve = false;
curve_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
geometry_set_curve_to_mesh(geometry_set, profile_set, params);
if (geometry_set.has_curve()) {
has_curve = true;
geometry_set_curve_to_mesh(geometry_set, profile_set);
}
geometry_set.keep_only({GEO_COMPONENT_TYPE_MESH, GEO_COMPONENT_TYPE_INSTANCES});
});
if (!has_curve && !curve_set.is_empty()) {
params.error_message_add(NodeWarningType::Warning,
TIP_("No curve data available in curve input"));
}
params.set_output("Mesh", std::move(curve_set));
}