Blender Kitsu: New Assset Tagging System #286

Merged
Nick Alberelli merged 8 commits from TinyNick/blender-studio-pipeline:feature/asset-tagging into main 2024-04-30 21:43:07 +02:00
3 changed files with 17 additions and 9 deletions
Showing only changes of commit f9c7a50d9f - Show all commits

View File

@ -87,8 +87,14 @@ MULTI_ASSETS = [
ASSET_COLL_PREFIXES = ["CH-", "PR-", "SE-", "FX-"]
# Kitsu Constants
KITSU_TV_PROJECT = 'tvshow'
# Kitsu Metadata Keys
KITSU_FILEPATH_KEY = "filepath"
KITSU_COLLECTION_KEY = "collection"
RES_DIR_PATH = Path(os.path.abspath(__file__)).parent.joinpath("res")
SCENE_NAME_PLAYBLAST = "playblast_playback"

View File

@ -1,5 +1,5 @@
import bpy
from .. import prefs
from .. import prefs, bkglobals
from pathlib import Path
import json
from ..types import Shot
@ -36,8 +36,8 @@ def get_shot_assets(
kitsu_assets = shot.get_all_assets()
for kitsu_asset in kitsu_assets:
asset_path = kitsu_asset.data.get("filepath")
collection_name = kitsu_asset.data.get("collection")
asset_path = kitsu_asset.data.get(bkglobals.KITSU_FILEPATH_KEY)
collection_name = kitsu_asset.data.get(bkglobals.KITSU_COLLECTION_KEY)
if not asset_path or not collection_name:
print(
f"Asset '{kitsu_asset.name}' is missing filepath or collection metadata. Skipping"

View File

@ -737,18 +737,20 @@ class Asset(Entity):
def set_asset_path(self, filepath: str, collection_name: str) -> None:
data = {}
data["filepath"] = filepath
data["collection"] = collection_name
filepath_key = bkglobals.KITSU_FILEPATH_KEY
collection_key = bkglobals.KITSU_COLLECTION_KEY
data[filepath_key] = filepath
data[collection_key] = collection_name
updated_asset = gazu.asset.update_asset_data(asdict(self), data)
self.data = updated_asset["data"]
if not gazu.project.get_metadata_descriptor_by_field_name(self.project_id, "filepath"):
if not gazu.project.get_metadata_descriptor_by_field_name(self.project_id, filepath_key):
gazu.project.add_metadata_descriptor(
self.project_id, "filepath", "Asset", data_type='string'
self.project_id, filepath_key, "Asset", data_type='string'
)
if not gazu.project.get_metadata_descriptor_by_field_name(self.project_id, "collection"):
if not gazu.project.get_metadata_descriptor_by_field_name(self.project_id, collection_key):
gazu.project.add_metadata_descriptor(
self.project_id, "collection", "Asset", data_type='string'
self.project_id, collection_key, "Asset", data_type='string'
)
def get_all_task_types(self) -> List[TaskType]: