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
4 changed files with 37 additions and 0 deletions
Showing only changes of commit a6736b1cd6 - Show all commits

View File

@ -15,6 +15,7 @@ from .core import (
from .editorial import editorial_export_get_latest
from .file_save import save_shot_builder_file
from .template import open_template_for_task_type
active_project = None
@ -138,6 +139,10 @@ class KITSU_OT_build_new_shot(bpy.types.Operator):
task_type = self._get_task_type_for_shot(context, shot)
task_short_name = task_type.get_short_name()
# Open Template File
# TODO DEBUG WHY THIS CAUSES CRASHES
# open_template_for_task_type(task_short_name)
# Set Up Scene + Naming
shot_task_name = shot.get_shot_task_name(task_type)
scene = set_shot_scene(shot_task_name)

View File

@ -0,0 +1,26 @@
import bpy
from pathlib import Path
# TODO add ability for custom templates
def get_template_dir() -> Path:
return Path(__file__).absolute().parent.joinpath("templates")
def get_template_files() -> list[Path]:
dir = get_template_dir()
return list(dir.glob('*.blend'))
def get_template_for_task_type(task_short_name: str) -> Path:
for file in get_template_files():
if file.stem == task_short_name:
return file
def open_template_for_task_type(task_short_name: str) -> bool:
file_path = get_template_for_task_type(task_short_name)
if file_path.exists() and file_path is not None:
bpy.ops.wm.open_mainfile(filepath=file_path.__str__())
return True
return False

Binary file not shown.

Binary file not shown.