Skip to content

Commit

Permalink
Set XformOps to syntactically clean declarative swift enums.
Browse files Browse the repository at this point in the history
  • Loading branch information
furby-tm committed Aug 7, 2024
1 parent 2478d0c commit b181e82
Show file tree
Hide file tree
Showing 8 changed files with 239 additions and 236 deletions.
28 changes: 14 additions & 14 deletions Python/PyUsdGeom/wrapXformable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,85 +157,85 @@ WRAP_CUSTOM
.def("AddXformOp",
&This::AddXformOp,
(arg("opType"),
arg("precision") = UsdGeomXformOp::PrecisionDouble,
arg("precision") = UsdGeomXformOp::Precision::PrecisionDouble,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

.def("AddTranslateOp",
&This::AddTranslateOp,
(arg("precision") = UsdGeomXformOp::PrecisionDouble,
(arg("precision") = UsdGeomXformOp::Precision::PrecisionDouble,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

.def("AddScaleOp",
&This::AddScaleOp,
(arg("precision") = UsdGeomXformOp::PrecisionFloat,
(arg("precision") = UsdGeomXformOp::Precision::PrecisionFloat,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

.def("AddRotateXOp",
&This::AddRotateXOp,
(arg("precision") = UsdGeomXformOp::PrecisionFloat,
(arg("precision") = UsdGeomXformOp::Precision::PrecisionFloat,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

.def("AddRotateYOp",
&This::AddRotateYOp,
(arg("precision") = UsdGeomXformOp::PrecisionFloat,
(arg("precision") = UsdGeomXformOp::Precision::PrecisionFloat,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

.def("AddRotateZOp",
&This::AddRotateZOp,
(arg("precision") = UsdGeomXformOp::PrecisionFloat,
(arg("precision") = UsdGeomXformOp::Precision::PrecisionFloat,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

.def("AddRotateXYZOp",
&This::AddRotateXYZOp,
(arg("precision") = UsdGeomXformOp::PrecisionFloat,
(arg("precision") = UsdGeomXformOp::Precision::PrecisionFloat,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

.def("AddRotateXZYOp",
&This::AddRotateXZYOp,
(arg("precision") = UsdGeomXformOp::PrecisionFloat,
(arg("precision") = UsdGeomXformOp::Precision::PrecisionFloat,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

.def("AddRotateYXZOp",
&This::AddRotateYXZOp,
(arg("precision") = UsdGeomXformOp::PrecisionFloat,
(arg("precision") = UsdGeomXformOp::Precision::PrecisionFloat,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

.def("AddRotateYZXOp",
&This::AddRotateYZXOp,
(arg("precision") = UsdGeomXformOp::PrecisionFloat,
(arg("precision") = UsdGeomXformOp::Precision::PrecisionFloat,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

.def("AddRotateZXYOp",
&This::AddRotateZXYOp,
(arg("precision") = UsdGeomXformOp::PrecisionFloat,
(arg("precision") = UsdGeomXformOp::Precision::PrecisionFloat,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

.def("AddRotateZYXOp",
&This::AddRotateZYXOp,
(arg("precision") = UsdGeomXformOp::PrecisionFloat,
(arg("precision") = UsdGeomXformOp::Precision::PrecisionFloat,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

.def("AddOrientOp",
&This::AddOrientOp,
(arg("precision") = UsdGeomXformOp::PrecisionFloat,
(arg("precision") = UsdGeomXformOp::Precision::PrecisionFloat,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

.def("AddTransformOp",
&This::AddTransformOp,
(arg("precision") = UsdGeomXformOp::PrecisionDouble,
(arg("precision") = UsdGeomXformOp::Precision::PrecisionDouble,
arg("opSuffix") = TfToken(),
arg("isInverseOp") = false))

Expand Down
19 changes: 11 additions & 8 deletions Sources/Tf/include/Tf/iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,17 @@ class Tf_ProxyReferenceReverseIterator : private std::reverse_iterator<Underlyin
using pointer = typename ReverseIterator::pointer;
using difference_type = typename ReverseIterator::difference_type;

static_assert(!std::is_reference<reference>::value,
"Tf_ProxyReferenceReverseIterator should only be used "
"when the underlying iterator's reference type is a "
"proxy (MyTypeRef) and not a true reference (MyType&)."
"Use std::reverse_iterator instead.");
static_assert(std::is_same<iterator_category, std::random_access_iterator_tag>::value,
"Tf_ProxyReferenceReverseIterator must wrap a random "
"access iterator.");
/// @WABI: FIX ME
// static_assert(!std::is_reference<reference>::value,
// "Tf_ProxyReferenceReverseIterator should only be used "
// "when the underlying iterator's reference type is a "
// "proxy (MyTypeRef) and not a true reference (MyType&)."
// "Use std::reverse_iterator instead.");

/// @WABI: FIX ME
// static_assert(std::is_same<iterator_category, std::random_access_iterator_tag>::value,
// "Tf_ProxyReferenceReverseIterator must wrap a random "
// "access iterator.");

Tf_ProxyReferenceReverseIterator() = default;
explicit Tf_ProxyReferenceReverseIterator(UnderlyingIterator it) : ReverseIterator(it) {}
Expand Down
4 changes: 2 additions & 2 deletions Sources/UsdGeom/include/UsdGeom/xformOp.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ TF_DECLARE_PUBLIC_TOKENS(UsdGeomXformOpTypes, USDGEOM_API, USDGEOM_XFORM_OP_TYPE
class UsdGeomXformOp {
public:
/// Enumerates the set of all transformation operation types.
enum Type {
enum class Type {
TypeInvalid, ///< Represents an invalid xformOp.
TypeTranslate, ///< XYZ translation.
TypeScale, ///< XYZ scale.
Expand All @@ -105,7 +105,7 @@ class UsdGeomXformOp {
};

/// Precision with which the value of the tranformation operation is encoded.
enum Precision {
enum class Precision {
PrecisionDouble, ///< Double precision
PrecisionFloat, ///< Floating-point precision
PrecisionHalf ///< Half-float precision
Expand Down
28 changes: 14 additions & 14 deletions Sources/UsdGeom/include/UsdGeom/xformable.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class UsdGeomXformable : public UsdGeomImageable {
USDGEOM_API
UsdGeomXformOp AddXformOp(
UsdGeomXformOp::Type const opType,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionDouble,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionDouble,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand Down Expand Up @@ -480,7 +480,7 @@ class UsdGeomXformable : public UsdGeomImageable {
/// \sa AddXformOp()
USDGEOM_API
UsdGeomXformOp AddTranslateOp(
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionDouble,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionDouble,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand All @@ -498,7 +498,7 @@ class UsdGeomXformable : public UsdGeomImageable {
/// \sa AddXformOp()
USDGEOM_API
UsdGeomXformOp AddScaleOp(
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionFloat,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionFloat,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand All @@ -516,7 +516,7 @@ class UsdGeomXformable : public UsdGeomImageable {
/// \sa AddXformOp()
USDGEOM_API
UsdGeomXformOp AddRotateXOp(
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionFloat,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionFloat,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand All @@ -534,7 +534,7 @@ class UsdGeomXformable : public UsdGeomImageable {
/// \sa AddXformOp()
USDGEOM_API
UsdGeomXformOp AddRotateYOp(
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionFloat,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionFloat,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand All @@ -551,7 +551,7 @@ class UsdGeomXformable : public UsdGeomImageable {
/// \sa AddXformOp()
USDGEOM_API
UsdGeomXformOp AddRotateZOp(
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionFloat,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionFloat,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand All @@ -569,7 +569,7 @@ class UsdGeomXformable : public UsdGeomImageable {
/// \sa AddXformOp(), \ref usdGeom_rotationPackingOrder "note on angle packing order"
USDGEOM_API
UsdGeomXformOp AddRotateXYZOp(
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionFloat,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionFloat,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand All @@ -588,7 +588,7 @@ class UsdGeomXformable : public UsdGeomImageable {
/// \sa AddXformOp(), \ref usdGeom_rotationPackingOrder "note on angle packing order"
USDGEOM_API
UsdGeomXformOp AddRotateXZYOp(
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionFloat,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionFloat,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand All @@ -607,7 +607,7 @@ class UsdGeomXformable : public UsdGeomImageable {
/// \sa AddXformOp(), \ref usdGeom_rotationPackingOrder "note on angle packing order"
USDGEOM_API
UsdGeomXformOp AddRotateYXZOp(
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionFloat,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionFloat,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand All @@ -626,7 +626,7 @@ class UsdGeomXformable : public UsdGeomImageable {
/// \sa AddXformOp(), \ref usdGeom_rotationPackingOrder "note on angle packing order"
USDGEOM_API
UsdGeomXformOp AddRotateYZXOp(
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionFloat,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionFloat,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand All @@ -645,7 +645,7 @@ class UsdGeomXformable : public UsdGeomImageable {
/// \sa AddXformOp(), \ref usdGeom_rotationPackingOrder "note on angle packing order"
USDGEOM_API
UsdGeomXformOp AddRotateZXYOp(
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionFloat,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionFloat,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand All @@ -664,7 +664,7 @@ class UsdGeomXformable : public UsdGeomImageable {
/// \sa AddXformOp(), \ref usdGeom_rotationPackingOrder "note on angle packing order"
USDGEOM_API
UsdGeomXformOp AddRotateZYXOp(
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionFloat,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionFloat,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand All @@ -682,7 +682,7 @@ class UsdGeomXformable : public UsdGeomImageable {
/// \sa AddXformOp()
USDGEOM_API
UsdGeomXformOp AddOrientOp(
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionFloat,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionFloat,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand All @@ -704,7 +704,7 @@ class UsdGeomXformable : public UsdGeomImageable {
/// in Sdf.
USDGEOM_API
UsdGeomXformOp AddTransformOp(
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::PrecisionDouble,
UsdGeomXformOp::Precision const precision = UsdGeomXformOp::Precision::PrecisionDouble,
TfToken const &opSuffix = TfToken(),
bool isInverseOp = false) const;

Expand Down
Loading

0 comments on commit b181e82

Please sign in to comment.