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
2 changed files with 15 additions and 5 deletions
Showing only changes of commit 51a64cdaab - Show all commits

View File

@ -4,7 +4,6 @@ from pathlib import Path
from typing import List, Any, Tuple, Set, cast
from .. import prefs, cache
from .core import (
get_file_dir,
set_render_engine,
link_camera_rig,
create_task_type_output_collection,
@ -146,8 +145,7 @@ class KITSU_OT_build_new_shot(bpy.types.Operator):
# File Path
# TODO Only run if saving file
dir = get_file_dir(seq, shot, task_type)
shot_file_path_str = dir.joinpath(shot_task_name).__str__()
shot_file_path_str = shot.get_shot_filepath(context, task_type)
# Set Render Settings
if task_short_name == 'anim': # TODO get anim from a constant instead

View File

@ -22,11 +22,11 @@ from __future__ import annotations
import inspect
from dataclasses import asdict, dataclass, field
from typing import Any, Dict, List, Optional, Union, Tuple, TypeVar
from pathlib import Path
import gazu
from .logger import LoggerFactory
from . import bkglobals
from . import prefs
logger = LoggerFactory.getLogger()
@ -573,6 +573,18 @@ class Shot(Entity):
def get_output_collection_name(self, task_type: TaskType) -> str:
return f"{self.get_shot_task_name(task_type)}{bkglobals.FILE_DELIMITER}output"
def get_shot_dir(self, context) -> str:
project_root_dir = prefs.project_root_dir_get(context)
all_shots_dir = project_root_dir.joinpath('pro').joinpath('shots')
seq = self.get_sequence()
shot_dir = all_shots_dir.joinpath(seq.name).joinpath(self.name)
return shot_dir.__str__()
def get_shot_filepath(self, context, task_type: TaskType) -> str:
shot_task_name = self.get_shot_task_name(task_type)
file_name = shot_task_name + '.blend'
return Path(self.get_shot_dir(context)).joinpath(file_name).__str__()
def update_data(self, data: Dict[str, Any]) -> Shot:
gazu.shot.update_shot_data(asdict(self), data=data)
if not self.data: