-
Notifications
You must be signed in to change notification settings - Fork 202
/
Copy pathtestVP2RenderDelegateGeomSubset.py
78 lines (60 loc) · 2.36 KB
/
testVP2RenderDelegateGeomSubset.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env mayapy
#
# Copyright 2021 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 fixturesUtils
import imageUtils
import mayaUtils
import usdUtils
import testUtils
from mayaUsd import lib as mayaUsdLib
from mayaUsd import ufe as mayaUsdUfe
from maya import cmds
import ufe
import os
class testVP2RenderDelegateGeomSubset(imageUtils.ImageDiffingTestCase):
"""
Tests imaging using the Viewport 2.0 render delegate when using per-instance
inherited data on instances.
"""
@classmethod
def setUpClass(cls):
# The test USD data is authored Z-up, so make sure Maya is configured
# that way too.
cmds.upAxis(axis='z')
inputPath = fixturesUtils.setUpClass(__file__,
initializeStandalone=False, loadPlugin=False)
cls._baselineDir = os.path.join(inputPath,
'VP2RenderDelegateGeomSubsetTest', 'baseline')
cls._testDir = os.path.abspath('.')
def assertSnapshotClose(self, imageName):
baselineImage = os.path.join(self._baselineDir, imageName)
snapshotImage = os.path.join(self._testDir, imageName)
imageUtils.snapshot(snapshotImage, width=960, height=540)
return self.assertImagesClose(baselineImage, snapshotImage)
def _StartTest(self, testName):
cmds.file(force=True, new=True)
cmds.move(2, -2, 1.5, 'persp')
mayaUtils.loadPlugin("mayaUsdPlugin")
self._testName = testName
testFile = testUtils.getTestScene("geomSubset", self._testName + ".usda")
mayaUtils.createProxyFromFile(testFile)
globalSelection = ufe.GlobalSelection.get()
globalSelection.clear()
self.assertSnapshotClose('%s_unselected.png' % self._testName)
def testPerInstanceInheritedData(self):
self._StartTest('perFaceShaders')
if __name__ == '__main__':
fixturesUtils.runTests(globals())