Skip to content

Commit

Permalink
Usd.GetVersion() - min supported is 21.11
Browse files Browse the repository at this point in the history
mayaMajorVersion()/mayaMajorMinorVersions() - min supported is 2022
ufeFeatureSetVersion() - min supported is 2
  • Loading branch information
seando-adsk committed Oct 24, 2023
1 parent c3889a8 commit 7095ccb
Show file tree
Hide file tree
Showing 36 changed files with 55 additions and 476 deletions.
10 changes: 1 addition & 9 deletions lib/mayaUsd/resources/ae/usdschemabase/ae_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,12 +784,7 @@ def createCustomExtraAttrs(self):
self.createSection(sectionName, extraAttrs, True)

def createAppliedSchemasSection(self):
# USD version 0.21.2 is required because of
# Usd.SchemaRegistry().GetPropertyNamespacePrefix()
usdVer = Usd.GetVersion()
if usdVer < (0, 21, 2):
return

showAppliedSchemasSection = False

# loop on all applied schemas and store all those
Expand All @@ -813,10 +808,7 @@ def createAppliedSchemasSection(self):
schemaAttrsDict = {}
appliedSchemas = self.prim.GetAppliedSchemas()
for schema in appliedSchemas:
if usdVer > (0, 21, 5):
typeAndInstance = Usd.SchemaRegistry().GetTypeNameAndInstance(schema)
else:
typeAndInstance = Usd.SchemaRegistry().GetTypeAndInstance(schema)
typeAndInstance = Usd.SchemaRegistry().GetTypeNameAndInstance(schema)
typeName = typeAndInstance[0]
schemaType = Usd.SchemaRegistry().GetTypeFromName(typeName)

Expand Down
1 change: 0 additions & 1 deletion test/lib/mayaUsd/fileio/testSchemaApiAdaptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ def tearDownClass(cls):
def setUp(self):
pass

@unittest.skipUnless(Usd.GetVersion() > (0, 21, 2), 'USD Lux becomes connectable in 21.05.')
def testMinimalAdaptation(self):
"""Test that we can adapt ShadowAPI to an existing light shape. This exercises the most
basic callbacks exposed by a SchemaAPI adaptor:"""
Expand Down
5 changes: 0 additions & 5 deletions test/lib/mayaUsd/nodes/testLayerManagerSerialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def confirmEditsSavedStatus(self, fileBackedSavedStatus, sessionSavedStatus):
self.assertEqual(
sessionSavedStatus, stage.GetPrimAtPath(newPrimPath).IsValid())

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testSaveAllToMaya is available only in UFE v2 or greater.')
def testSaveAllToMaya(self):
'''
Verify that all USD edits are save into the Maya file.
Expand Down Expand Up @@ -159,7 +158,6 @@ def testSaveAllToMaya(self):

shutil.rmtree(self._currentTestDir)

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testSaveAllToUsd is available only in UFE v2 or greater.')
def testSaveAllToUsd(self):
'''
Verify that all USD edits are saved back to the original .usd files
Expand Down Expand Up @@ -191,7 +189,6 @@ def testSaveAllToUsd(self):

