diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_spline_resolution.cc b/source/blender/nodes/geometry/nodes/node_geo_input_spline_resolution.cc index fb895aaf7dc..741bd293225 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_spline_resolution.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_spline_resolution.cc @@ -1,5 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ +#include "BKE_curves.hh" + #include "node_geometry_util.hh" namespace blender::nodes::node_geo_input_spline_resolution_cc { @@ -9,10 +11,39 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output(N_("Resolution")).field_source(); } +class ResolutionFieldInput final : public bke::CurvesFieldInput { + public: + ResolutionFieldInput() : bke::CurvesFieldInput(CPPType::get(), "resolution") + { + category_ = Category::NamedAttribute; + } + + GVArray get_varray_for_context(const bke::CurvesGeometry &curves, + const eAttrDomain domain, + const IndexMask /*mask*/) const final + { + return curves.adapt_domain(curves.resolution(), ATTR_DOMAIN_CURVE, domain); + } + + uint64_t hash() const final + { + return 82713465872345682; + } + + bool is_equal_to(const fn::FieldNode &other) const final + { + return dynamic_cast(&other) != nullptr; + } + + std::optional preferred_domain(const bke::CurvesGeometry & /*curves*/) const final + { + return ATTR_DOMAIN_CURVE; + } +}; + static void node_geo_exec(GeoNodeExecParams params) { - Field resolution_field = AttributeFieldInput::Create("resolution"); - params.set_output("Resolution", std::move(resolution_field)); + params.set_output("Resolution", Field(std::make_shared())); } } // namespace blender::nodes::node_geo_input_spline_resolution_cc