change constants and do smaller fixes

This commit is contained in:
Jakub Trllo 2024-02-23 12:25:22 +01:00
parent b21d75896d
commit 8549588f27
13 changed files with 38 additions and 35 deletions

View file

@ -11,7 +11,7 @@ from ayon_core.pipeline import (
from ayon_core.hosts.aftereffects.api.pipeline import cache_and_get_instances
from ayon_core.hosts.aftereffects.api.lib import set_settings
from ayon_core.lib import prepare_template_data
from ayon_core.pipeline.create import SUBSET_NAME_ALLOWED_SYMBOLS
from ayon_core.pipeline.create import PRODUCT_NAME_ALLOWED_SYMBOLS
class RenderCreator(Creator):
@ -58,7 +58,7 @@ class RenderCreator(Creator):
len(comps) > 1)
for comp in comps:
composition_name = re.sub(
"[^{}]+".format(SUBSET_NAME_ALLOWED_SYMBOLS),
"[^{}]+".format(PRODUCT_NAME_ALLOWED_SYMBOLS),
"",
comp.name
)

View file

@ -445,7 +445,7 @@ def set_avalon_knob_data(node, data=None, prefix="avalon:"):
create = OrderedDict()
tab_name = NODE_TAB_NAME
editable = ["asset", "subset", "name", "namespace"]
editable = ["folderPath", "productName", "name", "namespace"]
existed_knobs = node.knobs()
@ -714,6 +714,7 @@ def get_imageio_node_override_setting(
if plugin_name not in onode["plugins"]:
continue
# TODO change 'subsets' to 'product_names' in settings
if (
onode["subsets"]
and not any(

View file

@ -57,7 +57,7 @@ class ExtractReviewIntermediates(publish.Extractor):
families.add(instance.data["productType"])
task_type = instance.context.data["taskType"]
subset = instance.data["subset"]
product_name = instance.data["productName"]
self.log.debug("Creating staging dir...")
if "representations" not in instance.data:
@ -93,8 +93,8 @@ class ExtractReviewIntermediates(publish.Extractor):
f_task_types, task_type))
self.log.debug(
"product_names `{}` > subset: {}".format(
product_names, subset))
"product_names `{}` > product: {}".format(
product_names, product_name))
# test if family found in context
# using intersection to make sure all defined
@ -111,7 +111,7 @@ class ExtractReviewIntermediates(publish.Extractor):
# test subsets from filter
if product_names and not any(
re.search(p, subset) for p in product_names
re.search(p, product_name) for p in product_names
):
continue

View file

@ -144,6 +144,7 @@ class WriteNodeKnobSettingPanel(nukescripts.PythonPanel):
knobs_nodes = settings[i]["knobs"]
for setting in settings:
# TODO change 'subsets' to 'product_names' in settings
for subset in setting["subsets"]:
preset_name.append(subset)

View file

@ -8,7 +8,7 @@ from ayon_core.pipeline import (
CreatorError
)
from ayon_core.lib import prepare_template_data
from ayon_core.pipeline.create import SUBSET_NAME_ALLOWED_SYMBOLS
from ayon_core.pipeline.create import PRODUCT_NAME_ALLOWED_SYMBOLS
from ayon_core.hosts.photoshop.api.pipeline import cache_and_get_instances
from ayon_core.hosts.photoshop.lib import clean_product_name
@ -80,7 +80,7 @@ class ImageCreator(Creator):
if use_layer_name:
layer_name = re.sub(
"[^{}]+".format(SUBSET_NAME_ALLOWED_SYMBOLS),
"[^{}]+".format(PRODUCT_NAME_ALLOWED_SYMBOLS),
"",
group.name
)

View file