shutil.rmtree(self._currentTestDir)

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testIgnoreAllUsd is available only in UFE v2 or greater.')
def testIgnoreAllUsd(self):
'''
Verify that all USD edits are ignored
Expand Down Expand Up @@ -223,7 +220,6 @@ def testIgnoreAllUsd(self):

shutil.rmtree(self._currentTestDir)

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testAnonymousRootToMaya is available only in UFE v2 or greater.')
def testAnonymousRootToMaya(self):
self.setupEmptyScene()

Expand Down Expand Up @@ -254,7 +250,6 @@ def testAnonymousRootToMaya(self):

shutil.rmtree(self._currentTestDir)

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testAnonymousRootToMaya is available only in UFE v2 or greater.')
def testAnonymousRootToUsd(self):
self.setupEmptyScene()

Expand Down
7 changes: 0 additions & 7 deletions test/lib/mayaUsd/nodes/testProxyShapeBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def testBoundingBox(self):
bboxSize = cmds.getAttr('Cube_usd.boundingBoxSize')[0]
self.assertEqual(bboxSize, (1.0, 1.0, 1.0))

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testDuplicateProxyStageAnonymous only available in UFE v2 or greater.')
def testDuplicateProxyStageAnonymous(self):
'''
Verify stage with new anonymous layer is duplicated properly.
Expand Down Expand Up @@ -158,7 +157,6 @@ def testDeleteStage(self):
# Request the now dead proxy shape. This should not crash.
result = handler.findGatewayItems(proxyShapePath)

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testDeleteStageUndo uses PathString which is only available in UFE v2 or greater.')
def testDeleteStageUndo(self):
'''
Verify that we can undo the deletion of the stage.
Expand Down Expand Up @@ -205,7 +203,6 @@ def testDeleteStageUndo(self):
ufe.GlobalSelection.get().clear()
ufe.GlobalSelection.get().append(cylItem)

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testDuplicateProxyStageFileBacked only available in UFE v2 or greater.')
def testDuplicateProxyStageFileBacked(self):
'''
Verify stage from file is duplicated properly.
Expand Down Expand Up @@ -564,7 +561,6 @@ def verifyPrim():
# Verify that we did not lose the data on the root layer.
verifyPrim()

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testSettingStageViaIdPreservedWhenSaved only available in UFE v2 or greater.')
def testSettingStageViaIdPreservedWhenSaved(self):
'''
Verify that setting the stage via the stageCacheId on the proxy shape can be reloaded.
Expand Down Expand Up @@ -608,7 +604,6 @@ def verify():
verify()


@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testShareStageLoadRules only available in UFE v2 or greater.')
def testShareStageLoadRules(self):
'''
Verify that share/unshare stage preserve the load rules of the stage.
Expand Down Expand Up @@ -665,7 +660,6 @@ def check_load_rules(stage):
# check that the expected load rules are still on the stage.
check_load_rules(stage)

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testStageMutedLayers only available in UFE v2 or greater.')
def testStageMutedLayers(self):
'''
Verify that stage preserve the muted layers of the stage when a scene is reloaded.
Expand Down Expand Up @@ -699,7 +693,6 @@ def verifyMuting(stage):
stage = mayaUsd.lib.GetPrim('|stage1|stageShape1').GetStage()
verifyMuting(stage)

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testStageTargetLayer only available in UFE v2 or greater.')
def testStageTargetLayer(self):
'''
Verify that stage preserve the target layer of the stage when a scene is reloaded.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def _WriteViewportImage(self, outputImageName, suffix):
cmds.ogsRender(camera=self._cameraName, currentFrame=True, width=960,
height=540)

