Blender Kitsu: Refactor Shot Builder #183
@ -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)
|
||||
|
@ -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
|
BIN
scripts-blender/addons/blender_kitsu/shot_builder_2/templates/anim.blend
(Stored with Git LFS)
Normal file
BIN
scripts-blender/addons/blender_kitsu/shot_builder_2/templates/anim.blend
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
scripts-blender/addons/blender_kitsu/shot_builder_2/templates/lighting.blend
(Stored with Git LFS)
Normal file
BIN
scripts-blender/addons/blender_kitsu/shot_builder_2/templates/lighting.blend
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user