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

Adapt testConnections for USD 22.11 #2726

Merged
merged 1 commit into from
Nov 16, 2022
Merged
Changes from all commits
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
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