-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1965 from Autodesk/krickw/MAYA-120890/add_vp2Rend…
…erDelegate_selection_test MAYA-120890 Test selection highlighting of USD objects in vp2RenderDelegate.
- Loading branch information
Showing
44 changed files
with
180 additions
and
1 deletion.
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
Binary file added
BIN
+10.8 KB
...p2RenderDelegate/VP2RenderDelegateSelectionTest/baseline/clear_smoothShaded.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
+5.34 KB
...r/vp2RenderDelegate/VP2RenderDelegateSelectionTest/baseline/clear_wireframe.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
+12.9 KB
...derDelegate/VP2RenderDelegateSelectionTest/baseline/clear_wireframeOnShaded.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
+12.9 KB
...erDelegate/VP2RenderDelegateSelectionTest/baseline/gatewayNode_smoothShaded.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
+5.34 KB
...enderDelegate/VP2RenderDelegateSelectionTest/baseline/gatewayNode_wireframe.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
+12.9 KB
...egate/VP2RenderDelegateSelectionTest/baseline/gatewayNode_wireframeOnShaded.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
+16.4 KB
...elegate/VP2RenderDelegateSelectionTest/baseline/instance_clear_smoothShaded.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
+3.73 KB
...erDelegate/VP2RenderDelegateSelectionTest/baseline/instance_clear_wireframe.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
+16.6 KB
...te/VP2RenderDelegateSelectionTest/baseline/instance_clear_wireframeOnShaded.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
+16.6 KB
...e/VP2RenderDelegateSelectionTest/baseline/instance_gatewayNode_smoothShaded.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
+3.73 KB
...gate/VP2RenderDelegateSelectionTest/baseline/instance_gatewayNode_wireframe.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
+16.6 KB
...RenderDelegateSelectionTest/baseline/instance_gatewayNode_wireframeOnShaded.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
+16.5 KB
...derDelegateSelectionTest/baseline/instance_objectA_and_objectB_smoothShaded.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
+3.78 KB
...RenderDelegateSelectionTest/baseline/instance_objectA_and_objectB_wireframe.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
+16.6 KB
...legateSelectionTest/baseline/instance_objectA_and_objectB_wireframeOnShaded.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
+16.6 KB
...egate/VP2RenderDelegateSelectionTest/baseline/instance_objectA_smoothShaded.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
+3.76 KB
...Delegate/VP2RenderDelegateSelectionTest/baseline/instance_objectA_wireframe.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
+16.6 KB
.../VP2RenderDelegateSelectionTest/baseline/instance_objectA_wireframeOnShaded.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
+16.5 KB
...e/VP2RenderDelegateSelectionTest/baseline/instance_redoObjectB_smoothShaded.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
+3.78 KB
...gate/VP2RenderDelegateSelectionTest/baseline/instance_redoObjectB_wireframe.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
+16.6 KB
...RenderDelegateSelectionTest/baseline/instance_redoObjectB_wireframeOnShaded.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
+16.6 KB
...e/VP2RenderDelegateSelectionTest/baseline/instance_undoObjectB_smoothShaded.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
+3.76 KB
...gate/VP2RenderDelegateSelectionTest/baseline/instance_undoObjectB_wireframe.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
+16.6 KB
...RenderDelegateSelectionTest/baseline/instance_undoObjectB_wireframeOnShaded.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
+16.4 KB
...te/VP2RenderDelegateSelectionTest/baseline/instance_unselected_smoothShaded.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
+3.73 KB
...egate/VP2RenderDelegateSelectionTest/baseline/instance_unselected_wireframe.png
Oops, something went wrong.
Binary file added
BIN
+16.6 KB
...2RenderDelegateSelectionTest/baseline/instance_unselected_wireframeOnShaded.png
Oops, something went wrong.
Binary file added
BIN
+10.8 KB
...te/VP2RenderDelegateSelectionTest/baseline/objectA_and_objectB_smoothShaded.png
Oops, something went wrong.
Binary file added
BIN
+5.41 KB
...egate/VP2RenderDelegateSelectionTest/baseline/objectA_and_objectB_wireframe.png
Oops, something went wrong.
Binary file added
BIN
+12.9 KB
...2RenderDelegateSelectionTest/baseline/objectA_and_objectB_wireframeOnShaded.png
Oops, something went wrong.
Binary file added
BIN
+10.8 KB
...RenderDelegate/VP2RenderDelegateSelectionTest/baseline/objectA_smoothShaded.png
Oops, something went wrong.
Binary file added
BIN
+5.37 KB
...vp2RenderDelegate/VP2RenderDelegateSelectionTest/baseline/objectA_wireframe.png
Oops, something went wrong.
Binary file added
BIN
+12.9 KB
...rDelegate/VP2RenderDelegateSelectionTest/baseline/objectA_wireframeOnShaded.png
Oops, something went wrong.
Binary file added
BIN
+10.8 KB
...erDelegate/VP2RenderDelegateSelectionTest/baseline/redoObjectB_smoothShaded.png
Oops, something went wrong.
Binary file added
BIN
+5.41 KB
...enderDelegate/VP2RenderDelegateSelectionTest/baseline/redoObjectB_wireframe.png
Oops, something went wrong.
Binary file added
BIN
+12.9 KB
...egate/VP2RenderDelegateSelectionTest/baseline/redoObjectB_wireframeOnShaded.png
Oops, something went wrong.
Binary file added
BIN
+10.8 KB
...erDelegate/VP2RenderDelegateSelectionTest/baseline/undoObjectB_smoothShaded.png
Oops, something went wrong.
Binary file added
BIN
+5.37 KB
...enderDelegate/VP2RenderDelegateSelectionTest/baseline/undoObjectB_wireframe.png
Oops, something went wrong.
Binary file added
BIN
+12.9 KB
...egate/VP2RenderDelegateSelectionTest/baseline/undoObjectB_wireframeOnShaded.png
Oops, something went wrong.
Binary file added
BIN
+10.8 KB
...derDelegate/VP2RenderDelegateSelectionTest/baseline/unselected_smoothShaded.png
Oops, something went wrong.
Binary file added
BIN
+5.34 KB
...RenderDelegate/VP2RenderDelegateSelectionTest/baseline/unselected_wireframe.png
Oops, something went wrong.
Binary file added
BIN
+12.9 KB
...legate/VP2RenderDelegateSelectionTest/baseline/unselected_wireframeOnShaded.png
Oops, something went wrong.
173 changes: 173 additions & 0 deletions
173
test/lib/mayaUsd/render/vp2RenderDelegate/testVP2RenderDelegateSelection.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,173 @@ | ||
#!/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 unittest | ||
import usdUtils | ||
import testUtils | ||
|
||
from mayaUsd import lib as mayaUsdLib | ||
from mayaUsd import ufe as mayaUsdUfe | ||
|
||
from maya import cmds | ||
import maya.api.OpenMayaRender as omr | ||
|
||
from pxr import Usd | ||
|
||
import ufe | ||
|
||
import os | ||
|
||
|
||
class testVP2RenderDelegateSelection(imageUtils.ImageDiffingTestCase): | ||
""" | ||
Tests imaging using the Viewport 2.0 render delegate when using per-instance | ||
inherited data on instances. | ||
""" | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
inputPath = fixturesUtils.setUpClass(__file__, | ||
initializeStandalone=False, loadPlugin=False) | ||
|
||
cls._baselineDir = os.path.join(inputPath, | ||
'VP2RenderDelegateSelectionTest', 'baseline') | ||
|
||
cls._testDir = os.path.abspath('.') | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
panel = mayaUtils.activeModelPanel() | ||
cmds.modelEditor(panel, edit=True, useDefaultMaterial=False) | ||
|
||
def assertSnapshotClose(self, imageName): | ||
cmds.undoInfo(stateWithoutFlush=False) # disable the undo queue during the snapshot | ||
baselineImage = os.path.join(self._baselineDir, imageName) | ||
snapshotImage = os.path.join(self._testDir, imageName) | ||
imageUtils.snapshot(snapshotImage, width=960, height=540) | ||
retVal = self.assertImagesClose(baselineImage, snapshotImage) | ||
cmds.undoInfo(stateWithoutFlush=True) | ||
return retVal | ||
|
||
def _stringToUfeItem(self, pathString): | ||
ufePath = ufe.PathString.path(pathString) | ||
ufeItem = ufe.Hierarchy.createItem(ufePath) | ||
return ufeItem | ||
|
||
def _createPrim(self, underItem, primType, expectedPath): | ||
''' | ||
Helper that creates a prim of the given type under the given item, and return its item. | ||
''' | ||
# create a proxy shape and add a Cone prim | ||
|
||
proxyShapeContextOps = ufe.ContextOps.contextOps(underItem) | ||
proxyShapeContextOps.doOp(['Add New Prim', primType]) | ||
|
||
primPath = ufe.Path([ | ||
ufe.PathString.path("|stage|stageShape").segments[0], | ||
ufe.PathSegment(expectedPath, mayaUsdUfe.getUsdRunTimeId(), "/") | ||
]) | ||
return ufe.PathString.string(primPath) | ||
|
||
def _selectionTest(self, scene, objectA, objectB, proxyDagPath, displayMode): | ||
|
||
globalSelection = ufe.GlobalSelection.get() | ||
globalSelection.clear() | ||
self.assertSnapshotClose('%sunselected_%s.png' % (scene, displayMode)) | ||
|
||
# Select cube | ||
cmds.select(objectA) | ||
self.assertSnapshotClose('%sobjectA_%s.png' % (scene, displayMode)) | ||
|
||
# Select cylinder | ||
cmds.select(objectB, add=True) | ||
self.assertSnapshotClose('%sobjectA_and_objectB_%s.png' % (scene, displayMode)) | ||
|
||
# Undo, Redo | ||
cmds.undo() # Undo remove capsule from isolate select | ||
self.assertSnapshotClose('%sundoObjectB_%s.png' % (scene, displayMode)) | ||
cmds.redo() # Redo remove capsule from isolate select | ||
self.assertSnapshotClose('%sredoObjectB_%s.png' % (scene, displayMode)) | ||
|
||
# Proxy | ||
cmds.select(proxyDagPath) | ||
self.assertSnapshotClose('%sgatewayNode_%s.png' % (scene, displayMode)) | ||
|
||
cmds.select(clear=True) | ||
self.assertSnapshotClose('%sclear_%s.png' % (scene, displayMode)) | ||
|
||
def testSelection(self): | ||
cmds.file(force=True, new=True) | ||
mayaUtils.loadPlugin("mayaUsdPlugin") | ||
panel = mayaUtils.activeModelPanel() | ||
usdaFile = testUtils.getTestScene("setsCmd", "5prims.usda") | ||
proxyDagPath, sphereStage = mayaUtils.createProxyFromFile(usdaFile) | ||
|
||
cmds.move(-4, -24, 0, "persp") | ||
cmds.rotate(90, 0, 0, "persp") | ||
|
||
usdCube = proxyDagPath + ",/Cube1" | ||
usdCylinder = proxyDagPath + ",/Cylinder1" | ||
|
||
# Test smooth shaded | ||
cmds.modelEditor('modelPanel4', e=True, displayAppearance='smoothShaded', displayLights='default') | ||
cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=False, displayLights='default') | ||
self._selectionTest('', usdCube, usdCylinder, proxyDagPath, 'smoothShaded') | ||
|
||
# Test smooth shaded | ||
cmds.modelEditor('modelPanel4', e=True, displayAppearance='smoothShaded', displayLights='default') | ||
cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=True, displayLights='default') | ||
self._selectionTest('', usdCube, usdCylinder, proxyDagPath, 'wireframeOnShaded') | ||
|
||
# Test smooth shaded | ||
cmds.modelEditor('modelPanel4', e=True, displayAppearance='wireframe', displayLights='default') | ||
cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=False, displayLights='default') | ||
self._selectionTest('', usdCube, usdCylinder, proxyDagPath, 'wireframe') | ||
|
||
def testInstancedSelection(self): | ||
cmds.file(force=True, new=True) | ||
mayaUtils.loadPlugin("mayaUsdPlugin") | ||
panel = mayaUtils.activeModelPanel() | ||
usdaFile = testUtils.getTestScene("instances", "perInstanceInheritedData.usda") | ||
proxyDagPath, sphereStage = mayaUtils.createProxyFromFile(usdaFile) | ||
usdball01 = proxyDagPath + ",/root/group/ball_01" | ||
usdball03 = proxyDagPath + ",/root/group/ball_03" | ||
|
||
cmds.move(8.5, -20, 0, "persp") | ||
cmds.rotate(90, 0, 0, "persp") | ||
|
||
# Test smooth shaded | ||
cmds.modelEditor('modelPanel4', e=True, displayAppearance='smoothShaded', displayLights='default') | ||
cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=False, displayLights='default') | ||
self._selectionTest('instance_', usdball01, usdball03, proxyDagPath, 'smoothShaded') | ||
|
||
# Test smooth shaded | ||
cmds.modelEditor('modelPanel4', e=True, displayAppearance='smoothShaded', displayLights='default') | ||
cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=True, displayLights='default') | ||
self._selectionTest('instance_', usdball01, usdball03, proxyDagPath, 'wireframeOnShaded') | ||
|
||
# Test smooth shaded | ||
cmds.modelEditor('modelPanel4', e=True, displayAppearance='wireframe', displayLights='default') | ||
cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=False, displayLights='default') | ||
self._selectionTest('instance_', usdball01, usdball03, proxyDagPath, 'wireframe') | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
fixturesUtils.runTests(globals()) |