Blender Kitsu: Refactor Shot Builder #183
@ -527,6 +527,11 @@ def addon_prefs_get(context: bpy.types.Context) -> bpy.types.AddonPreferences:
|
||||
return context.preferences.addons["blender_kitsu"].preferences
|
||||
|
||||
|
||||
def project_root_dir_get(context: bpy.types.Context):
|
||||
addon_prefs = addon_prefs_get(context)
|
||||
return Path(addon_prefs.project_root_dir).resolve()
|
||||
|
||||
|
||||
def session_auth(context: bpy.types.Context) -> bool:
|
||||
"""
|
||||
Shortcut to check if zession is authorized
|
||||
|
@ -10,7 +10,7 @@ from ..types import (
|
||||
|
||||
from ..cache import Project
|
||||
|
||||
from blender_kitsu import prefs
|
||||
from .. import prefs
|
||||
|
||||
#################
|
||||
# Constants
|
||||
@ -18,11 +18,6 @@ from blender_kitsu import prefs
|
||||
CAMERA_NAME = 'CAM-camera'
|
||||
|
||||
|
||||
def get_project_root_path() -> Path:
|
||||
addon_prefs = prefs.addon_prefs_get(bpy.context)
|
||||
return Path(addon_prefs.project_root_dir).resolve()
|
||||
|
||||
|
||||
def get_file_dir(seq: Sequence, shot: Shot, task_type: TaskType) -> Path:
|
||||
"""Returns Path to Directory for Current Shot, will ensure that
|
||||
file path exists if it does not.
|
||||
@ -35,7 +30,7 @@ def get_file_dir(seq: Sequence, shot: Shot, task_type: TaskType) -> Path:
|
||||
Returns:
|
||||
Path: Returns Path for Shot Directory
|
||||
"""
|
||||
project_root_dir = get_project_root_path()
|
||||
project_root_dir = prefs.project_root_dir_get(bpy.context)
|
||||
all_shots_dir = project_root_dir.joinpath('pro').joinpath('shots')
|
||||
shot_dir = all_shots_dir.joinpath(seq.name).joinpath(shot.name)
|
||||
if not shot_dir.exists():
|
||||
@ -122,7 +117,7 @@ def link_camera_rig(
|
||||
of the shot and the camera will be set as active camera.
|
||||
"""
|
||||
# Load camera rig.
|
||||
project_path = get_project_root_path()
|
||||
project_path = prefs.project_root_dir_get(bpy.context)
|
||||
path = f"{project_path}/pro/assets/cam/camera_rig.blend"
|
||||
|
||||
if not Path(path).exists():
|
||||
@ -173,7 +168,7 @@ def link_task_type_output_collections(shot: Shot, task_short_name: str):
|
||||
if bkglobals.OUTPUT_COL_LINK_MAPPING.get(task_short_name) == None:
|
||||
return
|
||||
for short_name in bkglobals.OUTPUT_COL_LINK_MAPPING.get(task_short_name):
|
||||
external_filepath = dir.joinpath(short_name)
|
||||
external_filepath = shot.get_shot_filepath(bpy.context, short_name)
|
||||
if not external_filepath.exists():
|
||||
print(f"Unable to link output collection for {external_filepath.name}")
|
||||
file_path = external_filepath.__str__()
|
||||
|
Loading…
Reference in New Issue
Block a user