-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into lanierd/HYDRA-803NEW
- Loading branch information
Showing
24 changed files
with
2,339 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+2.85 KB
test/lib/mayaUsd/render/mayaToHydra/NurbsPrimitivesTest/circle_fresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.78 KB
test/lib/mayaUsd/render/mayaToHydra/NurbsPrimitivesTest/circle_modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.76 KB
test/lib/mayaUsd/render/mayaToHydra/NurbsPrimitivesTest/circle_tolerance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.45 KB
test/lib/mayaUsd/render/mayaToHydra/NurbsPrimitivesTest/circle_unfixedCenter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.72 KB
test/lib/mayaUsd/render/mayaToHydra/NurbsPrimitivesTest/cube_fresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.74 KB
test/lib/mayaUsd/render/mayaToHydra/NurbsPrimitivesTest/cube_modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.12 KB
test/lib/mayaUsd/render/mayaToHydra/NurbsPrimitivesTest/square_fresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.67 KB
test/lib/mayaUsd/render/mayaToHydra/NurbsPrimitivesTest/square_modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+19.3 KB
test/lib/mayaUsd/render/mayaToHydra/NurbsPrimitivesTest/torus_fresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.97 KB
test/lib/mayaUsd/render/mayaToHydra/NurbsPrimitivesTest/torus_modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.3 KB
test/lib/mayaUsd/render/mayaToHydra/NurbsPrimitivesTest/torus_tolerance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# | ||
# Copyright 2024 Autodesk, Inc. All rights reserved. | ||
# | ||
# 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 | ||
import mayaUtils | ||
import unittest | ||
import platform | ||
|
||
class TestArnoldLights(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose | ||
# MayaHydraBaseTestCase.setUpClass requirement. | ||
_file = __file__ | ||
|
||
@property | ||
def imageDiffFailThreshold(self): | ||
return 0.01 | ||
|
||
@property | ||
def imageDiffFailPercent(self): | ||
# 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 | ||
|
||
def verifyLightingModes(self, shadowOn): | ||
imageSuffix = "_shadowOn" if shadowOn else "" | ||
panel = mayaUtils.activeModelPanel() | ||
|
||
#Turn on/off shadows | ||
cmds.modelEditor(panel, edit=True, shadows=shadowOn) | ||
|
||
#All Lights mode | ||
cmds.modelEditor(panel, edit=True, displayLights="all") | ||
cmds.refresh() | ||
self.assertSnapshotClose("allLights" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#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) | ||
|
||
#Selected Light mode | ||
#cmds.modelEditor(panel, edit=True, displayLights="selected") | ||
#cmds.select( clear=True ) | ||
|
||
#cmds.select( 'aiSkyDomeLight1', r=True ) | ||
#cmds.refresh() | ||
#self.assertSnapshotClose("spotLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#Flat Light mode | ||
#cmds.modelEditor(panel, edit=True, displayLights="flat") | ||
#cmds.refresh() | ||
#self.assertSnapshotClose("flatLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#No Light mode | ||
#cmds.modelEditor(panel, edit=True, displayLights="none") | ||
#cmds.refresh() | ||
#self.assertSnapshotClose("noLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#Test arnold lights (e.g., aiSkyDomeLight,etc.) with a maya native sphere and usd sphere. | ||
@unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin() and mtohUtils.checkForMtoAPlugin(), "Requires Maya USD and MtoA Plugins.") | ||
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( | ||
"testArnoldLights", | ||
"testArnoldLights.ma") | ||
cmds.refresh() | ||
|
||
#Test Lighting Modes | ||
#Shadow OFF | ||
self.verifyLightingModes(False) | ||
|
||
if __name__ == '__main__': | ||
fixturesUtils.runTests(globals()) |
112 changes: 112 additions & 0 deletions
112
test/lib/mayaUsd/render/mayaToHydra/testNurbsPrimitives.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# 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 TestNurbsPrimitives(mtohUtils.MtohTestCase): | ||
# MayaHydraBaseTestCase.setUpClass requirement. | ||
_file = __file__ | ||
|
||
IMAGE_DIFF_FAIL_THRESHOLD = 0.1 | ||
IMAGE_DIFF_FAIL_PERCENT = 0.75 | ||
|
||
def compareSnapshot(self, referenceFilename, cameraDistance=10): | ||
self.setBasicCam(cameraDistance) | ||
cmds.refresh() | ||
self.assertSnapshotClose(referenceFilename, self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
|
||
def setupScene(self, nurbsCreationCallable): | ||
self.setHdStormRenderer() | ||
makeNurbNodeName = nurbsCreationCallable()[1] | ||
cmds.refresh() | ||
return makeNurbNodeName | ||
|
||
# Torus attributes is a superset of sphere, cone, and cylinder attributes | ||
def test_NurbsTorus(self): | ||
makeNurbNodeName = self.setupScene(cmds.torus) | ||
self.compareSnapshot("torus_fresh.png", 5) | ||
|
||
cmds.setAttr(makeNurbNodeName + ".startSweep", 50) | ||
cmds.setAttr(makeNurbNodeName + ".endSweep", 300) | ||
cmds.setAttr(makeNurbNodeName + ".radius", 2) | ||
cmds.setAttr(makeNurbNodeName + ".degree", 1) | ||
cmds.setAttr(makeNurbNodeName + ".sections", 12) | ||
cmds.setAttr(makeNurbNodeName + ".spans", 6) | ||
cmds.setAttr(makeNurbNodeName + ".heightRatio", 0.8) | ||
cmds.setAttr(makeNurbNodeName + ".minorSweep", 250) | ||
self.compareSnapshot("torus_modified.png") | ||
|
||
cmds.setAttr(makeNurbNodeName + ".useTolerance", True) | ||
cmds.setAttr(makeNurbNodeName + ".tolerance", 0.05) | ||
self.compareSnapshot("torus_tolerance.png") | ||
|
||
# Cube attributes is a superset of plane attributes | ||
def test_NurbsCube(self): | ||
makeNurbNodeName = self.setupScene(cmds.nurbsCube) | ||
self.compareSnapshot("cube_fresh.png", 5) | ||
|
||
cmds.setAttr(makeNurbNodeName + ".degree", 1) | ||
cmds.setAttr(makeNurbNodeName + ".patchesU", 2) | ||
cmds.setAttr(makeNurbNodeName + ".patchesV", 3) | ||
cmds.setAttr(makeNurbNodeName + ".width", 4) | ||
cmds.setAttr(makeNurbNodeName + ".lengthRatio", 2) | ||
cmds.setAttr(makeNurbNodeName + ".heightRatio", 3) | ||
self.compareSnapshot("cube_modified.png") | ||
|
||
def test_NurbsCircle(self): | ||
makeNurbNodeName = self.setupScene(cmds.circle) | ||
self.compareSnapshot("circle_fresh.png", 5) | ||
|
||
cmds.setAttr(makeNurbNodeName + ".sweep", 180) | ||
cmds.setAttr(makeNurbNodeName + ".radius", 2) | ||
cmds.setAttr(makeNurbNodeName + ".degree", 1) | ||
cmds.setAttr(makeNurbNodeName + ".sections", 12) | ||
cmds.setAttr(makeNurbNodeName + ".normalX", 1) | ||
cmds.setAttr(makeNurbNodeName + ".normalY", 2) | ||
cmds.setAttr(makeNurbNodeName + ".normalZ", 3) | ||
cmds.setAttr(makeNurbNodeName + ".centerX", 4) | ||
cmds.setAttr(makeNurbNodeName + ".centerY", 5) | ||
cmds.setAttr(makeNurbNodeName + ".centerZ", 6) | ||
cmds.setAttr(makeNurbNodeName + ".firstPointX", 7) | ||
cmds.setAttr(makeNurbNodeName + ".firstPointY", 8) | ||
cmds.setAttr(makeNurbNodeName + ".firstPointZ", 9) | ||
self.compareSnapshot("circle_modified.png") | ||
|
||
cmds.setAttr(makeNurbNodeName + ".useTolerance", True) | ||
cmds.setAttr(makeNurbNodeName + ".tolerance", 0.05) | ||
self.compareSnapshot("circle_tolerance.png") | ||
|
||
cmds.setAttr(makeNurbNodeName + ".fixCenter", False) | ||
self.compareSnapshot("circle_unfixedCenter.png") | ||
|
||
def test_NurbsSquare(self): | ||
makeNurbNodeName = self.setupScene(cmds.nurbsSquare) | ||
self.compareSnapshot("square_fresh.png", 5) | ||
|
||
cmds.setAttr(makeNurbNodeName + ".sideLength1", 2) | ||
cmds.setAttr(makeNurbNodeName + ".sideLength2", 3) | ||
cmds.setAttr(makeNurbNodeName + ".spansPerSide", 4) | ||
cmds.setAttr(makeNurbNodeName + ".degree", 1) | ||
cmds.setAttr(makeNurbNodeName + ".normalX", 1) | ||
cmds.setAttr(makeNurbNodeName + ".normalY", 2) | ||
cmds.setAttr(makeNurbNodeName + ".normalZ", 3) | ||
cmds.setAttr(makeNurbNodeName + ".centerX", 4) | ||
cmds.setAttr(makeNurbNodeName + ".centerY", 5) | ||
cmds.setAttr(makeNurbNodeName + ".centerZ", 6) | ||
self.compareSnapshot("square_modified.png") | ||
|
||
if __name__ == '__main__': | ||
fixturesUtils.runTests(globals()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# | ||
# Copyright 2024 Autodesk, Inc. All rights reserved. | ||
# | ||
# 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 | ||
import mayaUtils | ||
import unittest | ||
import platform | ||
|
||
class TestUSDLights(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose | ||
# MayaHydraBaseTestCase.setUpClass requirement. | ||
_file = __file__ | ||
|
||
@property | ||
def imageDiffFailThreshold(self): | ||
return 0.01 | ||
|
||
@property | ||
def imageDiffFailPercent(self): | ||
# 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 | ||
|
||
def verifyLightingModes(self, shadowOn): | ||
imageSuffix = "_shadowOn" if shadowOn else "" | ||
panel = mayaUtils.activeModelPanel() | ||
|
||
#Turn on/off shadows | ||
cmds.modelEditor(panel, edit=True, shadows=shadowOn) | ||
|
||
#All Lights mode | ||
cmds.modelEditor(panel, edit=True, displayLights="all") | ||
cmds.refresh() | ||
self.assertSnapshotClose("allLights" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#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) | ||
|
||
#Selected Light mode | ||
#cmds.modelEditor(panel, edit=True, displayLights="selected") | ||
#cmds.select( clear=True ) | ||
|
||
#cmds.select( 'distantLight1', r=True ) | ||
#cmds.refresh() | ||
#self.assertSnapshotClose("directionalLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#cmds.select( 'diskLight1', r=True ) | ||
#cmds.refresh() | ||
#self.assertSnapshotClose("pointLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#cmds.select( 'domeLight1', r=True ) | ||
#cmds.refresh() | ||
#self.assertSnapshotClose("spotLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#Flat Light mode | ||
#cmds.modelEditor(panel, edit=True, displayLights="flat") | ||
#cmds.refresh() | ||
#self.assertSnapshotClose("flatLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#No Light mode | ||
#cmds.modelEditor(panel, edit=True, displayLights="none") | ||
#cmds.refresh() | ||
#self.assertSnapshotClose("noLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#Test usd lights (e.g., disk,distant,dome,etc.) with a maya native sphere and usd sphere. | ||
@unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") | ||
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( | ||
"testUSDLights", | ||
"testUSDLights.ma") | ||
cmds.refresh() | ||
|
||
#Test Lighting Modes | ||
#Shadow OFF | ||
self.verifyLightingModes(False) | ||
#TODO: Enable code below when shadows are supported by usd lights | ||
#Shadow ON | ||
#self.verifyLightingModes(True) | ||
|
||
if __name__ == '__main__': | ||
fixturesUtils.runTests(globals()) |
Binary file not shown.
Oops, something went wrong.