Blender Kitsu: Refactor Shot Builder #183
@ -4,7 +4,6 @@ from pathlib import Path
|
|||||||
from typing import List, Any, Tuple, Set, cast
|
from typing import List, Any, Tuple, Set, cast
|
||||||
from .. import prefs, cache
|
from .. import prefs, cache
|
||||||
from .core import (
|
from .core import (
|
||||||
get_file_dir,
|
|
||||||
set_render_engine,
|
set_render_engine,
|
||||||
link_camera_rig,
|
link_camera_rig,
|
||||||
create_task_type_output_collection,
|
create_task_type_output_collection,
|
||||||
@ -146,8 +145,7 @@ class KITSU_OT_build_new_shot(bpy.types.Operator):
|
|||||||
|
|
||||||
# File Path
|
# File Path
|
||||||
# TODO Only run if saving file
|
# TODO Only run if saving file
|
||||||
dir = get_file_dir(seq, shot, task_type)
|
shot_file_path_str = shot.get_shot_filepath(context, task_type)
|
||||||
shot_file_path_str = dir.joinpath(shot_task_name).__str__()
|
|
||||||
|
|
||||||
# Set Render Settings
|
# Set Render Settings
|
||||||
if task_short_name == 'anim': # TODO get anim from a constant instead
|
if task_short_name == 'anim': # TODO get anim from a constant instead
|
||||||
|
@ -22,11 +22,11 @@ from __future__ import annotations
|
|||||||
import inspect
|
import inspect
|
||||||
from dataclasses import asdict, dataclass, field
|
from dataclasses import asdict, dataclass, field
|
||||||
from typing import Any, Dict, List, Optional, Union, Tuple, TypeVar
|
from typing import Any, Dict, List, Optional, Union, Tuple, TypeVar
|
||||||
|
from pathlib import Path
|
||||||
import gazu
|
import gazu
|
||||||
from .logger import LoggerFactory
|
from .logger import LoggerFactory
|
||||||
from . import bkglobals
|
from . import bkglobals
|
||||||
|
from . import prefs
|
||||||
|
|
||||||
logger = LoggerFactory.getLogger()
|
logger = LoggerFactory.getLogger()
|
||||||
|
|
||||||
@ -573,6 +573,18 @@ class Shot(Entity):
|
|||||||
def get_output_collection_name(self, task_type: TaskType) -> str:
|
def get_output_collection_name(self, task_type: TaskType) -> str:
|
||||||
return f"{self.get_shot_task_name(task_type)}{bkglobals.FILE_DELIMITER}output"
|
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:
|
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:
|
||||||
|
Loading…
Reference in New Issue
Block a user