diff --git a/pype/ftrack/actions/action_syncToAvalon.py b/pype/ftrack/actions/action_syncToAvalon.py index 4e4ce8d55d..a2787e7a38 100644 --- a/pype/ftrack/actions/action_syncToAvalon.py +++ b/pype/ftrack/actions/action_syncToAvalon.py @@ -82,7 +82,7 @@ class SyncToAvalon(BaseAction): 'tasks': [{'name': ''}], 'apps': apps, # TODO redo work!!! - 'template': {'work': '{root}/{project}/{hierarchy}/{asset}/work/{task}/{app}','publish':''} + 'template': {'work': '','publish':''} } # Set project template diff --git a/pype/ftrack/actions/ftrack_action_handler.py b/pype/ftrack/actions/ftrack_action_handler.py index 57fe0f22d7..dd40854d42 100644 --- a/pype/ftrack/actions/ftrack_action_handler.py +++ b/pype/ftrack/actions/ftrack_action_handler.py @@ -9,6 +9,14 @@ import toml from avalon import io, lib, pipeline from avalon import session as sess +from app.api import ( + Templates +) + +t = Templates() + + + class AppAction(object): '''Custom Action base class @@ -226,7 +234,27 @@ class AppAction(object): os.environ["AVALON_ASSET"] = entity['parent']['name'] os.environ["AVALON_TASK"] = entity['name'] 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 if self.identifier == 'maya':