Skip to content

Commit

Permalink
Merge pull request #1944 from Autodesk/krickw/MAYA-120722/test_orient…
Browse files Browse the repository at this point in the history
…ation_in_vp2RenderDelegate

Add a test to verify that the orientation of point instanced objects
  • Loading branch information
seando-adsk authored Jan 5, 2022
2 parents 7e43868 + 4ef7c74 commit 43fe072
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/lib/mayaUsd/render/vp2RenderDelegate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set(TEST_SCRIPT_FILES "")

list(APPEND TEST_SCRIPT_FILES
testVP2RenderDelegateGeomSubset.py
testVP2RenderDelegatePointInstanceOrientation.py
)

if(CMAKE_UFE_V2_FEATURES_AVAILABLE)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/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 testVP2RenderDelegatePointInstanceOrientation(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,
'VP2RenderDelegatePointInstanceOrientationTest', '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)
mayaUtils.loadPlugin("mayaUsdPlugin")

self._testName = testName
testFile = testUtils.getTestScene("pointInstances", self._testName + ".usda")
mayaUtils.createProxyFromFile(testFile)
globalSelection = ufe.GlobalSelection.get()
globalSelection.clear()
self.assertSnapshotClose('%s_unselected.png' % self._testName)

def testPerInstanceInheritedData(self):
self._StartTest('point_instanced_axis')



if __name__ == '__main__':
fixturesUtils.runTests(globals())
Loading

0 comments on commit 43fe072

Please sign in to comment.