mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
feat(celaction): publishing wip
This commit is contained in:
parent
13dda8ef24
commit
d30df3a75a
7 changed files with 98 additions and 55 deletions
|
|
@ -108,6 +108,8 @@ def main():
|
|||
log.info(f"Registering path: {path}")
|
||||
pyblish.api.register_plugin_path(path)
|
||||
|
||||
pyblish.api.register_host(publish_host)
|
||||
|
||||
# Register project specific plugins
|
||||
project_name = os.environ["AVALON_PROJECT"]
|
||||
project_plugins_paths = os.getenv("PYPE_PROJECT_PLUGINS", "")
|
||||
|
|
|
|||
|
|
@ -2,16 +2,19 @@ import pyblish.api
|
|||
import pype.celaction
|
||||
|
||||
|
||||
class CollectKwargs(pyblish.api.Collector):
|
||||
class CollectCelactionCliKwargs(pyblish.api.Collector):
|
||||
""" Collects all keyword arguments passed from the terminal """
|
||||
|
||||
|
||||
label = "Collect Celaction Cli Kwargs"
|
||||
order = pyblish.api.Collector.order - 0.1
|
||||
|
||||
def process(self, context):
|
||||
kwargs = pype.celaction.kwargs.copy()
|
||||
|
||||
self.log.info("Converting nested lists to dict: %s" % kwargs)
|
||||
kwargs["data"] = dict(kwargs.get("data") or [])
|
||||
|
||||
self.log.info("Storing kwargs: %s" % kwargs)
|
||||
context.set_data("kwargs", kwargs)
|
||||
|
||||
# get kwargs onto context data as keys with values
|
||||
for k, v in kwargs.items():
|
||||
self.log.info(f"Setting `{k}` to instance.data with value: `{v}`")
|
||||
context.data[k] = v
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
import os
|
||||
from avalon import api
|
||||
import pyblish.api
|
||||
|
||||
|
||||
class CollectCelactionInstances(pyblish.api.ContextPlugin):
|
||||
""" Adds the celaction render instances """
|
||||
|
||||
label = "Collect Celaction Instances"
|
||||
order = pyblish.api.CollectorOrder + 0.1
|
||||
|
||||
def process(self, context):
|
||||
task = api.Session["AVALON_TASK"]
|
||||
current_file = context.data["currentFile"]
|
||||
staging_dir = os.path.dirname(current_file)
|
||||
scene_file = os.path.basename(current_file)
|
||||
|
||||
asset_entity = context.data["assetEntity"]
|
||||
|
||||
shared_instance_data = {
|
||||
"asset": asset_entity["name"],
|
||||
"frameStart": asset_entity["data"]["frameStart"],
|
||||
"frameEnd": asset_entity["data"]["frameEnd"],
|
||||
"handleStart": asset_entity["data"]["handleStart"],
|
||||
"handleEnd": asset_entity["data"]["handleEnd"],
|
||||
"fps": asset_entity["data"]["fps"],
|
||||
"resolutionWidth": asset_entity["data"]["resolutionWidth"],
|
||||
"resolutionHeight": asset_entity["data"]["resolutionHeight"],
|
||||
"pixelAspect": 1,
|
||||
"step": 1
|
||||
}
|
||||
|
||||
celaction_kwargs = context.data.get("kwargs", {})
|
||||
|
||||
if celaction_kwargs:
|
||||
shared_instance_data.update(celaction_kwargs)
|
||||
|
||||
##################################################3
|
||||
# workfile instance
|
||||
family = "workfile"
|
||||
subset = family + task.capitalize()
|
||||
# Create instance
|
||||
instance = context.create_instance(subset)
|
||||
|
||||
# creating instance data
|
||||
instance.data.update({
|
||||
"subset": subset,
|
||||
"label": scene_file,
|
||||
"family": family,
|
||||
"families": [],
|
||||
"representations": list()
|
||||
})
|
||||
|
||||
# adding basic script data
|
||||
instance.data.update(shared_instance_data)
|
||||
|
||||
# creating representation
|
||||
representation = {
|
||||
'name': 'scn',
|
||||
'ext': 'scn',
|
||||
'files': scene_file,
|
||||
"stagingDir": staging_dir,
|
||||
}
|
||||
|
||||
instance.data["representations"].append(representation)
|
||||
|
||||
self.log.info('Publishing Celaction workfile')
|
||||
context.data["instances"].append(instance)
|
||||
|
||||
####################################################3
|
||||
# render instance
|
||||
subset = f"render{task}Main"
|
||||
instance = context.create_instance(name=subset)
|
||||
# getting instance state
|
||||
instance.data["publish"] = True
|
||||
|
||||
# add assetEntity data into instance
|
||||
instance.data.update({
|
||||
"label": "{} - farm".format(subset),
|
||||
"family": "render.farm",
|
||||
"families": [],
|
||||
"subset":
|
||||
})
|
||||
|
||||
self.log.debug(f"Instance data: `{instance.data}`")
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
import os
|
||||
|
||||
import pyblish.api
|
||||
|
||||
|
||||
class CollectCelactionRender(pyblish.api.ContextPlugin):
|
||||
""" Adds the celaction render instances """
|
||||
|
||||
label = "Collect Celaction Render Instance"
|
||||
order = pyblish.api.CollectorOrder + 0.1
|
||||
|
||||
def process(self, context):
|
||||
project_entity = context.data["projectEntity"]
|
||||
asset_entity = context.data["assetEntity"]
|
||||
|
||||
# scene render
|
||||
scene_file = os.path.basename(context.data["currentFile"])
|
||||
scene_name, _ = os.path.splitext(scene_file)
|
||||
component_name = scene_name.split(".")[0]
|
||||
|
||||
instance = context.create_instance(name=component_name)
|
||||
instance.data["family"] = "render"
|
||||
instance.data["label"] = "{} - remote".format(component_name)
|
||||
instance.data["families"] = ["render", "img"]
|
||||
|
||||
# getting instance state
|
||||
instance.data["publish"] = True
|
||||
|
||||
# add assetEntity data into instance
|
||||
instance.data.update({
|
||||
"subset": "renderAnimationMain",
|
||||
"asset": asset_entity["name"],
|
||||
"frameStart": asset_entity["data"]["frameStart"],
|
||||
"frameEnd": asset_entity["data"]["frameEnd"],
|
||||
"handleStart": asset_entity["data"]["handleStart"],
|
||||
"handleEnd": asset_entity["data"]["handleEnd"],
|
||||
"fps": asset_entity["data"]["fps"],
|
||||
"resolutionWidth": asset_entity["data"]["resolutionWidth"],
|
||||
"resolutionHeight": asset_entity["data"]["resolutionHeight"],
|
||||
"pixelAspect": 1,
|
||||
"step": 1
|
||||
})
|
||||
|
||||
data = context.data.get("kwargs", {}).get("data", {})
|
||||
|
||||
if data:
|
||||
instance.data.update(data)
|
||||
|
|
@ -19,7 +19,7 @@ class ExtractCelactionDeadline(pyblish.api.InstancePlugin):
|
|||
label = "Submit CelAction to Deadline"
|
||||
order = pyblish.api.IntegratorOrder + 0.1
|
||||
hosts = ["celaction"]
|
||||
families = ["render"]
|
||||
families = ["render.farm"]
|
||||
|
||||
deadline_department = ""
|
||||
deadline_priority = 50
|
||||
|
|
@ -86,7 +86,7 @@ class ExtractCelactionDeadline(pyblish.api.InstancePlugin):
|
|||
pass
|
||||
|
||||
# define chunk and priority
|
||||
chunk_size = instance.data.get("deadlineChunkSize")
|
||||
chunk_size = instance.context.data.get("chunk")
|
||||
if chunk_size == 0:
|
||||
chunk_size = self.deadline_chunk_size
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
|||
order = pyblish.api.IntegratorOrder + 0.2
|
||||
icon = "tractor"
|
||||
|
||||
hosts = ["fusion", "maya", "nuke"]
|
||||
hosts = ["fusion", "maya", "nuke", "celaction"]
|
||||
|
||||
families = ["render.farm", "prerener", "renderlayer", "imagesequence"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue