Skip to content

Commit 2548f00

Browse files
authored
HYDRA-2438 : Fix random camera position in testLightingRenderDelegates (#478)
1 parent 4cba64d commit 2548f00

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

test/lib/mayaUsd/render/mayaToHydra/testLightingRenderDelegates.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,32 @@ def _delegateRunsOnPlatform(self, delegate):
235235
return True
236236
return platform.system().lower() == required.lower()
237237

238+
def _setupSnapshotViewport(self):
239+
"""Pin the snapshot camera and display flags used when baselines were captured.
240+
241+
The test scene stores camera1 on the Persp panel in its embedded UI config,
242+
but that config is not always restored in batch/standalone Maya (depends on
243+
Maya version and $gUseScenePanelConfig). Without an explicit lookThru, the
244+
active editor can keep a default persp view and snapshot comparisons fail
245+
with a large framing mismatch rather than lighting noise.
246+
"""
247+
panel = cmds.playblast(activeEditor=True)
248+
cmds.lookThru(panel, "camera1")
249+
cmds.modelEditor(
250+
panel,
251+
edit=True,
252+
displayLights="all",
253+
displayTextures=True,
254+
shadows=True,
255+
grid=False,
256+
)
257+
cmds.refresh(force=True)
258+
238259
def loadScene(self):
239260
"""Load the test scene and set the base renderer state."""
240261
mayaUtils.openTestScene("testLightingRenderDelegates", "testLightingRenderDelegates.ma")
241262
self.setHdStormRenderer()
263+
self._setupSnapshotViewport()
242264

243265
def test_EachLight_PerRenderDelegate(self):
244266
"""For each render delegate, enable each Maya light one by one and compare snapshots to baseline."""

0 commit comments

Comments
 (0)