Merged in feature/PYPE-184_format_path_silotasks (pull request #63)

hierarchy is set to empty string if no parents

Approved-by: Milan Kolar <milan@orbi.tools>
This commit is contained in:
Jakub Trllo 2019-02-11 22:09:03 +00:00 committed by Milan Kolar
commit a620acac87
5 changed files with 23 additions and 13 deletions

View file

@ -406,7 +406,9 @@ def get_data(entity, session, custom_attributes):
{'type': 'asset', 'name': parName} {'type': 'asset', 'name': parName}
)['_id'] )['_id']
hierarchy = os.path.sep.join(folderStruct) hierarchy = ""
if len(folderStruct) > 0:
hierarchy = os.path.sep.join(folderStruct)
data['visualParent'] = parentId data['visualParent'] = parentId
data['parents'] = folderStruct data['parents'] = folderStruct

View file

@ -180,13 +180,14 @@ class AppAction(BaseHandler):
os.environ["AVALON_APP_NAME"] = self.identifier os.environ["AVALON_APP_NAME"] = self.identifier
anatomy = pype.Anatomy anatomy = pype.Anatomy
hierarchy = database[project_name].find_one({ hierarchy = ""
parents = database[project_name].find_one({
"type": 'asset', "type": 'asset',
"name": entity['parent']['name'] "name": entity['parent']['name']
})['data']['parents'] })['data']['parents']
if hierarchy: if parents:
hierarchy = os.path.join(*hierarchy) hierarchy = os.path.join(*parents)
data = {"project": {"name": entity['project']['full_name'], data = {"project": {"name": entity['project']['full_name'],
"code": entity['project']['name']}, "code": entity['project']['name']},

View file

@ -141,10 +141,14 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
# \|________| # \|________|
# #
root = api.registered_root() root = api.registered_root()
hierarchy = io.find_one({"type": 'asset', "name": ASSET})['data']['parents'] hierarchy = ""
if hierarchy: parents = io.find_one({
"type": 'asset',
"name": ASSET
})['data']['parents']
if parents and len(parents) > 0:
# hierarchy = os.path.sep.join(hierarchy) # hierarchy = os.path.sep.join(hierarchy)
hierarchy = os.path.join(*hierarchy) hierarchy = os.path.join(*parents)
template_data = {"root": root, template_data = {"root": root,
"project": {"name": PROJECT, "project": {"name": PROJECT,

View file

@ -142,11 +142,12 @@ class IntegrateFrames(pyblish.api.InstancePlugin):
# \|________| # \|________|
# #
root = api.registered_root() root = api.registered_root()
hierarchy = io.find_one({"type": 'asset', "name": ASSET})[ hierarchy = ""
parents = io.find_one({"type": 'asset', "name": ASSET})[
'data']['parents'] 'data']['parents']
if hierarchy: if parents and len(parents) > 0:
# hierarchy = os.path.sep.join(hierarchy) # hierarchy = os.path.sep.join(hierarchy)
hierarchy = os.path.join(*hierarchy) hierarchy = os.path.join(*parents)
template_data = {"root": root, template_data = {"root": root,
"project": {"name": PROJECT, "project": {"name": PROJECT,

View file

@ -167,14 +167,16 @@ def get_hierarchy():
string: asset hierarchy path string: asset hierarchy path
""" """
hierarchy = io.find_one({ parents = io.find_one({
"type": 'asset', "type": 'asset',
"name": get_asset()} "name": get_asset()}
)['data']['parents'] )['data']['parents']
if hierarchy: hierarchy = ""
if parents and len(parents) > 0:
# hierarchy = os.path.sep.join(hierarchy) # hierarchy = os.path.sep.join(hierarchy)
return os.path.join(*hierarchy).replace("\\", "/") hierarchy = os.path.join(*parents).replace("\\", "/")
return hierarchy
def set_hierarchy(hierarchy): def set_hierarchy(hierarchy):