Geometry Nodes: Add preferred domain to many field inputs
The preferred domain is used to decide which domain the viewer node should use when set to "Auto" domain. This commit adds it to some curve input nodes and the curve and mesh topology nodes. This makes debugging node setups with these nodes a bit faster and less frustrating.
This commit is contained in:
@@ -306,6 +306,7 @@ class CurveLengthFieldInput final : public CurvesFieldInput {
|
||||
IndexMask mask) const final;
|
||||
uint64_t hash() const override;
|
||||
bool is_equal_to(const fn::FieldNode &other) const override;
|
||||
std::optional<eAttrDomain> preferred_domain(const bke::CurvesGeometry &curves) const final;
|
||||
};
|
||||
|
||||
bool try_capture_field_on_geometry(GeometryComponent &component,
|
||||
|
||||
@@ -282,6 +282,12 @@ bool CurveLengthFieldInput::is_equal_to(const fn::FieldNode &other) const
|
||||
return dynamic_cast<const CurveLengthFieldInput *>(&other) != nullptr;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> CurveLengthFieldInput::preferred_domain(
|
||||
const bke::CurvesGeometry & /*curves*/) const
|
||||
{
|
||||
return ATTR_DOMAIN_CURVE;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
} // namespace blender::bke
|
||||
|
||||
@@ -48,6 +48,11 @@ class CurveOfPointInput final : public bke::CurvesFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/)const final
|
||||
{
|
||||
return ATTR_DOMAIN_POINT;
|
||||
}
|
||||
};
|
||||
|
||||
class PointIndexInCurveInput final : public bke::CurvesFieldInput {
|
||||
@@ -86,6 +91,11 @@ class PointIndexInCurveInput final : public bke::CurvesFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/)
|
||||
{
|
||||
return ATTR_DOMAIN_POINT;
|
||||
}
|
||||
};
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
@@ -113,6 +113,11 @@ class PointsOfCurveInput final : public bke::CurvesFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/)const final
|
||||
{
|
||||
return ATTR_DOMAIN_CURVE;
|
||||
}
|
||||
};
|
||||
|
||||
class CurvePointCountInput final : public bke::CurvesFieldInput {
|
||||
@@ -146,6 +151,11 @@ class CurvePointCountInput final : public bke::CurvesFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/)const final
|
||||
{
|
||||
return ATTR_DOMAIN_CURVE;
|
||||
}
|
||||
};
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
@@ -56,6 +56,11 @@ class SplineCountFieldInput final : public bke::CurvesFieldInput {
|
||||
{
|
||||
return dynamic_cast<const SplineCountFieldInput *>(&other) != nullptr;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/) const final
|
||||
{
|
||||
return ATTR_DOMAIN_CURVE;
|
||||
}
|
||||
};
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
@@ -110,6 +110,11 @@ class TangentFieldInput final : public bke::CurvesFieldInput {
|
||||
{
|
||||
return dynamic_cast<const TangentFieldInput *>(&other) != nullptr;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const bke::CurvesGeometry & /*curves*/) const final
|
||||
{
|
||||
return ATTR_DOMAIN_POINT;
|
||||
}
|
||||
};
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
@@ -117,6 +117,11 @@ class CornersOfFaceInput final : public bke::MeshFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/)const final
|
||||
{
|
||||
return ATTR_DOMAIN_FACE;
|
||||
}
|
||||
};
|
||||
|
||||
static int get_poly_totloop(const MPoly &poly)
|
||||
@@ -153,6 +158,11 @@ class CornersOfFaceCountInput final : public bke::MeshFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/)const final
|
||||
{
|
||||
return ATTR_DOMAIN_FACE;
|
||||
}
|
||||
};
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
@@ -138,6 +138,11 @@ class CornersOfVertInput final : public bke::MeshFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/)const final
|
||||
{
|
||||
return ATTR_DOMAIN_POINT;
|
||||
}
|
||||
};
|
||||
|
||||
class CornersOfVertCountInput final : public bke::MeshFieldInput {
|
||||
@@ -174,6 +179,11 @@ class CornersOfVertCountInput final : public bke::MeshFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/)const final
|
||||
{
|
||||
return ATTR_DOMAIN_POINT;
|
||||
}
|
||||
};
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
@@ -59,6 +59,11 @@ class CornerNextEdgeFieldInput final : public bke::MeshFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/)const final
|
||||
{
|
||||
return ATTR_DOMAIN_CORNER;
|
||||
}
|
||||
};
|
||||
|
||||
class CornerPreviousEdgeFieldInput final : public bke::MeshFieldInput {
|
||||
@@ -100,6 +105,11 @@ class CornerPreviousEdgeFieldInput final : public bke::MeshFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/)const final
|
||||
{
|
||||
return ATTR_DOMAIN_CORNER;
|
||||
}
|
||||
};
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
@@ -138,6 +138,11 @@ class EdgesOfVertInput final : public bke::MeshFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/)const final
|
||||
{
|
||||
return ATTR_DOMAIN_POINT;
|
||||
}
|
||||
};
|
||||
|
||||
class EdgesOfVertCountInput final : public bke::MeshFieldInput {
|
||||
@@ -175,6 +180,11 @@ class EdgesOfVertCountInput final : public bke::MeshFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/)const final
|
||||
{
|
||||
return ATTR_DOMAIN_POINT;
|
||||
}
|
||||
};
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
@@ -85,6 +85,11 @@ class CornerIndexInFaceInput final : public bke::MeshFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const final
|
||||
{
|
||||
return ATTR_DOMAIN_CORNER;
|
||||
}
|
||||
};
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
@@ -86,6 +86,11 @@ class OffsetCornerInFaceFieldInput final : public bke::MeshFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/)const final
|
||||
{
|
||||
return ATTR_DOMAIN_CORNER;
|
||||
}
|
||||
};
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
@@ -53,6 +53,11 @@ class CornerVertFieldInput final : public bke::MeshFieldInput {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const final
|
||||
{
|
||||
return ATTR_DOMAIN_CORNER;
|
||||
}
|
||||
};
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
Reference in New Issue
Block a user