mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
(maya) work on attaching renders to subsets
This commit is contained in:
parent
f75f38b757
commit
e951cd36b0
6 changed files with 85 additions and 2 deletions
|
|
@ -2488,7 +2488,7 @@ class RenderSetupListObserver:
|
|||
members = cmds.sets(render_set, query=True)
|
||||
if "LAYER_{}".format(layer_name) in members:
|
||||
print(" - removing set for {}".format(layer_name))
|
||||
cmds.delete(n="LAYER_{}".format(layer_name))
|
||||
cmds.delete("LAYER_{}".format(layer_name))
|
||||
|
||||
|
||||
class RenderSetupItemObserver():
|
||||
|
|
|
|||
|
|
@ -191,6 +191,8 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin):
|
|||
families.append("review")
|
||||
if "write" in instance_family:
|
||||
families.append("write")
|
||||
if data.get("attachTo"):
|
||||
families.append("attach-render")
|
||||
|
||||
for collection in collections:
|
||||
instance = context.create_instance(str(collection))
|
||||
|
|
@ -232,6 +234,10 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin):
|
|||
})
|
||||
if lut_path:
|
||||
instance.data.update({"lutPath": lut_path})
|
||||
|
||||
if data.get("attachTo"):
|
||||
instance.data.update({"attachTo": data.get("attachTo")})
|
||||
|
||||
instance.append(collection)
|
||||
instance.context.data['fps'] = fps
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,8 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
if [ef for ef in self.exclude_families
|
||||
if instance.data["family"] in ef]:
|
||||
return
|
||||
if "attach-to" in instance.data["families"]:
|
||||
return
|
||||
|
||||
self.register(instance)
|
||||
|
||||
|
|
|
|||
|
|
@ -282,6 +282,18 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
|||
relative_path = os.path.relpath(source, api.registered_root())
|
||||
source = os.path.join("{root}", relative_path).replace("\\", "/")
|
||||
|
||||
# find subsets and version to attach render to
|
||||
attach_to = instance.data.get("attachTo")
|
||||
attach_subset_versions = []
|
||||
if attach_to:
|
||||
for subset in attach_to:
|
||||
for instance in context:
|
||||
if instance.data["subset"] != subset:
|
||||
continue
|
||||
attach_subset_versions.append(
|
||||
{"version": instance.data["version"],
|
||||
"subset": subset})
|
||||
|
||||
# Write metadata for publish job
|
||||
metadata = {
|
||||
"asset": asset,
|
||||
|
|
@ -293,6 +305,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
|||
"source": source,
|
||||
"user": context.data["user"],
|
||||
"version": context.data["version"],
|
||||
"attachTo": attach_subset_versions,
|
||||
# Optional metadata (for debugging)
|
||||
"metadata": {
|
||||
"instance": data,
|
||||
|
|
|
|||
57
pype/plugins/global/publish/update_version.py
Normal file
57
pype/plugins/global/publish/update_version.py
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import pyblish.api
|
||||
import logging
|
||||
from avalon import api, io
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class UpdateVersion(pyblish.api.InstancePlugin):
|
||||
"""Update existing subset version with new data"""
|
||||
|
||||
label = "Update Subset Version"
|
||||
order = pyblish.api.IntegratorOrder
|
||||
families = ["attach-render"]
|
||||
|
||||
def process(self, instance):
|
||||
# Required environment variables
|
||||
PROJECT = api.Session["AVALON_PROJECT"]
|
||||
ASSET = instance.data.get("asset") or api.Session["AVALON_ASSET"]
|
||||
TASK = instance.data.get("task") or api.Session["AVALON_TASK"]
|
||||
LOCATION = api.Session["AVALON_LOCATION"]
|
||||
|
||||
context = instance.context
|
||||
|
||||
stagingdir = instance.data.get("stagingDir")
|
||||
if not stagingdir:
|
||||
self.log.info('''{} is missing reference to staging
|
||||
directory Will try to get it from
|
||||
representation'''.format(instance))
|
||||
|
||||
# extra check if stagingDir actually exists and is available
|
||||
|
||||
self.log.debug("Establishing staging directory @ %s" % stagingdir)
|
||||
|
||||
# Ensure at least one file is set up for transfer in staging dir.
|
||||
repres = instance.data.get("representations", None)
|
||||
assert repres, "Instance has no files to transfer"
|
||||
assert isinstance(repres, (list, tuple)), (
|
||||
"Instance 'files' must be a list, got: {0}".format(repres)
|
||||
)
|
||||
|
||||
# FIXME: io is not initialized at this point for shell host
|
||||
io.install()
|
||||
project = io.find_one({"type": "project"})
|
||||
|
||||
asset = io.find_one({"type": "asset",
|
||||
"name": ASSET,
|
||||
"parent": project["_id"]})
|
||||
|
||||
assert instance.data.get("attachTo"), "no subset to attach to"
|
||||
for subset_to_attach in instance.data.get("attachTo"):
|
||||
|
||||
subset = io.find_one({"type": "subset",
|
||||
"parent": asset["_id"],
|
||||
"name": subset_to_attach["subset"]})
|
||||
|
||||
assert all([project, asset]), ("Could not find current project or "
|
||||
"asset '%s'" % ASSET)
|
||||
|
|
@ -66,7 +66,11 @@ class CollectMayaRender(pyblish.api.ContextPlugin):
|
|||
continue
|
||||
|
||||
# test if there are sets (subsets) to attach render to
|
||||
sets = cmds.ls(expected_layer_name, long=True, dag=True, sets=True)
|
||||
sets = cmds.sets(layer, query=True) or []
|
||||
if sets:
|
||||
for s in sets:
|
||||
self.log.info(" - attach render to: {}".format(s))
|
||||
|
||||
self.log.debug("marked subsets: {}".format(sets))
|
||||
|
||||
layer_name = "rs_{}".format(expected_layer_name)
|
||||
|
|
@ -74,6 +78,7 @@ class CollectMayaRender(pyblish.api.ContextPlugin):
|
|||
# Get layer specific settings, might be overrides
|
||||
data = {
|
||||
"subset": expected_layer_name,
|
||||
"attachTo": sets,
|
||||
"setMembers": expected_layer_name,
|
||||
"publish": True,
|
||||
"frameStart": self.get_render_attribute("startFrame",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue