diff --git a/test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py b/test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py index 1284712a5a..4fd09d3842 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py @@ -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 @@ -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) @@ -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__':