Skip to content
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-307: Add the FootPrint node as an Hydra example #75

Merged
merged 14 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions test/lib/mayaUsd/render/mayaToHydra/testFlowViewportAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class TestFlowViewportAPI(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTe
IMAGE_DIFF_FAIL_THRESHOLD = 0.1
IMAGE_DIFF_FAIL_PERCENT = 2

@classmethod
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not equivalent to what you had before: previously, you did a file new at the end of each test method. As I suggested in
https://github.com/Autodesk/maya-hydra/pull/75/files/e3184227bf913bbbb1f48fb2e75ad2b8b5944239..eff7ba8689bcfe5db288d514517fba122b1e90a5#r1499561088
the proper equivalent is tearDown():
https://docs.python.org/3/library/unittest.html#unittest.TestCase.tearDown
If you're O.K. with tearDownClass() then that's fine too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I want to use tearDown.

def tearDownClass(cls):
#Finish by a File New command to check that it's not crashing when cleaning up everything'
cmds.file(new=True, force=True)

def setupScene(self):
self.setHdStormRenderer()

Expand Down Expand Up @@ -102,9 +107,6 @@ def test_AddingPrimitives(self):
self.setHdStormRenderer()
self.assertSnapshotClose("add_VP2AndThenBackToStorm.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)

#Finish by a File New command to check that it's not crashing when cleaning up everything
cmds.file(new=True, force=True)

#Test filtering primitives
def test_FilteringPrimitives(self):
self.setupScene()
Expand Down Expand Up @@ -184,9 +186,6 @@ def test_FilteringPrimitives(self):
cmds.setAttr(sphereShape + '.subdivisionsAxis', 30) #Unfilter the prim
cmds.refresh()
self.assertSnapshotClose("filter_VP2AndThenBackToStorm_MovedSphereUnFiltered.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)

#Finish by a File New command to check that it's not crashing when cleaning up everything
cmds.file(new=True, force=True)

#Test Cube grids parameters
def test_CubeGrid(self):
Expand Down Expand Up @@ -241,9 +240,6 @@ def test_CubeGrid(self):
self.setHdStormRenderer()
self.assertSnapshotClose("cubeGrid_VP2AndThenBackToStorm.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)

#Finish by a File New command to check that it's not crashing when cleaning up everything
cmds.file(new=True, force=True)

#Test multiple nodes
def test_MultipleNodes(self):
self.setupScene()
Expand Down Expand Up @@ -345,9 +341,6 @@ def test_MultipleNodes(self):
self.setHdStormRenderer()
self.assertSnapshotClose("multipleNodes_VP2AndThenBackToStorm.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)

#Finish by a File New command to check that it's not crashing when cleaning up everything
cmds.file(new=True, force=True)

#Test multiple viewports
def test_MultipleViewports(self):
with PluginLoaded('flowViewportAPIMayaLocator'):
Expand Down Expand Up @@ -425,7 +418,5 @@ def test_MultipleViewports(self):
self.setHdStormRenderer()
self.assertSnapshotClose("multipleViewports_VP2AndThenBackToStorm_modPan2.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)

#Finish by a File New command to check that it's not crashing when cleaning up everything
cmds.file(new=True, force=True)
if __name__ == '__main__':
fixturesUtils.runTests(globals())
23 changes: 7 additions & 16 deletions test/lib/mayaUsd/render/mayaToHydra/testFootPrintNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ def imageDiffFailThreshold(self):
def imageDiffFailPercent(self):
return 0.1

@classmethod
def tearDownClass(cls):
ppt-adsk marked this conversation as resolved.
Show resolved Hide resolved
#Finish by a File New command to check that it's not crashing when cleaning up everything'
cmds.file(new=True, force=True)
ppt-adsk marked this conversation as resolved.
Show resolved Hide resolved

def setupScene(self):
testFile = mayaUtils.openTestScene( #Is an empty scene that is used to zoom in more on the foot print nodes, it also has Storm already set as the renderer
"testFootPrintNode",
"testFootPrintNode.ma")
self.setHdStormRenderer()
cmds.move(7.714, 5.786, 7.714, 'persp')
cmds.refresh()
self.setHdStormRenderer()#set Storm as the renderer (even if the scene is supposed to have it already)

#Test adding primitives
def test_AddingPrimitives(self):
Expand Down Expand Up @@ -105,9 +108,6 @@ def test_AddingPrimitives(self):
self.setHdStormRenderer()
self.assertSnapshotClose("add_VP2AndThenBackToStorm.png", self.imageDiffFailThreshold, self.imageDiffFailPercent)

#Finish by a File New command to check that it's not crashing when cleaning up everything'
cmds.file(new=True, force=True)

#Test FootPrint grids parameters
def test_FootPrintAttributes(self):
with PluginLoaded('mayaHydraFootPrintNode'):
Expand All @@ -133,9 +133,6 @@ def test_FootPrintAttributes(self):
self.setHdStormRenderer()
self.assertSnapshotClose("footPrint_VP2AndThenBackToStorm.png", self.imageDiffFailThreshold, self.imageDiffFailPercent)

#Finish by a File New command to check that it's not crashing when cleaning up everything
cmds.file(new=True, force=True)

#Test multiple nodes
def test_MultipleNodes(self):
with PluginLoaded('mayaHydraFootPrintNode'):
Expand Down Expand Up @@ -204,9 +201,6 @@ def test_MultipleNodes(self):
self.setHdStormRenderer()
self.assertSnapshotClose("multipleNodes_VP2AndThenBackToStorm.png", self.imageDiffFailThreshold, self.imageDiffFailPercent)

#Finish by a File New command to check that it's not crashing when cleaning up everything
cmds.file(new=True, force=True)

#Test multiple viewports
def test_MultipleViewports(self):
with PluginLoaded('mayaHydraFootPrintNode'):
Expand Down Expand Up @@ -260,9 +254,6 @@ def test_MultipleViewports(self):
self.setHdStormRenderer()
self.assertSnapshotClose("multipleViewports_VP2AndThenBackToStorm_modPan3.png", self.imageDiffFailThreshold, self.imageDiffFailPercent)

#Finish by a File New command to check that it's not crashing when cleaning up everything
cmds.file(new=True, force=True)

#Test loading a scene
def test_Load(self):
with PluginLoaded('mayaHydraFootPrintNode'):
Expand Down
Loading
Loading