diff --git a/test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt b/test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt index 2054e91528..cabf4f99b2 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt +++ b/test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt @@ -94,10 +94,6 @@ foreach(script ${TEST_SCRIPT_FILES}) # Maya uses a very old version of GLEW, so we need support for # pre-loading a newer version from elsewhere. "LD_PRELOAD=${ADDITIONAL_LD_PRELOAD}" - - # Fallback to old color management. We will have to investigate - # and introduce OCIOv2 compatible version of these tests. - "MAYA_COLOR_MANAGEMENT_SYNCOLOR=1" ) # Assign a CTest label to these tests for easy filtering. @@ -118,8 +114,6 @@ foreach(script ${INTERACTIVE_TEST_SCRIPT_FILES_MESH_ADAPTER}) "LD_PRELOAD=${ADDITIONAL_LD_PRELOAD}" - "MAYA_COLOR_MANAGEMENT_SYNCOLOR=1" - "MAYA_HYDRA_USE_MESH_ADAPTER=1" ) @@ -153,10 +147,6 @@ foreach(script ${INTERACTIVE_TEST_SCRIPT_FILES}) # Maya uses a very old version of GLEW, so we need support for # pre-loading a newer version from elsewhere. "LD_PRELOAD=${ADDITIONAL_LD_PRELOAD}" - - # Fallback to old color management. We will have to investigate - # and introduce OCIOv2 compatible version of these tests. - "MAYA_COLOR_MANAGEMENT_SYNCOLOR=1" ) # Add a ctest label to these tests for easy filtering. diff --git a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_basic.png b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_basic.png index f1783255c8..36d8eb920c 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_basic.png and b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_basic.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_bezier.png b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_bezier.png index 0bc9e23923..436988b516 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_bezier.png and b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_bezier.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_customKnots.png b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_customKnots.png index 39a512d600..aeab317640 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_customKnots.png and b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_customKnots.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_degree1.png b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_degree1.png index f6bf6b05d9..1338fca94e 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_degree1.png and b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_degree1.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_degree2.png b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_degree2.png index a7549edc04..6c216dbd18 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_degree2.png and b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_degree2.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_degree5.png b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_degree5.png index 113f3a2550..bbe183aa3c 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_degree5.png and b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveControlVertices_degree5.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_basic.png b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_basic.png index ca746be93e..00433ffe97 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_basic.png and b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_basic.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_bezier.png b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_bezier.png index b40c465d72..cf385d22c5 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_bezier.png and b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_bezier.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_degree1.png b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_degree1.png index f6bf6b05d9..1338fca94e 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_degree1.png and b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_degree1.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_degree2.png b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_degree2.png index aefc7213d8..e2c53f6b6d 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_degree2.png and b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_degree2.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_degree5.png b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_degree5.png index 96cf61db19..91d1a9c06c 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_degree5.png and b/test/lib/mayaUsd/render/mayaToHydra/CurveToolsTest/curveEditPoints_degree5.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/coneLayerCustomWireframe.png b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/coneLayerCustomWireframe.png index cf66c307cf..a47b4a12f7 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/coneLayerCustomWireframe.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/coneLayerCustomWireframe.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/layerTemplate.png b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/layerTemplate.png index 3c6e1be19a..3fc1035fdd 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/layerTemplate.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/layerTemplate.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/layerTemplateSelected.png b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/layerTemplateSelected.png index bf345af988..6a02b31d10 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/layerTemplateSelected.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/layerTemplateSelected.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/cylinder_roundCapHeightCompensation.png b/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/cylinder_roundCapHeightCompensation.png index a462af2f7c..58139da13b 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/cylinder_roundCapHeightCompensation.png and b/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/cylinder_roundCapHeightCompensation.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/helix_clockwise.png b/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/helix_clockwise.png index 4e728a69b8..9d4d423151 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/helix_clockwise.png and b/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/helix_clockwise.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/pipe_roundCapHeightCompensation.png b/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/pipe_roundCapHeightCompensation.png index 4db2d3974d..edaea1c25a 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/pipe_roundCapHeightCompensation.png and b/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/pipe_roundCapHeightCompensation.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/soccerball_modified.png b/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/soccerball_modified.png index 1e66d59ebb..5a41993f52 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/soccerball_modified.png and b/test/lib/mayaUsd/render/mayaToHydra/PolygonPrimitivesTest/soccerball_modified.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/README.md b/test/lib/mayaUsd/render/mayaToHydra/README.md index 2795de898d..f0a17c47cd 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/README.md +++ b/test/lib/mayaUsd/render/mayaToHydra/README.md @@ -72,6 +72,8 @@ Some important notes : - Don't skip tests unless necessary. If a test requires a certain plugin to be loaded, don't skip the test if the plugin fails to load, as this will falsely be reported as a pass. For such cases, prefer setting the `_requiredPlugins` variable in your test class. - Use relative paths in test data to make sure the tests will work anywhere. - Prefer storing USD data in text-form .usda instead of binary, for readability and ease of modification should a test need to be tweaked. +- By default, tests will disable color management. However, it tends to be automatically re-enabled in certain conditions; while we have mitigated this by re-disabling it every time we've seen this occur, it is safer to make sure it is explicitly disabled if possible, such as by saving test scenes with color management off (as opposed to saving them with an undefined color management status, or having it enabled). +- If you add tests for color management, do **NOT** use the legacy SynColor system, as it is no longer supported on OSX. # Image comparison diff --git a/test/lib/mayaUsd/render/mayaToHydra/testArnoldLights.py b/test/lib/mayaUsd/render/mayaToHydra/testArnoldLights.py index b13e984d7e..a8333ac307 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testArnoldLights.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testArnoldLights.py @@ -25,17 +25,8 @@ class TestArnoldLights(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils. _file = __file__ _requiredPlugins = ['mtoa'] - @property - def imageDiffFailThreshold(self): - return 0.01 - - @property - def imageDiffFailPercent(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 3 - return 0.2 + IMAGE_DIFF_FAIL_THRESHOLD = 0.01 + IMAGE_DIFF_FAIL_PERCENT = 0.2 def verifyLightingModes(self, shadowOn): imageSuffix = "_shadowOn" if shadowOn else "" @@ -47,13 +38,13 @@ def verifyLightingModes(self, shadowOn): #All Lights mode cmds.modelEditor(panel, edit=True, displayLights="all") cmds.refresh() - self.assertSnapshotClose("allLights" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("allLights" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #TODO: Enable code below when those lighting modes are supported by arnold lights #Default Light mode #cmds.modelEditor(panel, edit=True, displayLights="default") #cmds.refresh() - #self.assertSnapshotClose("defaultLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + #self.assertSnapshotClose("defaultLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Selected Light mode #cmds.modelEditor(panel, edit=True, displayLights="selected") @@ -61,17 +52,17 @@ def verifyLightingModes(self, shadowOn): #cmds.select( 'aiSkyDomeLight1', r=True ) #cmds.refresh() - #self.assertSnapshotClose("spotLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + #self.assertSnapshotClose("spotLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Flat Light mode #cmds.modelEditor(panel, edit=True, displayLights="flat") #cmds.refresh() - #self.assertSnapshotClose("flatLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + #self.assertSnapshotClose("flatLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #No Light mode #cmds.modelEditor(panel, edit=True, displayLights="none") #cmds.refresh() - #self.assertSnapshotClose("noLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + #self.assertSnapshotClose("noLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Test arnold lights (e.g., aiSkyDomeLight,etc.) with a maya native sphere and usd sphere. def test_ArnoldLights(self): diff --git a/test/lib/mayaUsd/render/mayaToHydra/testCurveTools.py b/test/lib/mayaUsd/render/mayaToHydra/testCurveTools.py index b139d157d0..99a445b92b 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testCurveTools.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testCurveTools.py @@ -25,22 +25,13 @@ class TestCurveTools(mtohUtils.MayaHydraBaseTestCase): POINTS = [(0,-5,10), (-10, 0, 0), (0, 5, -10), (10, 0, 0), (0, -5, 5), (-5,0,0), (0,5,-5), (5, 0, 0), (0,0,0)] CUSTOM_KNOTS = [0,1,2,3,4,5,6,7,8,9,10] - @property - def imageDiffFailThreshold(self): - return 0.05 - - @property - def imageDiffFailPercent(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 2 - return 0.5 + IMAGE_DIFF_FAIL_THRESHOLD = 0.05 + IMAGE_DIFF_FAIL_PERCENT = 0.5 def compareSnapshot(self, referenceFilename, cameraDistance=15): self.setBasicCam(cameraDistance) cmds.refresh() - self.assertSnapshotClose(referenceFilename, self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose(referenceFilename, self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) def setUp(self): super(TestCurveTools, self).setUp() diff --git a/test/lib/mayaUsd/render/mayaToHydra/testFootPrintNode.py b/test/lib/mayaUsd/render/mayaToHydra/testFootPrintNode.py index 9a71cf66b0..e6c8f51cd4 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testFootPrintNode.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testFootPrintNode.py @@ -30,13 +30,8 @@ class TestFootPrintNode(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - @property - def imageDiffFailThreshold(self): - return 0.01 - - @property - def imageDiffFailPercent(self): - return 0.1 + IMAGE_DIFF_FAIL_THRESHOLD = 0.01 + IMAGE_DIFF_FAIL_PERCENT = 0.1 def tearDown(self): #is called after each test : finish by a File New command to check that it's not crashing when cleaning up everything' @@ -58,7 +53,7 @@ def test_AddingPrimitives(self): #Increase its size cmds.setAttr(footPrintNodeName + '.size', 5) cmds.refresh() - self.assertSnapshotClose("add_NodeCreated.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("add_NodeCreated.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Move the transform node, the added prims should move as well # Get the transform node of the mayaHydraFootPrintNode @@ -66,41 +61,41 @@ def test_AddingPrimitives(self): self.assertIsNotNone(transformNode) cmds.move(2, 0.5, -2, transformNode) cmds.refresh() - self.assertSnapshotClose("add_NodeMoved.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("add_NodeMoved.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Hide the transform node, this should hide the mayaHydraFootPrintNode node and the added prims as well. cmds.hide(transformNode) - self.assertSnapshotClose("add_NodeHidden.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("add_NodeHidden.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Unhide the transform node, this should unhide the mayaHydraFootPrintNode node and the added prims as well. cmds.showHidden(transformNode) - self.assertSnapshotClose("add_NodeUnhidden.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("add_NodeUnhidden.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Delete the shape node, this should hide the added prims as well cmds.delete(footPrintNodeName) - self.assertSnapshotClose("add_NodeDeleted.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("add_NodeDeleted.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Undo the delete, the node should be visible again so do the added prims cmds.undo() - self.assertSnapshotClose("add_NodeDeletedUndo.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("add_NodeDeletedUndo.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Redo the delete, the added prims should be hidden cmds.redo() - self.assertSnapshotClose("add_NodeDeletedRedo.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("add_NodeDeletedRedo.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Undo the delete again, the added prims should be visible cmds.undo() - self.assertSnapshotClose("add_NodeDeletedUndoAgain.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("add_NodeDeletedUndoAgain.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.move(-0.2, -0.5, 0, transformNode) cmds.refresh() - self.assertSnapshotClose("add_NodeMovedAfterDeletionAndUndo.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("add_NodeMovedAfterDeletionAndUndo.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Switch to VP2 self.setViewport2Renderer() #Switch back to Storm self.setHdStormRenderer() - self.assertSnapshotClose("add_VP2AndThenBackToStorm.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("add_VP2AndThenBackToStorm.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Test FootPrint grids parameters def test_FootPrintAttributes(self): @@ -110,19 +105,19 @@ def test_FootPrintAttributes(self): #Create a mayaHydraFootPrintNode node which adds a dataProducerSceneIndex and a Filtering scene index footPrintNodeName = cmds.createNode("MhFootPrint") cmds.refresh() - self.assertSnapshotClose("footPrint_BeforeModifs.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("footPrint_BeforeModifs.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Modify the attributes cmds.setAttr(footPrintNodeName + '.size', 3) cmds.setAttr(footPrintNodeName + '.color', 1.0, 1.0, 1.0, type="double3") cmds.refresh() - self.assertSnapshotClose("footPrint_AfterModifs.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("footPrint_AfterModifs.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Switch to VP2 self.setViewport2Renderer() #Switch back to Storm self.setHdStormRenderer() - self.assertSnapshotClose("footPrint_VP2AndThenBackToStorm.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("footPrint_VP2AndThenBackToStorm.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Test multiple nodes def test_MultipleNodes(self): @@ -158,7 +153,7 @@ def test_MultipleNodes(self): cmds.move(2, 0, -2, transformNode2) cmds.refresh() - self.assertSnapshotClose("multipleNodes_BeforeModifs.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("multipleNodes_BeforeModifs.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Modify the color of node #2, it shouldn't change node's #1 color cmds.setAttr(footPrintNodeName2 + '.color', 1.0, 0.0, 0.0, type="double3") @@ -168,21 +163,21 @@ def test_MultipleNodes(self): cmds.rotate(0, 45, 0) cmds.scale(4, 1, 1) cmds.refresh() - self.assertSnapshotClose("multipleNodes_AfterModifs.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("multipleNodes_AfterModifs.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Hide node #1 cmds.hide(transformNode1) - self.assertSnapshotClose("multipleNodes_Node1Hidden.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("multipleNodes_Node1Hidden.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Unhide node #1 cmds.showHidden(transformNode1) - self.assertSnapshotClose("multipleNodes_Node1Unhidden.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("multipleNodes_Node1Unhidden.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Switch to VP2 self.setViewport2Renderer() #Switch back to Storm self.setHdStormRenderer() - self.assertSnapshotClose("multipleNodes_VP2AndThenBackToStorm.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("multipleNodes_VP2AndThenBackToStorm.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Test multiple viewports def test_MultipleViewports(self): @@ -213,25 +208,25 @@ def test_MultipleViewports(self): cmds.refresh() cmds.setFocus ('modelPanel4') - self.assertSnapshotClose("multipleViewports_viewPanel4.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("multipleViewports_viewPanel4.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.setFocus ('modelPanel1') - self.assertSnapshotClose("multipleViewports_viewPanel1.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("multipleViewports_viewPanel1.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Switch to VP2 cmds.setFocus ('modelPanel4') self.setViewport2Renderer() - self.assertSnapshotClose("multipleViewports_VP2_modPan4.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("multipleViewports_VP2_modPan4.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.setFocus ('modelPanel1') self.setViewport2Renderer() - self.assertSnapshotClose("multipleViewports_VP2_modPan3.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("multipleViewports_VP2_modPan3.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Switch back to Storm cmds.setFocus ('modelPanel4') self.setHdStormRenderer() - self.assertSnapshotClose("multipleViewports_VP2AndThenBackToStorm_modPan4.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("multipleViewports_VP2AndThenBackToStorm_modPan4.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.setFocus ('modelPanel1') self.setHdStormRenderer() - self.assertSnapshotClose("multipleViewports_VP2AndThenBackToStorm_modPan3.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("multipleViewports_VP2AndThenBackToStorm_modPan3.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Test loading a scene def test_Load(self): @@ -241,7 +236,7 @@ def test_Load(self): "testFootPrintNode", "testFootPrintNodeSaved.ma") cmds.refresh() - self.assertSnapshotClose("loadingFootPrintScene.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("loadingFootPrintScene.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) if __name__ == '__main__': fixturesUtils.runTests(globals()) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testLookThrough.py b/test/lib/mayaUsd/render/mayaToHydra/testLookThrough.py index e15e7dcad9..d212fb8877 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testLookThrough.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testLookThrough.py @@ -24,17 +24,8 @@ class TestLookThrough(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.M # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - @property - def imageDiffFailThreshold(self): - return 0.01 - - @property - def imageDiffFailPercent(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 3 - return 0.2 + IMAGE_DIFF_FAIL_THRESHOLD = 0.01 + IMAGE_DIFF_FAIL_PERCENT = 0.2 #Test look through camera and maya lights (spot & area). def test_LookThrough(self): @@ -46,22 +37,22 @@ def test_LookThrough(self): #Verify Default display panel = mayaUtils.activeModelPanel() - self.assertSnapshotClose("default" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("default" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Verify look through camera cmds.lookThru( panel, 'persp1' ) cmds.refresh() - self.assertSnapshotClose("lookThroughCamera" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("lookThroughCamera" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Verify look through spot Light cmds.lookThru( panel, 'spotLight1' ) cmds.refresh() - self.assertSnapshotClose("lookThroughSpotLight" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("lookThroughSpotLight" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Verify look through area light, use a small far clip to clip the scene cmds.lookThru( panel, 'areaLight1', nc=0.0, fc=7.5 ) cmds.refresh() - self.assertSnapshotClose("lookThroughAreaLight" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("lookThroughAreaLight" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) if __name__ == '__main__': fixturesUtils.runTests(globals()) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayLayers.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayLayers.py index 3c1acd82f6..1fd58f9f02 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayLayers.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayLayers.py @@ -24,21 +24,8 @@ class TestMayaDisplayLayers(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohU # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - @property - def imageDiffFailThreshold(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 0.1 - return 0.01 - - @property - def imageDiffFailPercent(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 4 - return 0.2 + IMAGE_DIFF_FAIL_THRESHOLD = 0.01 + IMAGE_DIFF_FAIL_PERCENT = 0.2 def setLayerDisplayType(self, val): allLayers = cmds.ls(long=True, type='displayLayer') @@ -53,7 +40,7 @@ def test_MayaDisplayLayers(self): cone = cmds.cone( n='cone1' ) cmds.move( 1, 5, 1 ) cmds.select(None) - self.assertSnapshotClose("default" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("default" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.select(sphere) # Create the Display layer for Sphere @@ -67,14 +54,14 @@ def test_MayaDisplayLayers(self): cmds.select(None) cmds.refresh() # All layers - self.assertSnapshotClose("allLayers" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("allLayers" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) # Hide Sphere cmds.setAttr(sphereLayer+".visibility", False) cmds.refresh() # Only Cone - self.assertSnapshotClose("coneLayer" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("coneLayer" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) # Unhide Sphere cmds.setAttr(sphereLayer+".visibility", True) @@ -83,7 +70,7 @@ def test_MayaDisplayLayers(self): # Custom Wireframe Color for Cone layer cmds.setAttr(conePlayer+".levelOfDetail", 1) cmds.setAttr(conePlayer+".color", 11) - self.assertSnapshotClose("coneLayerCustomWireframe" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("coneLayerCustomWireframe" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.setAttr(conePlayer+".levelOfDetail", 0) cmds.refresh() @@ -92,18 +79,18 @@ def test_MayaDisplayLayers(self): # Template cmds.select(None) self.setLayerDisplayType(1) - self.assertSnapshotClose("layerTemplate" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("layerTemplate" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.refresh() cmds.select(sphere) - self.assertSnapshotClose("layerTemplateSelected" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("layerTemplateSelected" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.select(None) # Reference self.setLayerDisplayType(2) - self.assertSnapshotClose("layerReference" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("layerReference" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.refresh() cmds.select(sphere) - self.assertSnapshotClose("layerReferenceSelected" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("layerReferenceSelected" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.select(None) # reset to normal diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayModes.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayModes.py index fea6b8f85a..c8d19d7822 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayModes.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayModes.py @@ -26,21 +26,8 @@ class TestMayaDisplayModes(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUt # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - @property - def imageDiffFailThreshold(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 0.1 - return 0.01 - - @property - def imageDiffFailPercent(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 4 - return 0.2 + IMAGE_DIFF_FAIL_THRESHOLD = 0.05 + IMAGE_DIFF_FAIL_PERCENT = 1.5 def test_MayaDisplayModes(self): @@ -59,44 +46,44 @@ def test_MayaDisplayModes(self): #Use Default Material cmds.modelEditor(panel, edit=True, useDefaultMaterial=True) cmds.refresh() - self.assertSnapshotClose("defaultMaterial" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("defaultMaterial" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.modelEditor(panel, edit=True, useDefaultMaterial=False) #xray mode cmds.modelEditor(panel, edit=True, xray=True) cmds.refresh() - self.assertSnapshotClose("xray" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("xray" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.modelEditor(panel, edit=True, xray=False) #WireframeOnShaded mode cmds.modelEditor(panel, edit=True, useDefaultMaterial=True) cmds.modelEditor(panel, edit=True, wireframeOnShaded=True) cmds.refresh() - self.assertSnapshotClose("wireframeOnShaded" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("wireframeOnShaded" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.modelEditor(panel, edit=True, wireframeOnShaded=False) cmds.modelEditor(panel, edit=True, useDefaultMaterial=False) #All Lights mode cmds.modelEditor(panel, edit=True, displayLights="all") cmds.refresh() - self.assertSnapshotClose("allLights" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("allLights" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Shadows mode cmds.modelEditor(panel, edit=True, shadows=True) cmds.refresh() - self.assertSnapshotClose("shadows" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("shadows" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.modelEditor(panel, edit=True, shadows=False) #Smoothshaded Material cmds.modelEditor(panel, edit=True, displayAppearance="smoothShaded") cmds.refresh() - self.assertSnapshotClose("smoothShaded" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("smoothShaded" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.modelEditor(panel, edit=True, displayLights="default") #revert to default lighting #Display texures mode cmds.modelEditor(panel, edit=True, displayTextures=True) cmds.refresh() - self.assertSnapshotClose("displayTextures" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("displayTextures" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.modelEditor(panel, edit=True, displayTextures=False) def test_MayaBoundingBoxDisplayMode(self): @@ -106,10 +93,10 @@ def test_MayaBoundingBoxDisplayMode(self): "testMayaDisplayModes", "testMayaBoundingBoxDisplayMode.ma") cmds.refresh() - self.assertSnapshotClose("BBox_sceneLoaded" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("BBox_sceneLoaded" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) panel = mayaUtils.activeModelPanel() cmds.modelEditor(panel, edit=True, displayAppearance="boundingBox") - self.assertSnapshotClose("BBox_DisplayModeOn" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("BBox_DisplayModeOn" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) if __name__ == '__main__': fixturesUtils.runTests(globals()) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaIsolateSelect.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaIsolateSelect.py index b2225dd630..3378874044 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaIsolateSelect.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaIsolateSelect.py @@ -24,28 +24,15 @@ class TestMayaIsolateSelect(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohU # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - @property - def imageDiffFailThreshold(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 0.1 - return 0.01 - - @property - def imageDiffFailPercent(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 4 - return 0.2 + IMAGE_DIFF_FAIL_THRESHOLD = 0.01 + IMAGE_DIFF_FAIL_PERCENT = 0.2 def test_IsolateSelect(self): sphere = cmds.sphere( n='sphere1' ) cone = cmds.cone( n='cone1' ) cmds.move( 1, 5, 1 ) - self.assertSnapshotClose("default" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("default" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) # Use the current modelPanel for isolation isolated_panel = cmds.paneLayout('viewPanes', q=True, pane1=True) @@ -54,7 +41,7 @@ def test_IsolateSelect(self): cmds.select(sphere) cmds.isolateSelect( isolated_panel, state=1 ) - self.assertSnapshotClose("isolateSelect" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("isolateSelect" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) if __name__ == '__main__': fixturesUtils.runTests(globals()) \ No newline at end of file diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaLights.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaLights.py index b7954f0de3..d929113308 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaLights.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaLights.py @@ -25,14 +25,12 @@ class TestMayaLights(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.Ma # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ + IMAGE_DIFF_FAIL_THRESHOLD = 0.01 + @property - def imageDiffFailThreshold(self): - return 0.01 - - @property - def imageDiffFailPercent(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. + def IMAGE_DIFF_FAIL_PERCENT(self): + # HYDRA-943 : Shadows don't seem to work properly on OSX, possibly only with point lights. + # Only the "all lights with shadows" check fails, and shadows with point light only is skipped. if platform.system() == "Darwin": return 3 return 0.2 @@ -47,12 +45,12 @@ def verifyLightingModes(self, shadowOn): #All Lights mode cmds.modelEditor(panel, edit=True, displayLights="all") cmds.refresh() - self.assertSnapshotClose("allLights" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("allLights" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Default Light mode cmds.modelEditor(panel, edit=True, displayLights="default") cmds.refresh() - self.assertSnapshotClose("defaultLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("defaultLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Selected Light mode cmds.modelEditor(panel, edit=True, displayLights="selected") @@ -60,31 +58,31 @@ def verifyLightingModes(self, shadowOn): #Use Directional Light cmds.select( 'directionalLight1', r=True ) cmds.refresh() - self.assertSnapshotClose("directionalLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("directionalLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Use Point Light #TODO: Enable shadowOn test on point light when it works if not shadowOn: cmds.select( 'pointLight1', r=True ) cmds.refresh() - self.assertSnapshotClose("pointLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("pointLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Use Spot Light cmds.select( 'spotLight1', r=True ) cmds.refresh() - self.assertSnapshotClose("spotLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("spotLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Flat Light mode #TODO: Enable test on flat lighting mode when it works #cmds.modelEditor(panel, edit=True, displayLights="flat") #cmds.refresh() - #self.assertSnapshotClose("flatLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + #self.assertSnapshotClose("flatLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #No Light mode if not shadowOn: cmds.modelEditor(panel, edit=True, displayLights="none") cmds.refresh() - self.assertSnapshotClose("noLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("noLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Test maya lights (e.g., default,directional,point,spot,etc.) with a maya native sphere and usd sphere. def test_MayaLights(self): diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaShadingModes.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaShadingModes.py index 08ca45a22d..9063ec0431 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaShadingModes.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaShadingModes.py @@ -25,21 +25,8 @@ class TestMayaShadingModes(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUt # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - @property - def imageDiffFailThreshold(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 0.05 - return 0.01 - - @property - def imageDiffFailPercent(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 6.5 - return 0.3 + IMAGE_DIFF_FAIL_THRESHOLD = 0.1 + IMAGE_DIFF_FAIL_PERCENT = 2 def test_MayaShadingModes(self): @@ -55,25 +42,25 @@ def test_MayaShadingModes(self): #Smooth Shading cmds.modelEditor(panel, edit=True, displayAppearance="smoothShaded") cmds.refresh() - self.assertSnapshotClose("default" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("default" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Flat Shading cmds.modelEditor(panel, edit=True, displayAppearance="flatShaded") cmds.refresh() - self.assertSnapshotClose("flatShaded" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("flatShaded" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.modelEditor(panel, edit=True, displayAppearance="smoothShaded") #Bounding Box cmds.modelEditor(panel, edit=True, displayAppearance="boundingBox") cmds.refresh() - self.assertSnapshotClose("boundingBox" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("boundingBox" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.modelEditor(panel, edit=True, displayAppearance="smoothShaded") #SmoothWirefame cmds.modelEditor(panel, edit=True, displayAppearance="wireframe") cmds.modelEditor(panel, edit=True, smoothWireframe=True) cmds.refresh() - self.assertSnapshotClose("smoothwireframe" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("smoothwireframe" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.modelEditor(panel, edit=True, smoothWireframe=False) cmds.modelEditor(panel, edit=True, displayAppearance="smoothShaded") @@ -81,14 +68,14 @@ def test_MayaShadingModes(self): cmds.modelEditor(panel, edit=True, wireframeOnShaded=True) cmds.modelEditor(panel, edit=True, smoothWireframe=True) cmds.refresh() - self.assertSnapshotClose("smoothwireframeonshaded" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("smoothwireframeonshaded" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.modelEditor(panel, edit=True, smoothWireframe=False) cmds.modelEditor(panel, edit=True, wireframeOnShaded=False) #X-ray cmds.modelEditor(panel, edit=True, xray=True) cmds.refresh() - self.assertSnapshotClose("xray" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("xray" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) cmds.modelEditor(panel, edit=True, xray=False) if __name__ == '__main__': diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaUsdAPIUsage.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaUsdAPIUsage.py index 23148e37f9..8d28200d5c 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaUsdAPIUsage.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaUsdAPIUsage.py @@ -24,17 +24,8 @@ class TestMayaUsdAPI(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.Ma # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - @property - def imageDiffFailThreshold(self): - return 0.01 - - @property - def imageDiffFailPercent(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 3 - return 0.2 + IMAGE_DIFF_FAIL_THRESHOLD = 0.05 + IMAGE_DIFF_FAIL_PERCENT = 1 def test_MovingUsdStage(self): # Load a maya scene with a sphere prim in a UsdStage and a directional light, with HdStorm already being the viewport renderer. @@ -42,7 +33,7 @@ def test_MovingUsdStage(self): "testMayaUsdAPIUsage", "UsdStageWithSphereMatXStdSurf.ma") cmds.refresh() - self.assertSnapshotClose("mayaUsdAPI_DirectionalLight.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("mayaUsdAPI_DirectionalLight.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Move the transform node, the usd stage prim should move as well # Get the transform node of the MayaUsdProxyShape node hosting the stage, it is named "stage1" @@ -52,44 +43,44 @@ def test_MovingUsdStage(self): # Move the selected node cmds.move(0, 0, -2) cmds.refresh() - self.assertSnapshotClose("mayaUsdAPI_TransformMoved.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("mayaUsdAPI_TransformMoved.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Hide the transform node, this should hide the usd stage cmds.hide(transformNode) - self.assertSnapshotClose("mayaUsdAPI__NodeHidden.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("mayaUsdAPI__NodeHidden.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Unhide the transform node, this should unhide the usd stage cmds.showHidden(transformNode) - self.assertSnapshotClose("mayaUsdAPI__NodeUnhidden.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("mayaUsdAPI__NodeUnhidden.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Delete the shape node, this should hide the usd stage cmds.delete(transformNode) - self.assertSnapshotClose("mayaUsdAPI__NodeDeleted.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("mayaUsdAPI__NodeDeleted.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Undo the delete, the usd stage should be visible again cmds.undo() - self.assertSnapshotClose("mayaUsdAPI__NodeDeletedUndo.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("mayaUsdAPI__NodeDeletedUndo.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Redo the delete, the usd stage should be hidden cmds.redo() - self.assertSnapshotClose("mayaUsdAPI__NodeDeletedRedo.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("mayaUsdAPI__NodeDeletedRedo.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Undo the delete again, the stage prims should be visible cmds.undo() - self.assertSnapshotClose("mayaUsdAPI__NodeDeletedUndoAgain.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("mayaUsdAPI__NodeDeletedUndoAgain.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Move transform node again to see if it still updates the usd stage prims cmds.select(transformNode) # Move the selected node cmds.move(0, 0, 4) cmds.refresh() - self.assertSnapshotClose("mayaUsdAPI__NodeMovedAfterDeletionAndUndo.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("mayaUsdAPI__NodeMovedAfterDeletionAndUndo.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Switch to VP2 self.setViewport2Renderer() #Switch back to Storm self.setHdStormRenderer() - self.assertSnapshotClose("mayaUsdAPI__VP2AndThenBackToStorm.png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("mayaUsdAPI__VP2AndThenBackToStorm.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Finish by a File New command cmds.file(new=True, force=True) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testObjectTemplate.py b/test/lib/mayaUsd/render/mayaToHydra/testObjectTemplate.py index 773732ffba..095f5e8bbe 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testObjectTemplate.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testObjectTemplate.py @@ -24,17 +24,8 @@ class TestObjectTemplate(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtil # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - @property - def imageDiffFailThreshold(self): - return 0.01 - - @property - def imageDiffFailPercent(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 3 - return 0.2 + IMAGE_DIFF_FAIL_THRESHOLD = 0.01 + IMAGE_DIFF_FAIL_PERCENT = 0.2 #Test object display & selection when template attribute is on. def test_ObjectTemplate(self): @@ -48,18 +39,18 @@ def test_ObjectTemplate(self): #Verify Default display panel = mayaUtils.activeModelPanel() - self.assertSnapshotClose("default" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("default" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Verify template attribute #Display cmds.setAttr('pSphere1.template', 1) cmds.refresh() - self.assertSnapshotClose("templateOn" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("templateOn" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Selection cmds.select( clear=True ) cmds.select( 'pSphere1', r=True ) cmds.refresh() - self.assertSnapshotClose("templateOnSelection" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("templateOnSelection" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) if __name__ == '__main__': fixturesUtils.runTests(globals()) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testPolygonPrimitives.py b/test/lib/mayaUsd/render/mayaToHydra/testPolygonPrimitives.py index 1f2f7b83d4..53c961e921 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testPolygonPrimitives.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testPolygonPrimitives.py @@ -22,22 +22,13 @@ class TestPolygonPrimitives(mtohUtils.MayaHydraBaseTestCase): # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - @property - def imageDiffFailThreshold(self): - return 0.1 - - @property - def imageDiffFailPercent(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 2 - return 0.5 + IMAGE_DIFF_FAIL_THRESHOLD = 0.05 + IMAGE_DIFF_FAIL_PERCENT = 1.5 def compareSnapshot(self, referenceFilename, cameraDistance=15): self.setBasicCam(cameraDistance) cmds.refresh() - self.assertSnapshotClose(referenceFilename, self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose(referenceFilename, self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) def setupScene(self, polygonCreationCallable): self.setHdStormRenderer() diff --git a/test/lib/mayaUsd/render/mayaToHydra/testUSDLights.py b/test/lib/mayaUsd/render/mayaToHydra/testUSDLights.py index fc78af534c..3389191806 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testUSDLights.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testUSDLights.py @@ -24,17 +24,8 @@ class TestUSDLights(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.May # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - @property - def imageDiffFailThreshold(self): - return 0.01 - - @property - def imageDiffFailPercent(self): - # HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds - # for that platform specifically for now, so we can still catch issues on other platforms. - if platform.system() == "Darwin": - return 5 - return 0.2 + IMAGE_DIFF_FAIL_THRESHOLD = 0.01 + IMAGE_DIFF_FAIL_PERCENT = 0.2 def verifyLightingModes(self, shadowOn): imageSuffix = "_shadowOn" if shadowOn else "" @@ -46,13 +37,13 @@ def verifyLightingModes(self, shadowOn): #All Lights mode cmds.modelEditor(panel, edit=True, displayLights="all") cmds.refresh() - self.assertSnapshotClose("allLights" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + self.assertSnapshotClose("allLights" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #TODO: Enable code below when those lighting modes are supported by usd lights #Default Light mode #cmds.modelEditor(panel, edit=True, displayLights="default") #cmds.refresh() - #self.assertSnapshotClose("defaultLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + #self.assertSnapshotClose("defaultLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Selected Light mode #cmds.modelEditor(panel, edit=True, displayLights="selected") @@ -60,25 +51,25 @@ def verifyLightingModes(self, shadowOn): #cmds.select( 'distantLight1', r=True ) #cmds.refresh() - #self.assertSnapshotClose("directionalLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + #self.assertSnapshotClose("directionalLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #cmds.select( 'diskLight1', r=True ) #cmds.refresh() - #self.assertSnapshotClose("pointLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + #self.assertSnapshotClose("pointLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #cmds.select( 'domeLight1', r=True ) #cmds.refresh() - #self.assertSnapshotClose("spotLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + #self.assertSnapshotClose("spotLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Flat Light mode #cmds.modelEditor(panel, edit=True, displayLights="flat") #cmds.refresh() - #self.assertSnapshotClose("flatLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + #self.assertSnapshotClose("flatLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #No Light mode #cmds.modelEditor(panel, edit=True, displayLights="none") #cmds.refresh() - #self.assertSnapshotClose("noLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) + #self.assertSnapshotClose("noLight" + imageSuffix + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Test usd lights (e.g., disk,distant,dome,etc.) with a maya native sphere and usd sphere. def test_USDLights(self): diff --git a/test/testUtils/imageUtils.py b/test/testUtils/imageUtils.py index 235b67b841..b2fc7ae144 100644 --- a/test/testUtils/imageUtils.py +++ b/test/testUtils/imageUtils.py @@ -40,7 +40,7 @@ def resetDefaultLightIntensity(): cmds.setAttr('hardwareRenderingGlobals.defaultLightIntensity', 1.0) resetDefaultLightIntensity() -def snapshot(outputPath, width=400, height=None, hud=False, grid=False, camera=None): +def snapshot(outputPath, width=400, height=None, hud=False, grid=False, colorManagementEnabled=False, camera=None): resetDefaultLightIntensity() cmds.displayRGBColor('background', 0.36, 0.36, 0.36) @@ -64,33 +64,8 @@ def snapshot(outputPath, width=400, height=None, hud=False, grid=False, camera=N oldHud = cmds.headsUpDisplay(q=1, layoutVisibility=1) # save the grid setting oldGrid = cmds.grid(q=1, toggle=1) - # save the old view transform - oldColorTransform = cmds.colorManagementPrefs(q=1, outputTarget="playblast", - outputTransformName=1) - - # Some environments use legacy synColor transforms with 2022 and above. - # Find whether the color config should be Raw or Raw legacy - # However depending on the MAYA_COLOR_MANAGEMENT_SYNCOLOR env var or the loaded - # configs, this may be under a different names. So procedurally find it. - colorTransforms = cmds.colorManagementPrefs(q=1, outputTransformNames=True) - if "Raw" in colorTransforms: - newColorTransform = "Raw" - elif "Raw (legacy)" in colorTransforms: - newColorTransform = "Raw (legacy)" - else: - # RAW should be reliably raw-like in most configs, so find the first ending in RAW - newColorTransform = [c for c in colorTransforms if c.startswith("Raw ")] - if newColorTransform: - newColorTransform = newColorTransform[0] - else: - raise RuntimeError("Could not find Raw color space in available color transforms") - - # Some environments have locked color policies that prevent changing color policies - # so we must disable and restore this accordingly. - lockedColorTransforms = os.environ.get("MAYA_COLOR_MANAGEMENT_POLICY_LOCK") == '1' - if lockedColorTransforms: - os.environ['MAYA_COLOR_MANAGEMENT_POLICY_LOCK'] = '0' - + # save the old color management status + oldColorManagementEnabled = cmds.colorManagementPrefs(q=1, cmEnabled=1) # Find the current model panel for playblasting # to make sure the desired camera is set, if any @@ -99,29 +74,20 @@ def snapshot(outputPath, width=400, height=None, hud=False, grid=False, camera=N if camera: cmds.modelEditor(panel, edit=True, camera=camera) - - # do these in a separate try/finally from color management, because - # color management seems a bit more finicky cmds.setAttr("defaultRenderGlobals.imageFormat", formatNum) cmds.headsUpDisplay(layoutVisibility=hud) cmds.grid(toggle=grid) + cmds.colorManagementPrefs(edit=True, cmEnabled=colorManagementEnabled) try: - cmds.colorManagementPrefs(e=1, outputTarget="playblast", - outputTransformName=newColorTransform) - try: - cmds.refresh() - cmds.playblast(cf=outputPath, viewer=False, format="image", - frame=cmds.currentTime(q=1), offScreen=1, - widthHeight=(width, height), percent=100) - finally: - cmds.colorManagementPrefs(e=1, outputTarget="playblast", - outputTransformName=oldColorTransform) + cmds.refresh() + cmds.playblast(cf=outputPath, viewer=False, format="image", + frame=cmds.currentTime(q=1), offScreen=1, + widthHeight=(width, height), percent=100) finally: cmds.setAttr("defaultRenderGlobals.imageFormat", oldFormat) cmds.headsUpDisplay(layoutVisibility=oldHud) cmds.grid(toggle=oldGrid) - if lockedColorTransforms: - os.environ['MAYA_COLOR_MANAGEMENT_POLICY_LOCK'] = '1' + cmds.colorManagementPrefs(edit=True, cmEnabled=oldColorManagementEnabled) if camera: cmds.lookThru(panel, oldCamera) diff --git a/test/testUtils/mayaUtils.py b/test/testUtils/mayaUtils.py index f9f758f01e..62412e8db8 100644 --- a/test/testUtils/mayaUtils.py +++ b/test/testUtils/mayaUtils.py @@ -135,6 +135,9 @@ def isHydraRenderer(): def openTestScene(*args): filePath = testUtils.getTestScene(*args) cmds.file(filePath, force=True, open=True) + # To err on the safe side, disable color management in case the scene had color management on. + # If/when we add color management tests, they will need to re-enable it manually. + cmds.colorManagementPrefs(edit=True, cmEnabled=False) if isHydraRenderer(): cmds.setAttr("hardwareRenderingGlobals.multiSampleEnable", True) diff --git a/test/testUtils/mtohUtils.py b/test/testUtils/mtohUtils.py index 252e99b856..d61b621065 100644 --- a/test/testUtils/mtohUtils.py +++ b/test/testUtils/mtohUtils.py @@ -69,6 +69,12 @@ def setUpClass(cls): cls._testDir = os.path.abspath('.') + # This optionVar sets the color management status used when creating a new scene. + # We set it to off to have color management turned off by default before each test + # (as setUp creates a new file), and to avoid inadvertently turning it on mid-test + # if a new file is manually created. + cmds.optionVar(intValue=('colorManagementEnabledByDefault', 0)) + if MAYAUSD_PLUGIN_NAME not in cls._requiredPlugins: cls._requiredPlugins.append(MAYAUSD_PLUGIN_NAME)