From b41264899e7ae03e6b0aa3683f1bf8fb7c7815fc Mon Sep 17 00:00:00 2001 From: debloip-adsk <145056365+debloip-adsk@users.noreply.github.com> Date: Tue, 2 Apr 2024 19:00:18 -0400 Subject: [PATCH] HYDRA-536 & HYDRA-537 : Background color and grid tests (#112) * HYDRA-536 & HYDRA-537 : Add background color and grid tests * HYDRA-536 & HYDRA-537 : Refactor to apply test settings on scene open * HYDRA-536 & HYDRA-537 : Update test README * HYDRA-536 & HYDRA-537 : Remove background color change in applyTestSettings * HYDRA-536 & HYDRA-537 : Update README * HYDRA-537 : Adjust testGrid thresholds for OSX --- .../BackgroundColorTest/background_black.jpg | Bin 0 -> 3153 bytes .../BackgroundColorTest/background_blue.jpg | Bin 0 -> 3156 bytes .../BackgroundColorTest/background_gray.jpg | Bin 0 -> 3150 bytes .../BackgroundColorTest/background_green.jpg | Bin 0 -> 3155 bytes .../BackgroundColorTest/background_red.jpg | Bin 0 -> 3155 bytes .../BackgroundColorTest/background_white.jpg | Bin 0 -> 3151 bytes .../mayaUsd/render/mayaToHydra/CMakeLists.txt | 2 + .../mayaToHydra/GridTest/grid_disabled.png | Bin 0 -> 1563 bytes .../mayaToHydra/GridTest/grid_enabled.png | Bin 0 -> 16576 bytes test/lib/mayaUsd/render/mayaToHydra/README.md | 1 + .../render/mayaToHydra/testArnoldLights.py | 2 - .../render/mayaToHydra/testBackgroundColor.py | 49 ++++++++ .../render/mayaToHydra/testFootPrintNode.py | 1 - .../mayaUsd/render/mayaToHydra/testGrid.py | 34 ++++++ .../render/mayaToHydra/testMayaLights.py | 2 - .../render/mayaToHydra/testMtohBasicRender.py | 2 - .../render/mayaToHydra/testMtohDagChanges.py | 3 +- .../render/mayaToHydra/testObjectTemplate.py | 2 - .../testStagePayloadsReferences.py | 6 +- .../render/mayaToHydra/testStageVariants.py | 1 - .../render/mayaToHydra/testStandardSurface.py | 2 - .../render/mayaToHydra/testTransforms.py | 3 +- .../render/mayaToHydra/testUSDLights.py | 2 - test/testUtils/imageUtils.py | 37 +----- test/testUtils/mayaUtils.py | 106 ++++-------------- test/testUtils/mtohUtils.py | 7 +- 26 files changed, 119 insertions(+), 143 deletions(-) create mode 100644 test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_black.jpg create mode 100644 test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_blue.jpg create mode 100644 test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_gray.jpg create mode 100644 test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_green.jpg create mode 100644 test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_red.jpg create mode 100644 test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_white.jpg create mode 100644 test/lib/mayaUsd/render/mayaToHydra/GridTest/grid_disabled.png create mode 100644 test/lib/mayaUsd/render/mayaToHydra/GridTest/grid_enabled.png create mode 100644 test/lib/mayaUsd/render/mayaToHydra/testBackgroundColor.py create mode 100644 test/lib/mayaUsd/render/mayaToHydra/testGrid.py diff --git a/test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_black.jpg b/test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_black.jpg new file mode 100644 index 0000000000000000000000000000000000000000..53c40b27c383e90105d29bc3633bba9f5afc1605 GIT binary patch literal 3153 zcmex=Hq-)3+IszL!wU>=BM zf&pe`7G@A&VgfN(K!Ayvm6e4Bh*(%ahCodK>SAJH2C5<%{6D}T$iX;)aRM`=5(ASU zBeNjm|04|YK=-pk%!WCc5okIq8#@Ol7dKGBRsjYkMxeu3z|H}xt_8|7un4jWDH=Mm z2?r*!D;0_uHBMZ}q3pErplHy=4=Tnkx|JhscGpMnOVgprDf$6l~v6xt!?ccon4bAPnkMx`iz;g7A;<~blLJ1 zD_3pWyk+aQ?K^hvI&}ER(PPI?oIG{u@|COCuHU$M>*1rvPo6$|{^I4UkDoq&`TFhq zkDtFl{$gZch6WiZjz9p-UxGk?F|n{Pv#Hq-)3+IszL!wU>=BM zf&pe`7G@A&VgfN(K!Ayvm6e4Bh*(%ahCodK>SAJH2C5<%{6D}T$iX;)aRM`=5(ASU zBeNjm|04|YK=-pk%!WCc5okIq8#@Ol7dKGBRsjYkMxeu3z|H}xt_8|7un4jWDH=Mm z2?r*!D;0_uHBMZ}q3pErplHy=4=Tnkx|JhscGpMnOVgprDf$6l~v6xt!?ccon4bAPnkMx`iz;g7A;<~blLJ1 zD_3pWyk+aQ?K^hvI&}ER(PPI?oIG{u@|COCuHU$M>*1rvPo6$|{^I4UkDoq&`TFhq zkDtFl{$gZch6WiZjz9p-UxGk?F|n{Pv#uTY(KIlc21e7sXc`zz1EXnR$fN=O|2F}UY6BMl literal 0 HcmV?d00001 diff --git a/test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_gray.jpg b/test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_gray.jpg new file mode 100644 index 0000000000000000000000000000000000000000..747660e76261b1db71598624fd1aee5470dcb000 GIT binary patch literal 3150 zcmex=Hq-)3+IszL!wU>=BM zf&pe`7G@A&VgfN(K!Ayvm6e4Bh*(%ahCodK>SAJH2C5<%{6D}T$iX;)aRM`=5(ASU zBeNjm|04|YK=-pk%!WCc5okIq8#@Ol7dKGBRsjYkMxeu3z|H}xt_8|7un4jWDH=Mm z2?r*!D;0_uHBMZ}q3pErplHy=4=Tnkx|JhscGpMnOVgprDf$6l~v6xt!?ccon4bAPnkMx`iz;g7A;<~blLJ1 zD_3pWyk+aQ?K^hvI&}ER(PPI?oIG{u@|COCuHU$M>*1rvPo6$|{^I4UkDoq&`TFhq zkDtFl{$gZch6WiZjz9p-UxGk?F|n{Pv#qhTHq-)3+IszL!wU>=BM zf&pe`7G@A&VgfN(K!Ayvm6e4Bh*(%ahCodK>SAJH2C5<%{6D}T$iX;)aRM`=5(ASU zBeNjm|04|YK=-pk%!WCc5okIq8#@Ol7dKGBRsjYkMxeu3z|H}xt_8|7un4jWDH=Mm z2?r*!D;0_uHBMZ}q3pErplHy=4=Tnkx|JhscGpMnOVgprDf$6l~v6xt!?ccon4bAPnkMx`iz;g7A;<~blLJ1 zD_3pWyk+aQ?K^hvI&}ER(PPI?oIG{u@|COCuHU$M>*1rvPo6$|{^I4UkDoq&`TFhq zkDtFl{$gZch6WiZjz9p-UxGk?F|n{Pv#FjqiJ9?4UDFN(KIk*(g5@Sn*eav0+0Xz literal 0 HcmV?d00001 diff --git a/test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_red.jpg b/test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_red.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8d5143a5707c1337184e41cc10122b46db7f0fbf GIT binary patch literal 3155 zcmex=Hq-)3+IszL!wU>=BM zf&pe`7G@A&VgfN(K!Ayvm6e4Bh*(%ahCodK>SAJH2C5<%{6D}T$iX;)aRM`=5(ASU zBeNjm|04|YK=-pk%!WCc5okIq8#@Ol7dKGBRsjYkMxeu3z|H}xt_8|7un4jWDH=Mm z2?r*!D;0_uHBMZ}q3pErplHy=4=Tnkx|JhscGpMnOVgprDf$6l~v6xt!?ccon4bAPnkMx`iz;g7A;<~blLJ1 zD_3pWyk+aQ?K^hvI&}ER(PPI?oIG{u@|COCuHU$M>*1rvPo6$|{^I4UkDoq&`TFhq zkDtFl{$gZch6WiZjz9p-UxGk?F|n{Pv#FjqiJ9?4UDFN(KIk*(g5@Sn*f>^0~Y`Q literal 0 HcmV?d00001 diff --git a/test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_white.jpg b/test/lib/mayaUsd/render/mayaToHydra/BackgroundColorTest/background_white.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4e3e4da09de292718e88b2e884c84bfc1876f4a1 GIT binary patch literal 3151 zcmex=Hq-)3+IszL!wU>=BM zf&pe`7G@A&VgfN(K!Ayvm6e4Bh*(%ahCodK>SAJH2C5<%{6D}T$iX;)aRM`=5(ASU zBeNjm|04|YK=-pk%!WCc5okIq8#@Ol7dKGBRsjYkMxeu3z|H}xt_8|7un4jWDH=Mm z2?r*!D;0_uHBMZ}q3pErplHy=4=Tnkx|JhscGpMnOVgprDf$6l~v6xt!?ccon4bAPnkMx`iz;g7A;<~blLJ1 zD_3pWyk+aQ?K^hvI&}ER(PPI?oIG{u@|COCuHU$M>*1rvPo6$|{^I4UkDoq&`TFhq zkDtFl{$gZch6WiZjz9p-UxGk?F|n{Pv#l$9a4C2) zkmSsFb1Me(LBuVsZRZ#mSZ8{=IEGZrd3)87mqAhBz=6jl>*{4Q7RWmpEncvH-OQg1 z53bZ(Gc=e>axio@GE9&drAC8bG!=|ygwe8q#>HXI_W%}?wyzd{fMqrAGM&NG)z4*} HQ$iB}d4q$r literal 0 HcmV?d00001 diff --git a/test/lib/mayaUsd/render/mayaToHydra/GridTest/grid_enabled.png b/test/lib/mayaUsd/render/mayaToHydra/GridTest/grid_enabled.png new file mode 100644 index 0000000000000000000000000000000000000000..c08e74edb79a67167382ebc983f665b588bcdd9d GIT binary patch literal 16576 zcmeIa_g|84^gnLXwk<2SWo0>2(_E-6HD@kxp_MB^+@NA=Wo5&W8tzf4DInm&4O*s_ z3sV7cW^NEM1x*zF_?fTu5ke z_paSSLN2mKLP8G?|L@8FtBwDCH=ZgRgwUmgYOOcvF#VC&yxfUBUfXnb3+GZKrf z^U2tJx_gYEA#Bv}>BipOdsXrjt{bdmQa1ms#cZ!_uZnChiENv31RG7;8}7_C>*(cF z8Pe(yl=Fn&pC9es#Hk+_3OlNxRO@*0^wzZd)^tGh&VjADf+Pbzf*eg;`3Fg(T7Bo- z`)Ha`lDN00ldah-cqVng_4FB`?bU$o)oQAp`_^)L6CNDbX?n%9%=O@F&Of5z)}-N9 z2&$W9`n05rnmE-yl>C^ULf;j>AZzsdm&d2`Uq3eS%F>Z$3W^6)V)(@|{1~96Qv!St zFqUdmtFV%;5OPU&>=$$>w5C*H}`UGNWoSFuwpnC*T^j%FQpFXi(`6! z#5KNr8g>xbee1SJ#NjjP8^2>kqH$7jV{3_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Lasa7e}bl5ob zX>4A$N<^v9(8q7PwIA2bGkvJtXMgwo>jH-f{U)Dpc-7ZX)1xf>bo{x{uE)Pee}LEa z{5FU^bohTs+5hiR)K{S5r*}yDm;dV*;Qz+Q-!eQqBzoqx_pblC75M+}ctGghU8_6z ITMwT9AJ6XR?EnA( literal 0 HcmV?d00001 diff --git a/test/lib/mayaUsd/render/mayaToHydra/README.md b/test/lib/mayaUsd/render/mayaToHydra/README.md index f0a17c47cd..5d7babf853 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/README.md +++ b/test/lib/mayaUsd/render/mayaToHydra/README.md @@ -67,6 +67,7 @@ To add a new Python-only test suite : Some important notes : - Before each test, a new file will be opened and the renderer will be switched to Hydra. If you need to switch between renderers, you can use the `self.setHdStormRenderer()` and `self.setViewport2Renderer()` methods. +- Some test settings (such as turning color management off, disabling the grid, etc.) are applied by default when opening a scene using `mayaUtils.openNewScene` or `mayaUtils.openTestScene`. The new scene opened before each test is opened using `mayaUtils.openNewScene`, meaning those test settings will automatically be applied before each test. These methods provide the option not to apply those settings if desired, by passing in `useTestSettings=False`. If you want to test a setting that is modified as part of those test settings, you can either re-set it explicitly in the test, and/or load a scene with the desired settings by calling `mayaUtils.openTestScene(, useTestSettings=False)`. In case you want to avoid ever changing the test settings entirely, you can also override the `setUp` method. # Best practices - 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. diff --git a/test/lib/mayaUsd/render/mayaToHydra/testArnoldLights.py b/test/lib/mayaUsd/render/mayaToHydra/testArnoldLights.py index a8333ac307..f3a1a96fce 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testArnoldLights.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testArnoldLights.py @@ -66,8 +66,6 @@ def verifyLightingModes(self, shadowOn): #Test arnold lights (e.g., aiSkyDomeLight,etc.) with a maya native sphere and usd sphere. def test_ArnoldLights(self): - cmds.file(new=True, force=True) - # Load a maya scene with a maya native sphere, usd sphere and some lights, with HdStorm already being the viewport renderer. # The sphere is not at the origin on purpose testFile = mayaUtils.openTestScene( diff --git a/test/lib/mayaUsd/render/mayaToHydra/testBackgroundColor.py b/test/lib/mayaUsd/render/mayaToHydra/testBackgroundColor.py new file mode 100644 index 0000000000..d002808e60 --- /dev/null +++ b/test/lib/mayaUsd/render/mayaToHydra/testBackgroundColor.py @@ -0,0 +1,49 @@ +# Copyright 2024 Autodesk +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import maya.cmds as cmds + +import fixturesUtils +import mtohUtils + +class TestBackgroundColor(mtohUtils.MayaHydraBaseTestCase): + # MayaHydraBaseTestCase.setUpClass requirement. + _file = __file__ + + IMAGE_DIFF_FAIL_THRESHOLD = 0.05 + IMAGE_DIFF_FAIL_PERCENT = 1 + + def compareBackgroundColor(self, imageName): + self.setViewport2Renderer() + self.assertSnapshotClose(imageName, self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + self.setHdStormRenderer() + self.assertSnapshotClose(imageName, self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + + def test_BackgroundColor(self): + cmds.displayRGBColor('background', 0.5, 0, 0) + self.compareBackgroundColor("background_red.jpg") + cmds.displayRGBColor('background', 0, 0.5, 0) + self.compareBackgroundColor("background_green.jpg") + cmds.displayRGBColor('background', 0, 0, 0.5) + self.compareBackgroundColor("background_blue.jpg") + + cmds.displayRGBColor('background', 0, 0, 0) + self.compareBackgroundColor("background_black.jpg") + cmds.displayRGBColor('background', 0.5, 0.5, 0.5) + self.compareBackgroundColor("background_gray.jpg") + cmds.displayRGBColor('background', 1, 1, 1) + self.compareBackgroundColor("background_white.jpg") + +if __name__ == '__main__': + fixturesUtils.runTests(globals()) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testFootPrintNode.py b/test/lib/mayaUsd/render/mayaToHydra/testFootPrintNode.py index e6c8f51cd4..9e15682960 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testFootPrintNode.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testFootPrintNode.py @@ -231,7 +231,6 @@ def test_MultipleViewports(self): #Test loading a scene def test_Load(self): with PluginLoaded('mayaHydraFootPrintNode'): - cmds.file(new=True, force=True) testFile = mayaUtils.openTestScene( "testFootPrintNode", "testFootPrintNodeSaved.ma") diff --git a/test/lib/mayaUsd/render/mayaToHydra/testGrid.py b/test/lib/mayaUsd/render/mayaToHydra/testGrid.py new file mode 100644 index 0000000000..566a261a33 --- /dev/null +++ b/test/lib/mayaUsd/render/mayaToHydra/testGrid.py @@ -0,0 +1,34 @@ +# Copyright 2024 Autodesk +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import maya.cmds as cmds + +import fixturesUtils +import mtohUtils + +class TestGrid(mtohUtils.MayaHydraBaseTestCase): + # MayaHydraBaseTestCase.setUpClass requirement. + _file = __file__ + + IMAGE_DIFF_FAIL_THRESHOLD = 0.15 + IMAGE_DIFF_FAIL_PERCENT = 2 + + def test_Grid(self): + cmds.grid(toggle=True) + self.assertSnapshotClose("grid_enabled.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + cmds.grid(toggle=False) + self.assertSnapshotClose("grid_disabled.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/testMayaLights.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaLights.py index d929113308..6d2b111155 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaLights.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaLights.py @@ -86,8 +86,6 @@ def verifyLightingModes(self, shadowOn): #Test maya lights (e.g., default,directional,point,spot,etc.) with a maya native sphere and usd sphere. def test_MayaLights(self): - cmds.file(new=True, force=True) - # Load a maya scene with a maya native sphere, usd sphere and some lights, with HdStorm already being the viewport renderer. # The sphere is not at the origin on purpose testFile = mayaUtils.openTestScene( diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMtohBasicRender.py b/test/lib/mayaUsd/render/mayaToHydra/testMtohBasicRender.py index 7b974d9d14..824082fc39 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMtohBasicRender.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMtohBasicRender.py @@ -26,8 +26,6 @@ class TestSnapshot(mtohUtils.MayaHydraBaseTestCase): _file = __file__ def test_flat_orange(self): - cmds.file(new=1, f=1) - activeEditor = cmds.playblast(activeEditor=1) # Note that we use the default viewport2 renderer, because we're not testing diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMtohDagChanges.py b/test/lib/mayaUsd/render/mayaToHydra/testMtohDagChanges.py index 838b807170..0bfd4eeff7 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMtohDagChanges.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMtohDagChanges.py @@ -17,6 +17,7 @@ import maya.mel import fixturesUtils +import mayaUtils import mtohUtils class TestDagChanges(mtohUtils.MayaHydraBaseTestCase): @@ -271,7 +272,7 @@ def test_node_creation_undo(self): cmds.undoInfo(state=0) try: - cmds.file(new=1, f=1) + mayaUtils.openNewScene() self.setBasicCam() self.setHdStormRenderer() diff --git a/test/lib/mayaUsd/render/mayaToHydra/testObjectTemplate.py b/test/lib/mayaUsd/render/mayaToHydra/testObjectTemplate.py index 095f5e8bbe..8ffc27f517 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testObjectTemplate.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testObjectTemplate.py @@ -29,8 +29,6 @@ class TestObjectTemplate(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtil #Test object display & selection when template attribute is on. def test_ObjectTemplate(self): - cmds.file(new=True, force=True) - # Load a maya scene with a maya native sphere testFile = mayaUtils.openTestScene( "testObjectTemplate", diff --git a/test/lib/mayaUsd/render/mayaToHydra/testStagePayloadsReferences.py b/test/lib/mayaUsd/render/mayaToHydra/testStagePayloadsReferences.py index 504ac064ea..3cd3e05bed 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testStagePayloadsReferences.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testStagePayloadsReferences.py @@ -30,7 +30,6 @@ class TestUsdStagePayloadsAndReferences(mtohUtils.MayaHydraBaseTestCase): #Subcl IMAGE_DIFF_FAIL_PERCENT = 2 def loadUsdPayloadScene(self): - cmds.file(new=True, force=True) mayaUtils.openTestScene( "testStagePayloadsReferences", "FlowerPot.ma") @@ -38,7 +37,6 @@ def loadUsdPayloadScene(self): cmds.refresh() def loadUsdReferencesScene(self): - cmds.file(new=True, force=True) mayaUtils.openTestScene( "testStagePayloadsReferences", "References.ma") @@ -49,7 +47,7 @@ def setUpReferenceScene(self): from mayaUsd import lib as mayaUsdLib import mayaUsd_createStageWithNewLayer - cmds.file(new=True, force=True) + mayaUtils.openNewScene() # Create a simple scene with a Def prim with a USD reference. psPathStr = mayaUsd_createStageWithNewLayer.createStageWithNewLayer() @@ -66,7 +64,7 @@ def setUpReferenceScene(self): self.setHdStormRenderer() def setUpPayloadScene(self): - cmds.file(new=True, force=True) + mayaUtils.openNewScene() import mayaUsd_createStageWithNewLayer from mayaUsd import lib as mayaUsdLib import usdUtils diff --git a/test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py b/test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py index 1b97fcd4ea..15ef9999d2 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py @@ -32,7 +32,6 @@ def test_UsdStageVariants(self): from mayaUsd import lib as mayaUsdLib # usdUtils imports mayaUsd.ufe import usdUtils - cmds.file(new=True, force=True) testFile = mayaUtils.openTestScene( "testStageVariants", diff --git a/test/lib/mayaUsd/render/mayaToHydra/testStandardSurface.py b/test/lib/mayaUsd/render/mayaToHydra/testStandardSurface.py index a5fcf60386..ff3a526097 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testStandardSurface.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testStandardSurface.py @@ -28,8 +28,6 @@ class TestStandardSurface(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUti #Test the translation from maya standard surface with a maya native plane to usd preview surface. def test_StandardSurface(self): - cmds.file(new=True, force=True) - # Load a maya scene with a maya native plane, which has autodesk standard surface as material testFile = mayaUtils.openTestScene( "testStandardSurface", diff --git a/test/lib/mayaUsd/render/mayaToHydra/testTransforms.py b/test/lib/mayaUsd/render/mayaToHydra/testTransforms.py index 70f27b2d6a..7efbf12d91 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testTransforms.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testTransforms.py @@ -15,6 +15,7 @@ import maya.cmds as cmds import fixturesUtils +import mayaUtils import mtohUtils class TestTransforms(mtohUtils.MayaHydraBaseTestCase): @@ -59,7 +60,7 @@ def test_usdPrim(self): import mayaUsd_createStageWithNewLayer from pxr import UsdGeom, Gf - cmds.file(new=True, force=True) + mayaUtils.openNewScene() self.setBasicCam(10) self.setHdStormRenderer() diff --git a/test/lib/mayaUsd/render/mayaToHydra/testUSDLights.py b/test/lib/mayaUsd/render/mayaToHydra/testUSDLights.py index 3389191806..5afb988821 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testUSDLights.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testUSDLights.py @@ -73,8 +73,6 @@ def verifyLightingModes(self, shadowOn): #Test usd lights (e.g., disk,distant,dome,etc.) with a maya native sphere and usd sphere. def test_USDLights(self): - cmds.file(new=True, force=True) - # Load a maya scene with a maya native sphere, usd sphere and some lights, with HdStorm already being the viewport renderer. # The sphere is not at the origin on purpose testFile = mayaUtils.openTestScene( diff --git a/test/testUtils/imageUtils.py b/test/testUtils/imageUtils.py index b2fc7ae144..19459aff05 100644 --- a/test/testUtils/imageUtils.py +++ b/test/testUtils/imageUtils.py @@ -15,8 +15,6 @@ # import os import maya.cmds as cmds -import maya.mel -import mayaUtils import subprocess KNOWN_FORMATS = { @@ -31,19 +29,8 @@ 'bmp': 20, 'png': 32, } -def resetDefaultLightIntensity(): - """If the current Maya version supports setting the default light intensity, - then restore it to 1 so snapshots look equal across versions.""" - if maya.mel.eval("optionVar -exists defaultLightIntensity"): - maya.mel.eval("optionVar -fv defaultLightIntensity 1") - if cmds.attributeQuery('defaultLightIntensity', node='hardwareRenderingGlobals', exists=True): - cmds.setAttr('hardwareRenderingGlobals.defaultLightIntensity', 1.0) -resetDefaultLightIntensity() -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) - +def snapshot(outputPath, width=400, height=None): if height is None: height = width @@ -60,24 +47,8 @@ def snapshot(outputPath, width=400, height=None, hud=False, grid=False, colorMan # save the old output image format oldFormat = cmds.getAttr("defaultRenderGlobals.imageFormat") - # save the hud setting - oldHud = cmds.headsUpDisplay(q=1, layoutVisibility=1) - # save the grid setting - oldGrid = cmds.grid(q=1, toggle=1) - # 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 - panel = mayaUtils.activeModelPanel() - oldCamera = cmds.modelPanel(panel, q=True, cam=True) - if camera: - cmds.modelEditor(panel, edit=True, camera=camera) cmds.setAttr("defaultRenderGlobals.imageFormat", formatNum) - cmds.headsUpDisplay(layoutVisibility=hud) - cmds.grid(toggle=grid) - cmds.colorManagementPrefs(edit=True, cmEnabled=colorManagementEnabled) try: cmds.refresh() cmds.playblast(cf=outputPath, viewer=False, format="image", @@ -85,12 +56,6 @@ def snapshot(outputPath, width=400, height=None, hud=False, grid=False, colorMan widthHeight=(width, height), percent=100) finally: cmds.setAttr("defaultRenderGlobals.imageFormat", oldFormat) - cmds.headsUpDisplay(layoutVisibility=oldHud) - cmds.grid(toggle=oldGrid) - cmds.colorManagementPrefs(edit=True, cmEnabled=oldColorManagementEnabled) - - if camera: - cmds.lookThru(panel, oldCamera) def imageDiff(imagePath1, imagePath2, verbose, fail, failpercent, hardfail, warn, warnpercent, hardwarn, perceptual): diff --git a/test/testUtils/mayaUtils.py b/test/testUtils/mayaUtils.py index 62412e8db8..e5ee67781a 100644 --- a/test/testUtils/mayaUtils.py +++ b/test/testUtils/mayaUtils.py @@ -29,6 +29,7 @@ pass from maya import cmds +from maya import mel from maya.api import OpenMaya as om import ufe @@ -132,75 +133,31 @@ def isHydraRenderer(): activeRenderer = cmds.modelEditor(activeEditor, q=True,rendererOverrideName=True) return activeRenderer == HD_STORM_OVERRIDE -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. +def resetDefaultLightIntensity(): + """If the current Maya version supports setting the default light intensity, + then restore it to 1 so snapshots look equal across versions.""" + if mel.eval("optionVar -exists defaultLightIntensity"): + mel.eval("optionVar -fv defaultLightIntensity 1") + if cmds.attributeQuery('defaultLightIntensity', node='hardwareRenderingGlobals', exists=True): + cmds.setAttr('hardwareRenderingGlobals.defaultLightIntensity', 1.0) + +def applyTestSettings(): + resetDefaultLightIntensity() + cmds.headsUpDisplay(layoutVisibility=False) + cmds.grid(toggle=False) cmds.colorManagementPrefs(edit=True, cmEnabled=False) - if isHydraRenderer(): - cmds.setAttr("hardwareRenderingGlobals.multiSampleEnable", True) - - -def openTopLayerScene(): - ''' - The test scene hierarchy is represented as : - |world - |pSphere1 - |pSphereShape1 - |transform1 - |proxyShape1 - /Room_set - /Props - /Ball_1 - /Ball_2 - ... - /Ball_35 - ''' - # Open top_layer file which contains the USD scene - return openTestScene("ballset", "StandaloneScene", "top_layer.ma" ) - -def openCylinderScene(): - return openTestScene("cylinder", "usdCylinder.ma" ) - -def openTwoSpheresScene(): - return openTestScene("twoSpheres", "twoSpheres.ma" ) - -def openSphereAnimatedRadiusScene(): - return openTestScene("sphereAnimatedRadius", "sphereAnimatedRadiusProxyShape.ma" ) - -def openTreeScene(): - return openTestScene("tree", "tree.ma" ) - -def openTreeRefScene(): - return openTestScene("tree", "treeRef.ma" ) - -def openAppleBiteScene(): - return openTestScene("appleBite", "appleBite.ma" ) - -def openGroupBallsScene(): - return openTestScene("groupBalls", "ballset.ma" ) + cmds.setAttr("hardwareRenderingGlobals.multiSampleEnable", True) # TODO : Turn anti-aliasing off by default. -def openPrimitivesScene(): - return openTestScene("reorderCmd", "primitives.ma" ) - -def openPointInstancesGrid14Scene(): - return openTestScene("pointInstances", "PointInstancer_Grid_14.ma" ) - -def openPointInstancesGrid7kScene(): - return openTestScene("pointInstances", "PointInstancer_Grid_7k.ma" ) - -def openPointInstancesGrid70kScene(): - return openTestScene("pointInstances", "PointInstancer_Grid_70k.ma" ) - -def openVariantSetScene(): - return openTestScene("variantSet", "Variant.ma" ) - -def openCompositionArcsScene(): - return openTestScene("compositionArcs", "compositionArcs.ma" ) +def openNewScene(useTestSettings=True): + cmds.file(new=True, force=True) + if useTestSettings: + applyTestSettings() -def openPrimPathScene(): - return openTestScene("primPath", "primPath.ma" ) +def openTestScene(*args, useTestSettings=True): + filePath = testUtils.getTestScene(*args) + cmds.file(filePath, force=True, open=True) + if useTestSettings: + applyTestSettings() def setMayaTranslation(aMayaItem, t): '''Set the translation on the argument Maya scene item.''' @@ -254,23 +211,6 @@ def createProxyFromFile(filePath): return shapeNode,shapeStage -def createSingleSphereMayaScene(directory=None): - '''Create a Maya scene with a single polygonal sphere. - Returns the file path. - ''' - - cmds.file(new=True, force=True) - cmds.CreatePolygonSphere() - tempMayaFile = 'simpleSphere.ma' - if directory is not None: - tempMayaFile = os.path.join(directory, tempMayaFile) - # Prevent Windows single backslash from being interpreted as a control - # character. - tempMayaFile = tempMayaFile.replace(os.sep, '/') - cmds.file(rename=tempMayaFile) - cmds.file(save=True, force=True, type='mayaAscii') - return tempMayaFile - def mayaMajorVersion(): return int(cmds.about(majorVersion=True)) diff --git a/test/testUtils/mtohUtils.py b/test/testUtils/mtohUtils.py index d61b621065..b8240bbea0 100644 --- a/test/testUtils/mtohUtils.py +++ b/test/testUtils/mtohUtils.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import inspect import os import unittest @@ -21,6 +20,7 @@ import maya.mel import fixturesUtils +import mayaUtils import testUtils from imageUtils import ImageDiffingTestCase @@ -88,7 +88,7 @@ def setUp(self): # Maya is not closed/reset between each test of a test suite, # so open a new file before each test to minimize leftovers # from previous tests. - cmds.file(new=True, force=True) + mayaUtils.openNewScene() self.setHdStormRenderer() @classmethod @@ -108,7 +108,6 @@ def setHdStormRenderer(self): cmds.modelEditor( self.activeEditor, e=1, rendererOverrideName=HD_STORM_OVERRIDE) - cmds.setAttr("hardwareRenderingGlobals.multiSampleEnable", True) cmds.refresh(f=1) self.delegateId = cmds.mayaHydra(renderer=HD_STORM, sceneDelegateId="MayaHydraSceneDelegate") @@ -125,7 +124,7 @@ def setBasicCam(self, dist=DEFAULT_CAM_DIST): cmds.setAttr('persp.translate', dist, .75 * dist, dist, type='float3') def makeCubeScene(self, camDist=DEFAULT_CAM_DIST): - cmds.file(f=1, new=1) + mayaUtils.openNewScene() self.cubeTrans = cmds.polyCube()[0] self.cubeShape = cmds.listRelatives(self.cubeTrans)[0] self.setHdStormRenderer()