Skip to content

Commit

Permalink
Merge pull request #1033 from Autodesk/krickw/MAYA-108121/build_fix_f…
Browse files Browse the repository at this point in the history
…or_ufe_update

Maya-108121 Fix type name changed in UFE.
  • Loading branch information
Krystian Ligenza authored Jan 4, 2021
2 parents cd192e8 + f63c6e8 commit 19d82e8
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@

namespace {

using OpFunc = std::function<UsdGeomXformOp(const Ufe::BaseTransformUndoableCommand&)>;
#if UFE_PREVIEW_VERSION_NUM >= 2031
using BaseUndoableCommand = Ufe::BaseUndoableCommand;
#else
using BaseUndoableCommand = Ufe::BaseTransformUndoableCommand;
#endif
using OpFunc = std::function<UsdGeomXformOp(const BaseUndoableCommand&)>;

using namespace MayaUsd::ufe;

Expand Down Expand Up @@ -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<UsdSceneItem>(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());
Expand Down Expand Up @@ -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<UsdSceneItem>(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<UsdSceneItem>(cmd.sceneItem());
TF_AXIOM(usdSceneItem);
Expand Down Expand Up @@ -565,24 +570,24 @@ 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<UsdSceneItem>(cmd.sceneItem());
TF_AXIOM(usdSceneItem);
auto attr = usdSceneItem->prim().GetAttribute(attrName);
return UsdGeomXformOp(attr);
})
: OpFunc([opSuffix, setXformOpOrderFn = getXformOpOrderFn(), v](
const Ufe::BaseTransformUndoableCommand& cmd) {
InTransform3dChange guard(cmd.path());
auto usdSceneItem = std::dynamic_pointer_cast<UsdSceneItem>(cmd.sceneItem());
TF_AXIOM(usdSceneItem);
UsdGeomXformable xformable(usdSceneItem->prim());
auto op = xformable.AddTranslateOp(OpPrecision<V>::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<UsdSceneItem>(cmd.sceneItem());
TF_AXIOM(usdSceneItem);
UsdGeomXformable xformable(usdSceneItem->prim());
auto op = xformable.AddTranslateOp(OpPrecision<V>::precision, opSuffix);
TF_AXIOM(op);
op.Set(v);
setXformOpOrderFn(xformable);
return op;
});

return std::make_shared<UsdVecOpUndoableCmd<V>>(
v, path(), std::move(f), UsdTimeCode::Default());
Expand All @@ -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<UsdSceneItem>(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
Expand Down

0 comments on commit 19d82e8

Please sign in to comment.