Fix: Incorrect viewer preferred domain for some curve fields
Mentioned by https://pvs-studio.com/en/blog/posts/cpp/1106/
This commit is contained in:
@@ -80,18 +80,18 @@ class EndpointFieldInput final : public bke::CurvesFieldInput {
|
||||
return VArray<bool>::ForContainer(std::move(selection));
|
||||
};
|
||||
|
||||
void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const override
|
||||
void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const final
|
||||
{
|
||||
start_size_.node().for_each_field_input_recursive(fn);
|
||||
end_size_.node().for_each_field_input_recursive(fn);
|
||||
}
|
||||
|
||||
uint64_t hash() const override
|
||||
uint64_t hash() const final
|
||||
{
|
||||
return get_default_hash(start_size_, end_size_);
|
||||
}
|
||||
|
||||
bool is_equal_to(const fn::FieldNode &other) const override
|
||||
bool is_equal_to(const fn::FieldNode &other) const final
|
||||
{
|
||||
if (const EndpointFieldInput *other_endpoint = dynamic_cast<const EndpointFieldInput *>(
|
||||
&other))
|
||||
@@ -101,7 +101,7 @@ class EndpointFieldInput final : public bke::CurvesFieldInput {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<AttrDomain> preferred_domain(const CurvesGeometry & /*curves*/) const
|
||||
std::optional<AttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/) const final
|
||||
{
|
||||
return AttrDomain::Point;
|
||||
}
|
||||
|
||||
@@ -98,12 +98,12 @@ class HandleTypeFieldInput final : public bke::CurvesFieldInput {
|
||||
return VArray<bool>::ForContainer(std::move(selection));
|
||||
}
|
||||
|
||||
uint64_t hash() const override
|
||||
uint64_t hash() const final
|
||||
{
|
||||
return get_default_hash(int(mode_), int(type_));
|
||||
}
|
||||
|
||||
bool is_equal_to(const fn::FieldNode &other) const override
|
||||
bool is_equal_to(const fn::FieldNode &other) const final
|
||||
{
|
||||
if (const HandleTypeFieldInput *other_handle_selection =
|
||||
dynamic_cast<const HandleTypeFieldInput *>(&other))
|
||||
@@ -113,7 +113,7 @@ class HandleTypeFieldInput final : public bke::CurvesFieldInput {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<AttrDomain> preferred_domain(const CurvesGeometry & /*curves*/) const
|
||||
std::optional<AttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/) const final
|
||||
{
|
||||
return AttrDomain::Point;
|
||||
}
|
||||
|
||||
@@ -264,17 +264,17 @@ class IndexOnSplineFieldInput final : public bke::CurvesFieldInput {
|
||||
return VArray<int>::ForContainer(std::move(result));
|
||||
}
|
||||
|
||||
uint64_t hash() const override
|
||||
uint64_t hash() const final
|
||||
{
|
||||
return 4536246522;
|
||||
}
|
||||
|
||||
bool is_equal_to(const fn::FieldNode &other) const override
|
||||
bool is_equal_to(const fn::FieldNode &other) const final
|
||||
{
|
||||
return dynamic_cast<const IndexOnSplineFieldInput *>(&other) != nullptr;
|
||||
}
|
||||
|
||||
std::optional<AttrDomain> preferred_domain(const CurvesGeometry & /*curves*/) const
|
||||
std::optional<AttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/) const final
|
||||
{
|
||||
return AttrDomain::Point;
|
||||
}
|
||||
|
||||
@@ -72,17 +72,17 @@ class HandlePositionFieldInput final : public bke::CurvesFieldInput {
|
||||
VArray<float3>::ForContainer(std::move(output)), AttrDomain::Point, domain);
|
||||
}
|
||||
|
||||
void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const override
|
||||
void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const final
|
||||
{
|
||||
relative_.node().for_each_field_input_recursive(fn);
|
||||
}
|
||||
|
||||
uint64_t hash() const override
|
||||
uint64_t hash() const final
|
||||
{
|
||||
return get_default_hash(relative_, left_);
|
||||
}
|
||||
|
||||
bool is_equal_to(const fn::FieldNode &other) const override
|
||||
bool is_equal_to(const fn::FieldNode &other) const final
|
||||
{
|
||||
if (const HandlePositionFieldInput *other_handle =
|
||||
dynamic_cast<const HandlePositionFieldInput *>(&other))
|
||||
@@ -92,7 +92,7 @@ class HandlePositionFieldInput final : public bke::CurvesFieldInput {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<AttrDomain> preferred_domain(const CurvesGeometry & /*curves*/) const
|
||||
std::optional<AttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/) const final
|
||||
{
|
||||
return AttrDomain::Point;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user