WIP: uv-simple-select #1

Closed
Chris Blackbourn wants to merge 182 commits from uv-simple-select into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 48693eecb0 - Show all commits

View File

@ -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<decl::Int>(N_("Resolution")).field_source();
}
class ResolutionFieldInput final : public bke::CurvesFieldInput {
public:
ResolutionFieldInput() : bke::CurvesFieldInput(CPPType::get<int>(), "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<const ResolutionFieldInput *>(&other) != nullptr;
}
std::optional<eAttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/) const final
{
return ATTR_DOMAIN_CURVE;
}
};
static void node_geo_exec(GeoNodeExecParams params)
{
Field<int> resolution_field = AttributeFieldInput::Create<int>("resolution");
params.set_output("Resolution", std::move(resolution_field));
params.set_output("Resolution", Field<int>(std::make_shared<ResolutionFieldInput>()));
}
} // namespace blender::nodes::node_geo_input_spline_resolution_cc