removed assetbuild logic from hiero

This commit is contained in:
Jakub Trllo 2024-03-05 13:29:04 +01:00
parent f5e36197eb
commit 630f325807
3 changed files with 1 additions and 90 deletions

View file

@ -1,10 +1,9 @@
import json
import re
import os
import hiero
import ayon_api
from ayon_core.client import get_assets
from ayon_core.lib import Logger
from ayon_core.pipeline import get_current_project_name
@ -160,25 +159,6 @@ def add_tags_to_workfile():
}
}
# Get project assets. Currently Ftrack specific to differentiate between
# asset builds and shots.
if int(os.getenv("TAG_ASSETBUILD_STARTUP", 0)) == 1:
nks_pres_tags["[AssetBuilds]"] = {}
for asset in get_assets(
project_name, fields=["name", "data.entityType"]
):
if asset["data"]["entityType"] == "AssetBuild":
nks_pres_tags["[AssetBuilds]"][asset["name"]] = {
"editable": "1",
"note": "",
"icon": {
"path": "icons:TagActor.png"
},
"metadata": {
"productType": "assetbuild"
}
}
# loop through tag data dict and create deep tag structure
for _k, _val in nks_pres_tags.items():
# check if key is not decorated with [] so it is defined as bin

View file

@ -1,64 +0,0 @@
from pyblish import api
from ayon_core.client import get_assets, get_asset_name_identifier
class CollectAssetBuilds(api.ContextPlugin):
"""Collect asset from tags.
Tag is expected to have name of the asset and metadata:
{
"productType": "assetbuild"
}
"""
# Run just after CollectClip
order = api.CollectorOrder + 0.02
label = "Collect AssetBuilds"
hosts = ["hiero"]
def process(self, context):
project_name = context.data["projectName"]
asset_builds = {}
for asset_doc in get_assets(project_name):
if asset_doc["data"].get("entityType") != "AssetBuild":
continue
asset_name = get_asset_name_identifier(asset_doc)
self.log.debug("Found \"{}\" in database.".format(asset_doc))
asset_builds[asset_name] = asset_doc
for instance in context:
if instance.data["productType"] != "clip":
continue
# Exclude non-tagged instances.
tagged = False
asset_names = []
for tag in instance.data["tags"]:
t_metadata = dict(tag.metadata())
t_product_type = t_metadata.get("tag.productType")
if t_product_type is None:
t_product_type = t_metadata.get("tag.family", "")
if t_product_type.lower() == "assetbuild":
asset_names.append(tag["name"])
tagged = True
if not tagged:
self.log.debug(
"Skipping \"{}\" because its not tagged with "
"\"assetbuild\"".format(instance)
)
continue
# Collect asset builds.
data = {"assetbuilds": []}
for name in asset_names:
data["assetbuilds"].append(asset_builds[name])
self.log.debug(
"Found asset builds: {}".format(data["assetbuilds"])
)
instance.data.update(data)

View file

@ -41,11 +41,6 @@ class CollectHierarchy(pyblish.api.ContextPlugin):
if not instance.data.get("heroTrack"):
continue
# get asset build data if any available
shot_data["inputs"] = [
x["_id"] for x in instance.data.get("assetbuilds", [])
]
# suppose that all instances are Shots
shot_data['entity_type'] = 'Shot'
shot_data['tasks'] = instance.data.get("tasks") or {}