Skip to content

Commit

Permalink
Merge pull request #2726 from Autodesk/gamaj/USD-22.11/fix_connection…
Browse files Browse the repository at this point in the history
…s_test

Adapt testConnections for USD 22.11
  • Loading branch information
seando-adsk authored Nov 16, 2022
2 parents 1c96ce2 + ff80299 commit f7997b1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/lib/ufe/testConnections.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import testUtils

from maya import cmds
from pxr import Sdr

import os
import ufe
Expand Down Expand Up @@ -493,6 +494,13 @@ def testCreateStandardSurface(self):

shaderAttr = shaderAttrs.attribute("info:id")
shaderAttr.set("ND_standard_surface_surfaceshader")

# The native type of the output has changed in recent versions of USD, so we need to
# check with Sdr to see what native type we are going to get.
ssNodeDef = Sdr.Registry().GetShaderNodeByIdentifier("ND_standard_surface_surfaceshader")
ssOutput = ssNodeDef.GetShaderOutput("out")
ssOutputType = ssOutput.GetType()

#
#
# Then switch to connection code to connect the shader. Since we never created the
Expand All @@ -503,7 +511,7 @@ def testCreateStandardSurface(self):
materialOutput = materialAttrs.attribute("outputs:surface")

self.assertEqual(shaderOutput.type, "Generic")
self.assertEqual(shaderOutput.nativeType(), "surfaceshader")
self.assertEqual(shaderOutput.nativeType(), ssOutputType)
self.assertEqual(materialOutput.type, "Generic")
self.assertEqual(materialOutput.nativeType(), "TfToken")

Expand Down Expand Up @@ -557,7 +565,7 @@ def testCreateStandardSurface(self):
shaderAttrs = ufe.Attributes.attributes(shaderItem)
shaderOutput = shaderAttrs.attribute("outputs:out")
self.assertEqual(shaderOutput.type, "Generic")
self.assertEqual(shaderOutput.nativeType(), "surfaceshader")
self.assertEqual(shaderOutput.nativeType(), ssOutputType)

# TODO: Test the undoable versions of these commands. They MUST restore the prims as they
# were before connecting, which might require deleting authored attributes.
Expand Down

0 comments on commit f7997b1

Please sign in to comment.