mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
removed redundant check, cosmetics
This commit is contained in:
parent
24c75a6797
commit
e62d3748cc
2 changed files with 11 additions and 34 deletions
|
|
@ -186,7 +186,7 @@ class CollectLook(pyblish.api.InstancePlugin):
|
|||
|
||||
node_id = lib.get_id(node)
|
||||
if not node_id:
|
||||
self.log.error("Node '{}' has no attribute 'cbId'".format(node))
|
||||
self.log.error("Member '{}' has no attribute 'cbId'".format(node))
|
||||
return
|
||||
|
||||
member_data = {"name": node, "uuid": node_id}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import colorbleed.api
|
|||
|
||||
|
||||
class ValidateLookNoDefaultShaders(pyblish.api.InstancePlugin):
|
||||
"""Validate look contains no default shaders.
|
||||
"""Validate if any node has a connection to a default shader.
|
||||
|
||||
This checks whether the look has any members of:
|
||||
- lambert1
|
||||
|
|
@ -28,6 +28,9 @@ class ValidateLookNoDefaultShaders(pyblish.api.InstancePlugin):
|
|||
label = 'Look No Default Shaders'
|
||||
actions = [colorbleed.api.SelectInvalidAction]
|
||||
|
||||
DEFAULT_SHADERS = {"lambert1", "initialShadingGroup",
|
||||
"initialParticleSE", "particleCloud1"}
|
||||
|
||||
def process(self, instance):
|
||||
"""Process all the nodes in the instance"""
|
||||
|
||||
|
|
@ -38,44 +41,18 @@ class ValidateLookNoDefaultShaders(pyblish.api.InstancePlugin):
|
|||
|
||||
@classmethod
|
||||
def get_invalid(cls, instance):
|
||||
disallowed = ["lambert1", "initialShadingGroup",
|
||||
"initialParticleSE", "particleCloud1"]
|
||||
disallowed = set(disallowed)
|
||||
|
||||
# Check if there are any skinClusters present
|
||||
# If so ensure nodes which are skinned
|
||||
intermediate = []
|
||||
skinclusters = cmds.ls(type="skinCluster")
|
||||
cls.log.info("Found skinClusters, will skip original shapes")
|
||||
if skinclusters:
|
||||
intermediate += cmds.ls(intermediateObjects=True,
|
||||
shapes=True,
|
||||
long=True)
|
||||
|
||||
invalid = set()
|
||||
for node in instance:
|
||||
# Get shading engine connections
|
||||
shaders = cmds.listConnections(node, type="shadingEngine") or []
|
||||
|
||||
# get connection
|
||||
# listConnections returns a list or None
|
||||
object_sets = cmds.listConnections(node, type="objectSet") or []
|
||||
|
||||
# Ensure the shape in the instances have at least a single shader
|
||||
# connected if it *can* have a shader, like a `surfaceShape` in
|
||||
# Maya.
|
||||
if (cmds.objectType(node, isAType="surfaceShape") and
|
||||
not cmds.ls(object_sets, type="shadingEngine")):
|
||||
if node in intermediate:
|
||||
continue
|
||||
cls.log.error("Detected shape without shading engine: "
|
||||
"'{}'".format(node))
|
||||
invalid.add(node)
|
||||
|
||||
# Check for any disallowed connections
|
||||
if any(s in disallowed for s in object_sets):
|
||||
# Check for any disallowed connections on *all* nodes
|
||||
if any(s in cls.DEFAULT_SHADERS for s in shaders):
|
||||
|
||||
# Explicitly log each individual "wrong" connection.
|
||||
for s in object_sets:
|
||||
if s in disallowed:
|
||||
for s in shaders:
|
||||
if s in cls.DEFAULT_SHADERS:
|
||||
cls.log.error("Node has unallowed connection to "
|
||||
"'{}': {}".format(s, node))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue