mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Merged publish into master
This commit is contained in:
commit
05124cc558
3 changed files with 34 additions and 15 deletions
|
|
@ -1,6 +1,10 @@
|
|||
import os
|
||||
import pprint
|
||||
|
||||
from maya import cmds
|
||||
|
||||
import pyblish.api
|
||||
import avalon.io as io
|
||||
|
||||
from cb.utils.maya import context, shaders
|
||||
import cbra.utils.maya.node_uuid as id_utils
|
||||
|
|
@ -120,9 +124,15 @@ class CollectLook(pyblish.api.InstancePlugin):
|
|||
instance.data["lookData"] = {"attributes": attributes,
|
||||
"relationships": sets.values(),
|
||||
"sets": looksets}
|
||||
# Collect textures
|
||||
resources = [self.collect_resource(n) for n in cmds.ls(type="file")]
|
||||
|
||||
# Collect file nodes used by shading engines
|
||||
history = cmds.listHistory(looksets)
|
||||
files = cmds.ls(history, type="file", long=True)
|
||||
|
||||
# Collect textures,
|
||||
resources = [self.collect_resource(n) for n in files]
|
||||
instance.data["resources"] = resources
|
||||
# pprint.pprint(resources)
|
||||
|
||||
# Log a warning when no relevant sets were retrieved for the look.
|
||||
if not instance.data["lookData"]["sets"]:
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class CollectModelData(pyblish.api.InstancePlugin):
|
|||
"""
|
||||
|
||||
order = pyblish.api.CollectorOrder + 0.499
|
||||
label = 'Model Data'
|
||||
label = 'Collect Model Data'
|
||||
families = ["colorbleed.model"]
|
||||
|
||||
def process(self, instance):
|
||||
|
|
|
|||
|
|
@ -39,26 +39,35 @@ class ExtractLook(colorbleed.api.Extractor):
|
|||
|
||||
# Remove all members of the sets so they are not included in the
|
||||
# exported file by accident
|
||||
self.log.info("Extract sets (Maya ASCII)..")
|
||||
self.log.info("Extract sets (Maya ASCII) ...")
|
||||
lookdata = instance.data["lookData"]
|
||||
sets = lookdata["sets"]
|
||||
|
||||
resources = instance.data["resources"]
|
||||
remap = {}
|
||||
for resource in resources:
|
||||
attr = resource['attribute']
|
||||
remap[attr] = resource['destination']
|
||||
|
||||
self.log.info("Finished remapping destinations ...")
|
||||
|
||||
# Extract in correct render layer
|
||||
layer = instance.data.get("renderlayer", "defaultRenderLayer")
|
||||
with context.renderlayer(layer):
|
||||
# TODO: Ensure membership edits don't become renderlayer overrides
|
||||
with context.empty_sets(sets):
|
||||
with avalon.maya.maintained_selection():
|
||||
cmds.select(sets, noExpand=True)
|
||||
cmds.file(maya_path,
|
||||
force=True,
|
||||
typ="mayaAscii",
|
||||
exportSelected=True,
|
||||
preserveReferences=False,
|
||||
channels=True,
|
||||
constraints=True,
|
||||
expressions=True,
|
||||
constructionHistory=True)
|
||||
with context.attribute_values(remap):
|
||||
with avalon.maya.maintained_selection():
|
||||
cmds.select(sets, noExpand=True)
|
||||
cmds.file(maya_path,
|
||||
force=True,
|
||||
typ="mayaAscii",
|
||||
exportSelected=True,
|
||||
preserveReferences=False,
|
||||
channels=True,
|
||||
constraints=True,
|
||||
expressions=True,
|
||||
constructionHistory=True)
|
||||
|
||||
# Write the JSON data
|
||||
self.log.info("Extract json..")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue