hiero is using product name and type

This commit is contained in:
Jakub Trllo 2024-02-23 12:24:08 +01:00
parent adf5318c9a
commit b21d75896d
13 changed files with 145 additions and 130 deletions

View file

@ -589,8 +589,8 @@ def imprint(track_item, data=None):
Examples:
data = {
'asset': 'sq020sh0280',
'family': 'render',
'subset': 'subsetMain'
'productType': 'render',
'productName': 'productMain'
}
"""
data = data or {}

View file

@ -439,7 +439,7 @@ class ClipLoader:
""" Gets context and convert it to self.data
data structure:
{
"name": "assetName_subsetName_representationName"
"name": "assetName_productName_representationName"
"path": "path/to/file/created/by/get_repr..",
"binPath": "projectBinPath",
}
@ -448,10 +448,10 @@ class ClipLoader:
repr = self.context["representation"]
repr_cntx = repr["context"]
asset = str(repr_cntx["asset"])
subset = str(repr_cntx["subset"])
product_name = str(repr_cntx["subset"])
representation = str(repr_cntx["representation"])
self.data["clip_name"] = self.clip_name_template.format(**repr_cntx)
self.data["track_name"] = "_".join([subset, representation])
self.data["track_name"] = "_".join([product_name, representation])
self.data["versionData"] = self.context["version"]["data"]
# gets file path
file = get_representation_path_from_context(self.context)
@ -659,9 +659,9 @@ class PublishClip:
rename_default = False
hierarchy_default = "{_folder_}/{_sequence_}/{_track_}"
clip_name_default = "shot_{_trackIndex_:0>3}_{_clipIndex_:0>4}"
subset_name_default = "<track_name>"
base_product_name_default = "<track_name>"
review_track_default = "< none >"
subset_family_default = "plate"
product_type_default = "plate"
count_from_default = 10
count_steps_default = 10
vertical_sync_default = False
@ -785,10 +785,10 @@ class PublishClip:
"countFrom", {}).get("value") or self.count_from_default
self.count_steps = self.ui_inputs.get(
"countSteps", {}).get("value") or self.count_steps_default
self.subset_name = self.ui_inputs.get(
"subsetName", {}).get("value") or self.subset_name_default
self.subset_family = self.ui_inputs.get(
"subsetFamily", {}).get("value") or self.subset_family_default
self.base_product_name = self.ui_inputs.get(
"productName", {}).get("value") or self.base_product_name_default
self.product_type = self.ui_inputs.get(
"productType", {}).get("value") or self.product_type_default
self.vertical_sync = self.ui_inputs.get(
"vSyncOn", {}).get("value") or self.vertical_sync_default
self.driving_layer = self.ui_inputs.get(
@ -798,12 +798,14 @@ class PublishClip:
self.audio = self.ui_inputs.get(
"audio", {}).get("value") or False
# build subset name from layer name
if self.subset_name == "<track_name>":
self.subset_name = self.track_name
# build product name from layer name
if self.base_product_name == "<track_name>":
self.base_product_name = self.track_name
# create subset for publishing
self.subset = self.subset_family + self.subset_name.capitalize()
# create product for publishing
self.product_name = (
self.product_type + self.base_product_name.capitalize()
)
def _replace_hash_to_expression(self, name, text):
""" Replace hash with number in correct padding. """
@ -885,14 +887,14 @@ class PublishClip:
for (_in, _out), hero_data in self.vertical_clip_match.items():
hero_data.update({"heroTrack": False})
if _in == self.clip_in and _out == self.clip_out:
data_subset = hero_data["subset"]
data_product_name = hero_data["productName"]
# add track index in case duplicity of names in hero data
if self.subset in data_subset:
hero_data["subset"] = self.subset + str(
if self.product_name in data_product_name:
hero_data["productName"] = self.product_name + str(
self.track_index)
# in case track name and subset name is the same then add
if self.subset_name == self.track_name:
hero_data["subset"] = self.subset
# in case track name and product name is the same then add
if self.base_product_name == self.track_name:
hero_data["productName"] = self.product_name
# assign data to return hierarchy data to tag
tag_hierarchy_data = hero_data
@ -913,9 +915,9 @@ class PublishClip:
"hierarchy": hierarchy_filled,
"parents": self.parents,
"hierarchyData": hierarchy_formatting_data,
"subset": self.subset,
"family": self.subset_family,
"families": [self.data["family"]]
"productName": self.product_name,
"productType": self.product_type,
"families": [self.product_type, self.data["family"]]
}
def _convert_to_entity(self, type, template):

View file

@ -28,8 +28,8 @@ def tag_data():
# "note": "Collecting track items to Nuke scripts.",
# "icon": "icons:TagNuke.png",
# "metadata": {
# "family": "nukescript",
# "subset": "main"
# "productType": "nukescript",
# "productName": "main"
# }
# },
"Comment": {
@ -37,17 +37,17 @@ def tag_data():
"note": "Comment on a shot.",
"icon": "icons:TagComment.png",
"metadata": {
"family": "comment",
"subset": "main"
"productType": "comment",
"productName": "main"
}
},
"FrameMain": {
"editable": "1",
"note": "Publishing a frame subset.",
"note": "Publishing a frame product.",
"icon": "z_layer_main.png",
"metadata": {
"family": "frame",
"subset": "main",
"productType": "frame",
"productName": "main",
"format": "png"
}
}
@ -153,7 +153,7 @@ def add_tags_to_workfile():
"note": task_type,
"icon": "icons:TagGood.png",
"metadata": {
"family": "task",
"productType": "task",
"type": task_type
}
}
@ -173,7 +173,7 @@ def add_tags_to_workfile():
"path": "icons:TagActor.png"
},
"metadata": {
"family": "assetbuild"
"productType": "assetbuild"
}
}

View file

@ -10,7 +10,7 @@ class CreateShotClip(phiero.Creator):
"""Publishable clip"""
label = "Create Publishable Clip"
family = "clip"
product_type = "clip"
icon = "film"
defaults = ["Main"]
@ -133,19 +133,19 @@ class CreateShotClip(phiero.Creator):
"target": "ui",
"order": 3,
"value": {
"subsetName": {
"productName": {
"value": ["<track_name>", "main", "bg", "fg", "bg",
"animatic"],
"type": "QComboBox",
"label": "Subset Name",
"label": "pRODUCT Name",
"target": "ui",
"toolTip": "chose subset name pattern, if <track_name> is selected, name of track layer will be used", # noqa
"toolTip": "chose product name pattern, if <track_name> is selected, name of track layer will be used", # noqa
"order": 0},
"subsetFamily": {
"productType": {
"value": ["plate", "take"],
"type": "QComboBox",
"label": "Subset Family",
"target": "ui", "toolTip": "What use of this subset is for", # noqa
"label": "Product Type",
"target": "ui", "toolTip": "What use of this product is for", # noqa
"order": 1},
"reviewTrack": {
"value": ["< none >"] + gui_tracks,
@ -159,7 +159,7 @@ class CreateShotClip(phiero.Creator):
"type": "QCheckBox",
"label": "Include audio",
"target": "tag",
"toolTip": "Process subsets with corresponding audio", # noqa
"toolTip": "Process productS with corresponding audio", # noqa
"order": 3},
"sourceResolution": {
"value": False,

View file

@ -14,7 +14,7 @@ import ayon_core.hosts.hiero.api as phiero
class LoadClip(phiero.SequenceLoader):
"""Load a subset to timeline as clip
"""Load a product to timeline as clip
Place clip to timeline on its asset origin timings collected
during conforming to project

View file

@ -12,13 +12,13 @@ class CollectClipEffects(pyblish.api.InstancePlugin):
effect_categories = []
def process(self, instance):
family = "effect"
product_type = "effect"
effects = {}
review = instance.data.get("review")
review_track_index = instance.context.data.get("reviewTrackIndex")
item = instance.data["item"]
if "audio" in instance.data["family"]:
if "audio" in instance.data["productType"]:
return
# frame range
@ -61,16 +61,16 @@ class CollectClipEffects(pyblish.api.InstancePlugin):
if not effects:
return
subset = instance.data.get("subset")
effects.update({"assignTo": subset})
product_name = instance.data.get("productName")
effects.update({"assignTo": product_name})
subset_split = re.findall(r'[A-Z][^A-Z]*', subset)
product_name_split = re.findall(r'[A-Z][^A-Z]*', product_name)
if len(subset_split) > 0:
root_name = subset.replace(subset_split[0], "")
subset_split.insert(0, root_name.capitalize())
if len(product_name_split) > 0:
root_name = product_name.replace(product_name_split[0], "")
product_name_split.insert(0, root_name.capitalize())
subset_split.insert(0, "effect")
product_name_split.insert(0, "effect")
effect_categories = {
x["name"]: x["effect_classes"] for x in self.effect_categories
@ -104,8 +104,8 @@ class CollectClipEffects(pyblish.api.InstancePlugin):
effects_categorized[category]["assignTo"] = effects["assignTo"]
for category, effects in effects_categorized.items():
name = "".join(subset_split)
name += category.capitalize()
product_name = "".join(product_name_split)
product_name += category.capitalize()
# create new instance and inherit data
data = {}
@ -115,12 +115,12 @@ class CollectClipEffects(pyblish.api.InstancePlugin):
data[key] = value
# change names
data["subset"] = name
data["family"] = family
data["families"] = [family]
data["name"] = data["subset"] + "_" + data["folderPath"]
data["productName"] = product_name
data["productType"] = product_type
data["families"] = [product_type]
data["name"] = product_name + "_" + data["folderPath"]
data["label"] = "{} - {}".format(
data["folderPath"], data["subset"]
data["folderPath"], product_name
)
data["effects"] = effects

View file

@ -13,8 +13,8 @@ class CollectFrameTagInstances(pyblish.api.ContextPlugin):
Tag is expected to have metadata:
{
"family": "frame"
"subset": "main"
"productType": "frame"
"productName": "main"
}
"""
@ -26,14 +26,14 @@ class CollectFrameTagInstances(pyblish.api.ContextPlugin):
self._context = context
# collect all sequence tags
subset_data = self._create_frame_subset_data_sequence(context)
product_data = self._create_frame_product_data_sequence(context)
self.log.debug("__ subset_data: {}".format(
pformat(subset_data)
self.log.debug("__ product_data: {}".format(
pformat(product_data)
))
# create instances
self._create_instances(subset_data)
self._create_instances(product_data)
def _get_tag_data(self, tag):
data = {}
@ -66,7 +66,7 @@ class CollectFrameTagInstances(pyblish.api.ContextPlugin):
return data
def _create_frame_subset_data_sequence(self, context):
def _create_frame_product_data_sequence(self, context):
sequence_tags = []
sequence = context.data["activeTimeline"]
@ -87,10 +87,13 @@ class CollectFrameTagInstances(pyblish.api.ContextPlugin):
if not tag_data:
continue
if "family" not in tag_data:
product_type = tag_data.get("productType")
if product_type is None:
product_type = tag_data.get("family")
if not product_type:
continue
if tag_data["family"] != "frame":
if product_type != "frame":
continue
sequence_tags.append(tag_data)
@ -99,8 +102,8 @@ class CollectFrameTagInstances(pyblish.api.ContextPlugin):
pformat(sequence_tags)
))
# first collect all available subset tag frames
subset_data = {}
# first collect all available product tag frames
product_data = {}
context_asset_doc = context.data["assetEntity"]
context_folder_path = get_asset_name_identifier(context_asset_doc)
@ -110,33 +113,36 @@ class CollectFrameTagInstances(pyblish.api.ContextPlugin):
if frame not in publish_frames:
continue
subset = tag_data["subset"]
product_name = tag_data.get("productName")
if product_name is None:
product_name = tag_data["subset"]
if subset in subset_data:
# update existing subset key
subset_data[subset]["frames"].append(frame)
if product_name in product_data:
# update existing product key
product_data[product_name]["frames"].append(frame)
else:
# create new subset key
subset_data[subset] = {
# create new product key
product_data[product_name] = {
"frames": [frame],
"format": tag_data["format"],
"folderPath": context_folder_path
}
return subset_data
return product_data
def _create_instances(self, subset_data):
# create instance per subset
for subset_name, subset_data in subset_data.items():
name = "frame" + subset_name.title()
def _create_instances(self, product_data):
# create instance per product
product_type = "image"
for product_name, product_data in product_data.items():
name = "frame" + product_name.title()
data = {
"name": name,
"label": "{} {}".format(name, subset_data["frames"]),
"family": "image",
"families": ["frame"],
"folderPath": subset_data["folderPath"],
"subset": name,
"format": subset_data["format"],
"frames": subset_data["frames"]
"label": "{} {}".format(name, product_data["frames"]),
"productType": product_type,
"families": [product_type, "frame"],
"folderPath": product_data["folderPath"],
"productName": name,
"format": product_data["format"],
"frames": product_data["frames"]
}
self._context.create_instance(**data)

View file

@ -16,10 +16,12 @@ class CollectClipTagTasks(api.InstancePlugin):
tasks = {}
for tag in tags:
t_metadata = dict(tag.metadata())
t_family = t_metadata.get("tag.family", "")
t_product_type = t_metadata.get("tag.productType")
if t_product_type is None:
t_product_type = t_metadata.get("tag.family", "")
# gets only task family tags and collect labels
if "task" in t_family:
# gets only task product type tags and collect labels
if "task" in t_product_type:
t_task_name = t_metadata.get("tag.label", "")
t_task_type = t_metadata.get("tag.type", "")
tasks[t_task_name] = {"type": t_task_type}

View file

@ -21,8 +21,8 @@ class ExtractClipEffects(publish.Extractor):
if not effects:
return
subset = instance.data.get("subset")
family = instance.data["family"]
product_name = instance.data.get("productName")
product_type = instance.data["productType"]
self.log.debug("creating staging dir")
staging_dir = self.staging_dir(instance)
@ -32,7 +32,7 @@ class ExtractClipEffects(publish.Extractor):
instance.data["transfers"] = list()
ext = "json"
file = subset + "." + ext
file = product_name + "." + ext
# when instance is created during collection part
resources_dir = instance.data["resourcesDir"]
@ -68,8 +68,10 @@ class ExtractClipEffects(publish.Extractor):
version_data.update({
"colorspace": item.sourceMediaColourTransform(),
"colorspaceScript": instance.context.data["colorspace"],
"families": [family, "plate"],
"subset": subset,
"families": [product_type, "plate"],
# TODO find out if 'subset' is needed (and 'productName')
"subset": product_name,
"productName": product_name,
"fps": instance.context.data["fps"]
})
instance.data["versionData"] = version_data
@ -77,7 +79,7 @@ class ExtractClipEffects(publish.Extractor):
representation = {
'files': file,
'stagingDir': staging_dir,
'name': family + ext.title(),
'name': product_type + ext.title(),
'ext': ext
}
instance.data["representations"].append(representation)

View file

@ -87,19 +87,20 @@ class PrecollectInstances(pyblish.api.ContextPlugin):
asset, asset_name = self._get_asset_data(tag_data)
subset = tag_data["subset"]
product_name = tag_data.get("productName")
if product_name is None:
product_name = tag_data["subset"]
# insert family into families
families = [str(f) for f in tag_data["families"]]
# form label
label = "{} -".format(asset)
if asset_name != clip_name:
label += " ({})".format(clip_name)
label += " {}".format(subset)
label += " {}".format(product_name)
data.update({
"name": "{}_{}".format(asset, subset),
"name": "{}_{}".format(asset, product_name),
"label": label,
"folderPath": asset,
"asset_name": asset_name,
@ -146,7 +147,7 @@ class PrecollectInstances(pyblish.api.ContextPlugin):
if not with_audio:
continue
# create audio subset instance
# create audio product instance
self.create_audio_instance(context, **data)
# add audioReview attribute to plate instance data
@ -180,7 +181,7 @@ class PrecollectInstances(pyblish.api.ContextPlugin):
})
def create_shot_instance(self, context, **data):
subset = "shotMain"
product_name = "shotMain"
master_layer = data.get("heroTrack")
hierarchy_data = data.get("hierarchyData")
item = data.get("item")
@ -195,21 +196,20 @@ class PrecollectInstances(pyblish.api.ContextPlugin):
asset = data["folderPath"]
asset_name = data["asset_name"]
# insert family into families
family = "shot"
product_type = "shot"
# form label
label = "{} -".format(asset)
if asset_name != clip_name:
label += " ({}) ".format(clip_name)
label += " {}".format(subset)
label += " {}".format(product_name)
data.update({
"name": "{}_{}".format(asset, subset),
"name": "{}_{}".format(asset, product_name),
"label": label,
"subset": subset,
"family": family,
"families": []
"productName": product_name,
"productType": product_type,
"families": [product_type]
})
instance = context.create_instance(**data)
@ -238,7 +238,7 @@ class PrecollectInstances(pyblish.api.ContextPlugin):
return folder_path, asset_name
def create_audio_instance(self, context, **data):
subset = "audioMain"
product_name = "audioMain"
master_layer = data.get("heroTrack")
if not master_layer:
@ -254,21 +254,20 @@ class PrecollectInstances(pyblish.api.ContextPlugin):
asset = data["folderPath"]
asset_name = data["asset_name"]
# insert family into families
family = "audio"
product_type = "audio"
# form label
label = "{} -".format(asset)
if asset_name != clip_name:
label += " ({}) ".format(clip_name)
label += " {}".format(subset)
label += " {}".format(product_name)
data.update({
"name": "{}_{}".format(asset, subset),
"name": "{}_{}".format(asset, product_name),
"label": label,
"subset": subset,
"family": family,
"families": ["clip"]
"productName": product_name,
"productType": product_type,
"families": [product_type, "clip"]
})
# remove review track attr if any
data.pop("reviewTrack")

View file

@ -59,17 +59,19 @@ class PrecollectWorkfile(pyblish.api.ContextPlugin):
'files': base_name,
"stagingDir": staging_dir,
}
family = "workfile"
product_type = "workfile"
instance_data = {
"label": "{} - {}Main".format(
asset, family),
"name": "{}_{}".format(asset_name, family),
asset, product_type),
"name": "{}_{}".format(asset_name, product_type),
"folderPath": context.data["folderPath"],
# TODO use 'get_subset_name'
"subset": "{}{}Main".format(asset_name, family.capitalize()),
# TODO use 'get_product_name'
"productName": "{}{}Main".format(
asset_name, product_type.capitalize()
),
"item": project,
"family": family,
"families": [],
"productType": product_type,
"families": [product_type],
"representations": [workfile_representation, thumb_representation]
}

View file

@ -8,7 +8,7 @@ class CollectAssetBuilds(api.ContextPlugin):
Tag is expected to have name of the asset and metadata:
{
"family": "assetbuild"
"productType": "assetbuild"
}
"""
@ -29,7 +29,7 @@ class CollectAssetBuilds(api.ContextPlugin):
asset_builds[asset_name] = asset_doc
for instance in context:
if instance.data["family"] != "clip":
if instance.data["productType"] != "clip":
continue
# Exclude non-tagged instances.
@ -38,9 +38,11 @@ class CollectAssetBuilds(api.ContextPlugin):
for tag in instance.data["tags"]:
t_metadata = dict(tag.metadata())
t_family = t_metadata.get("tag.family", "")
t_product_type = t_metadata.get("tag.productType")
if t_product_type is None:
t_product_type = t_metadata.get("tag.family", "")
if t_family.lower() == "assetbuild":
if t_product_type.lower() == "assetbuild":
asset_names.append(tag["name"])
tagged = True

View file

@ -990,7 +990,7 @@ class FileDescriptor(DescriptorBase):
:class:`descriptor_pb2.FileDescriptorProto`.
dependencies (list[FileDescriptor]): List of other :class:`FileDescriptor`
objects this :class:`FileDescriptor` depends on.
public_dependencies (list[FileDescriptor]): A subset of
public_dependencies (list[FileDescriptor]): A product of
:attr:`dependencies`, which were declared as "public".
message_types_by_name (dict(str, Descriptor)): Mapping from message names
to their :class:`Descriptor`.