Skip to content

Commit

Permalink
Merge pull request #2513 from Autodesk/tremblp/MAYA-124619/ufe_xform_…
Browse files Browse the repository at this point in the history
…cpc_test

Add test for xform -cpc support.
  • Loading branch information
seando-adsk authored Jul 28, 2022
2 parents 4afa144 + a898a79 commit 53441f4
Showing 1 changed file with 33 additions and 27 deletions.
60 changes: 33 additions & 27 deletions test/lib/ufe/testComboCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,34 +861,40 @@ def testCenterPivotUndo(self):
sn.clear()
sn.append(capsuleItem)

# center point is expected to be at [0.0, 0.0, 0.0]
assertVectorAlmostEqual(self, usdT3d.rotatePivot().vector, [0.0, 0.0, 0.0])
assertVectorAlmostEqual(self, usdT3d.scalePivot().vector, [0.0, 0.0, 0.0])
kwArgs = [{'cp' : True}]
if mayaUtils.ufeSupportFixLevel() >= 4:
kwArgs.append({'cpc' : True})

# move the pivot location
cmds.move(7, 2, 1, r=True, urp=True, usp=True)

assertVectorAlmostEqual(self, usdT3d.rotatePivot().vector, [7.0, 2.0, 1.0])
assertVectorAlmostEqual(self, usdT3d.scalePivot().vector, [7.0, 2.0, 1.0])

# call center pivot command
cmds.xform(cp=True)

# center point is expected to be at [0.0, 0.0, 0.0]
assertVectorAlmostEqual(self, usdT3d.rotatePivot().vector, [0.0, 0.0, 0.0])
assertVectorAlmostEqual(self, usdT3d.scalePivot().vector, [0.0, 0.0, 0.0])

# undo
cmds.undo()

assertVectorAlmostEqual(self, usdT3d.rotatePivot().vector, [7.0, 2.0, 1.0])
assertVectorAlmostEqual(self, usdT3d.scalePivot().vector, [7.0, 2.0, 1.0])

# redo
cmds.redo()

assertVectorAlmostEqual(self, usdT3d.rotatePivot().vector, [0.0, 0.0, 0.0])
assertVectorAlmostEqual(self, usdT3d.scalePivot().vector, [0.0, 0.0, 0.0])
for kwArg in kwArgs:

# center point is expected to be at [0.0, 0.0, 0.0]
assertVectorAlmostEqual(self, usdT3d.rotatePivot().vector, [0.0, 0.0, 0.0])
assertVectorAlmostEqual(self, usdT3d.scalePivot().vector, [0.0, 0.0, 0.0])

# move the pivot location
cmds.move(7, 2, 1, r=True, urp=True, usp=True)

assertVectorAlmostEqual(self, usdT3d.rotatePivot().vector, [7.0, 2.0, 1.0])
assertVectorAlmostEqual(self, usdT3d.scalePivot().vector, [7.0, 2.0, 1.0])

# call center pivot command
cmds.xform(**kwArg)

# center point is expected to be at [0.0, 0.0, 0.0]
assertVectorAlmostEqual(self, usdT3d.rotatePivot().vector, [0.0, 0.0, 0.0])
assertVectorAlmostEqual(self, usdT3d.scalePivot().vector, [0.0, 0.0, 0.0])

# undo
cmds.undo()

assertVectorAlmostEqual(self, usdT3d.rotatePivot().vector, [7.0, 2.0, 1.0])
assertVectorAlmostEqual(self, usdT3d.scalePivot().vector, [7.0, 2.0, 1.0])

# redo
cmds.redo()

assertVectorAlmostEqual(self, usdT3d.rotatePivot().vector, [0.0, 0.0, 0.0])
assertVectorAlmostEqual(self, usdT3d.scalePivot().vector, [0.0, 0.0, 0.0])

@unittest.skipUnless(mayaUtils.ufeSupportFixLevel() > 0, "Requires center pivot Maya fix.")
def testCenterPivotUpdatePivotCompensations(self):
Expand Down

0 comments on commit 53441f4

Please sign in to comment.