@ -3,7 +3,7 @@ import re
import pyblish.api
from ayon_core.hosts.photoshop import api as photoshop
from ayon_core.pipeline.create import SUBSET_NAME_ALLOWED_SYMBOLS
from ayon_core.pipeline.create import PRODUCT_NAME_ALLOWED_SYMBOLS
from ayon_core.pipeline.publish import (
ValidateContentsOrder,
PublishXmlValidationError,
@ -56,7 +56,7 @@ class ValidateNamingRepair(pyblish.api.Action):
# format from Tool Creator
product_name = re.sub(
"[^{}]+".format(SUBSET_NAME_ALLOWED_SYMBOLS),
"[^{}]+".format(PRODUCT_NAME_ALLOWED_SYMBOLS),
"",
product_name
)

View file

@ -31,7 +31,7 @@ Product type tells how should be instance processed and product name what name w
"productType": <product type>,
# Mutable data
## Subset name based on product name template - may change overtime (on context change)
## Product name based on product name template - may change overtime (on context change)
"productName": <product name>,
## Instance is active and will be published
"active": True,

View file

@ -1,6 +1,6 @@
from .constants import (
SUBSET_NAME_ALLOWED_SYMBOLS,
DEFAULT_SUBSET_TEMPLATE,
PRODUCT_NAME_ALLOWED_SYMBOLS,
DEFAULT_PRODUCT_TEMPLATE,
PRE_CREATE_THUMBNAIL_KEY,
DEFAULT_VARIANT_VALUE,
)
@ -48,17 +48,14 @@ from .legacy_create import (
__all__ = (
"SUBSET_NAME_ALLOWED_SYMBOLS",
"DEFAULT_SUBSET_TEMPLATE",
"PRODUCT_NAME_ALLOWED_SYMBOLS",
"DEFAULT_PRODUCT_TEMPLATE",
"PRE_CREATE_THUMBNAIL_KEY",
"DEFAULT_VARIANT_VALUE",
"get_last_versions_for_instances",
"get_next_versions_for_instances",
"get_subset_name_template",
"get_subset_name",
"TaskNotSetError",
"get_product_name",
"get_product_name_template",

View file

@ -1,12 +1,12 @@
SUBSET_NAME_ALLOWED_SYMBOLS = "a-zA-Z0-9_."
DEFAULT_SUBSET_TEMPLATE = "{family}{Variant}"
PRODUCT_NAME_ALLOWED_SYMBOLS = "a-zA-Z0-9_."
DEFAULT_PRODUCT_TEMPLATE = "{family}{Variant}"
PRE_CREATE_THUMBNAIL_KEY = "thumbnail_source"
DEFAULT_VARIANT_VALUE = "Main"
__all__ = (
"SUBSET_NAME_ALLOWED_SYMBOLS",
"DEFAULT_SUBSET_TEMPLATE",
"PRODUCT_NAME_ALLOWED_SYMBOLS",
"DEFAULT_PRODUCT_TEMPLATE",
"PRE_CREATE_THUMBNAIL_KEY",
"DEFAULT_VARIANT_VALUE",
)

View file

@ -532,7 +532,7 @@ class BaseCreator:
instance is passed in.
Args:
variant(str): Subset name variant. In most of cases user input.
variant(str): Product name variant. In most of cases user input.
task_name(str): For which task product is created.
asset_doc(dict): Asset document for which product is created.
project_name(str): Project name.
@ -687,7 +687,7 @@ class Creator(BaseCreator):
Ideally should be stored to workfile using host implementation.
Args:
product_name(str): Subset name of created instance.
product_name(str): Product name of created instance.
instance_data(dict): Base data for instance.
pre_create_data(dict): Data based on pre creation attributes.
Those may affect how creator works.

View file

@ -3,7 +3,7 @@ import os
from ayon_core.settings import get_project_settings
from ayon_core.lib import filter_profiles, prepare_template_data
from .constants import DEFAULT_SUBSET_TEMPLATE
from .constants import DEFAULT_PRODUCT_TEMPLATE
class TaskNotSetError(KeyError):
@ -40,7 +40,7 @@ def get_product_name_template(
task_type (str): Type of task in which context the product is created.
default_template (Union[str, None]): Default template which is used if
settings won't find any matching possitibility. Constant
'DEFAULT_SUBSET_TEMPLATE' is used if not defined.
'DEFAULT_PRODUCT_TEMPLATE' is used if not defined.
project_settings (Union[Dict[str, Any], None]): Prepared settings for
project. Settings are queried if not passed.
"""
@ -75,7 +75,7 @@ def get_product_name_template(
# Make sure template is set (matching may have empty string)
if not template:
template = default_template or DEFAULT_SUBSET_TEMPLATE
template = default_template or DEFAULT_PRODUCT_TEMPLATE
return template
@ -96,7 +96,7 @@ def get_product_name(
Subst name templates are defined in `project_settings/global/tools/creator
/product_name_profiles` where are profiles with host name, product type,
task name and task type filters. If context does not match any profile
then `DEFAULT_SUBSET_TEMPLATE` is used as default template.
then `DEFAULT_PRODUCT_TEMPLATE` is used as default template.
That's main reason why so many arguments are required to calculate product
name.
@ -114,7 +114,7 @@ def get_product_name(
asset_doc (dict): Queried asset document with its tasks in data.
Used to get task type.
default_template (Optional[str]): Default template if any profile does
not match passed context. Constant 'DEFAULT_SUBSET_TEMPLATE'
not match passed context. Constant 'DEFAULT_PRODUCT_TEMPLATE'
is used if is not passed.
dynamic_data (Optional[Dict[str, Any]]): Dynamic data specific for
a creator which creates instance.

View file

@ -225,7 +225,7 @@ class LoaderPlugin(list):
Returns static (cls) options or could collect from 'contexts'.
Args:
contexts (list): of repre or subset contexts
contexts (list): of repre or product contexts
Returns:
(list)
"""
@ -246,7 +246,7 @@ class LoaderPlugin(list):
class SubsetLoaderPlugin(LoaderPlugin):
"""Load subset into host application
"""Load product into host application
Arguments:
context (dict): avalon-core:context-1.0
name (str, optional): Use pre-defined name

View file

@ -1299,6 +1299,10 @@ class PlaceholderLoadMixin(object):
" used."
)
product_type = options.get("product_type")
if product_type is None:
product_type = options.get("family")
return [
attribute_definitions.UISeparatorDef(),
attribute_definitions.UILabelDef("Main attributes"),
@ -1312,9 +1316,9 @@ class PlaceholderLoadMixin(object):
tooltip=build_type_help
),
attribute_definitions.EnumDef(
"family",
label="Family",
default=options.get("family"),
"product_type",
label="Product type",
default=product_type,
items=families
),
attribute_definitions.TextDef(