marked 'get_format_dict' as deprecated and moved it to pipeline delivery

This commit is contained in:
Jakub Trllo 2022-08-29 15:00:08 +02:00
parent 14dc209ab0
commit e2060b9d65
4 changed files with 47 additions and 20 deletions

View file

@ -125,28 +125,25 @@ def copy_file(src_path, dst_path):
shutil.copyfile(src_path, dst_path) shutil.copyfile(src_path, dst_path)
@deprecated("openpype.pipeline.delivery.get_format_dict")
def get_format_dict(anatomy, location_path): def get_format_dict(anatomy, location_path):
"""Returns replaced root values from user provider value. """Returns replaced root values from user provider value.
Args: Args:
anatomy (Anatomy) anatomy (Anatomy)
location_path (str): user provided value location_path (str): user provided value
Returns:
(dict): prepared for formatting of a template Returns:
(dict): prepared for formatting of a template
Deprecated:
Function was moved to different location and will be removed
after 3.16.* release.
""" """
format_dict = {}
if location_path: from openpype.pipeline.delivery import get_format_dict
location_path = location_path.replace("\\", "/")
root_names = anatomy.root_names_from_templates( return get_format_dict(anatomy, location_path)
anatomy.templates["delivery"]
)
if root_names is None:
format_dict["root"] = location_path
else:
format_dict["root"] = {}
for name in root_names:
format_dict["root"][name] = location_path
return format_dict
def check_destination_path(repre_id, def check_destination_path(repre_id,

View file

@ -18,8 +18,10 @@ from openpype_modules.ftrack.lib.custom_attributes import (
from openpype.lib.dateutils import get_datetime_data from openpype.lib.dateutils import get_datetime_data
from openpype.pipeline import Anatomy from openpype.pipeline import Anatomy
from openpype.pipeline.load import get_representation_path_with_anatomy from openpype.pipeline.load import get_representation_path_with_anatomy
from openpype.lib.delivery import ( from openpype.pipeline.delivery import (
get_format_dict, get_format_dict,
)
from openpype.lib.delivery import (
check_destination_path, check_destination_path,
process_single_file, process_single_file,
process_sequence process_sequence

View file

@ -0,0 +1,26 @@
"""Functions useful for delivery of published representations."""
def get_format_dict(anatomy, location_path):
"""Returns replaced root values from user provider value.
Args:
anatomy (Anatomy): Project anatomy.
location_path (str): User provided value.
Returns:
(dict): Prepared data for formatting of a template.
"""
format_dict = {}
if not location_path:
return format_dict
location_path = location_path.replace("\\", "/")
root_names = anatomy.root_names_from_templates(
anatomy.templates["delivery"]
)
format_dict["root"] = {}
for name in root_names:
format_dict["root"][name] = location_path
return format_dict

View file

@ -13,8 +13,10 @@ from openpype.lib import (
get_datetime_data, get_datetime_data,
) )
from openpype.pipeline.load import get_representation_path_with_anatomy from openpype.pipeline.load import get_representation_path_with_anatomy
from openpype.lib.delivery import ( from openpype.pipeline.delivery import (
get_format_dict, get_format_dict,
)
from openpype.lib.delivery import (
check_destination_path, check_destination_path,
process_single_file, process_single_file,
process_sequence, process_sequence,