'get_product_name' now expects 'task_name' and 'task_type'

This commit is contained in:
Jakub Trllo 2024-03-11 12:11:22 +01:00
parent a8f9ac5569
commit 7e9dfd5b47
15 changed files with 108 additions and 37 deletions

View file

@ -22,9 +22,15 @@ class CollecTimelineOTIO(pyblish.api.ContextPlugin):
sequence = opfapi.get_current_sequence(opfapi.CTX.selection)
# create product name
task_entity = context.data["taskEntity"]
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
product_name = get_product_name(
context.data["projectName"],
context.data["taskEntity"],
task_name,
task_type,
context.data["hostName"],
product_type,
variant,

View file

@ -17,9 +17,15 @@ class CollectWorkfile(pyblish.api.ContextPlugin):
"""Plugin entry point."""
product_type = "workfile"
basename = os.path.basename(context.data["currentFile"])
task_entity = context.data["taskEntity"]
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
product_name = get_product_name(
context.data["projectName"],
context.data["taskEntity"],
task_name,
task_type,
context.data["hostName"],
product_type,
"",

View file

@ -55,9 +55,15 @@ class ValidateSubsetName(pyblish.api.InstancePlugin,
# Check product name
folder_entity = instance.data["folderEntity"]
task_entity = instance.data["taskEntity"]
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
product_name = get_product_name(
instance.context.data["projectName"],
instance.data["taskEntity"],
task_name,
task_type,
instance.context.data["hostName"],
instance.data["productType"],
variant=instance.data["variant"],
@ -79,10 +85,15 @@ class ValidateSubsetName(pyblish.api.InstancePlugin,
# Check product name
folder_entity = instance.data["folderEntity"]
task_entity = instance.data["taskEntity"]
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
product_name = get_product_name(
instance.context.data["projectName"],
instance.data["taskEntity"],
instance.data["task"],
task_name,
task_type,
instance.context.data["hostName"],
instance.data["productType"],
variant=instance.data["variant"],

View file

@ -600,10 +600,15 @@ class RenderlayerCreator(NewCreator, MayaCreatorBase):
host_name,
instance
)
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
# creator.product_type != 'render' as expected
return get_product_name(
project_name,
task_entity,
task_name,
task_type
host_name,
self.layer_instance_prefix or self.product_type,
variant,

View file

@ -136,10 +136,18 @@ class AutoImageCreator(PSAutoCreator):
):
if host_name is None:
host_name = self.create_context.host_name
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
dynamic_data = prepare_template_data({"layer": "{layer}"})
product_name = get_product_name(
project_name,
task_entity,
task_name,
task_type,
host_name,
self.product_type,
variant,

View file

@ -27,6 +27,10 @@ class CollectAutoImage(pyblish.api.ContextPlugin):
host_name = context.data["hostName"]
folder_entity = context.data["folderEntity"]
task_entity = context.data["taskEntity"]
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
auto_creator = proj_settings.get(
"photoshop", {}).get(
@ -79,7 +83,8 @@ class CollectAutoImage(pyblish.api.ContextPlugin):
product_name = get_product_name(
project_name,
task_entity,
task_name,
task_type,
host_name,
product_type,
variant,

View file

@ -65,10 +65,15 @@ class CollectAutoReview(pyblish.api.ContextPlugin):
host_name = context.data["hostName"]
folder_entity = context.data["folderEntity"]
task_entity = context.data["taskEntity"]
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
product_name = get_product_name(
project_name,
task_entity,
task_name,
task_type,
host_name,
product_type,
variant,

View file

@ -70,10 +70,15 @@ class CollectAutoWorkfile(pyblish.api.ContextPlugin):
host_name = context.data["hostName"]
folder_entity = context.data["folderEntity"]
task_entity = context.data["taskEntity"]
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
product_name = get_product_name(
project_name,
task_entity,
task_name,
task_type,
host_name,
product_type,
variant,

View file

@ -86,13 +86,19 @@ class CollectTextureSet(pyblish.api.InstancePlugin):
map_identifier = strip_template(template)
suffix += f".{map_identifier}"
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
image_product_name = get_product_name(
# TODO: The product type actually isn't 'texture' currently but
# for now this is only done so the product name starts with
# 'texture'
project_name=context.data["projectName"],
task_entity=task_entity,
host_name=context.data["hostName"],
context.data["projectName"],
task_name,
task_type,
context.data["hostName"],
product_type="texture",
variant=instance.data["variant"] + suffix,
project_settings=context.data["project_settings"]

View file

@ -105,10 +105,15 @@ class BatchMovieCreator(TrayPublishCreator):
def _get_product_name(self, project_name, task_entity, variant):
"""Create product name according to standard template process"""
host_name = self.create_context.host_name
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
try:
product_name = get_product_name(
project_name,
task_entity,
task_name,
task_type,
host_name,
self.product_type,
variant,
@ -119,14 +124,10 @@ class BatchMovieCreator(TrayPublishCreator):
# but user have ability to change it
# NOTE: This expect that there is not task 'Undefined' on folder
dumb_value = "Undefined"
task_entity = {
"name": dumb_value,
"taskType": dumb_value,
"short": dumb_value,
}
product_name = get_product_name(
project_name,
task_entity,
dumb_value,
dumb_value,
host_name,
self.product_type,
variant,

View file

@ -70,10 +70,15 @@ class TVPaintCreatorCommon:
host_name,
instance
)
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
return get_product_name(
project_name,
task_entity,
task_name,
task_type,
host_name,
self.product_type,
variant,

View file

@ -514,6 +514,12 @@ class BaseCreator:
if host_name is None:
host_name = self.create_context.host_name
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
dynamic_data = self.get_dynamic_data(
project_name,
folder_entity,
@ -525,7 +531,8 @@ class BaseCreator:
return get_product_name(
project_name,
task_entity,
task_name,
task_type,
host_name,
self.product_type,
variant,

View file

@ -149,10 +149,14 @@ class LegacyCreator(object):
dynamic_data = cls.get_dynamic_data(
project_name, folder_entity, task_entity, variant, host_name
)
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
return get_product_name(
project_name,
task_entity,
task_name,
task_type,
host_name,
cls.product_type,
variant,

View file

@ -81,7 +81,8 @@ def get_product_name_template(
def get_product_name(
project_name,
task_entity,
task_name,
task_type,
host_name,
product_type,
variant,
@ -106,7 +107,8 @@ def get_product_name(
Args:
project_name (str): Project name.
task_entity (Dict[str, Any]): Task entity.
task_name (Union[str, None]): Task name.
task_type (Union[str, None]): Task type.
host_name (str): Host name.
product_type (str): Product type.
variant (str): In most of the cases it is user input during creation.
@ -129,11 +131,6 @@ def get_product_name(
if not product_type:
return ""
task_name = task_type = None
if task_entity:
task_name = task_entity["name"]
task_type = task_entity["taskType"]
template = get_product_name_template(
project_name,
product_type_filter or product_type,

View file

@ -819,15 +819,15 @@ class ProjectPushItemProcess:
def _determine_product_name(self):
product_type = self._product_type
task_info = self._task_info
new_task_info = None
task_name = task_type = None
if task_info:
new_task_info = {
"name": task_info["name"],
"taskType": task_info["type"]
}
task_name = task_info["name"]
task_type = task_info["type"]
product_name = get_product_name(
self._item.dst_project_name,
new_task_info,
task_name,
task_type,
self.host_name,
product_type,
self._item.variant,