Do not error with confusing message if shadingEngine has no material for whatever reason

This commit is contained in:
Roy Nieterau 2024-03-28 14:09:05 +01:00
parent c131071c7d
commit 350c40d77a

View file

@ -47,10 +47,18 @@ class ValidateShadingEngine(pyblish.api.InstancePlugin,
shape, destination=True, type="shadingEngine"
) or []
for shading_engine in shading_engines:
name = (
cmds.listConnections(shading_engine + ".surfaceShader")[0]
+ "SG"
materials = cmds.listConnections(
shading_engine + ".surfaceShader",
source=True, destination=False
)
if not materials:
cls.log.warning(
"Shading engine '{}' has no material connected to its "
".surfaceShader attribute.".format(shading_engine))
continue
material = materials[0] # there should only ever be one input
name = material + "SG"
if shading_engine != name:
invalid.append(shading_engine)