-
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.
- Loading branch information
1 parent
316b2aa
commit 8b4fd0b
Showing
6 changed files
with
10,590 additions
and
0 deletions.
There are no files selected for viewing
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
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,96 @@ | ||
# | ||
# 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 | ||
|
||
class TesUSDtLights(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose | ||
# MayaHydraBaseTestCase.setUpClass requirement. | ||
_file = __file__ | ||
|
||
IMAGE_DIFF_FAIL_THRESHOLD = 0.1 | ||
IMAGE_DIFF_FAIL_PERCENT = 0.3 | ||
|
||
def verifyLightingModes(self, shadowOn): | ||
imageSuffix = "_shadowOn" if shadowOn else "" | ||
panel = mayaUtils.activeModelPanel() | ||
|
||
#All Lights mode | ||
cmds.modelEditor(panel, edit=True, displayLights="all") | ||
cmds.refresh() | ||
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.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
|
||
#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.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
|
||
#cmds.select( 'diskLight1', r=True ) | ||
#cmds.refresh() | ||
#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.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.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.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. | ||
@unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") | ||
def test_USDLights(self): | ||
cmds.file(new=True, force=True) | ||
cmds.refresh() | ||
|
||
# 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() | ||
#Do a view fit --Test removed as on Linux the fit doesn't produce the same result as on Windows and OSX. | ||
#cmds.viewFit('persp') | ||
#cmds.refresh() | ||
#self.assertSnapshotClose("allLightsFit.png", None, None) | ||
|
||
#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.