fix workdir setup and hierarchy preparation

This commit is contained in:
Milan Kolar 2018-10-31 11:55:51 +01:00
parent 2c21c28417
commit de5716a193
2 changed files with 30 additions and 2 deletions

View file

@ -82,7 +82,7 @@ class SyncToAvalon(BaseAction):
'tasks': [{'name': ''}], 'tasks': [{'name': ''}],
'apps': apps, 'apps': apps,
# TODO redo work!!! # TODO redo work!!!
'template': {'work': '{root}/{project}/{hierarchy}/{asset}/work/{task}/{app}','publish':''} 'template': {'work': '','publish':''}
} }
# Set project template # Set project template

View file

@ -9,6 +9,14 @@ import toml
from avalon import io, lib, pipeline from avalon import io, lib, pipeline
from avalon import session as sess from avalon import session as sess
from app.api import (
Templates
)
t = Templates()
class AppAction(object): class AppAction(object):
'''Custom Action base class '''Custom Action base class
@ -226,7 +234,27 @@ class AppAction(object):
os.environ["AVALON_ASSET"] = entity['parent']['name'] os.environ["AVALON_ASSET"] = entity['parent']['name']
os.environ["AVALON_TASK"] = entity['name'] os.environ["AVALON_TASK"] = entity['name']
os.environ["AVALON_APP"] = self.identifier os.environ["AVALON_APP"] = self.identifier
os.environ["AVALON_APP_NAME"] = self.executable os.environ["AVALON_APP_NAME"] = self.identifier + "_" + self.variant
anatomy = t.anatomy
io.install()
hierarchy = io.find_one({"type":'asset', "name":entity['parent']['name']})['data']['parents']
io.uninstall()
if hierarchy:
# hierarchy = os.path.sep.join(hierarchy)
hierarchy = os.path.join(*hierarchy)
data = { "project": {"name": entity['project']['full_name'],
"code": entity['project']['name']},
"task": entity['name'],
"asset": entity['parent']['name'],
"hierarchy": hierarchy}
anatomy = anatomy.format(data)
os.environ["AVALON_WORKDIR"] = os.path.join(anatomy.work.root, anatomy.work.folder)
# TODO Add paths to avalon setup from tomls # TODO Add paths to avalon setup from tomls
if self.identifier == 'maya': if self.identifier == 'maya':