@unittest.skipIf((mayaUtils.mayaMajorVersion() == 2022) and (sys.version_info.major == 2) and (Usd.GetVersion() == (0, 21, 2)), "This test fails Maya 2022, python 2, USD min")
def testUsdChangeProcessingProxy(self):
"""
Tests that authoring on a USD stage that is referenced by a proxy shape
Expand All @@ -94,7 +93,7 @@ def testUsdChangeProcessingProxy(self):
rootPrim = mayaUsdLib.GetPrim(dagPathName)
self.assertTrue(rootPrim)

# Disabled this test as it is currently failing one of the extra config jobs
# Disabled this test (internally) as it is currently failing one of the extra config jobs
# Maya 2022 [USD min, Python 2, Interactive] - Branch Preflight (Windows)
#
# File ".../test/lib/mayaUsd/render/pxrUsdMayaGL\testProxyShapeDrawUsdChangeProcessing.py",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@ def _StartTest(self, testName, version=None):
def testPerInstanceInheritedData(self):
self._StartTest('perInstanceInheritedData')

# These tests don't work in earlier versions of USD, the wrong
# instance index gets selected
usdVersion = Usd.GetVersion()
if usdVersion < (0, 20, 8):
return

# Hide and show some instances to make sure it updates correctly
stage = mayaUsdUfe.getStage("|stage|stageShape")
ball_03_vis = stage.GetPrimAtPath('/root/group/ball_03').GetAttribute('visibility')
Expand All @@ -114,27 +108,18 @@ def testPerInstanceInheritedData(self):
ball_04_vis.Set('inherited')
self.assertSnapshotClose('%s_shown_after_hidden.png' % self._testName)

# These tests behave differently before USD version 21.05, so don't run
# them for those earlier versions.
if usdVersion < (0, 21, 5):
return

imageVersion = None
if usdVersion < (0, 21, 8):
imageVersion = 'pre-21_08'

# Modify the purpose of some instances to make sure they are shown and hidden properly
ball_03_purpose = stage.GetPrimAtPath('/root/group/ball_03').GetAttribute('purpose')
ball_04_purpose = stage.GetPrimAtPath('/root/group/ball_04').GetAttribute('purpose')

ball_03_purpose.Set('guide')
self.assertSnapshotClose('%s_ball_03_guide.png' % self._testName, imageVersion)
self.assertSnapshotClose('%s_ball_03_guide.png' % self._testName)
ball_04_purpose.Set('guide')
self.assertSnapshotClose('%s_ball_03_and_04_guide.png' % self._testName, imageVersion)
self.assertSnapshotClose('%s_ball_03_and_04_guide.png' % self._testName)
ball_03_purpose.Set('default')
self.assertSnapshotClose('%s_ball_04_guide.png' % self._testName, imageVersion)
self.assertSnapshotClose('%s_ball_04_guide.png' % self._testName)
ball_04_purpose.Set('default')
self.assertSnapshotClose('%s_default_after_guide.png' % self._testName, imageVersion)
self.assertSnapshotClose('%s_default_after_guide.png' % self._testName)

def testPerInstanceInheritedDataPartialOverridePxrMtls(self):
self._StartTest('inheritedDisplayColor_noPxrMtls')
Expand Down
1 change: 0 additions & 1 deletion test/lib/mayaUsd/undo/testUsdUndoManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def testNestedUsdUndoBlock(self):
# expect to have 2 items on the undo queue
self.assertEqual(cmds.undoInfo(q=True), nbCmds+2)

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'For unknown reason this test is failing on UFE v1')
def testRemovePrims(self):
'''
Test delete prims
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,7 @@ def testPointInstancerGrid14(self):
cmds.optionVar(stringValue=(
testUtilsSelectabilityPointInstanceSelection._pointInstancesPickModeOptionVarName, 'PointInstancer'))

# In USD versions before 21.05, the point instancer pick mode did not exists.
# For those version we end-up selecting the prototypes, of which there are 7.
expectedCount = 1 if Usd.GetVersion() >= (0, 21, 2) else 7

expectedCount = 1
self._RunTest(expectedCount)

def testPointInstancerGrid7k(self):
Expand All @@ -201,10 +198,7 @@ def testPointInstancerGrid7k(self):
cmds.optionVar(stringValue=(
testUtilsSelectabilityPointInstanceSelection._pointInstancesPickModeOptionVarName, 'PointInstancer'))

# In USD versions before 21.05, the point instancer pick mode did not exists.
# For those version we end-up selecting the prototypes, of which there are 7.
expectedCount = 1 if Usd.GetVersion() >= (0, 21, 2) else 7

expectedCount = 1
self._RunTest(expectedCount)


Expand Down
10 changes: 2 additions & 8 deletions test/lib/ufe/testAttribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,8 @@ def __init__(self):
self._keys = None

def __call__(self, notification):
if (ufeUtils.ufeFeatureSetVersion() >= 2):
if isinstance(notification, ufe.AttributeValueChanged):
self._notifications += 1
else:
if isinstance(notification, ufe.AttributeChanged):
self._notifications += 1
if isinstance(notification, ufe.AttributeValueChanged):
self._notifications += 1
if hasattr(ufe, 'AttributeMetadataChanged') and isinstance(notification, ufe.AttributeMetadataChanged):
self._keys = notification.keys()

Expand Down Expand Up @@ -1816,7 +1812,6 @@ def createAndTestAttribute(self, materialItem, shaderDefName, shaderName, origVa
validation(self, shaderAttr.get(), newValue)

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 4, 'Test only available in UFE v4 or greater')
@unittest.skipUnless(Usd.GetVersion() >= (0, 21, 8), 'Requires CanApplySchema from USD')
def testCreateAttributeTypes(self):
"""Tests all shader attribute types"""
cmds.file(new=True, force=True)
Expand Down Expand Up @@ -1960,7 +1955,6 @@ def testMaterialXMetadata(self):
self.assertFalse(attr.hasMetadata("uisoftmax"))

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 4, 'Test only available in UFE v4 or greater')
@unittest.skipUnless(Usd.GetVersion() >= (0, 21, 8), 'Requires CanApplySchema from USD')
def testCreateUsdPreviewSurfaceAttribute(self):
cmds.file(new=True, force=True)
testFile = testUtils.getTestScene("UsdPreviewSurface", "DisplayColorCube.usda")
Expand Down
1 change: 0 additions & 1 deletion test/lib/ufe/testAttributeBlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ def testAttributeBlocking3dCommonApi(self):
# authoring new transformation edit is allowed.
self.assertTrue(mayaUsdUfe.isAttributeEditAllowed(rotateAttr))

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testAttributeBlocking3dMatrixOps only available in UFE v2 or greater.')
def testAttributeBlocking3dMatrixOps(self):
'''
Verify authoring transformation attribute(s) in weaker layer(s) are not permitted if there exist opinion(s)
Expand Down
14 changes: 6 additions & 8 deletions test/lib/ufe/testComboCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,12 @@ def __init__(self):
self._valueChanged = 0

def __call__(self, notification):
if (ufeUtils.ufeFeatureSetVersion() >= 2):
if (ufeUtils.ufeFeatureSetVersion() >= 4):
if isinstance(notification, ufe.AttributeChanged):
self._valueChanged += 1
else:
if isinstance(notification, ufe.AttributeValueChanged):
self._valueChanged += 1
if (ufeUtils.ufeFeatureSetVersion() >= 4):
if isinstance(notification, ufe.AttributeChanged):
self._valueChanged += 1
else:
if isinstance(notification, ufe.AttributeValueChanged):
self._valueChanged += 1

if isinstance(notification, ufe.Transform3dChanged):
self._transform3d += 1
Expand Down Expand Up @@ -992,7 +991,6 @@ def testCenterPivotMatrixOp(self):

self.assertEqual(t3d.rotatePivot().vector, [0, 0, 0])

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testPrimPropertyPathNotifs only available in UFE v2 or greater.')
def testPrimPropertyPathNotifs(self):
import mayaUsd_createStageWithNewLayer
proxyShape = mayaUsd_createStageWithNewLayer.createStageWithNewLayer()
Expand Down
9 changes: 0 additions & 9 deletions test/lib/ufe/testContextOps.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@ def testAddNewPrimInWeakerLayer(self):
self.assertEqual(ufeObs.nbAddNotif(), 1)
self.assertEqual(ufeObs.nbDeleteNotif(), 1)

@unittest.skipUnless(Usd.GetVersion() >= (0, 21, 8), 'Requires CanApplySchema from USD')
def testMaterialBinding(self):
"""This test builds a material using only Ufe pre-4.10 capabilities."""
cmds.file(new=True, force=True)
Expand Down Expand Up @@ -579,7 +578,6 @@ def testMaterialBinding(self):
self.assertTrue(capsuleBindAPI.GetDirectBinding().GetMaterialPath().isEmpty)

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 4, 'Test only available in UFE v4 or greater')
@unittest.skipUnless(Usd.GetVersion() >= (0, 21, 8), 'Requires CanApplySchema from USD')
def testMaterialCreationForSingleObject(self):
"""This test builds a material using contextOps capabilities."""
cmds.file(new=True, force=True)
Expand Down Expand Up @@ -692,7 +690,6 @@ def checkItem(self, item, type, path):
checkMaterial(self, rootHier, 3, 1, 0, "standard_surface", "mtlx", "out", "/test_scope")

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 4, 'Test only available in UFE v4 or greater')
@unittest.skipUnless(Usd.GetVersion() >= (0, 21, 8), 'Requires CanApplySchema from USD')
def testMaterialCreationForMultipleObjects(self):
"""This test creates a single shared material for multiple objects using contextOps capabilities."""
cmds.file(new=True, force=True)
Expand Down Expand Up @@ -839,7 +836,6 @@ def checkItem(self, item, type, path):
checkMaterial(self, rootHier, 5, 1, 1, 0, "standard_surface", "mtlx", "out", "/test_scope")

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 4, 'Test only available in UFE v4 or greater')
@unittest.skipUnless(Usd.GetVersion() >= (0, 21, 8), 'Requires CanApplySchema from USD')
def testMaterialCreationScopeName(self):
"""This test verifies that materials get created in the correct scope."""
cmds.file(new=True, force=True)
Expand Down Expand Up @@ -1034,7 +1030,6 @@ def createMaterial(proxyShape):
assert ufe.Hierarchy.createItem(ufe.PathString.path(expectedPath))

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 4, 'Test only available in UFE v4 or greater')
@unittest.skipUnless(Usd.GetVersion() >= (0, 21, 8), 'Requires CanApplySchema from USD')
def testAddMaterialToScope(self):
"""This test adds a new material to the material scope."""
cmds.file(new=True, force=True)
Expand Down Expand Up @@ -1104,7 +1099,6 @@ def testAddMaterialToScope(self):
self.assertEqual(mxConn.dst.name, "outputs:mtlx:surface")

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 4, 'Test only available in UFE v4 or greater')
@unittest.skipUnless(Usd.GetVersion() >= (0, 21, 8), 'Requires CanApplySchema from USD')
def testMaterialBindingWithNodeDefHandler(self):
"""In this test we will go as far as possible towards creating and binding a working
material using only Ufe and Maya commands (for full undo capabilities). It is locked
Expand Down Expand Up @@ -1185,7 +1179,6 @@ def testMaterialBindingWithNodeDefHandler(self):
self.assertTrue(capsuleBindAPI.GetDirectBinding().GetMaterialPath().isEmpty)

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 4, 'Test only available in UFE v4 or greater')
@unittest.skipUnless(Usd.GetVersion() >= (0, 21, 8), 'Requires CanApplySchema from USD')
def testMaterialBindingToSelection(self):
"""Exercising the bind to selection context menu option."""
cmds.file(new=True, force=True)
Expand Down Expand Up @@ -1415,7 +1408,6 @@ def _validateLoadAndUnloadItems(hierItem, itemStrings):


