mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Changed data structure for lookdev
This commit is contained in:
parent
524d80ebf2
commit
f9c55ee5ea
7 changed files with 21 additions and 20 deletions
|
|
@ -83,7 +83,7 @@ class CollectLook(pyblish.api.InstancePlugin):
|
|||
verbose = instance.data.get("verbose", False)
|
||||
|
||||
self.log.info("Looking for look associations "
|
||||
"for %s" % instance.data['label'])
|
||||
"for %s" % instance.data['name'])
|
||||
|
||||
# Discover related object sets
|
||||
self.log.info("Gathering sets..")
|
||||
|
|
@ -118,16 +118,15 @@ class CollectLook(pyblish.api.InstancePlugin):
|
|||
self.log.info("Gathering attribute changes to instance members..")
|
||||
|
||||
attributes = self.collect_attributes_changes(instance)
|
||||
looksets = cmds.ls(sets.keys(), absoluteName=True, long=True)
|
||||
|
||||
# Store data on the instance
|
||||
instance.data["lookAttributes"] = attributes
|
||||
instance.data["lookSetRelations"] = sets.values()
|
||||
instance.data["lookSets"] = cmds.ls(sets.keys(),
|
||||
absoluteName=True,
|
||||
long=True)
|
||||
instance.data["lookData"] = {"attributes": attributes,
|
||||
"relationships": sets.values(),
|
||||
"sets": looksets}
|
||||
|
||||
# Log a warning when no relevant sets were retrieved for the look.
|
||||
if not instance.data['lookSets']:
|
||||
if not instance.data["lookData"]["sets"]:
|
||||
self.log.warning("No sets found for the nodes in the instance: "
|
||||
"%s" % instance[:])
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class CollectLookTextures(pyblish.api.InstancePlugin):
|
|||
verbose = instance.data.get("verbose", False)
|
||||
|
||||
# Get textures from sets
|
||||
sets = instance.data["lookSets"]
|
||||
sets = instance.data["lookData"]["sets"]
|
||||
if not sets:
|
||||
raise RuntimeError("No look sets found for the nodes in the "
|
||||
"instance. %s" % sets)
|
||||
|
|
|
|||
|
|
@ -20,16 +20,17 @@ class ValidateLookContents(pyblish.api.InstancePlugin):
|
|||
|
||||
error = False
|
||||
|
||||
attributes = ["lookSets",
|
||||
"lookSetRelations",
|
||||
"lookAttributes"]
|
||||
attributes = ["sets",
|
||||
"relationships",
|
||||
"attributes"]
|
||||
|
||||
if not instance[:]:
|
||||
raise RuntimeError("Instance is empty")
|
||||
|
||||
# Required look data
|
||||
lookdata = instance.data["lookData"]
|
||||
for attr in attributes:
|
||||
if attr not in instance.data:
|
||||
if attr not in lookdata:
|
||||
self.log.error("No %s found in data" % attr)
|
||||
error = True
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class ValidateLookMembersNodeIds(pyblish.api.InstancePlugin):
|
|||
|
||||
# Get all members from the sets
|
||||
members = []
|
||||
relations = instance.data["lookSetRelations"]
|
||||
relations = instance.data["lookData"]["relationships"]
|
||||
for sg in relations:
|
||||
sg_members = sg['members']
|
||||
sg_members = [member['name'] for member in sg_members]
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class ValidateLookMembersUnique(pyblish.api.InstancePlugin):
|
|||
|
||||
# Get all members from the sets
|
||||
members = []
|
||||
relations = instance.data["lookSetRelations"]
|
||||
relations = instance.data["lookData"]["sets"]
|
||||
for sg in relations:
|
||||
sg_members = sg['members']
|
||||
sg_members = [member['name'] for member in sg_members]
|
||||
|
|
@ -45,11 +45,11 @@ class ValidateLookMembersUnique(pyblish.api.InstancePlugin):
|
|||
# Group members per id
|
||||
id_nodes = defaultdict(set)
|
||||
for node in members:
|
||||
id = id_utils.get_id(node)
|
||||
if not id:
|
||||
node_id = id_utils.get_id(node)
|
||||
if not node_id:
|
||||
continue
|
||||
|
||||
id_nodes[id].add(node)
|
||||
id_nodes[node_id].add(node)
|
||||
|
||||
invalid = list()
|
||||
for nodes in id_nodes.itervalues():
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ class ValidateLookNoDefaultShaders(pyblish.api.InstancePlugin):
|
|||
disallowed = set(disallowed)
|
||||
|
||||
# Check among the sets
|
||||
sets = instance.data['lookSets']
|
||||
lookdata = instance.data["lookData"]
|
||||
sets = lookdata['sets']
|
||||
lookup = set(sets)
|
||||
intersect = lookup.intersection(disallowed)
|
||||
if intersect:
|
||||
|
|
@ -67,7 +68,7 @@ class ValidateLookNoDefaultShaders(pyblish.api.InstancePlugin):
|
|||
# Get members of the shaders
|
||||
all = set()
|
||||
for shader in shaders:
|
||||
members = cmds.sets(shader, q=True) or []
|
||||
members = cmds.sets(shader, query=True) or []
|
||||
members = cmds.ls(members, long=True)
|
||||
all.update(members)
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class ValidateLookNodeUniqueIds(pyblish.api.InstancePlugin):
|
|||
@staticmethod
|
||||
def get_invalid(instance):
|
||||
|
||||
nodes = instance.data["lookSets"]
|
||||
nodes = instance.data["lookData"]["sets"]
|
||||
|
||||
# Ensure all nodes have a cbId
|
||||
id_sets = defaultdict(list)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue