diff --git a/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp b/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp index c8be1e7c1a..e942d1c792 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,12 @@ void UsdRotatePivotTranslateUndoableCommand::redo() // Ufe::TranslateUndoableCommand overrides //------------------------------------------------------------------------------ +#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) +#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..10e5f660d7 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,12 @@ class MAYAUSD_CORE_PUBLIC UsdRotatePivotTranslateUndoableCommand : public Ufe::T // Ufe::TranslateUndoableCommand overrides 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; +#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..806de50e58 100644 --- a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp @@ -100,7 +100,12 @@ void UsdRotateUndoableCommand::performImp(double x, double y, double z) // Ufe::RotateUndoableCommand overrides //------------------------------------------------------------------------------ +#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) +#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..95956a10bd 100644 --- a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h @@ -59,7 +59,12 @@ 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 +//#ifdef UFE_V2_FEATURES_AVAILABLE + 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..50a5ecb65e 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,12 @@ void UsdScaleUndoableCommand::performImp(double x, double y, double z) // Ufe::ScaleUndoableCommand overrides //------------------------------------------------------------------------------ +#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) +#endif { perform(x, y, z); return true; diff --git a/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h b/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h index 3bcd3917b8..6d63c7e3fa 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,12 @@ class MAYAUSD_CORE_PUBLIC UsdScaleUndoableCommand : public Ufe::ScaleUndoableCom // Ufe::ScaleUndoableCommand overrides 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; +#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..f8cfcf9d4d 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,20 @@ void UsdTransform3d::scale(double x, double y, double z) scaleOp(prim(), fItem->path(), x, y, 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 + // 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 +247,7 @@ void UsdTransform3d::rotatePivotTranslate(double x, double y, double z) { rotatePivotTranslateOp(prim(), path(), x, y, z); } +#endif Ufe::Vector3d UsdTransform3d::rotatePivot() const { @@ -246,6 +265,18 @@ Ufe::Vector3d UsdTransform3d::rotatePivot() const return Ufe::Vector3d(x, y, z); } +#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"); +} + +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 +286,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..fc6c10a29b 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,19 @@ 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 +//#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; + 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..f936d8b069 100644 --- a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp @@ -85,7 +85,12 @@ void UsdTranslateUndoableCommand::performImp(double x, double y, double z) // Ufe::TranslateUndoableCommand overrides //------------------------------------------------------------------------------ +#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) +#endif { perform(x, y, z); return true; diff --git a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h index 96441a3cf2..0ad3f8146c 100644 --- a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h @@ -57,7 +57,12 @@ 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 +//#ifdef UFE_V2_FEATURES_AVAILABLE + 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/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); diff --git a/test/lib/ufe/testRotatePivot.py b/test/lib/ufe/testRotatePivot.py index 0c713d02d1..ae4690781f 100644 --- a/test/lib/ufe/testRotatePivot.py +++ b/test/lib/ufe/testRotatePivot.py @@ -102,7 +102,11 @@ def testRotatePivot(self): usdSphereItem = ufe.Hierarchy.createItem(usdSpherePath) t3d = ufe.Transform3d.transform3d(usdSphereItem) - t3d.rotatePivotTranslate(pivot[0], pivot[1], pivot[2]) + # if (ufeUtils.ufeFeatureSetVersion() >= 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 +114,11 @@ def testRotatePivot(self): sphereMatrix = om.MMatrix(t3d.inclusiveMatrix().matrix) self.checkPos(sphereMatrix, [xyWorldValue, xyWorldValue, 0]) - t3d.rotatePivotTranslate(0, 0, 0) + # if (ufeUtils.ufeFeatureSetVersion() >= 2): + 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 +126,13 @@ 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 (ufeUtils.ufeFeatureSetVersion() >= 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 +175,11 @@ 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 (ufeUtils.ufeFeatureSetVersion() >= 2): + 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))