mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
fix(global): adding frame (padding) into template filling of path, basic template taken from anatomy instead of avalon.db
This commit is contained in:
parent
e9a2870c6e
commit
0134f93b3a
1 changed files with 14 additions and 10 deletions
|
|
@ -13,14 +13,14 @@ class IntegrateAssumedDestination(pyblish.api.InstancePlugin):
|
||||||
|
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
|
|
||||||
self.create_destination_template(instance)
|
anatomy = instance.context.data['anatomy']
|
||||||
|
|
||||||
|
self.create_destination_template(instance, anatomy)
|
||||||
|
|
||||||
template_data = instance.data["assumedTemplateData"]
|
template_data = instance.data["assumedTemplateData"]
|
||||||
# template = instance.data["template"]
|
|
||||||
|
|
||||||
anatomy = instance.context.data['anatomy']
|
|
||||||
# self.log.info(anatomy.templates)
|
# self.log.info(anatomy.templates)
|
||||||
anatomy_filled = anatomy.format(template_data)
|
anatomy_filled = anatomy.format(template_data)
|
||||||
|
|
||||||
# self.log.info(anatomy_filled)
|
# self.log.info(anatomy_filled)
|
||||||
mock_template = anatomy_filled["publish"]["path"]
|
mock_template = anatomy_filled["publish"]["path"]
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ class IntegrateAssumedDestination(pyblish.api.InstancePlugin):
|
||||||
"resources")
|
"resources")
|
||||||
|
|
||||||
# Clean the path
|
# Clean the path
|
||||||
mock_destination = os.path.abspath(os.path.normpath(mock_destination))
|
mock_destination = os.path.abspath(os.path.normpath(mock_destination)).replace("\\", "/")
|
||||||
|
|
||||||
# Define resource destination and transfers
|
# Define resource destination and transfers
|
||||||
resources = instance.data.get("resources", list())
|
resources = instance.data.get("resources", list())
|
||||||
|
|
@ -38,7 +38,7 @@ class IntegrateAssumedDestination(pyblish.api.InstancePlugin):
|
||||||
for resource in resources:
|
for resource in resources:
|
||||||
|
|
||||||
# Add destination to the resource
|
# Add destination to the resource
|
||||||
source_filename = os.path.basename(resource["source"])
|
source_filename = os.path.basename(resource["source"]).replace("\\", "/")
|
||||||
destination = os.path.join(mock_destination, source_filename)
|
destination = os.path.join(mock_destination, source_filename)
|
||||||
|
|
||||||
# Force forward slashes to fix issue with software unable
|
# Force forward slashes to fix issue with software unable
|
||||||
|
|
@ -53,13 +53,13 @@ class IntegrateAssumedDestination(pyblish.api.InstancePlugin):
|
||||||
files = resource['files']
|
files = resource['files']
|
||||||
for fsrc in files:
|
for fsrc in files:
|
||||||
fname = os.path.basename(fsrc)
|
fname = os.path.basename(fsrc)
|
||||||
fdest = os.path.join(mock_destination, fname)
|
fdest = os.path.join(mock_destination, fname).replace("\\", "/")
|
||||||
transfers.append([fsrc, fdest])
|
transfers.append([fsrc, fdest])
|
||||||
|
|
||||||
instance.data["resources"] = resources
|
instance.data["resources"] = resources
|
||||||
instance.data["transfers"] = transfers
|
instance.data["transfers"] = transfers
|
||||||
|
|
||||||
def create_destination_template(self, instance):
|
def create_destination_template(self, instance, anatomy):
|
||||||
"""Create a filepath based on the current data available
|
"""Create a filepath based on the current data available
|
||||||
|
|
||||||
Example template:
|
Example template:
|
||||||
|
|
@ -77,12 +77,13 @@ class IntegrateAssumedDestination(pyblish.api.InstancePlugin):
|
||||||
self.log.info(subset_name)
|
self.log.info(subset_name)
|
||||||
asset_name = instance.data["asset"]
|
asset_name = instance.data["asset"]
|
||||||
project_name = api.Session["AVALON_PROJECT"]
|
project_name = api.Session["AVALON_PROJECT"]
|
||||||
|
a_template = anatomy.templates
|
||||||
|
|
||||||
project = io.find_one({"type": "project",
|
project = io.find_one({"type": "project",
|
||||||
"name": project_name},
|
"name": project_name},
|
||||||
projection={"config": True, "data": True})
|
projection={"config": True, "data": True})
|
||||||
|
|
||||||
template = project["config"]["template"]["publish"]
|
template = a_template['publish']['path']
|
||||||
# anatomy = instance.context.data['anatomy']
|
# anatomy = instance.context.data['anatomy']
|
||||||
|
|
||||||
asset = io.find_one({"type": "asset",
|
asset = io.find_one({"type": "asset",
|
||||||
|
|
@ -112,10 +113,12 @@ class IntegrateAssumedDestination(pyblish.api.InstancePlugin):
|
||||||
if instance.data.get('version'):
|
if instance.data.get('version'):
|
||||||
version_number = int(instance.data.get('version'))
|
version_number = int(instance.data.get('version'))
|
||||||
|
|
||||||
|
padding = int(a_template['render']['padding'])
|
||||||
|
|
||||||
hierarchy = asset['data']['parents']
|
hierarchy = asset['data']['parents']
|
||||||
if hierarchy:
|
if hierarchy:
|
||||||
# hierarchy = os.path.sep.join(hierarchy)
|
# hierarchy = os.path.sep.join(hierarchy)
|
||||||
hierarchy = os.path.join(*hierarchy)
|
hierarchy = "/".join(hierarchy)
|
||||||
|
|
||||||
template_data = {"root": api.Session["AVALON_PROJECTS"],
|
template_data = {"root": api.Session["AVALON_PROJECTS"],
|
||||||
"project": {"name": project_name,
|
"project": {"name": project_name,
|
||||||
|
|
@ -124,6 +127,7 @@ class IntegrateAssumedDestination(pyblish.api.InstancePlugin):
|
||||||
"family": instance.data['family'],
|
"family": instance.data['family'],
|
||||||
"asset": asset_name,
|
"asset": asset_name,
|
||||||
"subset": subset_name,
|
"subset": subset_name,
|
||||||
|
"frame": ('#' * padding),
|
||||||
"version": version_number,
|
"version": version_number,
|
||||||
"hierarchy": hierarchy,
|
"hierarchy": hierarchy,
|
||||||
"representation": "TEMP"}
|
"representation": "TEMP"}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue