def testMetallicF0(self): """Tests that the specular F0 of a metallic surface is equal to its base color See Pixar USD commit https://github.com/PixarAnimationStudios/USD/commit/f11ab360""" cmds.file(force=True, new=True) mayaUtils.loadPlugin("mayaUsdPlugin") cmds.xform("persp", t=(24, 16, 0), ws=True) cmds.xform("persp", ro=[-35, 90, 0], ws=True) testFile = testUtils.getTestScene("UsdPreviewSurface", "F0_is_base.usda") mayaUtils.createProxyFromFile(testFile) # Need a point light at (0.36, 7.625, 8.111) white_light = cmds.pointLight(rgb=(1, 1, 1)) white_transform = cmds.listRelatives(white_light, parent=True)[0] cmds.xform(white_transform, t=(0.36, 7.625, 8.111), ws=True) panel = mayaUtils.activeModelPanel() cmds.modelEditor(panel, edit=True, lights=False, displayLights="all") if int(os.getenv("MAYA_LIGHTAPI_VERSION")) == 2: light_api = "V2" else: light_api = "V1" self.assertSnapshotClose('F0_is_base_{}.png'.format(light_api))
def testShadowsAndSSAO(self): cmds.file(force=True, new=True) mayaUtils.loadPlugin("mayaUsdPlugin") cmds.xform("persp", t=(10, 10, 10)) cmds.xform("persp", ro=[-30, 45, 0], ws=True) testFile = testUtils.getTestScene("UsdPreviewSurface", "LightAPI_Test.usda") mayaUtils.createProxyFromFile(testFile) white_light = cmds.directionalLight(rgb=(1, 1, 1)) white_transform = cmds.listRelatives(white_light, parent=True)[0] cmds.xform(white_transform, ro=(-35, 0, 0), ws=True) if int(os.getenv("MAYA_LIGHTAPI_VERSION")) == 2: light_api = "V2" else: light_api = "V1" panel = mayaUtils.activeModelPanel() cmds.modelEditor(panel, edit=True, lights=False, displayLights="all") cmds.setAttr("hardwareRenderingGlobals.ssaoEnable", False) cmds.modelEditor(panel, edit=True, shadows=False) self.assertSnapshotClose('LightAPI_{}.png'.format(light_api)) cmds.setAttr("hardwareRenderingGlobals.ssaoEnable", True) self.assertSnapshotClose('SSAO_LightAPI_{}.png'.format(light_api)) cmds.modelEditor(panel, edit=True, shadows=True) self.assertSnapshotClose('Shadow_LightAPI_{}.png'.format(light_api)) cmds.setAttr("hardwareRenderingGlobals.ssaoEnable", False) cmds.modelEditor(panel, edit=True, shadows=False)
def _StartTest(self, testName): cmds.file(force=True, new=True) mayaUtils.loadPlugin("mayaUsdPlugin") self._testName = testName testFile = testUtils.getTestScene("camera", self._testName + ".usda") mayaUtils.createProxyFromFile(testFile) globalSelection = ufe.GlobalSelection.get() globalSelection.clear()
def _StartTest(self, testName): cmds.file(force=True, new=True) mayaUtils.loadPlugin("mayaUsdPlugin") self._testName = testName # Re-using the test scene from the consolidation test testFile = testUtils.getTestScene("consolidation", self._testName + ".usda") mayaUtils.createProxyFromFile(testFile) globalSelection = ufe.GlobalSelection.get() globalSelection.clear()
def _StartTest(self, testName): cmds.file(force=True, new=True) mayaUtils.loadPlugin("mayaUsdPlugin") self._testName = testName testFile = testUtils.getTestScene("consolidation", self._testName + ".usda") mayaUtils.createProxyFromFile(testFile) globalSelection = ufe.GlobalSelection.get() globalSelection.clear() self.assertSnapshotClose('%s_unselected.png' % self._testName)
def testFallbackColor(self): cmds.file(force=True, new=True) mayaUtils.loadPlugin("mayaUsdPlugin") cmds.xform("persp", t=(0, 0, 5)) cmds.xform("persp", ro=[0, 0, 0], ws=True) testFile = testUtils.getTestScene("UsdPreviewSurface", "TestFallbackColor.usda") mayaUtils.createProxyFromFile(testFile) self.assertSnapshotClose('TestFallbackColor.png')
def testUseSpecularWorkflow(self): cmds.file(force=True, new=True) mayaUtils.loadPlugin("mayaUsdPlugin") cmds.xform("persp", t=(0, 0, 10)) cmds.xform("persp", ro=[0, 0, 0], ws=True) testFile = testUtils.getTestScene("UsdPreviewSurface", "UseSpecularWorkflowTest.usda") mayaUtils.createProxyFromFile(testFile) self.assertSnapshotClose('UseSpecularWorkflowTest.png')
def _StartTest(self, testName): cmds.file(force=True, new=True) cmds.move(2, -2, 1.5, 'persp') mayaUtils.loadPlugin("mayaUsdPlugin") self._testName = testName testFile = testUtils.getTestScene("MaterialX", self._testName + ".usda") mayaUtils.createProxyFromFile(testFile) globalSelection = ufe.GlobalSelection.get() globalSelection.clear() self.assertSnapshotClose('%s_render.png' % self._testName)
def _StartTest(self, testName): cmds.file(force=True, new=True) mayaUtils.loadPlugin("mayaUsdPlugin") panel = mayaUtils.activeModelPanel() cmds.modelEditor(panel, edit=True, useDefaultMaterial=False) self._testName = testName testFile = testUtils.getTestScene("instances", self._testName + ".usda") mayaUtils.createProxyFromFile(testFile) globalSelection = ufe.GlobalSelection.get() globalSelection.clear() self.assertSnapshotClose('%s_unselected.png' % self._testName)
def _StartTest(self, testName): self._testName = testName testFile = testUtils.getTestScene("UsdSkel", self._testName + ".usda") mayaUtils.createProxyFromFile(testFile) globalSelection = ufe.GlobalSelection.get() globalSelection.clear() cmds.currentTime(0) self.assertSnapshotClose('%s_0.png' % self._testName) cmds.currentTime(50) self.assertSnapshotClose('%s_50.png' % self._testName) cmds.currentTime(100) self.assertSnapshotClose('%s_100.png' % self._testName)
def testGroupAcrossProxies(self): sphereFile = testUtils.getTestScene("groupCmd", "sphere.usda") sphereDagPath, sphereStage = mayaUtils.createProxyFromFile(sphereFile) usdSphere = sphereDagPath + ",/pSphere1" torusFile = testUtils.getTestScene("groupCmd", "torus.usda") torusDagPath, torusStage = mayaUtils.createProxyFromFile(torusFile) usdTorus = torusDagPath + ",/pTorus1" try: cmds.group(usdSphere, usdTorus) except Exception as e: self.assertTrue('cannot group across usd proxies')
def testMergeToUnchangedCylinder(self): '''Merge edits on unchanged data.''' # Create a stage from a file. testFile = getTestScene("cylinderSubset", "cylinder.usda") testDagPath, stage = mayaUtils.createProxyFromFile(testFile) usdCylPathString = testDagPath + ",/sphere_butNot_pCylinder1" cylBottomPrim = stage.GetPrimAtPath("/sphere_butNot_pCylinder1/bottom") bottomIndices = cylBottomPrim.GetAttribute("indices") self.assertEqual("int[]", bottomIndices.GetTypeName()) # Edit as maya and do nothing. with mayaUsd.lib.OpUndoItemList(): self.assertTrue( mayaUsd.lib.PrimUpdaterManager.editAsMaya(usdCylPathString)) cylMayaItem = ufe.GlobalSelection.get().front() # Merge edits back to USD. with mayaUsd.lib.OpUndoItemList(): cylMayaPath = cylMayaItem.path() cylMayaPathStr = ufe.PathString.string(cylMayaPath) self.assertTrue( mayaUsd.lib.PrimUpdaterManager.mergeToUsd(cylMayaPathStr)) # Check that the indices are still valid. cylBottomPrim = stage.GetPrimAtPath("/sphere_butNot_pCylinder1/bottom") bottomIndices = cylBottomPrim.GetAttribute("indices") self.assertEqual("int[]", bottomIndices.GetTypeName())
def testMergeWithoutMaterials(self): '''Merge edits on data and not merging the materials.''' # Create a stage from a file. testFile = getTestScene("cylinder", "cylinder.usda") testDagPath, stage = mayaUtils.createProxyFromFile(testFile) usdCylPathString = testDagPath + ",/pCylinder1" # Verify that the original scene does not have a look (material) prim. cylLooksPrim = stage.GetPrimAtPath("/pCylinder1/Looks") self.assertFalse(cylLooksPrim.IsValid()) # Edit as maya and do nothing. cmds.mayaUsdEditAsMaya(usdCylPathString) # Merge back to USD. cylMayaItem = ufe.GlobalSelection.get().front() cylMayaPath = cylMayaItem.path() cylMayaPathStr = ufe.PathString.string(cylMayaPath) cmds.mayaUsdMergeToUsd(cylMayaPathStr) # Verify that the merged scene added a look (material) prim. cylLooksPrim = stage.GetPrimAtPath("/pCylinder1/Looks") self.assertTrue(cylLooksPrim.IsValid()) # Undo merge to USD. cmds.undo() # Merge back to USD with export options that disable materials. cmds.mayaUsdMergeToUsd(cylMayaPathStr, exportOptions='shadingMode=none') # Verify that the merged scene still does not have a look (material) prim. cylLooksPrim = stage.GetPrimAtPath("/pCylinder1/Looks") self.assertFalse(cylLooksPrim.IsValid())
def testLayerUnselectable(self): ''' Verify that a higher priority layer can make an selectable prim unselectable. ''' cmds.file(new=True, force=True) testFile = testUtils.getTestScene("selectability", "cone-layer-unselectable-3.usda") mayaUtils.createProxyFromFile(testFile) globalSelection = ufe.GlobalSelection.get() globalSelection.clear() self._dragSelectActiveView() # verify there is the cone in the selection sel = ufe.GlobalSelection.get() self.assertTrue(sel.empty())
def testLayerSelectable(self): ''' Verify that a higher priority layer can make an unselectable prim selectable. ''' cmds.file(new=True, force=True) testFile = testUtils.getTestScene("selectability", "cone-layer-selectable-3.usda") mayaUtils.createProxyFromFile(testFile) globalSelection = ufe.GlobalSelection.get() globalSelection.clear() self._dragSelectActiveView() # verify there is the cone in the selection sel = ufe.GlobalSelection.get() self.assertEqual(1, len(sel)) coneItem = sel.front() self.assertEqual(str(coneItem.nodeName()), "Cone1")
def testInstancedIsolateSelect(self): cmds.file(force=True, new=True) mayaUtils.loadPlugin("mayaUsdPlugin") panel = mayaUtils.activeModelPanel() usdaFile = testUtils.getTestScene("instances", "perInstanceInheritedData.usda") proxyDagPath, sphereStage = mayaUtils.createProxyFromFile(usdaFile) usdball01 = proxyDagPath + ",/root/group/ball_01" usdball02 = proxyDagPath + ",/root/group/ball_02" usdball03 = proxyDagPath + ",/root/group/ball_03" usdball04 = proxyDagPath + ",/root/group/ball_04" usdball05 = proxyDagPath + ",/root/group/ball_05" cmds.move(8.5, -20, 0, "persp") cmds.rotate(90, 0, 0, "persp") globalSelection = ufe.GlobalSelection.get() globalSelection.clear() # Turn on isolate select for cube cmds.select(usdball01) cmds.isolateSelect(panel, state=1) self.assertSnapshotClose('ball01.png') # Add the hidden ball and another ball cmds.select(usdball02) cmds.select(usdball03, add=True) cmds.isolateSelect(panel, addSelectedObjects=True) self.assertSnapshotClose('ball01_ball02_ball03.png') # Remove the hidden ball cmds.select(usdball02) cmds.isolateSelect(panel, removeSelected=True) self.assertSnapshotClose('ball01_ball03.png') # Remove the first ball cmds.select(usdball01) cmds.isolateSelect(panel, removeSelected=True) self.assertSnapshotClose('ball03.png') #Auto load selected objects cmds.editor(panel, edit=True, unlockMainConnection=True) cmds.select(usdball02) self.assertSnapshotClose('autoLoadSelected_ball02.png') cmds.select(usdball01) cmds.select(usdball04, add=True) self.assertSnapshotClose('autoLoadSelected_ball01_ball04.png') cmds.select('|stage') self.assertSnapshotClose('autoLoadSelected_instance_stage.png') cmds.select(usdball05) cmds.select(usdball04, add=True) self.assertSnapshotClose('autoLoadSelected_ball04_ball05.png') cmds.editor(panel, edit=True, unlockMainConnection=False)
def testInstancedSelection(self): cmds.file(force=True, new=True) mayaUtils.loadPlugin("mayaUsdPlugin") panel = mayaUtils.activeModelPanel() usdaFile = testUtils.getTestScene("instances", "perInstanceInheritedData.usda") proxyDagPath, sphereStage = mayaUtils.createProxyFromFile(usdaFile) usdball01 = proxyDagPath + ",/root/group/ball_01" usdball03 = proxyDagPath + ",/root/group/ball_03" cmds.move(8.5, -20, 0, "persp") cmds.rotate(90, 0, 0, "persp") # Test smooth shaded cmds.modelEditor('modelPanel4', e=True, displayAppearance='smoothShaded', displayLights='default') cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=False, displayLights='default') self._selectionTest('instance_', usdball01, usdball03, proxyDagPath, 'smoothShaded') # Test smooth shaded cmds.modelEditor('modelPanel4', e=True, displayAppearance='smoothShaded', displayLights='default') cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=True, displayLights='default') self._selectionTest('instance_', usdball01, usdball03, proxyDagPath, 'wireframeOnShaded') # Test smooth shaded cmds.modelEditor('modelPanel4', e=True, displayAppearance='wireframe', displayLights='default') cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=False, displayLights='default') self._selectionTest('instance_', usdball01, usdball03, proxyDagPath, 'wireframe')
def testSelection(self): cmds.file(force=True, new=True) mayaUtils.loadPlugin("mayaUsdPlugin") panel = mayaUtils.activeModelPanel() usdaFile = testUtils.getTestScene("setsCmd", "5prims.usda") proxyDagPath, sphereStage = mayaUtils.createProxyFromFile(usdaFile) cmds.move(-4, -24, 0, "persp") cmds.rotate(90, 0, 0, "persp") usdCube = proxyDagPath + ",/Cube1" usdCylinder = proxyDagPath + ",/Cylinder1" # Test smooth shaded cmds.modelEditor('modelPanel4', e=True, displayAppearance='smoothShaded', displayLights='default') cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=False, displayLights='default') self._selectionTest('', usdCube, usdCylinder, proxyDagPath, 'smoothShaded') # Test smooth shaded cmds.modelEditor('modelPanel4', e=True, displayAppearance='smoothShaded', displayLights='default') cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=True, displayLights='default') self._selectionTest('', usdCube, usdCylinder, proxyDagPath, 'wireframeOnShaded') # Test smooth shaded cmds.modelEditor('modelPanel4', e=True, displayAppearance='wireframe', displayLights='default') cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=False, displayLights='default') self._selectionTest('', usdCube, usdCylinder, proxyDagPath, 'wireframe')
def confirmEditsSavedStatus(self, fileBackedSavedStatus, sessionSavedStatus): cmds.file(new=True, force=True) proxyNode, stage = createProxyFromFile(self._rootUsdFile) newPrimPath = "/ChangeInRoot" self.assertEqual( fileBackedSavedStatus, stage.GetPrimAtPath(newPrimPath).IsValid()) newPrimPath = "/ChangeInLayer_1_1" self.assertEqual( fileBackedSavedStatus, stage.GetPrimAtPath(newPrimPath).IsValid()) newPrimPath = "/ChangeInSessionLayer" self.assertEqual( sessionSavedStatus, stage.GetPrimAtPath(newPrimPath).IsValid())
def testSmartTransformDuplicate(self): '''Test smart transform option of duplicate command.''' torusFile = testUtils.getTestScene("groupCmd", "torus.usda") torusDagPath, torusStage = mayaUtils.createProxyFromFile(torusFile) usdTorusPathString = torusDagPath + ",/pTorus1" cmds.duplicate(usdTorusPathString) cmds.move(10, 0, 0, r=True) smartDup = cmds.duplicate(smartTransform=True) usdTorusItem = ufeUtils.createUfeSceneItem(torusDagPath, '/pTorus3') torusT3d = ufe.Transform3d.transform3d(usdTorusItem) transVector = torusT3d.inclusiveMatrix().matrix[-1] correctResult = [20, 0, 0, 1] self.assertEqual(correctResult, transVector)
def testTransform3dMatrixOpAccessors(self): '''Matrix transform op TRS must match separate transform op TRS.''' testFile = testUtils.getTestScene("transform3d", "TranslateRotate_vs_xform.usda") (psPath, stage) = mayaUtils.createProxyFromFile(testFile) # cam1 has the "transform" transform op (i.e. a matrix), and cam2 has # translate + rotateXYZ transform ops. cam1 = ufe.Hierarchy.createItem( ufe.PathString.path(psPath + ",/cameras/cam1")) cam2 = ufe.Hierarchy.createItem( ufe.PathString.path(psPath + ",/cameras/cam2")) cam1t3d = ufe.Transform3d.transform3d(cam1) cam2t3d = ufe.Transform3d.transform3d(cam2) cam1T = cam1t3d.translation() cam2T = cam2t3d.translation() testUtils.assertVectorAlmostEqual(self, cam1T.vector, cam2T.vector) cam1R = cam1t3d.rotation() cam2R = cam2t3d.rotation() testUtils.assertVectorAlmostEqual(self, cam1R.vector, cam2R.vector)
def _StartTest(self, testName): cmds.file(force=True, new=True) mayaUtils.loadPlugin("mayaUsdPlugin") self._testName = testName testFile = testUtils.getTestScene("displayColors", self._testName + ".ma") cmds.file(testFile, o=True) exportedFile = os.path.join(self._testDir, "ColorTest.usda") cmds.mayaUSDExport(mergeTransformAndShape=True, file=exportedFile, shadingMode='none', exportDisplayColor=True) shapeNode = mayaUtils.createProxyFromFile(exportedFile)[0] cmds.move(0, 0, -1, shapeNode) globalSelection = ufe.GlobalSelection.get() globalSelection.clear() self.assertSnapshotClose('%s_unselected.png' % self._testName)
def testIsolateSelect(self): cmds.file(force=True, new=True) mayaUtils.loadPlugin("mayaUsdPlugin") panel = mayaUtils.activeModelPanel() usdaFile = testUtils.getTestScene("setsCmd", "5prims.usda") proxyDagPath, sphereStage = mayaUtils.createProxyFromFile(usdaFile) usdCube = proxyDagPath + ",/Cube1" usdCylinder = proxyDagPath + ",/Cylinder1" usdCapsule = proxyDagPath + ",/Capsule1" usdCone = proxyDagPath + ",/Cone1" usdXform = proxyDagPath + ",/Xform1" cmds.move(-4, -24, 0, "persp") cmds.rotate(90, 0, 0, "persp") globalSelection = ufe.GlobalSelection.get() globalSelection.clear() self.assertSnapshotClose('unselected.png') # Turn on isolate select for cube cmds.select(usdCube) cmds.isolateSelect(panel, state=1) self.assertSnapshotClose('cube.png') # Replace isolate select cube with cylinder cmds.select(usdCylinder) cmds.isolateSelect(panel, loadSelected=True) self.assertSnapshotClose('cylinder.png') # Add capsule to isolate select cmds.select(usdCapsule) cmds.isolateSelect(panel, addSelected=True) self.assertSnapshotClose('cylinderAndCapsule.png') # Remove capsule from isolate select cmds.isolateSelect(panel, removeSelected=True) self.assertSnapshotClose('cylinderAfterCapsuleRemove.png') # Undo, Redo cmds.undo() # Undo remove capsule from isolate select self.assertSnapshotClose('undoCapsuleRemove.png') cmds.redo() # Redo remove capsule from isolate select self.assertSnapshotClose('redoCapsuleRemove.png') cmds.undo() # Undo remove capsule from isolate select cmds.undo() # Undo add capsule to isolate select self.assertSnapshotClose('undoCapsuleAdd.png') # Turn off isolate select cmds.isolateSelect(panel, state=0) self.assertSnapshotClose('isolateSelectOff.png') # Create an isolate select set, then add something directly to it cmds.isolateSelect(panel, state=1) isolateSelectSet = "modelPanel4ViewSelectedSet" cmds.sets(usdCube, add=isolateSelectSet) cmds.isolateSelect(panel, update=True) self.assertSnapshotClose('capsuleAndCube.png') # The flags addDagObject and removeDagObject don't # work with USD items. # Add the cone to the isolate select # different from addSelected because it filters out components cmds.select(usdCone) cmds.isolateSelect(panel, addSelectedObjects=True) self.assertSnapshotClose('capsuleAndCubeAndCone.png') # Translate Xform1 and reparent Cube1 under Xform1 cmds.select(usdXform) cmds.move(0, 0, 1, relative=True) cmds.select(clear=True) cmds.parent(usdCube, usdXform, relative=True) cmds.isolateSelect(panel, update=True) usdCube = usdXform + "/Cube1" self.assertSnapshotClose('reparentedCube.png') # Reparent Cube1 back cmds.parent(usdCube, proxyDagPath, relative=True) cmds.isolateSelect(panel, update=True) usdCube = proxyDagPath + ",/Cube1" self.assertSnapshotClose('reparentedCubeBack.png') #reparent the proxy shape locatorShape = cmds.createNode("locator") locator = "|" + cmds.listRelatives(locatorShape, parent=True)[0] cmds.move(0, 0, 5, locator) cmds.parent("|stage", locator, relative=True) usdCube = locator + usdCube self.assertSnapshotClose('reparentedProxyShape.png') cmds.undo() #undo reparent so that _createPrim works usdCube = proxyDagPath + ",/Cube1" #Auto load new objects usdXformItem = self._stringToUfeItem(usdXform) usdXformCone = self._createPrim(usdXformItem, 'Cone', '/Xform1/Cone1') cmds.select(usdXformCone) cmds.move(-8.725, 0, 2) self.assertSnapshotClose('autoLoadNewObjects.png') #Auto load selected objects cmds.editor(panel, edit=True, unlockMainConnection=True) self.assertSnapshotClose('autoLoadSelected_xformCone.png') cmds.select(usdCube) self.assertSnapshotClose('autoLoadSelected_cube.png') cmds.select("|stage") self.assertSnapshotClose('autoLoadSelected_stage.png') cmds.select(usdCone) cmds.select(usdCapsule, add=True) cmds.select(usdCylinder, add=True) self.assertSnapshotClose('autoLoadSelected_coneCapsuleCyliner.png') cmds.editor(panel, edit=True, unlockMainConnection=False)
def testSetsCmd(self): usdaFile = testUtils.getTestScene("setsCmd", "5prims.usda") proxyDagPath, sphereStage = mayaUtils.createProxyFromFile(usdaFile) usdCube = proxyDagPath + ",/Cube1" usdCylinder = proxyDagPath + ",/Cylinder1" usdXform = proxyDagPath + ",/Xform1" cmds.select(usdCube) set1 = cmds.sets() cmds.select(usdCylinder) set2 = cmds.sets() # set contents self.assertEqual(usdCube, *cmds.sets(set1, q=True)) # select set cmds.select(set1) self.assertEqual(usdCube, *cmds.ls(selection=True, ufe=True)) # set of sets setOfSets = cmds.sets(set1, set2, n="setOfSets") cmds.select(setOfSets) self.assertEqual([usdCube, usdCylinder], sorted(cmds.ls(selection=True, ufe=True))) # union of the sets self.assertEqual([usdCube, usdCylinder], sorted(cmds.sets(set2, un=set1))) self.assertFalse(cmds.sets(set2, ii=set1)) # do the sets have common members # query set contents, remove from set, add to set self.assertTrue(cmds.sets(usdCube, im=set1)) # Test if Cube1 is in set1 self.assertFalse(cmds.sets(usdCube, im=set2)) # Test if Cube1 is in set2 cmds.sets(usdCube, rm=set1) # Remove Cube1 from set1 self.assertFalse(cmds.sets(usdCube, im=set1)) # Test if Cube1 is in set1 cmds.sets(usdCube, add=set1) # Add Cube1 to set1 self.assertTrue(cmds.sets(usdCube, im=set1)) # Test if Cube1 is in set1 # Undo, Redo cmds.undo() # Undo Add Cube1 to set1 self.assertFalse(cmds.sets(usdCube, im=set1)) cmds.redo() # Redo Add Cube1 to set1 self.assertTrue(cmds.sets(usdCube, im=set1)) cmds.undo() # Undo Add Cube1 to set1 self.assertFalse(cmds.sets(usdCube, im=set1)) cmds.undo() # Undo Remove Cube1 from set1 self.assertTrue(cmds.sets(usdCube, im=set1)) #reparent Cube1 under Xform1 cmds.parent(usdCube, usdXform, relative=True) usdCube = usdXform + "/Cube1" self.assertTrue(cmds.sets(usdCube, im=set1)) # Test if Cube1 is in set1 cmds.parent(usdCube, proxyDagPath, relative=True) usdCube = proxyDagPath + ",/Cube1" self.assertTrue(cmds.sets(usdCube, im=set1)) # Test if Cube1 is in set1 #reparent the proxy shape locatorShape = cmds.createNode("locator") locator = "|" + cmds.listRelatives(locatorShape, parent=True)[0] cmds.parent("|stage", locator, relative=True) usdCube = locator + usdCube self.assertTrue(cmds.sets(usdCube, im=set1)) # Test if Cube1 is in set1