From 7402ad654d8a7feb418c0f58ccc2a39c0ae153e6 Mon Sep 17 00:00:00 2001 From: krickw Date: Mon, 4 Jan 2021 10:43:57 -0500 Subject: [PATCH 1/3] Fix type name changed in UFE. --- .../ufe/UsdTransform3dMayaXformStack.cpp | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp b/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp index b628c286b3..ca828a00e8 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp +++ b/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp @@ -31,7 +31,12 @@ namespace { -using OpFunc = std::function; +#if UFE_PREVIEW_VERSION_NUM >= 2031 +using BaseUndoableCommand = Ufe::BaseUndoableCommand; +#else +using BaseUndoableCommand = BaseUndoableCommand; +#endif +using OpFunc = std::function; using namespace MayaUsd::ufe; @@ -429,14 +434,14 @@ UsdTransform3dMayaXformStack::rotateCmd(double x, double y, double z) // If there is no rotate transform op, we will create a RotXYZ. CvtRotXYZToAttrFn cvt = hasRotate ? getCvtRotXYZToAttrFn(op.GetOpName()) : toXYZ; OpFunc f = hasRotate - ? OpFunc([attrName](const Ufe::BaseTransformUndoableCommand& cmd) { + ? OpFunc([attrName](const BaseUndoableCommand& cmd) { auto usdSceneItem = std::dynamic_pointer_cast(cmd.sceneItem()); TF_AXIOM(usdSceneItem); auto attr = usdSceneItem->prim().GetAttribute(attrName); return UsdGeomXformOp(attr); }) : OpFunc([opSuffix = getTRSOpSuffix(), setXformOpOrderFn = getXformOpOrderFn(), v]( - const Ufe::BaseTransformUndoableCommand& cmd) { + const BaseUndoableCommand& cmd) { // Use notification guard, otherwise will generate one notification // for the xform op add, and another for the reorder. InTransform3dChange guard(cmd.path()); @@ -465,14 +470,14 @@ Ufe::ScaleUndoableCommand::Ptr UsdTransform3dMayaXformStack::scaleCmd(double x, attrName = op.GetOpName(); } OpFunc f = hasScale - ? OpFunc([attrName](const Ufe::BaseTransformUndoableCommand& cmd) { + ? OpFunc([attrName](const BaseUndoableCommand& cmd) { auto usdSceneItem = std::dynamic_pointer_cast(cmd.sceneItem()); TF_AXIOM(usdSceneItem); auto attr = usdSceneItem->prim().GetAttribute(attrName); return UsdGeomXformOp(attr); }) : OpFunc([opSuffix = getTRSOpSuffix(), setXformOpOrderFn = getXformOpOrderFn(), v]( - const Ufe::BaseTransformUndoableCommand& cmd) { + const BaseUndoableCommand& cmd) { InTransform3dChange guard(cmd.path()); auto usdSceneItem = std::dynamic_pointer_cast(cmd.sceneItem()); TF_AXIOM(usdSceneItem); @@ -565,14 +570,14 @@ Ufe::SetVector3dUndoableCommand::Ptr UsdTransform3dMayaXformStack::setVector3dCm { auto attr = prim().GetAttribute(attrName); OpFunc f = attr - ? OpFunc([attrName](const Ufe::BaseTransformUndoableCommand& cmd) { + ? OpFunc([attrName](const BaseUndoableCommand& cmd) { auto usdSceneItem = std::dynamic_pointer_cast(cmd.sceneItem()); TF_AXIOM(usdSceneItem); auto attr = usdSceneItem->prim().GetAttribute(attrName); return UsdGeomXformOp(attr); }) : OpFunc([opSuffix, setXformOpOrderFn = getXformOpOrderFn(), v]( - const Ufe::BaseTransformUndoableCommand& cmd) { + const BaseUndoableCommand& cmd) { InTransform3dChange guard(cmd.path()); auto usdSceneItem = std::dynamic_pointer_cast(cmd.sceneItem()); TF_AXIOM(usdSceneItem); @@ -596,14 +601,14 @@ UsdTransform3dMayaXformStack::pivotCmd(const TfToken& pvtOpSuffix, double x, dou GfVec3f v(x, y, z); auto attr = prim().GetAttribute(pvtAttrName); OpFunc f = attr - ? OpFunc([pvtAttrName](const Ufe::BaseTransformUndoableCommand& cmd) { + ? OpFunc([pvtAttrName](const BaseUndoableCommand& cmd) { auto usdSceneItem = std::dynamic_pointer_cast(cmd.sceneItem()); TF_AXIOM(usdSceneItem); auto attr = usdSceneItem->prim().GetAttribute(pvtAttrName); return UsdGeomXformOp(attr); }) : OpFunc([pvtOpSuffix, setXformOpOrderFn = getXformOpOrderFn(), v]( - const Ufe::BaseTransformUndoableCommand& cmd) { + const BaseUndoableCommand& cmd) { // Without a notification guard each operation (each transform op // addition, setting the attribute value, and setting the transform // op order) will notify. Observers would see an object in an From c1f555c54e92f2b20632dd6bd4fb6805fd91b5d5 Mon Sep 17 00:00:00 2001 From: krickw Date: Mon, 4 Jan 2021 11:03:06 -0500 Subject: [PATCH 2/3] Fix clang format issue. --- .../ufe/UsdTransform3dMayaXformStack.cpp | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp b/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp index ca828a00e8..a7c5480ee6 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp +++ b/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp @@ -576,18 +576,18 @@ Ufe::SetVector3dUndoableCommand::Ptr UsdTransform3dMayaXformStack::setVector3dCm auto attr = usdSceneItem->prim().GetAttribute(attrName); return UsdGeomXformOp(attr); }) - : OpFunc([opSuffix, setXformOpOrderFn = getXformOpOrderFn(), v]( - const BaseUndoableCommand& cmd) { - InTransform3dChange guard(cmd.path()); - auto usdSceneItem = std::dynamic_pointer_cast(cmd.sceneItem()); - TF_AXIOM(usdSceneItem); - UsdGeomXformable xformable(usdSceneItem->prim()); - auto op = xformable.AddTranslateOp(OpPrecision::precision, opSuffix); - TF_AXIOM(op); - op.Set(v); - setXformOpOrderFn(xformable); - return op; - }); + : OpFunc( + [opSuffix, setXformOpOrderFn = getXformOpOrderFn(), v](const BaseUndoableCommand& cmd) { + InTransform3dChange guard(cmd.path()); + auto usdSceneItem = std::dynamic_pointer_cast(cmd.sceneItem()); + TF_AXIOM(usdSceneItem); + UsdGeomXformable xformable(usdSceneItem->prim()); + auto op = xformable.AddTranslateOp(OpPrecision::precision, opSuffix); + TF_AXIOM(op); + op.Set(v); + setXformOpOrderFn(xformable); + return op; + }); return std::make_shared>( v, path(), std::move(f), UsdTimeCode::Default()); From f63c6e8292e0cda8ae7d08887521576d3ec8834e Mon Sep 17 00:00:00 2001 From: krickw Date: Mon, 4 Jan 2021 13:02:44 -0500 Subject: [PATCH 3/3] Fix copy-paste error. --- lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp b/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp index a7c5480ee6..8b1cf8c7b4 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp +++ b/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp @@ -34,7 +34,7 @@ namespace { #if UFE_PREVIEW_VERSION_NUM >= 2031 using BaseUndoableCommand = Ufe::BaseUndoableCommand; #else -using BaseUndoableCommand = BaseUndoableCommand; +using BaseUndoableCommand = Ufe::BaseTransformUndoableCommand; #endif using OpFunc = std::function;