Skip to content

Commit

Permalink
Modifs from code review.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanierd-adsk committed Jan 29, 2024
1 parent 05ac5fc commit dd8e886
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ def test_UsdStageVariants(self):

#Check geometry variant
rootPrim = shapeStage.GetPrimAtPath('/Cubes')
self.assertFalse(rootPrim== None)
self.assertIsNotNone(rootPrim)
modVariant = rootPrim.GetVariantSet('modelingVariant')
self.assertFalse(modVariant== None)
self.assertIsNotNone(modVariant)
self.assertEqual(modVariant.GetVariantSelection(), 'OneCube')

#Select the USD Cubes to see the selection highlight
Expand All @@ -57,40 +57,41 @@ def test_UsdStageVariants(self):
usdUtils.createUfePathSegment("/Cubes")])
cubesItems = ufe.Hierarchy.createItem(cubesPath)
self.assertIsNotNone(cubesItems)
ufe.GlobalSelection.get().clear()
ufe.GlobalSelection.get().append(cubesItems)
ufeGlobalSel = ufe.GlobalSelection.get()
ufeGlobalSel.clear()
ufeGlobalSel.append(cubesItems)
self.assertSnapshotClose("oneCube.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)
ufe.GlobalSelection.get().clear()
ufeGlobalSel.clear()

modVariant.SetVariantSelection('TwoCubes')
self.assertEqual(modVariant.GetVariantSelection(), 'TwoCubes')
ufe.GlobalSelection.get().append(cubesItems)
ufeGlobalSel.append(cubesItems)
self.assertSnapshotClose("twoCubes.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)
ufe.GlobalSelection.get().clear()
ufeGlobalSel.clear()

modVariant.SetVariantSelection('ThreeCubes')
self.assertEqual(modVariant.GetVariantSelection(), 'ThreeCubes')
ufe.GlobalSelection.get().append(cubesItems)
ufeGlobalSel.append(cubesItems)
self.assertSnapshotClose("threeCubes.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)
ufe.GlobalSelection.get().clear()
ufeGlobalSel.clear()

#Check displacement variant for CubeOne (not an actual displacement but a different transform)
cube1Prim = shapeStage.GetPrimAtPath('/Cubes/Geom/CubeOne')
self.assertFalse(cube1Prim== None)
self.assertIsNotNone(cube1Prim)
displacementVariant = cube1Prim.GetVariantSet('displacement')
self.assertFalse(displacementVariant== None)
self.assertIsNotNone(displacementVariant)
self.assertEqual(displacementVariant.GetVariantSelection(), 'none')
displacementVariant .SetVariantSelection('moved')
self.assertEqual(displacementVariant.GetVariantSelection(), 'moved')
ufe.GlobalSelection.get().append(cubesItems)
ufeGlobalSel.append(cubesItems)
self.assertSnapshotClose("threeCubesWithDisplacement.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)
ufe.GlobalSelection.get().clear()
ufeGlobalSel.clear()

#Check if it works when the prims are instanceable
cube2Prim = shapeStage.GetPrimAtPath('/Cubes/Geom/CubeTwo')
self.assertFalse(cube2Prim== None)
self.assertIsNotNone(cube2Prim)
cube3Prim = shapeStage.GetPrimAtPath('/Cubes/Geom/CubeThree')
self.assertFalse(cube3Prim== None)
self.assertIsNotNone(cube3Prim)
cube1Prim.SetInstanceable(True)
self.assertTrue(cube1Prim.IsInstanceable())
cube2Prim.SetInstanceable(True)
Expand All @@ -99,20 +100,20 @@ def test_UsdStageVariants(self):
self.assertTrue(cube3Prim.IsInstanceable())
modVariant.SetVariantSelection('OneCube')
self.assertEqual(modVariant.GetVariantSelection(), 'OneCube')
ufe.GlobalSelection.get().append(cubesItems)
ufeGlobalSel.append(cubesItems)
self.assertSnapshotClose("oneCubeInstanceable.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)
ufe.GlobalSelection.get().clear()
ufeGlobalSel.clear()

#Enable the following tests when HYDRA-820 is fixed
#modVariant.SetVariantSelection('TwoCubes')
#self.assertEqual(modVariant.GetVariantSelection(), 'TwoCubes')
#ufe.GlobalSelection.get().append(cubesItems)
#ufeGlobalSel.append(cubesItems)
#self.assertSnapshotClose("twoCubesInstanceable.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)
#ufe.GlobalSelection.get().clear()
#ufeGlobalSel.clear()

#modVariant.SetVariantSelection('ThreeCubes')
#self.assertEqual(modVariant.GetVariantSelection(), 'ThreeCubes')
#ufe.GlobalSelection.get().append(cubesItems)
#ufeGlobalSel.append(cubesItems)
#self.assertSnapshotClose("threeCubesInstanceable.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)

if __name__ == '__main__':
Expand Down

0 comments on commit dd8e886

Please sign in to comment.