diff options
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_raycast.cc')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_raycast.cc | 59 |
1 files changed, 24 insertions, 35 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc index 1e687f163e6..34946b1115c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc @@ -31,32 +31,36 @@ namespace blender::nodes { static void geo_node_raycast_declare(NodeDeclarationBuilder &b) { - b.add_input<decl::Geometry>("Target Geometry"); - - b.add_input<decl::Vector>("Attribute").hide_value().supports_field(); - b.add_input<decl::Float>("Attribute", "Attribute_001").hide_value().supports_field(); - b.add_input<decl::Color>("Attribute", "Attribute_002").hide_value().supports_field(); - b.add_input<decl::Bool>("Attribute", "Attribute_003").hide_value().supports_field(); - b.add_input<decl::Int>("Attribute", "Attribute_004").hide_value().supports_field(); - - b.add_input<decl::Vector>("Source Position").implicit_field(); - b.add_input<decl::Vector>("Ray Direction").default_value({0.0f, 0.0f, 1.0f}).supports_field(); - b.add_input<decl::Float>("Ray Length") + b.add_input<decl::Geometry>(N_("Target Geometry")) + .only_realized_data() + .supported_type(GEO_COMPONENT_TYPE_MESH); + + b.add_input<decl::Vector>(N_("Attribute")).hide_value().supports_field(); + b.add_input<decl::Float>(N_("Attribute"), "Attribute_001").hide_value().supports_field(); + b.add_input<decl::Color>(N_("Attribute"), "Attribute_002").hide_value().supports_field(); + b.add_input<decl::Bool>(N_("Attribute"), "Attribute_003").hide_value().supports_field(); + b.add_input<decl::Int>(N_("Attribute"), "Attribute_004").hide_value().supports_field(); + + b.add_input<decl::Vector>(N_("Source Position")).implicit_field(); + b.add_input<decl::Vector>(N_("Ray Direction")) + .default_value({0.0f, 0.0f, -1.0f}) + .supports_field(); + b.add_input<decl::Float>(N_("Ray Length")) .default_value(100.0f) .min(0.0f) .subtype(PROP_DISTANCE) .supports_field(); - b.add_output<decl::Bool>("Is Hit").dependent_field(); - b.add_output<decl::Vector>("Hit Position").dependent_field(); - b.add_output<decl::Vector>("Hit Normal").dependent_field(); - b.add_output<decl::Float>("Hit Distance").dependent_field(); + b.add_output<decl::Bool>(N_("Is Hit")).dependent_field(); + b.add_output<decl::Vector>(N_("Hit Position")).dependent_field(); + b.add_output<decl::Vector>(N_("Hit Normal")).dependent_field(); + b.add_output<decl::Float>(N_("Hit Distance")).dependent_field(); - b.add_output<decl::Vector>("Attribute").dependent_field({1, 2, 3, 4, 5, 6}); - b.add_output<decl::Float>("Attribute", "Attribute_001").dependent_field({1, 2, 3, 4, 5, 6}); - b.add_output<decl::Color>("Attribute", "Attribute_002").dependent_field({1, 2, 3, 4, 5, 6}); - b.add_output<decl::Bool>("Attribute", "Attribute_003").dependent_field({1, 2, 3, 4, 5, 6}); - b.add_output<decl::Int>("Attribute", "Attribute_004").dependent_field({1, 2, 3, 4, 5, 6}); + b.add_output<decl::Vector>(N_("Attribute")).dependent_field({1, 2, 3, 4, 5, 6}); + b.add_output<decl::Float>(N_("Attribute"), "Attribute_001").dependent_field({1, 2, 3, 4, 5, 6}); + b.add_output<decl::Color>(N_("Attribute"), "Attribute_002").dependent_field({1, 2, 3, 4, 5, 6}); + b.add_output<decl::Bool>(N_("Attribute"), "Attribute_003").dependent_field({1, 2, 3, 4, 5, 6}); + b.add_output<decl::Int>(N_("Attribute"), "Attribute_004").dependent_field({1, 2, 3, 4, 5, 6}); } static void geo_node_raycast_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -389,26 +393,11 @@ static void geo_node_raycast_exec(GeoNodeExecParams params) }); }; - if (target.has_instances()) { - if (target.has_realized_data()) { - params.error_message_add( - NodeWarningType::Info, - TIP_("The node only supports realized mesh data, instances are ignored")); - } - else { - params.error_message_add(NodeWarningType::Error, - TIP_("The target geometry must contain realized data")); - return return_default(); - } - } - if (target.is_empty()) { return return_default(); } if (!target.has_mesh()) { - params.error_message_add(NodeWarningType::Error, - TIP_("The target geometry must contain a mesh")); return return_default(); } |