@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 4, 'Test only available in UFE v4 or greater')
@unittest.skipUnless(Usd.GetVersion() >= (0, 21, 8), 'Requires CanApplySchema from USD')
def testAssignExistingMaterialToSingleObject(self):
"""This test assigns an existing material from the stage via ContextOps capabilities."""
cmds.file(new=True, force=True)
Expand Down Expand Up @@ -1474,7 +1466,6 @@ def testAssignExistingMaterialToSingleObject(self):
self.assertFalse(capsulePrim.HasAPI(UsdShade.MaterialBindingAPI))

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 4, 'Test only available in UFE v4 or greater')
@unittest.skipUnless(Usd.GetVersion() >= (0, 21, 8), 'Requires CanApplySchema from USD')
def testGeomCoponentAssignment(self):
'''Duplicate a Maya cube to USD and then assign a material on a face.'''

Expand Down
8 changes: 1 addition & 7 deletions test/lib/ufe/testLegacyDeleteCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,7 @@ def testDelete(self):

# Create our UFE notification observer
ufeObs = TestObserver()

if ufeUtils.ufeFeatureSetVersion() < 2:
ufe.Scene.addObjectDeleteObserver(ufeObs)
ufe.Scene.addObjectAddObserver(ufeObs)
else:
ufe.Scene.addObserver(ufeObs)
ufe.Scene.addObserver(ufeObs)

# Select two objects, one Maya, one USD.
spherePath = ufe.Path(mayaUtils.createUfePathSegment("|pSphere1"))
Expand Down Expand Up @@ -203,7 +198,6 @@ def testDelete(self):
self.assertEqual(ufeObs.nbDeleteNotif(), 4)
self.assertEqual(ufeObs.nbAddNotif(), 4)

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testDeleteArgs only available in UFE v2 or greater.')
def testDeleteArgs(self):
'''Delete Maya and USD objects passed as command arguments.'''

Expand Down
1 change: 0 additions & 1 deletion test/lib/ufe/testMatrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ def testMatrices(self):
cylInclMat.matrix, [[1, 0, 0, 0], [0, cx60, sx60, 0],
[0, -sx60, cx60, 0], [0, 10, 0, 1]])

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testTransform3dMatrixOpAccessors only available in UFE v2 or greater.')
def testTransform3dMatrixOpAccessors(self):
'''Matrix transform op TRS must match separate transform op TRS.'''

Expand Down
Loading

0 comments on commit 7095ccb

Please sign in to comment.