mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Merge remote-tracking branch 'origin' into feature/2.0/documentation-support
This commit is contained in:
commit
46e5148bf1
8 changed files with 62 additions and 31 deletions
|
|
@ -38,9 +38,6 @@ def registerApp(app, session):
|
|||
description = apptoml.get('description', None)
|
||||
preactions = apptoml.get('preactions', [])
|
||||
|
||||
if icon:
|
||||
icon = icon.format(os.environ.get('PYPE_STATICS_SERVER', ''))
|
||||
|
||||
# register action
|
||||
AppAction(
|
||||
session, label, name, executable, variant,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import logging
|
||||
|
|
@ -46,7 +45,10 @@ class JobKiller(BaseAction):
|
|||
desctiption = data['description']
|
||||
except Exception:
|
||||
desctiption = '*No description*'
|
||||
user = job['user']['username']
|
||||
try:
|
||||
user = job['user']['username']
|
||||
except Exception:
|
||||
user = '*No user'
|
||||
created = job['created_at'].strftime('%d.%m.%Y %H:%M:%S')
|
||||
label = '{} - {} - {}'.format(
|
||||
desctiption, created, user
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from pype.vendor import ftrack_api
|
||||
import ftrack_api
|
||||
from pype.ftrack import BaseAction
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -340,7 +340,9 @@ class AppAction(BaseHandler):
|
|||
|
||||
if next_status_name is not None:
|
||||
try:
|
||||
query = 'Status where name is "{}"'.format(next_status_name)
|
||||
query = 'Status where name is "{}"'.format(
|
||||
next_status_name
|
||||
)
|
||||
status = session.query(query).one()
|
||||
entity['status'] = status
|
||||
session.commit()
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ class BaseHandler(object):
|
|||
self.session.reset()
|
||||
|
||||
def _preregister(self):
|
||||
# Rolecheck
|
||||
if hasattr(self, "role_list") and len(self.role_list) > 0:
|
||||
username = self.session.api_user
|
||||
user = self.session.query(
|
||||
|
|
@ -304,7 +305,7 @@ class BaseHandler(object):
|
|||
|
||||
# Launch preactions
|
||||
for preaction in self.preactions:
|
||||
event = fa_session.ftrack_api.event.base.Event(
|
||||
event = ftrack_api.event.base.Event(
|
||||
topic='ftrack.action.launch',
|
||||
data=dict(
|
||||
actionIdentifier=preaction,
|
||||
|
|
@ -316,7 +317,7 @@ class BaseHandler(object):
|
|||
)
|
||||
session.event_hub.publish(event, on_error='ignore')
|
||||
# Relaunch this action
|
||||
event = fa_session.ftrack_api.event.base.Event(
|
||||
event = ftrack_api.event.base.Event(
|
||||
topic='ftrack.action.launch',
|
||||
data=dict(
|
||||
actionIdentifier=self.identifier,
|
||||
|
|
|
|||
|
|
@ -428,6 +428,8 @@ class CollectLook(pyblish.api.InstancePlugin):
|
|||
computed_attribute = attribute
|
||||
source = cmds.getAttr(attribute)
|
||||
|
||||
color_space_attr = "{}.colorSpace".format(node)
|
||||
color_space = cmds.getAttr(color_space_attr)
|
||||
# Compare with the computed file path, e.g. the one with the <UDIM>
|
||||
# pattern in it, to generate some logging information about this
|
||||
# difference
|
||||
|
|
@ -453,4 +455,5 @@ class CollectLook(pyblish.api.InstancePlugin):
|
|||
return {"node": node,
|
||||
"attribute": attribute,
|
||||
"source": source, # required for resources
|
||||
"files": files} # required for resources
|
||||
"files": files,
|
||||
"color_space": color_space} # required for resources
|
||||
|
|
|
|||
|
|
@ -63,14 +63,18 @@ def maketx(source, destination, *args):
|
|||
"""
|
||||
|
||||
cmd = [
|
||||
"maketx",
|
||||
"-v", # verbose
|
||||
"-u", # update mode
|
||||
# unpremultiply before conversion (recommended when alpha present)
|
||||
"--unpremult",
|
||||
# use oiio-optimized settings for tile-size, planarconfig, metadata
|
||||
"--oiio"
|
||||
]
|
||||
"maketx",
|
||||
"-v", # verbose
|
||||
"-u", # update mode
|
||||
# unpremultiply before conversion (recommended when alpha present)
|
||||
"--unpremult",
|
||||
"--checknan",
|
||||
# use oiio-optimized settings for tile-size, planarconfig, metadata
|
||||
"--oiio",
|
||||
"--colorconvert sRGB linear",
|
||||
"--filter lanczos3"
|
||||
]
|
||||
|
||||
cmd.extend(args)
|
||||
cmd.extend([
|
||||
"-o", destination,
|
||||
|
|
@ -85,8 +89,7 @@ def maketx(source, destination, *args):
|
|||
creationflags=CREATE_NO_WINDOW
|
||||
)
|
||||
except subprocess.CalledProcessError as exc:
|
||||
print exc
|
||||
print out
|
||||
print(exc)
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
raise
|
||||
|
|
@ -169,16 +172,33 @@ class ExtractLook(pype.api.Extractor):
|
|||
|
||||
# Collect all unique files used in the resources
|
||||
files = set()
|
||||
files_metadata = dict()
|
||||
for resource in resources:
|
||||
files.update(os.path.normpath(f) for f in resource["files"])
|
||||
# Preserve color space values (force value after filepath change)
|
||||
# This will also trigger in the same order at end of context to
|
||||
# ensure after context it's still the original value.
|
||||
color_space = resource.get('color_space')
|
||||
|
||||
for f in resource["files"]:
|
||||
|
||||
files_metadata[os.path.normpath(f)] = {'color_space': color_space}
|
||||
# files.update(os.path.normpath(f))
|
||||
|
||||
# Process the resource files
|
||||
transfers = list()
|
||||
hardlinks = list()
|
||||
hashes = dict()
|
||||
for filepath in files:
|
||||
|
||||
self.log.info(files)
|
||||
for filepath in files_metadata:
|
||||
|
||||
cspace = files_metadata[filepath]['color_space']
|
||||
linearise = False
|
||||
if cspace == 'sRGB':
|
||||
linearise = True
|
||||
|
||||
source, mode, hash = self._process_texture(
|
||||
filepath, do_maketx, staging=dir_path
|
||||
filepath, do_maketx, staging=dir_path, linearise=linearise
|
||||
)
|
||||
destination = self.resource_destination(
|
||||
instance, source, do_maketx
|
||||
|
|
@ -204,15 +224,17 @@ class ExtractLook(pype.api.Extractor):
|
|||
instance, source, do_maketx
|
||||
)
|
||||
|
||||
# Remap file node filename to destination
|
||||
attr = resource['attribute']
|
||||
remap[attr] = destinations[source]
|
||||
|
||||
# Preserve color space values (force value after filepath change)
|
||||
# This will also trigger in the same order at end of context to
|
||||
# ensure after context it's still the original value.
|
||||
color_space_attr = resource['node'] + ".colorSpace"
|
||||
remap[color_space_attr] = cmds.getAttr(color_space_attr)
|
||||
color_space = cmds.getAttr(color_space_attr)
|
||||
|
||||
# Remap file node filename to destination
|
||||
attr = resource['attribute']
|
||||
remap[attr] = destinations[source]
|
||||
|
||||
remap[color_space_attr] = color_space
|
||||
|
||||
self.log.info("Finished remapping destinations ...")
|
||||
|
||||
|
|
@ -285,7 +307,7 @@ class ExtractLook(pype.api.Extractor):
|
|||
basename + ext
|
||||
)
|
||||
|
||||
def _process_texture(self, filepath, do_maketx, staging):
|
||||
def _process_texture(self, filepath, do_maketx, staging, linearise):
|
||||
"""Process a single texture file on disk for publishing.
|
||||
This will:
|
||||
1. Check whether it's already published, if so it will do hardlink
|
||||
|
|
@ -326,6 +348,11 @@ class ExtractLook(pype.api.Extractor):
|
|||
fname + ".tx"
|
||||
)
|
||||
|
||||
if linearise:
|
||||
colorconvert = "--colorconvert sRGB linear"
|
||||
else:
|
||||
colorconvert = ""
|
||||
|
||||
# Ensure folder exists
|
||||
if not os.path.exists(os.path.dirname(converted)):
|
||||
os.makedirs(os.path.dirname(converted))
|
||||
|
|
@ -333,7 +360,7 @@ class ExtractLook(pype.api.Extractor):
|
|||
self.log.info("Generating .tx file for %s .." % filepath)
|
||||
maketx(filepath, converted,
|
||||
# Include `source-hash` as string metadata
|
||||
"-sattrib", "sourceHash", texture_hash)
|
||||
"-sattrib", "sourceHash", texture_hash, colorconvert)
|
||||
|
||||
return converted, COPY, texture_hash
|
||||
|
||||
|
|
|
|||
|
|
@ -226,7 +226,6 @@ class LoadSequence(api.Loader):
|
|||
node,
|
||||
updated_dict
|
||||
)
|
||||
log.info("udated to version: {}".format(version.get("name")))
|
||||
|
||||
def remove(self, container):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue