Geometry Nodes: Add warnings for instances input in two nodes

Certain geometry nodes don't work properly on inputs that contain
instances, but don't display any warning that they aren't working.

The nodes now will display a warning that explains the situtation
iff the input contains any instances.

Differential Revision: https://developer.blender.org/D12858
This commit is contained in:
Peter Sergay 2021-10-20 11:48:53 -05:00 committed by Hans Goudey
parent 7d111f4ac2
commit 9959c5315f
Notes: blender-bot 2023-02-21 17:59:30 +01:00
Referenced by issue #91884, Add warnings for nodes that don't work with instances
2 changed files with 12 additions and 0 deletions

View File

@ -237,6 +237,12 @@ static void geo_node_curve_sample_exec(GeoNodeExecParams params)
params.set_output("Normal", fn::make_constant_field<float3>({0.0f, 0.0f, 0.0f}));
};
if (geometry_set.has_instances()) {
params.error_message_add(
NodeWarningType::Info,
TIP_("The node only supports realized curve data, instances are ignored"));
}
const CurveComponent *component = geometry_set.get_component_for_read<CurveComponent>();
if (component == nullptr) {
return return_default();

View File

@ -214,6 +214,12 @@ static void geo_node_proximity_exec(GeoNodeExecParams params)
params.set_output("Distance", fn::make_constant_field<float>(0.0f));
};
if (geometry_set_target.has_instances()) {
params.error_message_add(
NodeWarningType::Info,
TIP_("The node only supports realized mesh or point cloud data, instances are ignored"));
}
if (!geometry_set_target.has_mesh() && !geometry_set_target.has_pointcloud()) {
return return_default();
}