mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
fix(celaction, global): PR comments
This commit is contained in:
parent
c01115386d
commit
b8dde529b2
15 changed files with 16 additions and 650 deletions
|
|
@ -3,8 +3,11 @@ import os
|
|||
import winreg
|
||||
import shutil
|
||||
from pype.lib import PypeHook
|
||||
from pype.api import get_last_version_from_path
|
||||
from pypeapp import Anatomy, Logger
|
||||
from pype.api import (
|
||||
Anatomy,
|
||||
Logger,
|
||||
get_last_version_from_path
|
||||
)
|
||||
|
||||
from avalon import io, api, lib
|
||||
|
||||
|
|
|
|||
|
|
@ -9,23 +9,19 @@ from avalon.tools import publish
|
|||
import pyblish.api
|
||||
import pyblish.util
|
||||
|
||||
from pypeapp import Logger
|
||||
from pype.api import Logger
|
||||
import pype
|
||||
import pype.celaction
|
||||
|
||||
|
||||
log = Logger().get_logger("Celaction_cli_publisher")
|
||||
|
||||
publish_host = "celaction"
|
||||
|
||||
CURRENT_DIR = os.path.dirname(__file__)
|
||||
PACKAGE_DIR = os.path.dirname(CURRENT_DIR)
|
||||
PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins")
|
||||
PUBLISH_PATH = os.path.join(PLUGINS_DIR, publish_host, "publish")
|
||||
PUBLISH_PATH = os.path.join(pype.PLUGINS_DIR, publish_host, "publish")
|
||||
|
||||
PUBLISH_PATHS = [
|
||||
PUBLISH_PATH,
|
||||
os.path.join(PLUGINS_DIR, "ftrack", "publish")
|
||||
os.path.join(pype.PLUGINS_DIR, "ftrack", "publish")
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
import pyblish.api
|
||||
|
||||
|
||||
class AppendCelactionFtrackAssetName(pyblish.api.InstancePlugin):
|
||||
""" Appending "ftrackAssetName" """
|
||||
|
||||
label = "Ftrack Asset Name"
|
||||
order = pyblish.api.CollectorOrder + 0.1
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
# skipping if not launched from ftrack
|
||||
if "ftrackData" not in instance.context.data:
|
||||
return
|
||||
|
||||
ftrack_data = instance.context.data["ftrackData"]
|
||||
|
||||
asset_name = ftrack_data["Task"]["name"]
|
||||
instance.data["ftrackAssetName"] = asset_name
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
import pyblish.api
|
||||
from bait.ftrack.query_runner import QueryRunner
|
||||
|
||||
|
||||
class AppendCelactionFtrackAudio(pyblish.api.ContextPlugin):
|
||||
|
||||
label = "Ftrack Audio"
|
||||
order = pyblish.api.ExtractorOrder
|
||||
|
||||
def process(self, context):
|
||||
|
||||
if context.data.get("audio", ''):
|
||||
self.log.info('Audio data are already collected')
|
||||
self.log.info('Audio: {}'.format(context.data.get("audio", '')))
|
||||
return
|
||||
|
||||
runner = QueryRunner(context.data['ftrackSession'])
|
||||
|
||||
audio_file = runner.get_audio_file_for_shot(
|
||||
context.data['ftrackData']["Shot"]["id"])
|
||||
|
||||
if audio_file:
|
||||
context.data["audio"] = {
|
||||
'filename': audio_file,
|
||||
'enabled': True
|
||||
}
|
||||
else:
|
||||
self.log.warning("Couldn't find any audio file on Ftrack.")
|
||||
|
||||
|
||||
class AppendCelactionFtrackData(pyblish.api.InstancePlugin):
|
||||
""" Appending ftrack component and asset type data """
|
||||
|
||||
families = ["img.*", "mov.*"]
|
||||
# offset to piggy back from default collectors
|
||||
order = pyblish.api.CollectorOrder + 0.1
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
# ftrack data
|
||||
if not instance.context.has_data("ftrackData"):
|
||||
return
|
||||
|
||||
instance.data["ftrackComponents"] = {}
|
||||
asset_type = instance.data["family"].split(".")[0]
|
||||
instance.data["ftrackAssetType"] = asset_type
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
import pyblish.api
|
||||
|
||||
|
||||
class CollectCelactionScene(pyblish.api.ContextPlugin):
|
||||
""" Converts the path flag value to the current file in the context. """
|
||||
|
||||
order = pyblish.api.CollectorOrder
|
||||
|
||||
def process(self, context):
|
||||
context.data['ftrackStatus'] = "Ready"
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
import os
|
||||
import pyblish.api
|
||||
import pype.celaction
|
||||
|
||||
|
||||
class CollectData(pyblish.api.Collector):
|
||||
"""Collects data passed from via CLI"""
|
||||
|
||||
order = pyblish.api.Collector.order - 0.1
|
||||
|
||||
def process(self, context):
|
||||
self.log.info("Adding data from command-line into Context..")
|
||||
|
||||
kwargs = pype.celaction.kwargs.copy()
|
||||
|
||||
for key, value in kwargs.items():
|
||||
self.log.info("%s = %s" % (key, value))
|
||||
context.set_data(key, value)
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
"""
|
||||
Requires:
|
||||
context -> anatomy
|
||||
context -> anatomyData
|
||||
|
||||
Provides:
|
||||
instance -> publishDir
|
||||
instance -> resourcesDir
|
||||
"""
|
||||
|
||||
import os
|
||||
import copy
|
||||
|
||||
import pyblish.api
|
||||
from avalon import api
|
||||
|
||||
|
||||
class CollectRenderPath(pyblish.api.InstancePlugin):
|
||||
"""Generate file and directory path where rendered images will be"""
|
||||
|
||||
label = "Collect Render Path"
|
||||
order = pyblish.api.CollectorOrder + 0.495
|
||||
|
||||
def process(self, instance):
|
||||
anatomy = instance.context.data["anatomy"]
|
||||
|
||||
template_data = copy.deepcopy(instance.data["anatomyData"])
|
||||
|
||||
# This is for cases of Deprecated anatomy without `folder`
|
||||
# TODO remove when all clients have solved this issue
|
||||
template_data.update({
|
||||
"frame": "FRAME_TEMP",
|
||||
"representation": "png"
|
||||
})
|
||||
|
||||
anatomy_filled = anatomy.format(template_data)
|
||||
|
||||
if "folder" in anatomy.templates["render"]:
|
||||
render_folder = anatomy_filled["render"]["folder"]
|
||||
render_file = anatomy_filled["render"]["file"]
|
||||
else:
|
||||
# solve deprecated situation when `folder` key is not underneath
|
||||
# `publish` anatomy
|
||||
project_name = api.Session["AVALON_PROJECT"]
|
||||
self.log.warning((
|
||||
"Deprecation warning: Anatomy does not have set `folder`"
|
||||
" key underneath `publish` (in global of for project `{}`)."
|
||||
).format(project_name))
|
||||
|
||||
file_path = anatomy_filled["render"]["path"]
|
||||
# Directory
|
||||
render_folder = os.path.dirname(file_path)
|
||||
render_file = os.path.basename(file_path)
|
||||
|
||||
render_folder = os.path.normpath(render_folder)
|
||||
render_path = os.path.join(render_folder, render_file)
|
||||
|
||||
instance.data["outputRenderPath"] = render_path
|
||||
|
||||
self.log.debug("outputRenderPath: \"{}\"".format(render_path))
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
import os
|
||||
|
||||
import pyblish.api
|
||||
import pyblish_standalone
|
||||
import clique
|
||||
import requests
|
||||
from bait.deadline import get_render_settings, get_deadline_data, format_frames
|
||||
from bait.paths import get_output_path
|
||||
|
||||
|
||||
class ExtractCelactionDeadline(pyblish.api. InstancePlugin):
|
||||
|
||||
label = 'Deadline'
|
||||
families = ['render']
|
||||
order = pyblish.api.ExtractorOrder
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
render_settings = get_render_settings("celaction")
|
||||
|
||||
existing_data = instance.data.get(
|
||||
"deadlineData", {"job": {}, "plugin": {}}
|
||||
)
|
||||
|
||||
task_id = instance.context.data["ftrackData"]["Task"]["id"]
|
||||
|
||||
data = get_deadline_data(render_settings, existing_data)
|
||||
|
||||
filename = os.path.basename(instance.context.data["currentFile"])
|
||||
filename_no_ext, ext = os.path.splitext(filename)
|
||||
|
||||
data["job"]["Name"] = filename_no_ext + " - " + instance.data["name"]
|
||||
data["job"]['Frames'] = format_frames(
|
||||
instance.data('start'), instance.data('end'))
|
||||
|
||||
# get version data
|
||||
version = instance.context.data(
|
||||
'version') if instance.context.has_data('version') else 1
|
||||
|
||||
output_path = get_output_path(
|
||||
task_id, instance.data["name"], version, "png")
|
||||
output_path = output_path.replace("/", "\\")
|
||||
|
||||
data['job']['Plugin'] = 'CelAction'
|
||||
data['job']["BatchName"] = filename
|
||||
data['job']["UserName"] = os.environ['USERNAME']
|
||||
data["job"]['OutputFilename0'] = output_path.replace('%04d', '####')
|
||||
|
||||
scene_path = pyblish_standalone.kwargs['path'][0]
|
||||
scene_path = scene_path.replace("/", "\\")
|
||||
_, ext = os.path.splitext(scene_path)
|
||||
|
||||
# plugin data
|
||||
self.log.info(scene_path)
|
||||
|
||||
args = '<QUOTE>{}<QUOTE>'.format(scene_path)
|
||||
args += ' -a'
|
||||
args += ' -8'
|
||||
args += ' -s <STARTFRAME>'
|
||||
args += ' -e <ENDFRAME>'
|
||||
args += ' -d <QUOTE>{}<QUOTE>'.format(os.path.dirname(output_path))
|
||||
args += ' -x {}'.format(instance.data('x'))
|
||||
args += ' -y {}'.format(instance.data('y'))
|
||||
args += ' -r <QUOTE>{}<QUOTE>'.format(output_path.replace('.%04d', ''))
|
||||
args += ' -= AbsoluteFrameNumber=on -= PadDigits=4'
|
||||
args += ' -= ClearAttachment=on'
|
||||
|
||||
data["plugin"]['StartupDirectory'] = ''
|
||||
data["plugin"]['Arguments'] = args
|
||||
|
||||
self.log.info(data)
|
||||
|
||||
head = output_path.replace('%04d', '')
|
||||
tail = ".png"
|
||||
collection = clique.Collection(head=head, padding=4, tail=tail)
|
||||
|
||||
frame_start = int(instance.data['start'])
|
||||
frame_end = int(instance.data['end'])
|
||||
|
||||
for frame_no in range(frame_start, frame_end):
|
||||
collection.add(head + str(frame_no).zfill(4) + tail)
|
||||
|
||||
# instance.data["collection"] = collection
|
||||
|
||||
# adding to instance
|
||||
instance.set_data('deadlineData2', value=data)
|
||||
# instance.set_data('deadlineSubmissionJob', value=data)
|
||||
|
||||
payload = {
|
||||
"JobInfo": data["job"],
|
||||
"PluginInfo": data["plugin"],
|
||||
"AuxFiles": []
|
||||
}
|
||||
|
||||
url = "{}/api/jobs".format('http://192.168.146.8:8082')
|
||||
response = requests.post(url, json=payload)
|
||||
if not response.ok:
|
||||
raise Exception(response.text)
|
||||
|
||||
# Store output dir for unified publisher (filesequence)
|
||||
instance.data["outputDir"] = os.path.dirname(
|
||||
data["job"]['OutputFilename0'])
|
||||
instance.data["deadlineSubmissionJob"] = response.json()
|
||||
|
||||
instance.context.data['ftrackStatus'] = "Render"
|
||||
|
||||
# creating output path
|
||||
if not os.path.exists(os.path.dirname(output_path)):
|
||||
os.makedirs(os.path.dirname(output_path))
|
||||
|
|
@ -1,283 +0,0 @@
|
|||
import os
|
||||
import json
|
||||
import pprint
|
||||
import re
|
||||
import requests
|
||||
import pyblish.api
|
||||
|
||||
|
||||
class SubmitDependentImageSequenceJobDeadline(pyblish.api.InstancePlugin):
|
||||
"""Submit image sequence publish jobs to Deadline.
|
||||
|
||||
These jobs are dependent on a deadline job submission prior to this
|
||||
plug-in.
|
||||
|
||||
Renders are submitted to a Deadline Web Service as
|
||||
supplied via the environment variable DEADLINE_REST_URL
|
||||
|
||||
Options in instance.data:
|
||||
- deadlineSubmission (dict, Required): The returned .json
|
||||
data from the job submission to deadline.
|
||||
|
||||
- outputDir (str, Required): The output directory where the metadata
|
||||
file should be generated. It's assumed that this will also be
|
||||
final folder containing the output files.
|
||||
|
||||
- ext (str, Optional): The extension (including `.`) that is required
|
||||
in the output filename to be picked up for image sequence
|
||||
publishing.
|
||||
|
||||
- publishJobState (str, Optional): "Active" or "Suspended"
|
||||
This defaults to "Suspended"
|
||||
|
||||
This requires a "startFrame" and "endFrame" to be present in instance.data
|
||||
or in context.data.
|
||||
|
||||
"""
|
||||
|
||||
label = "Submit image sequence jobs to Deadline"
|
||||
order = pyblish.api.IntegratorOrder + 0.2
|
||||
|
||||
hosts = ["celaction"]
|
||||
|
||||
families = [
|
||||
"render",
|
||||
"deadline"
|
||||
]
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
# DEADLINE_REST_URL = os.environ.get("DEADLINE_REST_URL",
|
||||
# "http://localhost:8082")
|
||||
# assert DEADLINE_REST_URL, "Requires DEADLINE_REST_URL"
|
||||
|
||||
# Get a submission job
|
||||
|
||||
job = instance.data.get("deadlineSubmissionJob")
|
||||
if not job:
|
||||
raise RuntimeError("Can't continue without valid deadline "
|
||||
"submission prior to this plug-in.")
|
||||
################
|
||||
ft_data = instance.context.data["ftrackData"]
|
||||
project = ft_data['Project']['name']
|
||||
project_code = ft_data['Project']['code']
|
||||
projects_path = os.path.dirname(ft_data['Project']['root'])
|
||||
|
||||
data = instance.data.copy()
|
||||
asset = instance.context.data["ftrackData"]['Shot']['name']
|
||||
subset = 'render' + \
|
||||
instance.context.data["ftrackData"]['Task']['name'].capitalize()
|
||||
|
||||
state = data.get("publishJobState", "Suspended")
|
||||
# job_name = "{batch} - {subset} [publish image sequence]".format(
|
||||
# batch=job["Props"]["Name"],
|
||||
# subset=subset
|
||||
# )
|
||||
job_name = "{asset} [publish image sequence]".format(
|
||||
asset=asset
|
||||
)
|
||||
|
||||
# Get start/end frame from instance, if not available get from context
|
||||
context = instance.context
|
||||
|
||||
start = int(instance.data['start'])
|
||||
end = int(instance.data['end'])
|
||||
|
||||
try:
|
||||
source = data['source']
|
||||
except KeyError:
|
||||
source = context.data["currentFile"]
|
||||
|
||||
# Write metadata for publish job
|
||||
render_job = data.pop("deadlineSubmissionJob")
|
||||
metadata = {
|
||||
"asset": asset,
|
||||
"regex": r"^.*\.png",
|
||||
"subset": subset,
|
||||
"startFrame": start,
|
||||
"endFrame": end,
|
||||
"fps": context.data.get("fps", None),
|
||||
"families": ["render"],
|
||||
"source": source,
|
||||
"user": context.data["user"],
|
||||
"version": context.data.get('version'),
|
||||
"audio": context.data["audio"]['filename'],
|
||||
# Optional metadata (for debugging)
|
||||
"metadata": {
|
||||
"instance": data,
|
||||
"job": job,
|
||||
"session": fake_avalon_session(project, projects_path)
|
||||
}
|
||||
}
|
||||
|
||||
# Ensure output dir exists
|
||||
output_dir = instance.data["outputDir"]
|
||||
|
||||
if not os.path.isdir(output_dir):
|
||||
os.makedirs(output_dir)
|
||||
|
||||
for k, v in metadata.items():
|
||||
self.log.info(k)
|
||||
self.log.info(v)
|
||||
|
||||
metadata_filename = "{}_metadata.json".format(subset)
|
||||
metadata_path = os.path.join(output_dir, metadata_filename)
|
||||
with open(metadata_path, "w") as f:
|
||||
json.dump(metadata, f, indent=4, sort_keys=True)
|
||||
|
||||
# Generate the payload for Deadline submission
|
||||
payload = {
|
||||
"JobInfo": {
|
||||
"Plugin": "Python",
|
||||
"BatchName": job["Props"]["Batch"],
|
||||
"Name": job_name,
|
||||
"JobType": "Normal",
|
||||
"Group": "celaction",
|
||||
"JobDependency0": job["_id"],
|
||||
"UserName": os.environ['USERNAME'],
|
||||
"Comment": instance.context.data.get("comment", ""),
|
||||
"InitialStatus": "Active"
|
||||
},
|
||||
"PluginInfo": {
|
||||
"Version": "3.6",
|
||||
"ScriptFile": r"\\pype\Core\dev\pype-setup\repos\pype-config\pype\scripts\publish_filesequence.py",
|
||||
"Arguments": '--path "{}"'.format(metadata_path),
|
||||
"SingleFrameOnly": "True"
|
||||
},
|
||||
|
||||
# Mandatory for Deadline, may be empty
|
||||
"AuxFiles": []
|
||||
}
|
||||
|
||||
# Transfer the environment from the original job to this dependent
|
||||
# job so they use the same environment
|
||||
environment = fake_env()
|
||||
environment["AVALON_ASSET"] = asset
|
||||
environment["AVALON_TASK"] = instance.context.data["ftrackData"]['Task']['name']
|
||||
environment["AVALON_PROJECT"] = project
|
||||
environment["AVALON_PROJECTS"] = projects_path
|
||||
environment["PYPE_STUDIO_PROJECTS_PUBLISH"] = ft_data['Project']['root']
|
||||
environment["PYPE_STUDIO_PROJECTS_RENDER"] = ft_data['Project']['root']
|
||||
environment["PYPE_STUDIO_PROJECTS_RESOURCES"] = ft_data['Project']['root']
|
||||
environment["PYPE_STUDIO_PROJECTS_WORK"] = ft_data['Project']['root']
|
||||
|
||||
payload["JobInfo"].update({
|
||||
"EnvironmentKeyValue%d" % index: "{key}={value}".format(
|
||||
key=key,
|
||||
value=environment[key]
|
||||
) for index, key in enumerate(environment)
|
||||
})
|
||||
|
||||
# Avoid copied pools and remove secondary pool
|
||||
payload["JobInfo"]["Pool"] = "animation_2d"
|
||||
payload["JobInfo"].pop("SecondaryPool", None)
|
||||
|
||||
self.log.info("Submitting..")
|
||||
# self.log.info(json.dumps(payload, indent=4, sort_keys=True))
|
||||
|
||||
################
|
||||
######################
|
||||
fake_instance = instance.context.create_instance(
|
||||
name=(str(instance) + "1"))
|
||||
|
||||
for k, v in data.items():
|
||||
self.log.info(k)
|
||||
fake_instance.data[k] = v
|
||||
|
||||
# fake_instance.data['deadlineData'] = payload
|
||||
# 'http://192.168.146.8:8082'
|
||||
url = "{}/api/jobs".format('http://192.168.146.8:8082')
|
||||
response = requests.post(url, json=payload)
|
||||
if not response.ok:
|
||||
raise Exception(response.text)
|
||||
######################
|
||||
#######################
|
||||
|
||||
|
||||
def fake_avalon_session(project=None, projects_path=None):
|
||||
return {
|
||||
"AVALON_APP": "premiere",
|
||||
"AVALON_APP_VERSION": "2019",
|
||||
"AVALON_ASSET": "editorial",
|
||||
"AVALON_CONFIG": "pype",
|
||||
"AVALON_CONTAINER_ID": "avalon.container",
|
||||
"AVALON_DB": "Pype",
|
||||
"AVALON_DEADLINE": "http://192.168.146.8:8082",
|
||||
"AVALON_DEBUG": "1",
|
||||
"AVALON_EARLY_ADOPTER": "1",
|
||||
"AVALON_INSTANCE_ID": "avalon.instance",
|
||||
"AVALON_LABEL": "Avalon",
|
||||
"AVALON_LOCATION": "http://127.0.0.1",
|
||||
"AVALON_MONGO": "mongodb://PypeAdmin:X34vkuwL4wbK9A7X@192.168.146.24:27072/Pype",
|
||||
"AVALON_PASSWORD": "secret",
|
||||
"AVALON_PROJECT": project or "LBB2_dev",
|
||||
"AVALON_PROJECTS": projects_path or "L:/PYPE_test",
|
||||
"AVALON_SILO": "editorial",
|
||||
"AVALON_TASK": "conform",
|
||||
"AVALON_TIMEOUT": "1000",
|
||||
"AVALON_USERNAME": "avalon",
|
||||
"AVALON_WORKDIR": "L:/PYPE_test/episodes/editorial/work/conform",
|
||||
"schema": "avalon-core:session-1.0"
|
||||
}
|
||||
|
||||
|
||||
def fake_env():
|
||||
return {
|
||||
"AVALON_CONFIG": "pype",
|
||||
"AVALON_CONTAINER_ID": "avalon.container",
|
||||
"AVALON_CORE": "\\\\pype\\Core\\dev\\pype-setup\\repos\\avalon-core",
|
||||
"AVALON_DB": "Pype",
|
||||
"AVALON_DB_DATA": "\\\\pype\\Core\\dev\\mongo_db_data",
|
||||
"AVALON_DEADLINE": "http://192.168.146.8:8082",
|
||||
"AVALON_DEBUG": "1",
|
||||
"AVALON_EARLY_ADOPTER": "1",
|
||||
"AVALON_ENV_NAME": "pype_env",
|
||||
"AVALON_HIERARCHY": "",
|
||||
"AVALON_INSTANCE_ID": "avalon.instance",
|
||||
"AVALON_LABEL": "Avalon",
|
||||
"AVALON_LAUNCHER": "\\\\pype\\Core\\dev\\pype-setup\\repos\\avalon-launcher",
|
||||
"AVALON_LOCATION": "http://127.0.0.1",
|
||||
"AVALON_MONGO": "mongodb://PypeAdmin:X34vkuwL4wbK9A7X@192.168.146.24:27072/Pype",
|
||||
"AVALON_MONGO_PORT": "27072",
|
||||
"AVALON_PASSWORD": "secret",
|
||||
"AVALON_SCHEMA": "\\\\pype\\Core\\dev\\pype-setup\\repos\\clothcat-templates\\schema",
|
||||
"AVALON_SILO": "",
|
||||
"AVALON_TIMEOUT": "1000",
|
||||
"AVALON_USERNAME": "avalon",
|
||||
"AVALON_WORKDIR": "default",
|
||||
"DEADLINE_PATH": "C:\\Program Files\\Thinkbox\\Deadline10\\bin",
|
||||
"DEADLINE_REST_URL": "http://192.168.146.8:8082",
|
||||
"FTRACK_API_KEY": "NGI0ZGU3ZjMtNzNiZC00NGVlLWEwY2EtMzA1OWJlZGM0MjAyOjozZWZmMThjZi04MjkwLTQxMzQtODUwMC03NTZhMGJiZTM2MTA",
|
||||
"FTRACK_API_USER": "license@clothcatanimation.com",
|
||||
"FTRACK_SERVER": "https://clothcat2.ftrackapp.com",
|
||||
"MONGO_DB_ENTRYDB": "Pype",
|
||||
"MONGO_DB_PASS": "X34vkuwL4wbK9A7X",
|
||||
"MONGO_DB_USER": "PypeAdmin",
|
||||
"PATH": "\\\\pype\\Core\\dev\\pype-setup\\bin\\python\\pype_env\\python3\\lib\\site-packages\\PyQt5\\Qt\\bin;\\\\pype\\Core\\dev\\pype-setup\\bin\\python\\pype_env\\python3\\lib\\site-packages\\PyQt5\\Qt\\bin;\\\\pype\\Core\\dev\\pype-setup\\bin\\python\\pype_env\\python3\\lib\\site-packages\\PyQt5\\Qt\\bin;\\\\pype\\Core\\dev\\pype-setup\\bin\\python\\pype_env\\python3\\lib\\site-packages\\PyQt5\\Qt\\bin;\\\\pype\\Core\\dev\\pype-setup\\bin\\python\\pype_env\\python3\\lib\\site-packages\\PyQt5\\Qt\\bin;\\\\pype\\Core\\dev\\pype-setup\\bin\\python\\pype_env\\python3\\lib\\site-packages\\PyQt5\\Qt\\bin;\\\\pype\\Core\\dev\\pype-setup\\bin\\python\\pype_env\\python3\\lib\\site-packages\\PyQt5\\Qt\\bin;\\\\pype\\Core\\dev\\pype-setup\\bin\\python\\pype_env\\python3;\\\\pype\\Core\\dev\\pype-setup\\bin\\python\\pype_env\\python3\\Scripts;\\\\pype\\Core\\dev\\pype-setup\\bin\\python\\pype_env\\python3\\Library\\bin;\\\\pype\\Core\\dev\\pype-setup\\bin\\python\\pype_env\\python3\\Library;;\\\\pype\\Core\\dev\\pype-setup\\repos\\clothcat-templates\\bin;\\\\pype\\Core\\dev\\pype-setup\\repos\\clothcat-templates\\bin\\windows;\\\\pype\\Core\\dev\\pype-setup\\app;\\\\pype\\core\\software\\ffmpeg\\bin;\\\\pype\\Core\\dev\\Applications\\djv\\bin",
|
||||
"PYBLISHPLUGINPATH": "\\\\pype\\Core\\dev\\pype-setup\\repos\\pype-config\\pype\\plugins\\ftrack\\publish;",
|
||||
"PYBLISH_BASE": "\\\\pype\\Core\\dev\\pype-setup\\repos\\pyblish-base",
|
||||
"PYBLISH_HOSTS": "shell",
|
||||
"PYBLISH_LITE": "\\\\pype\\Core\\dev\\pype-setup\\repos\\pyblish-lite",
|
||||
"PYBLISH_QML": "\\\\pype\\Core\\dev\\pype-setup\\repos\\pyblish-qml",
|
||||
"PYPE_APP_ROOT": "\\\\pype\\Core\\dev\\pype-setup\\app",
|
||||
"PYPE_DEBUG": "3",
|
||||
"PYPE_DEBUG_STDOUT": "0",
|
||||
"PYPE_SETUP_ROOT": "\\\\pype\\Core\\dev\\pype-setup",
|
||||
"PYPE_STUDIO_CODE": "CC",
|
||||
"PYPE_STUDIO_CONFIG": "\\\\pype\\Core\\dev\\pype-setup\\repos\\pype-config",
|
||||
"PYPE_STUDIO_CORE": "\\\\pype\\Core\\dev",
|
||||
"PYPE_STUDIO_CORE_MOUNT": "\\\\pype\\Core\\dev",
|
||||
"PYPE_STUDIO_NAME": "Cloth Cat",
|
||||
"PYPE_STUDIO_SOFTWARE": "\\\\pype\\Core\\dev\\Applications",
|
||||
"PYPE_STUDIO_TEMPLATES": "\\\\pype\\Core\\dev\\pype-setup\\repos\\clothcat-templates",
|
||||
"PYPE_STUDIO_TOOLS": "\\\\pype\\Core\\dev\\production\\tools",
|
||||
"PYTHONPATH": "\\\\pype\\Core\\dev\\pype-setup;\\\\pype\\Core\\dev\\pype-setup\\app\\vendor;\\\\pype\\Core\\dev\\pype-setup\\repos\\avalon-core;\\\\pype\\Core\\dev\\pype-setup\\repos\\avalon-launcher;\\\\pype\\Core\\dev\\pype-setup\\repos\\pyblish-base;\\\\pype\\Core\\dev\\pype-setup\\repos\\pyblish-qml;\\\\pype\\Core\\dev\\pype-setup\\repos\\pyblish-lite;\\\\pype\\Core\\dev\\pype-setup\\repos\\ftrack-event-server;\\\\pype\\Core\\dev\\pype-setup\\repos\\pype-config;\\\\pype\\Core\\dev\\pype-setup\\app\\vendor;\\\\pype\\Core\\dev\\pype-setup\\repos\\pype-config\\pype\\vendor;\\\\pype\\Core\\dev\\pype-setup\\repos\\ftrack-event-server",
|
||||
"PYTHONVERBOSE": "True",
|
||||
"PYTHON_ENV": "C:\\Users\\Public\\pype_env",
|
||||
"REMOTE_ENV_DIR": "\\\\pype\\Core\\dev\\pype-setup\\bin\\python\\pype_env",
|
||||
"REMOTE_ENV_ON": "0",
|
||||
"SCHEMA": "avalon-core:session-1.0",
|
||||
"STUDIO_SOFT": "\\\\evo2\\core\\Applications",
|
||||
"TOOL_ENV": "\\\\pype\\Core\\dev\\pype-setup\\repos\\clothcat-templates\\environments",
|
||||
"USERNAME": "pype"
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
import shutil
|
||||
import pyblish.api
|
||||
import pyblish_standalone
|
||||
import os
|
||||
from bait.paths import get_env_work_file
|
||||
|
||||
|
||||
class RepairCelactionScenePath(pyblish.api.Action):
|
||||
label = "Repair"
|
||||
icon = "wrench"
|
||||
on = "failed"
|
||||
|
||||
def process(self, context, plugin):
|
||||
|
||||
# get version data
|
||||
version = context.data('version') if context.has_data('version') else 1
|
||||
|
||||
task_id = context.data["ftrackData"]["Task"]["id"]
|
||||
expected_path = get_env_work_file(
|
||||
"celaction", task_id, "scn", version).replace('\\\\\\', '\\\\')
|
||||
|
||||
src = context.data["currentFile"]
|
||||
|
||||
if not os.path.exists(os.path.dirname(expected_path)):
|
||||
os.makedirs(os.path.dirname(expected_path))
|
||||
|
||||
if os.path.exists(os.path.dirname(expected_path)):
|
||||
self.log.info("existing to \"%s\"" % expected_path)
|
||||
|
||||
if os.path.exists(expected_path) and ('v001' in expected_path):
|
||||
os.remove(expected_path)
|
||||
|
||||
shutil.copy2(src, expected_path)
|
||||
|
||||
pyblish_standalone.kwargs['path'] = [expected_path]
|
||||
context.data["currentFile"] = expected_path
|
||||
|
||||
self.log.info("Saved to \"%s\"" % expected_path)
|
||||
|
||||
|
||||
class ValidateCelactionScenePath(pyblish.api.InstancePlugin):
|
||||
order = pyblish.api.ValidatorOrder
|
||||
families = ['scene']
|
||||
label = 'Scene Path'
|
||||
actions = [RepairCelactionScenePath]
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
# getting current work file
|
||||
current_scene_path = pyblish_standalone.kwargs['path'][0]
|
||||
|
||||
version = instance.context.data(
|
||||
'version') if instance.context.has_data('version') else 1
|
||||
|
||||
task_id = instance.context.data["ftrackData"]["Task"]["id"]
|
||||
expected_scene_path = get_env_work_file(
|
||||
"celaction", task_id, "scn", version).replace('\\\\\\', '\\\\')
|
||||
|
||||
msg = 'Scene path is not correct: Current: {}, Expected: {}'.format(
|
||||
current_scene_path, expected_scene_path)
|
||||
|
||||
assert expected_scene_path == current_scene_path, msg
|
||||
|
|
@ -2,7 +2,6 @@ import pyblish.api
|
|||
import os
|
||||
|
||||
import pype.api as pype
|
||||
from avalon import io
|
||||
from pprint import pformat
|
||||
|
||||
class AppendCelactionAudio(pyblish.api.ContextPlugin):
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ class CollectRenderPath(pyblish.api.InstancePlugin):
|
|||
anatomy = instance.context.data["anatomy"]
|
||||
current_file = instance.context.data["currentFile"]
|
||||
work_dir = os.path.dirname(current_file)
|
||||
work_file = os.path.basename(current_file)
|
||||
padding = anatomy.templates.get("frame_padding", 4)
|
||||
render_dir = os.path.join(
|
||||
work_dir, "render", "celaction"
|
||||
)
|
||||
render_path = os.path.join(
|
||||
render_dir, ".".join([instance.data["subset"], f"%0{padding}d", "png"])
|
||||
render_dir,
|
||||
".".join([instance.data["subset"], f"%0{padding}d", "png"])
|
||||
)
|
||||
|
||||
# create dir if it doesnt exists
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import os
|
|||
import json
|
||||
import getpass
|
||||
|
||||
from avalon import api
|
||||
from avalon.vendor import requests
|
||||
import re
|
||||
import pyblish.api
|
||||
|
|
@ -29,8 +28,6 @@ class ExtractCelactionDeadline(pyblish.api.InstancePlugin):
|
|||
deadline_chunk_size = 1
|
||||
|
||||
def process(self, instance):
|
||||
families = instance.data["families"]
|
||||
|
||||
context = instance.context
|
||||
|
||||
DEADLINE_REST_URL = os.environ.get("DEADLINE_REST_URL")
|
||||
|
|
@ -155,23 +152,6 @@ class ExtractCelactionDeadline(pyblish.api.InstancePlugin):
|
|||
"AuxFiles": []
|
||||
}
|
||||
|
||||
# Include critical environment variables with submission
|
||||
keys = [
|
||||
"FTRACK_API_USER",
|
||||
"FTRACK_API_KEY",
|
||||
"FTRACK_SERVER",
|
||||
"AVALON_PROJECT"
|
||||
]
|
||||
environment = dict({key: os.environ[key] for key in keys
|
||||
if key in os.environ})
|
||||
|
||||
payload["JobInfo"].update({
|
||||
"EnvironmentKeyValue%d" % index: "{key}={value}".format(
|
||||
key=key,
|
||||
value=environment[key]
|
||||
) for index, key in enumerate(environment)
|
||||
})
|
||||
|
||||
plugin = payload["JobInfo"]["Plugin"]
|
||||
self.log.info("using render plugin : {}".format(plugin))
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import six
|
|||
|
||||
from pymongo import DeleteOne, InsertOne
|
||||
import pyblish.api
|
||||
from avalon import io
|
||||
from avalon import api, io
|
||||
from avalon.vendor import filelink
|
||||
|
||||
# this is needed until speedcopy for linux is fixed
|
||||
|
|
@ -44,7 +44,6 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
"frameStart"
|
||||
"frameEnd"
|
||||
'fps'
|
||||
"data": additional metadata for each representation.
|
||||
"""
|
||||
|
||||
label = "Integrate Asset New"
|
||||
|
|
@ -82,8 +81,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
"assembly",
|
||||
"fbx",
|
||||
"textures",
|
||||
"action",
|
||||
"harmony.template"
|
||||
"action"
|
||||
]
|
||||
exclude_families = ["clip"]
|
||||
db_representation_context_keys = [
|
||||
|
|
@ -379,8 +377,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
dst = "{0}{1}{2}".format(
|
||||
dst_head,
|
||||
dst_padding,
|
||||
dst_tail
|
||||
).replace("..", ".")
|
||||
dst_tail).replace("..", ".")
|
||||
|
||||
self.log.debug("destination: `{}`".format(dst))
|
||||
src = os.path.join(stagingdir, src_file_name)
|
||||
|
|
@ -453,15 +450,13 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
if repre_id is None:
|
||||
repre_id = io.ObjectId()
|
||||
|
||||
data = repre.get("data") or {}
|
||||
data.update({'path': dst, 'template': template})
|
||||
representation = {
|
||||
"_id": repre_id,
|
||||
"schema": "pype:representation-2.0",
|
||||
"type": "representation",
|
||||
"parent": version_id,
|
||||
"name": repre['name'],
|
||||
"data": data,
|
||||
"data": {'path': dst, 'template': template},
|
||||
"dependencies": instance.data.get("dependencies", "").split(),
|
||||
|
||||
# Imprint shortcut to context
|
||||
|
|
@ -568,7 +563,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
try:
|
||||
shutil.copyfile(src, dst)
|
||||
self.log.debug("Copying files with shutil...")
|
||||
except (OSError, AttributeError) as e:
|
||||
except (OSError) as e:
|
||||
self.log.critical("Cannot copy {} to {}".format(src, dst))
|
||||
self.log.critical(e)
|
||||
six.reraise(*sys.exc_info())
|
||||
|
|
|
|||
|
|
@ -845,7 +845,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
|||
# add audio to metadata file if available
|
||||
audio_file = context.data.get("audioFile")
|
||||
if os.path.isfile(audio_file):
|
||||
publish_job.update({ "audio": audio_file})
|
||||
publish_job.update({"audio": audio_file})
|
||||
|
||||
# pass Ftrack credentials in case of Muster
|
||||
if submission_type == "muster":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue