convert anatomy in plugins to new

This commit is contained in:
Milan Kolar 2019-04-13 01:06:48 +02:00
parent 44b9e48a67
commit dce33a9370
7 changed files with 27 additions and 22 deletions

View file

@ -63,4 +63,4 @@ def register(session):
time.sleep(0.1)
app_counter += 1
except Exception as e:
log.warning("'{0}' - not proper App ({1})".format(app['name'], e))
log.exception("'{0}' - not proper App ({1})".format(app['name'], e))

View file

@ -227,10 +227,10 @@ class AppAction(BaseHandler):
except Exception:
try:
anatomy = anatomy.format(data)
work_template = anatomy["work"]["path"]
work_template = anatomy["work"]["folder"]
except Exception as e:
self.log.error(
self.log.exception(
"{0} Error in anatomy.format: {1}".format(__name__, e)
)
os.environ["AVALON_WORKDIR"] = os.path.normpath(work_template)
@ -296,7 +296,7 @@ class AppAction(BaseHandler):
try:
fp = open(execfile)
except PermissionError as p:
self.log.error('Access denied on {0} - {1}'.format(
self.log.exception('Access denied on {0} - {1}'.format(
execfile, p))
return {
'success': False,

View file

@ -81,7 +81,7 @@ class BaseHandler(object):
self.type, label)
)
except Exception as e:
self.log.error('{} "{}" - Registration failed ({})'.format(
self.log.exception('{} "{}" - Registration failed ({})'.format(
self.type, label, str(e))
)
return wrapper_register
@ -104,7 +104,7 @@ class BaseHandler(object):
return result
except Exception as e:
msg = '{} "{}": Failed ({})'.format(self.type, label, str(e))
self.log.error(msg)
self.log.exception(msg)
return {
'success': False,
'message': msg

View file

@ -23,7 +23,7 @@ class CollectAssumedDestination(pyblish.api.InstancePlugin):
anatomy = instance.context.data['anatomy']
# self.log.info(anatomy.anatomy())
self.log.info(anatomy.anatomy)
self.log.info(anatomy.templates)
# template = anatomy.publish.path
anatomy_filled = anatomy.format(template_data)
self.log.info(anatomy_filled)
@ -137,5 +137,5 @@ class CollectAssumedDestination(pyblish.api.InstancePlugin):
# We take the parent folder of representation 'filepath'
instance.data["assumedDestination"] = os.path.dirname(
(anatomy.format(template_data)).publish.path
(anatomy.format(template_data))["publish"]["path"]
)

View file

@ -1,5 +1,6 @@
import pype.api as pype
from pypeapp import Anatomy
import pyblish.api
@ -11,6 +12,6 @@ class CollectTemplates(pyblish.api.ContextPlugin):
label = "Collect Templates"
def process(self, context):
pype.load_data_from_templates()
context.data['anatomy'] = pype.Anatomy
# pype.load_data_from_templates()
context.data['anatomy'] = Anatomy()
self.log.info("Anatomy templates collected...")

View file

@ -210,10 +210,10 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
src = os.path.join(stagingdir, fname)
anatomy_filled = anatomy.format(template_data)
dst = anatomy_filled.publish.path
dst = anatomy_filled["publish"]["path"]
instance.data["transfers"].append([src, dst])
template = anatomy.publish.path
template = anatomy.templates["publish"]["path"]
else:
# Single file
@ -234,10 +234,10 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
src = os.path.join(stagingdir, fname)
anatomy_filled = anatomy.format(template_data)
dst = anatomy_filled.publish.path
dst = anatomy_filled["publish"]["path"]
instance.data["transfers"].append([src, dst])
template = anatomy.publish.path
template = anatomy.templates["publish"]["path"]
representation = {
"schema": "pype:representation-2.0",

View file

@ -1,4 +1,5 @@
import pyblish.api
import os
class ValidateTemplates(pyblish.api.ContextPlugin):
"""Check if all templates were filed"""
@ -13,25 +14,28 @@ class ValidateTemplates(pyblish.api.ContextPlugin):
if not anatomy:
raise RuntimeError("Did not find anatomy")
else:
data = { "project": {"name": "D001_projectsx",
data = {
"root": os.environ["PYPE_STUDIO_PROJECTS_PATH"],
"project": {"name": "D001_projectsx",
"code": "prjX"},
"representation": "exr",
"ext": "exr",
"version": 3,
"task": "animation",
"asset": "sh001",
"hierarchy": "ep101/sq01/sh010"}
anatomy = context.data["anatomy"].format(data)
self.log.info(anatomy["work"]["path"])
anatomy_filled = anatomy.format(data)
self.log.info(anatomy_filled)
data = { "project": {"name": "D001_projectsy",
data = {"root": os.environ["PYPE_STUDIO_PROJECTS_PATH"],
"project": {"name": "D001_projectsy",
"code": "prjY"},
"representation": "abc",
"ext": "abc",
"version": 1,
"task": "lookdev",
"asset": "bob",
"hierarchy": "ep101/sq01/bob"}
anatomy = context.data["anatomy"].format(data)
self.log.info(anatomy["work"]["file"])
anatomy_filled = context.data["anatomy"].format(data)
self.log.info(anatomy_filled["work"]["folder"])