Cleanup: Simplify topology node deduplication comparisons

And add deduplication to the corners of edge count field input.
This commit is contained in:
Hans Goudey
2023-07-02 16:27:58 -04:00
parent dd4f0cebae
commit 7be0d1481c
9 changed files with 21 additions and 44 deletions

View File

@@ -45,10 +45,7 @@ class CurveOfPointInput final : public bke::CurvesFieldInput {
bool is_equal_to(const fn::FieldNode &other) const override
{
if (dynamic_cast<const CurveOfPointInput *>(&other)) {
return true;
}
return false;
return dynamic_cast<const CurveOfPointInput *>(&other) != nullptr;
}
std::optional<eAttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/) const final
@@ -88,10 +85,7 @@ class PointIndexInCurveInput final : public bke::CurvesFieldInput {
bool is_equal_to(const fn::FieldNode &other) const final
{
if (dynamic_cast<const PointIndexInCurveInput *>(&other)) {
return true;
}
return false;
return dynamic_cast<const PointIndexInCurveInput *>(&other) != nullptr;
}
std::optional<eAttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/)

View File

@@ -160,10 +160,7 @@ class CurvePointCountInput final : public bke::CurvesFieldInput {
bool is_equal_to(const fn::FieldNode &other) const final
{
if (dynamic_cast<const CurvePointCountInput *>(&other)) {
return true;
}
return false;
return dynamic_cast<const CurvePointCountInput *>(&other) != nullptr;
}
std::optional<eAttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/) const final
@@ -211,10 +208,7 @@ class CurveStartPointInput final : public bke::CurvesFieldInput {
bool is_equal_to(const fn::FieldNode &other) const final
{
if (dynamic_cast<const CurveStartPointInput *>(&other)) {
return true;
}
return false;
return dynamic_cast<const CurveStartPointInput *>(&other) != nullptr;
}
std::optional<eAttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/) const final

View File

@@ -159,6 +159,16 @@ class CornersOfEdgeCountInput final : public bke::MeshFieldInput {
return VArray<int>::ForContainer(std::move(counts));
}
uint64_t hash() const final
{
return 2345897985577;
}
bool is_equal_to(const fn::FieldNode &other) const final
{
return dynamic_cast<const CornersOfEdgeCountInput *>(&other) != nullptr;
}
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const final
{
return ATTR_DOMAIN_EDGE;

View File

@@ -160,10 +160,7 @@ class CornersOfFaceCountInput final : public bke::MeshFieldInput {
bool is_equal_to(const fn::FieldNode &other) const final
{
if (dynamic_cast<const CornersOfFaceCountInput *>(&other)) {
return true;
}
return false;
return dynamic_cast<const CornersOfFaceCountInput *>(&other) != nullptr;
}
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const final

View File

@@ -173,10 +173,7 @@ class CornersOfVertCountInput final : public bke::MeshFieldInput {
bool is_equal_to(const fn::FieldNode &other) const final
{
if (dynamic_cast<const CornersOfVertCountInput *>(&other)) {
return true;
}
return false;
return dynamic_cast<const CornersOfVertCountInput *>(&other) != nullptr;
}
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const final

View File

@@ -50,10 +50,7 @@ class CornerNextEdgeFieldInput final : public bke::MeshFieldInput {
bool is_equal_to(const fn::FieldNode &other) const final
{
if (dynamic_cast<const CornerNextEdgeFieldInput *>(&other)) {
return true;
}
return false;
return dynamic_cast<const CornerNextEdgeFieldInput *>(&other) != nullptr;
}
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const final
@@ -94,10 +91,7 @@ class CornerPreviousEdgeFieldInput final : public bke::MeshFieldInput {
bool is_equal_to(const fn::FieldNode &other) const final
{
if (dynamic_cast<const CornerPreviousEdgeFieldInput *>(&other)) {
return true;
}
return false;
return dynamic_cast<const CornerPreviousEdgeFieldInput *>(&other) != nullptr;
}
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const final

View File

@@ -176,10 +176,7 @@ class EdgesOfVertCountInput final : public bke::MeshFieldInput {
bool is_equal_to(const fn::FieldNode &other) const final
{
if (dynamic_cast<const EdgesOfVertCountInput *>(&other)) {
return true;
}
return false;
return dynamic_cast<const EdgesOfVertCountInput *>(&other) != nullptr;
}
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const final

View File

@@ -80,10 +80,7 @@ class CornerIndexInFaceInput final : public bke::MeshFieldInput {
bool is_equal_to(const fn::FieldNode &other) const final
{
if (dynamic_cast<const CornerIndexInFaceInput *>(&other)) {
return true;
}
return false;
return dynamic_cast<const CornerIndexInFaceInput *>(&other) != nullptr;
}
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const final

View File

@@ -44,10 +44,7 @@ class CornerVertFieldInput final : public bke::MeshFieldInput {
bool is_equal_to(const fn::FieldNode &other) const final
{
if (dynamic_cast<const CornerVertFieldInput *>(&other)) {
return true;
}
return false;
return dynamic_cast<const CornerVertFieldInput *>(&other) != nullptr;
}
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const final