-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HYDRA-805 - add test for look through camera&lights #73
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# | ||
# 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 platform | ||
|
||
class TestLookThrough(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): | ||
# 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 | ||
|
||
#Test look through camera and maya lights (spot & area). | ||
def test_LookThrough(self): | ||
cmds.file(new=True, force=True) | ||
|
||
# Load a maya scene with a maya native cubic | ||
testFile = mayaUtils.openTestScene( | ||
"testLookThrough", | ||
"testLookThrough.ma") | ||
cmds.refresh() | ||
|
||
#Verify Default display | ||
panel = mayaUtils.activeModelPanel() | ||
self.assertSnapshotClose("default" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#Verify look through camera | ||
cmds.lookThru( panel, 'persp1' ) | ||
cmds.refresh() | ||
self.assertSnapshotClose("lookThroughCamera" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#Verify look through spot Light | ||
cmds.lookThru( panel, 'spotLight1' ) | ||
cmds.refresh() | ||
self.assertSnapshotClose("lookThroughSpotLight" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#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) | ||
|
||
if __name__ == '__main__': | ||
fixturesUtils.runTests(globals()) |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
//Last modified: Mon, Feb 05, 2024 09:30:35 AM | ||
//Codeset: 1252 | ||
requires maya "2025ff02"; | ||
requires -nodeType "mayaUsdLayerManager" -dataType "pxrUsdStageData" "mayaUsdPlugin" "0.27.0"; | ||
currentUnit -l centimeter -a degree -t film; | ||
fileInfo "application" "maya"; | ||
fileInfo "product" "Maya 2025"; | ||
|
@@ -112,9 +111,6 @@ createNode file -n "file1"; | |
setAttr ".cs" -type "string" "sRGB"; | ||
createNode place2dTexture -n "place2dTexture1"; | ||
rename -uid "6616C90D-4B36-08C7-8666-33BB13D15663"; | ||
createNode mayaUsdLayerManager -n "mayaUsdLayerManager1"; | ||
rename -uid "61CE7C31-4E04-09B7-BFEA-F291A58D7E4C"; | ||
setAttr ".sst" -type "string" ""; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these changes required? Not sure why they're here, doesn't look like they're used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This's just for clearing out mayausd stuff, this might cause loading of mayausd, which is not necessary for this case. |
||
createNode script -n "uiConfigurationScriptNode"; | ||
rename -uid "8E0C2C18-4263-5451-E98E-C6B108D65C44"; | ||
setAttr ".b" -type "string" ( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer necessary, as now a new scene will be opened before each individual test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good, I'll remove it