Blender Kitsu: Refactor Shot Builder #183

Merged
Nick Alberelli merged 55 commits from TinyNick/blender-studio-pipeline:feature/shot-builder-2 into main 2023-12-21 23:58:21 +01:00
Showing only changes of commit b5078f7be3 - Show all commits

View File

@ -25,6 +25,8 @@ from typing import Any, Dict, List, Optional, Union, Tuple, TypeVar
import gazu import gazu
from .logger import LoggerFactory from .logger import LoggerFactory
from . import bkglobals
logger = LoggerFactory.getLogger() logger = LoggerFactory.getLogger()
@ -565,6 +567,12 @@ class Shot(Entity):
gazu.shot.update_shot(asdict(self)) gazu.shot.update_shot(asdict(self))
return self return self
def get_shot_task_name(self, task_type: TaskType) -> str: #
return f"{self.name}{bkglobals.FILE_DELIMITER}{task_type.get_short_name()}"
def get_output_collection_name(self, task_type: TaskType) -> str:
return f"{self.get_shot_task_name(task_type)}{bkglobals.FILE_DELIMITER}output"
def update_data(self, data: Dict[str, Any]) -> Shot: def update_data(self, data: Dict[str, Any]) -> Shot:
gazu.shot.update_shot_data(asdict(self), data=data) gazu.shot.update_shot_data(asdict(self), data=data)
if not self.data: if not self.data:
@ -714,6 +722,11 @@ class TaskType(Entity):
if t["for_entity"] == "Sequence" if t["for_entity"] == "Sequence"
] ]
def get_short_name(self) -> str:
for key, value in bkglobals.SHOT_TASK_MAPPING.items():
if value == self.name:
return key
def __bool__(self) -> bool: def __bool__(self) -> bool:
return bool(self.id) return bool(self.id)