Blender Kitsu: New Assset Tagging System #286
@ -87,8 +87,14 @@ MULTI_ASSETS = [
|
|||||||
|
|
||||||
ASSET_COLL_PREFIXES = ["CH-", "PR-", "SE-", "FX-"]
|
ASSET_COLL_PREFIXES = ["CH-", "PR-", "SE-", "FX-"]
|
||||||
|
|
||||||
|
|
||||||
|
# Kitsu Constants
|
||||||
KITSU_TV_PROJECT = 'tvshow'
|
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")
|
RES_DIR_PATH = Path(os.path.abspath(__file__)).parent.joinpath("res")
|
||||||
|
|
||||||
SCENE_NAME_PLAYBLAST = "playblast_playback"
|
SCENE_NAME_PLAYBLAST = "playblast_playback"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import bpy
|
import bpy
|
||||||
from .. import prefs
|
from .. import prefs, bkglobals
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import json
|
import json
|
||||||
from ..types import Shot
|
from ..types import Shot
|
||||||
@ -36,8 +36,8 @@ def get_shot_assets(
|
|||||||
kitsu_assets = shot.get_all_assets()
|
kitsu_assets = shot.get_all_assets()
|
||||||
|
|
||||||
for kitsu_asset in kitsu_assets:
|
for kitsu_asset in kitsu_assets:
|
||||||
asset_path = kitsu_asset.data.get("filepath")
|
asset_path = kitsu_asset.data.get(bkglobals.KITSU_FILEPATH_KEY)
|
||||||
collection_name = kitsu_asset.data.get("collection")
|
collection_name = kitsu_asset.data.get(bkglobals.KITSU_COLLECTION_KEY)
|
||||||
if not asset_path or not collection_name:
|
if not asset_path or not collection_name:
|
||||||
print(
|
print(
|
||||||
f"Asset '{kitsu_asset.name}' is missing filepath or collection metadata. Skipping"
|
f"Asset '{kitsu_asset.name}' is missing filepath or collection metadata. Skipping"
|
||||||
|
@ -737,18 +737,20 @@ class Asset(Entity):
|
|||||||
|
|
||||||
def set_asset_path(self, filepath: str, collection_name: str) -> None:
|
def set_asset_path(self, filepath: str, collection_name: str) -> None:
|
||||||
data = {}
|
data = {}
|
||||||
data["filepath"] = filepath
|
filepath_key = bkglobals.KITSU_FILEPATH_KEY
|
||||||
data["collection"] = collection_name
|
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)
|
updated_asset = gazu.asset.update_asset_data(asdict(self), data)
|
||||||
self.data = updated_asset["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(
|
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(
|
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]:
|
def get_all_task_types(self) -> List[TaskType]:
|
||||||
|
Loading…
Reference in New Issue
Block a user