From 363e460cebfc0d3e237a81cfe02865dc9413b6b9 Mon Sep 17 00:00:00 2001 From: Pierre Tremblay Date: Mon, 12 Oct 2020 21:39:26 -0400 Subject: [PATCH 1/3] Prepare for upcoming UFE interface changes to support Maya transform stack. --- ...UsdRotatePivotTranslateUndoableCommand.cpp | 6 +++- .../UsdRotatePivotTranslateUndoableCommand.h | 6 +++- lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp | 4 +++ lib/mayaUsd/ufe/UsdRotateUndoableCommand.h | 4 +++ lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp | 6 +++- lib/mayaUsd/ufe/UsdScaleUndoableCommand.h | 6 +++- lib/mayaUsd/ufe/UsdTransform3d.cpp | 32 ++++++++++++++++++- lib/mayaUsd/ufe/UsdTransform3d.h | 15 +++++++-- .../ufe/UsdTranslateUndoableCommand.cpp | 4 +++ lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h | 4 +++ test/lib/ufe/testRotatePivot.py | 23 ++++++++++--- 11 files changed, 98 insertions(+), 12 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp b/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp index c8be1e7c1a..b46439ef37 100644 --- a/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp @@ -1,5 +1,5 @@ // -// Copyright 2019 Autodesk +// Copyright 2020 Autodesk // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -109,7 +109,11 @@ void UsdRotatePivotTranslateUndoableCommand::redo() // Ufe::TranslateUndoableCommand overrides //------------------------------------------------------------------------------ +#if UFE_PREVIEW_VERSION_NUM >= 2025 +bool UsdRotatePivotTranslateUndoableCommand::set(double x, double y, double z) +#else bool UsdRotatePivotTranslateUndoableCommand::translate(double x, double y, double z) +#endif { #ifdef UFE_V2_FEATURES_AVAILABLE rotatePivotTranslateOp(prim(), fPath, x, y, z); diff --git a/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.h b/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.h index f8aa412634..b2f0729013 100644 --- a/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.h @@ -1,5 +1,5 @@ // -// Copyright 2019 Autodesk +// Copyright 2020 Autodesk // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -60,7 +60,11 @@ class MAYAUSD_CORE_PUBLIC UsdRotatePivotTranslateUndoableCommand : public Ufe::T // Ufe::TranslateUndoableCommand overrides void undo() override; void redo() override; +#if UFE_PREVIEW_VERSION_NUM >= 2025 + bool set(double x, double y, double z) override; +#else bool translate(double x, double y, double z) override; +#endif inline UsdPrim prim() const { TF_AXIOM(fItem != nullptr); return fItem->prim(); } diff --git a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp index c12aa3ce56..e2a9554b7d 100644 --- a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp @@ -100,7 +100,11 @@ void UsdRotateUndoableCommand::performImp(double x, double y, double z) // Ufe::RotateUndoableCommand overrides //------------------------------------------------------------------------------ +#if UFE_PREVIEW_VERSION_NUM >= 2025 +bool UsdRotateUndoableCommand::set(double x, double y, double z) +#else bool UsdRotateUndoableCommand::rotate(double x, double y, double z) +#endif { // Fail early - Initialization did not go as expected. if (fFailedInit) diff --git a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h index 15a49244eb..30607a9549 100644 --- a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h @@ -59,7 +59,11 @@ class MAYAUSD_CORE_PUBLIC UsdRotateUndoableCommand : public Ufe::RotateUndoableC // rotation value and executes the command. void undo() override; void redo() override; +#if UFE_PREVIEW_VERSION_NUM >= 2025 + bool set(double x, double y, double z) override; +#else bool rotate(double x, double y, double z) override; +#endif #ifdef UFE_V2_FEATURES_AVAILABLE Ufe::Path getPath() const override { return path(); } diff --git a/lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp b/lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp index 8ed34471c3..12867297ff 100644 --- a/lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp @@ -1,5 +1,5 @@ // -// Copyright 2019 Autodesk +// Copyright 2020 Autodesk // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -89,7 +89,11 @@ void UsdScaleUndoableCommand::performImp(double x, double y, double z) // Ufe::ScaleUndoableCommand overrides //------------------------------------------------------------------------------ +#if UFE_PREVIEW_VERSION_NUM >= 2025 +bool UsdScaleUndoableCommand::set(double x, double y, double z) +#else bool UsdScaleUndoableCommand::scale(double x, double y, double z) +#endif { perform(x, y, z); return true; diff --git a/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h b/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h index 3bcd3917b8..97f85fba9a 100644 --- a/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h @@ -1,5 +1,5 @@ // -// Copyright 2019 Autodesk +// Copyright 2020 Autodesk // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -56,7 +56,11 @@ class MAYAUSD_CORE_PUBLIC UsdScaleUndoableCommand : public Ufe::ScaleUndoableCom // Ufe::ScaleUndoableCommand overrides void undo() override; void redo() override; +#if UFE_PREVIEW_VERSION_NUM >= 2025 + bool set(double x, double y, double z) override; +#else bool scale(double x, double y, double z) override; +#endif #ifdef UFE_V2_FEATURES_AVAILABLE Ufe::Path getPath() const override { return path(); } diff --git a/lib/mayaUsd/ufe/UsdTransform3d.cpp b/lib/mayaUsd/ufe/UsdTransform3d.cpp index 1ee8c5c7af..d666b2510d 100644 --- a/lib/mayaUsd/ufe/UsdTransform3d.cpp +++ b/lib/mayaUsd/ufe/UsdTransform3d.cpp @@ -1,5 +1,5 @@ // -// Copyright 2019 Autodesk +// Copyright 2020 Autodesk // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -196,7 +196,11 @@ Ufe::ScaleUndoableCommand::Ptr UsdTransform3d::scaleCmd() #endif #ifdef UFE_V2_FEATURES_AVAILABLE +#if UFE_PREVIEW_VERSION_NUM >= 2025 +Ufe::SetMatrix4dUndoableCommand::Ptr UsdTransform3d::setMatrixCmd(const Ufe::Matrix4d& m) +#else Ufe::SetMatrixUndoableCommand::Ptr UsdTransform3d::setMatrixCmd(const Ufe::Matrix4d& m) +#endif { // TODO: HS Aug25,2020 dummy code to pass the compiler errors return nullptr; @@ -215,6 +219,19 @@ void UsdTransform3d::scale(double x, double y, double z) scaleOp(prim(), fItem->path(), x, y, z); } +#if UFE_PREVIEW_VERSION_NUM >= 2025 +Ufe::TranslateUndoableCommand::Ptr UsdTransform3d::rotatePivotCmd(double, double, double) +{ + // As of 12-Oct-2020, setting rotate pivot on command creation + // unsupported. Use translate() method on returned command. + return UsdRotatePivotTranslateUndoableCommand::create(fItem->path()); +} + +void UsdTransform3d::rotatePivot(double x, double y, double z) +{ + rotatePivotTranslateOp(prim(), path(), x, y, z); +} +#else Ufe::TranslateUndoableCommand::Ptr UsdTransform3d::rotatePivotTranslateCmd() { #ifdef UFE_V2_FEATURES_AVAILABLE @@ -229,6 +246,7 @@ void UsdTransform3d::rotatePivotTranslate(double x, double y, double z) { rotatePivotTranslateOp(prim(), path(), x, y, z); } +#endif Ufe::Vector3d UsdTransform3d::rotatePivot() const { @@ -246,6 +264,17 @@ Ufe::Vector3d UsdTransform3d::rotatePivot() const return Ufe::Vector3d(x, y, z); } +#if UFE_PREVIEW_VERSION_NUM >= 2025 +Ufe::TranslateUndoableCommand::Ptr UsdTransform3d::scalePivotCmd(double, double, double) +{ + throw std::runtime_error("UsdTransform3d::scalePivotCmd() not implemented"); +} + +void UsdTransform3d::scalePivot(double x, double y, double z) +{ + return rotatePivot(x, y, z); +} +#else Ufe::TranslateUndoableCommand::Ptr UsdTransform3d::scalePivotTranslateCmd() { throw std::runtime_error("UsdTransform3d::scalePivotTranslateCmd() not implemented"); @@ -255,6 +284,7 @@ void UsdTransform3d::scalePivotTranslate(double x, double y, double z) { return rotatePivotTranslate(x, y, z); } +#endif Ufe::Vector3d UsdTransform3d::scalePivot() const { diff --git a/lib/mayaUsd/ufe/UsdTransform3d.h b/lib/mayaUsd/ufe/UsdTransform3d.h index 09878c18a3..ce000c949a 100644 --- a/lib/mayaUsd/ufe/UsdTransform3d.h +++ b/lib/mayaUsd/ufe/UsdTransform3d.h @@ -1,5 +1,5 @@ // -// Copyright 2019 Autodesk +// Copyright 2020 Autodesk // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -68,7 +68,11 @@ class MAYAUSD_CORE_PUBLIC UsdTransform3d : public Ufe::Transform3d #endif #ifdef UFE_V2_FEATURES_AVAILABLE +#if UFE_PREVIEW_VERSION_NUM >= 2025 + Ufe::SetMatrix4dUndoableCommand::Ptr setMatrixCmd(const Ufe::Matrix4d& m) override; +#else Ufe::SetMatrixUndoableCommand::Ptr setMatrixCmd(const Ufe::Matrix4d& m) override; +#endif Ufe::Matrix4d matrix() const override; #endif @@ -76,11 +80,18 @@ class MAYAUSD_CORE_PUBLIC UsdTransform3d : public Ufe::Transform3d Ufe::Vector3d translation() const override; void rotate(double x, double y, double z) override; void scale(double x, double y, double z) override; +#if UFE_PREVIEW_VERSION_NUM >= 2025 + Ufe::TranslateUndoableCommand::Ptr rotatePivotCmd(double x, double y, double z) override; + void rotatePivot(double x, double y, double z) override; + Ufe::TranslateUndoableCommand::Ptr scalePivotCmd(double x, double y, double z) override; + void scalePivot(double x, double y, double z) override; +#else Ufe::TranslateUndoableCommand::Ptr rotatePivotTranslateCmd() override; void rotatePivotTranslate(double x, double y, double z) override; - Ufe::Vector3d rotatePivot() const override; Ufe::TranslateUndoableCommand::Ptr scalePivotTranslateCmd() override; void scalePivotTranslate(double x, double y, double z) override; +#endif + Ufe::Vector3d rotatePivot() const override; Ufe::Vector3d scalePivot() const override; Ufe::Matrix4d segmentInclusiveMatrix() const override; Ufe::Matrix4d segmentExclusiveMatrix() const override; diff --git a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp index 21494feeba..e261899160 100644 --- a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp @@ -85,7 +85,11 @@ void UsdTranslateUndoableCommand::performImp(double x, double y, double z) // Ufe::TranslateUndoableCommand overrides //------------------------------------------------------------------------------ +#if UFE_PREVIEW_VERSION_NUM >= 2025 +bool UsdTranslateUndoableCommand::set(double x, double y, double z) +#else bool UsdTranslateUndoableCommand::translate(double x, double y, double z) +#endif { perform(x, y, z); return true; diff --git a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h index 96441a3cf2..7f732c1d91 100644 --- a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h @@ -57,7 +57,11 @@ class MAYAUSD_CORE_PUBLIC UsdTranslateUndoableCommand : public Ufe::TranslateUnd // translation value and executes the command. void undo() override; void redo() override; +#if UFE_PREVIEW_VERSION_NUM >= 2025 + bool set(double x, double y, double z) override; +#else bool translate(double x, double y, double z) override; +#endif #ifdef UFE_V2_FEATURES_AVAILABLE Ufe::Path getPath() const override { return path(); } diff --git a/test/lib/ufe/testRotatePivot.py b/test/lib/ufe/testRotatePivot.py index 0c713d02d1..6fa36c7a6c 100644 --- a/test/lib/ufe/testRotatePivot.py +++ b/test/lib/ufe/testRotatePivot.py @@ -102,7 +102,10 @@ def testRotatePivot(self): usdSphereItem = ufe.Hierarchy.createItem(usdSpherePath) t3d = ufe.Transform3d.transform3d(usdSphereItem) - t3d.rotatePivotTranslate(pivot[0], pivot[1], pivot[2]) + if(os.getenv('UFE_PREVIEW_VERSION_NUM', '0000') < '2025'): + t3d.rotatePivotTranslate(pivot[0], pivot[1], pivot[2]) + else: + t3d.rotatePivot(pivot[0], pivot[1], pivot[2]) usdPivot = t3d.rotatePivot() self.assertEqual(v3dToMPoint(usdPivot), pivot) @@ -110,7 +113,10 @@ def testRotatePivot(self): sphereMatrix = om.MMatrix(t3d.inclusiveMatrix().matrix) self.checkPos(sphereMatrix, [xyWorldValue, xyWorldValue, 0]) - t3d.rotatePivotTranslate(0, 0, 0) + if(os.getenv('UFE_PREVIEW_VERSION_NUM', '0000') < '2025'): + t3d.rotatePivotTranslate(0, 0, 0) + else: + t3d.rotatePivot(0, 0, 0) usdPivot = t3d.rotatePivot() self.assertEqual(v3dToMPoint(usdPivot), om.MPoint(0, 0, 0)) @@ -118,8 +124,12 @@ def testRotatePivot(self): self.checkPos(sphereMatrix, [10, 0, 0]) # Use a UFE undoable command to set the pivot. - rotatePivotCmd = t3d.rotatePivotTranslateCmd() - rotatePivotCmd.translate(pivot[0], pivot[1], pivot[2]) + if(os.getenv('UFE_PREVIEW_VERSION_NUM', '0000') < '2025'): + rotatePivotCmd = t3d.rotatePivotTranslateCmd() + rotatePivotCmd.translate(pivot[0], pivot[1], pivot[2]) + else: + rotatePivotCmd = t3d.rotatePivotCmd() + rotatePivotCmd.set(pivot[0], pivot[1], pivot[2]) usdPivot = t3d.rotatePivot() self.assertEqual(v3dToMPoint(usdPivot), pivot) @@ -162,7 +172,10 @@ def testRotatePivotCmd(self): # Start with a non-zero initial rotate pivot. This is required to test # MAYA-105345, otherwise a zero initial rotate pivot produces the # correct result through an unintended code path. - t3d.rotatePivotTranslate(2, 0, 0) + if(os.getenv('UFE_PREVIEW_VERSION_NUM', '0000') < '2025'): + t3d.rotatePivotTranslate(2, 0, 0) + else: + t3d.rotatePivot(2, 0, 0) usdPivot = t3d.rotatePivot() self.assertEqual(v3dToMPoint(usdPivot), om.MPoint(2, 0, 0)) From 626d7960cd3205eeb7a23135b54576151b5e20b1 Mon Sep 17 00:00:00 2001 From: Pierre Tremblay Date: Tue, 13 Oct 2020 10:42:57 -0400 Subject: [PATCH 2/3] Fix macOS compilation errors from UFE 0.2.24 --- lib/mayaUsd/ufe/UsdUIInfoHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mayaUsd/ufe/UsdUIInfoHandler.cpp b/lib/mayaUsd/ufe/UsdUIInfoHandler.cpp index 36f6317524..1ec549932f 100644 --- a/lib/mayaUsd/ufe/UsdUIInfoHandler.cpp +++ b/lib/mayaUsd/ufe/UsdUIInfoHandler.cpp @@ -55,7 +55,7 @@ namespace template void addMetadataCount(const T& op, std::string& tooltip, bool& needComma, const std::string& singular, const std::string& plural) { - T::ItemVector refs; + typename T::ItemVector refs; op.ApplyOperations(&refs); if (!refs.empty()) { addMetadataStrings(refs.size(), tooltip, needComma, singular, plural); From 7b4ed39dc04d0580dbda8ed3e9005b31ef02bed9 Mon Sep 17 00:00:00 2001 From: Pierre Tremblay Date: Tue, 13 Oct 2020 16:32:00 -0400 Subject: [PATCH 3/3] Addressed UFE v1 interface comments feedback. --- lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp | 1 + lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.h | 1 + lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp | 1 + lib/mayaUsd/ufe/UsdRotateUndoableCommand.h | 1 + lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp | 1 + lib/mayaUsd/ufe/UsdScaleUndoableCommand.h | 1 + lib/mayaUsd/ufe/UsdTransform3d.cpp | 2 ++ lib/mayaUsd/ufe/UsdTransform3d.h | 1 + lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp | 1 + lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h | 1 + test/lib/ufe/testRotatePivot.py | 4 ++++ 11 files changed, 15 insertions(+) diff --git a/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp b/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp index b46439ef37..e942d1c792 100644 --- a/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp @@ -110,6 +110,7 @@ void UsdRotatePivotTranslateUndoableCommand::redo() //------------------------------------------------------------------------------ #if UFE_PREVIEW_VERSION_NUM >= 2025 +//#ifdef UFE_V2_FEATURES_AVAILABLE bool UsdRotatePivotTranslateUndoableCommand::set(double x, double y, double z) #else bool UsdRotatePivotTranslateUndoableCommand::translate(double x, double y, double z) diff --git a/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.h b/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.h index b2f0729013..10e5f660d7 100644 --- a/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.h @@ -61,6 +61,7 @@ class MAYAUSD_CORE_PUBLIC UsdRotatePivotTranslateUndoableCommand : public Ufe::T void undo() override; void redo() override; #if UFE_PREVIEW_VERSION_NUM >= 2025 +//#ifdef UFE_V2_FEATURES_AVAILABLE bool set(double x, double y, double z) override; #else bool translate(double x, double y, double z) override; diff --git a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp index e2a9554b7d..806de50e58 100644 --- a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp @@ -101,6 +101,7 @@ void UsdRotateUndoableCommand::performImp(double x, double y, double z) //------------------------------------------------------------------------------ #if UFE_PREVIEW_VERSION_NUM >= 2025 +//#ifdef UFE_V2_FEATURES_AVAILABLE bool UsdRotateUndoableCommand::set(double x, double y, double z) #else bool UsdRotateUndoableCommand::rotate(double x, double y, double z) diff --git a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h index 30607a9549..95956a10bd 100644 --- a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h @@ -60,6 +60,7 @@ class MAYAUSD_CORE_PUBLIC UsdRotateUndoableCommand : public Ufe::RotateUndoableC void undo() override; void redo() override; #if UFE_PREVIEW_VERSION_NUM >= 2025 +//#ifdef UFE_V2_FEATURES_AVAILABLE bool set(double x, double y, double z) override; #else bool rotate(double x, double y, double z) override; diff --git a/lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp b/lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp index 12867297ff..50a5ecb65e 100644 --- a/lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp @@ -90,6 +90,7 @@ void UsdScaleUndoableCommand::performImp(double x, double y, double z) //------------------------------------------------------------------------------ #if UFE_PREVIEW_VERSION_NUM >= 2025 +//#ifdef UFE_V2_FEATURES_AVAILABLE bool UsdScaleUndoableCommand::set(double x, double y, double z) #else bool UsdScaleUndoableCommand::scale(double x, double y, double z) diff --git a/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h b/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h index 97f85fba9a..6d63c7e3fa 100644 --- a/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h @@ -57,6 +57,7 @@ class MAYAUSD_CORE_PUBLIC UsdScaleUndoableCommand : public Ufe::ScaleUndoableCom void undo() override; void redo() override; #if UFE_PREVIEW_VERSION_NUM >= 2025 +//#ifdef UFE_V2_FEATURES_AVAILABLE bool set(double x, double y, double z) override; #else bool scale(double x, double y, double z) override; diff --git a/lib/mayaUsd/ufe/UsdTransform3d.cpp b/lib/mayaUsd/ufe/UsdTransform3d.cpp index d666b2510d..f8cfcf9d4d 100644 --- a/lib/mayaUsd/ufe/UsdTransform3d.cpp +++ b/lib/mayaUsd/ufe/UsdTransform3d.cpp @@ -220,6 +220,7 @@ void UsdTransform3d::scale(double x, double y, double z) } #if UFE_PREVIEW_VERSION_NUM >= 2025 +//#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::TranslateUndoableCommand::Ptr UsdTransform3d::rotatePivotCmd(double, double, double) { // As of 12-Oct-2020, setting rotate pivot on command creation @@ -265,6 +266,7 @@ Ufe::Vector3d UsdTransform3d::rotatePivot() const } #if UFE_PREVIEW_VERSION_NUM >= 2025 +//#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::TranslateUndoableCommand::Ptr UsdTransform3d::scalePivotCmd(double, double, double) { throw std::runtime_error("UsdTransform3d::scalePivotCmd() not implemented"); diff --git a/lib/mayaUsd/ufe/UsdTransform3d.h b/lib/mayaUsd/ufe/UsdTransform3d.h index ce000c949a..fc6c10a29b 100644 --- a/lib/mayaUsd/ufe/UsdTransform3d.h +++ b/lib/mayaUsd/ufe/UsdTransform3d.h @@ -81,6 +81,7 @@ class MAYAUSD_CORE_PUBLIC UsdTransform3d : public Ufe::Transform3d void rotate(double x, double y, double z) override; void scale(double x, double y, double z) override; #if UFE_PREVIEW_VERSION_NUM >= 2025 +//#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::TranslateUndoableCommand::Ptr rotatePivotCmd(double x, double y, double z) override; void rotatePivot(double x, double y, double z) override; Ufe::TranslateUndoableCommand::Ptr scalePivotCmd(double x, double y, double z) override; diff --git a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp index e261899160..f936d8b069 100644 --- a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp @@ -86,6 +86,7 @@ void UsdTranslateUndoableCommand::performImp(double x, double y, double z) //------------------------------------------------------------------------------ #if UFE_PREVIEW_VERSION_NUM >= 2025 +//#ifdef UFE_V2_FEATURES_AVAILABLE bool UsdTranslateUndoableCommand::set(double x, double y, double z) #else bool UsdTranslateUndoableCommand::translate(double x, double y, double z) diff --git a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h index 7f732c1d91..0ad3f8146c 100644 --- a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h @@ -58,6 +58,7 @@ class MAYAUSD_CORE_PUBLIC UsdTranslateUndoableCommand : public Ufe::TranslateUnd void undo() override; void redo() override; #if UFE_PREVIEW_VERSION_NUM >= 2025 +//#ifdef UFE_V2_FEATURES_AVAILABLE bool set(double x, double y, double z) override; #else bool translate(double x, double y, double z) override; diff --git a/test/lib/ufe/testRotatePivot.py b/test/lib/ufe/testRotatePivot.py index 6fa36c7a6c..ae4690781f 100644 --- a/test/lib/ufe/testRotatePivot.py +++ b/test/lib/ufe/testRotatePivot.py @@ -102,6 +102,7 @@ def testRotatePivot(self): usdSphereItem = ufe.Hierarchy.createItem(usdSpherePath) t3d = ufe.Transform3d.transform3d(usdSphereItem) + # if (ufeUtils.ufeFeatureSetVersion() >= 2): if(os.getenv('UFE_PREVIEW_VERSION_NUM', '0000') < '2025'): t3d.rotatePivotTranslate(pivot[0], pivot[1], pivot[2]) else: @@ -113,6 +114,7 @@ def testRotatePivot(self): sphereMatrix = om.MMatrix(t3d.inclusiveMatrix().matrix) self.checkPos(sphereMatrix, [xyWorldValue, xyWorldValue, 0]) + # if (ufeUtils.ufeFeatureSetVersion() >= 2): if(os.getenv('UFE_PREVIEW_VERSION_NUM', '0000') < '2025'): t3d.rotatePivotTranslate(0, 0, 0) else: @@ -124,6 +126,7 @@ def testRotatePivot(self): self.checkPos(sphereMatrix, [10, 0, 0]) # Use a UFE undoable command to set the pivot. + # if (ufeUtils.ufeFeatureSetVersion() >= 2): if(os.getenv('UFE_PREVIEW_VERSION_NUM', '0000') < '2025'): rotatePivotCmd = t3d.rotatePivotTranslateCmd() rotatePivotCmd.translate(pivot[0], pivot[1], pivot[2]) @@ -172,6 +175,7 @@ def testRotatePivotCmd(self): # Start with a non-zero initial rotate pivot. This is required to test # MAYA-105345, otherwise a zero initial rotate pivot produces the # correct result through an unintended code path. + # if (ufeUtils.ufeFeatureSetVersion() >= 2): if(os.getenv('UFE_PREVIEW_VERSION_NUM', '0000') < '2025'): t3d.rotatePivotTranslate(2, 0, 0) else: