Blender Kitsu: Rename Edit Render to Edit Export #249
@ -26,20 +26,20 @@ import bpy
|
|||||||
from ..models import FileListModel
|
from ..models import FileListModel
|
||||||
from ..logger import LoggerFactory
|
from ..logger import LoggerFactory
|
||||||
|
|
||||||
EDIT_RENDER_FILE_MODEL = FileListModel()
|
EDIT_EXPORT_FILE_MODEL = FileListModel()
|
||||||
_edit_render_enum_list: List[Tuple[str, str, str]] = []
|
_edit_export_enum_list: List[Tuple[str, str, str]] = []
|
||||||
_edit_render_file_model_init: bool = False
|
_edit_export_file_model_init: bool = False
|
||||||
|
|
||||||
logger = LoggerFactory.getLogger()
|
logger = LoggerFactory.getLogger()
|
||||||
|
|
||||||
# TODO Compare to Playblast opsdata, maybe centralize some repeated code
|
# TODO Compare to Playblast opsdata, maybe centralize some repeated code
|
||||||
|
|
||||||
|
|
||||||
def init_edit_render_file_model(
|
def init_edit_export_file_model(
|
||||||
context: bpy.types.Context,
|
context: bpy.types.Context,
|
||||||
) -> None:
|
) -> None:
|
||||||
global EDIT_RENDER_FILE_MODEL
|
global EDIT_EXPORT_FILE_MODEL
|
||||||
global _edit_render_file_model_init
|
global _edit_export_file_model_init
|
||||||
|
|
||||||
addon_prefs = prefs.addon_prefs_get(context)
|
addon_prefs = prefs.addon_prefs_get(context)
|
||||||
kitsu_props = context.scene.kitsu
|
kitsu_props = context.scene.kitsu
|
||||||
@ -48,32 +48,32 @@ def init_edit_render_file_model(
|
|||||||
# Is None if invalid.
|
# Is None if invalid.
|
||||||
if addon_prefs.edit_export_dir == "" or not edit_export_dir.exists():
|
if addon_prefs.edit_export_dir == "" or not edit_export_dir.exists():
|
||||||
logger.error(
|
logger.error(
|
||||||
"Failed to initialize edit render file model. Invalid path. Check addon preferences"
|
"Failed to initialize edit export file model. Invalid path. Check addon preferences"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
EDIT_RENDER_FILE_MODEL.reset()
|
EDIT_EXPORT_FILE_MODEL.reset()
|
||||||
EDIT_RENDER_FILE_MODEL.root_path = edit_export_dir
|
EDIT_EXPORT_FILE_MODEL.root_path = edit_export_dir
|
||||||
|
|
||||||
if not EDIT_RENDER_FILE_MODEL.versions:
|
if not EDIT_EXPORT_FILE_MODEL.versions:
|
||||||
EDIT_RENDER_FILE_MODEL.append_item("v001")
|
EDIT_EXPORT_FILE_MODEL.append_item("v001")
|
||||||
# Update edit_export_version prop.
|
# Update edit_export_version prop.
|
||||||
kitsu_props.edit_export_version = "v001"
|
kitsu_props.edit_export_version = "v001"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Update edit_export_version prop.
|
# Update edit_export_version prop.
|
||||||
kitsu_props.edit_export_version = EDIT_RENDER_FILE_MODEL.versions[0]
|
kitsu_props.edit_export_version = EDIT_EXPORT_FILE_MODEL.versions[0]
|
||||||
|
|
||||||
_edit_render_file_model_init = True
|
_edit_export_file_model_init = True
|
||||||
|
|
||||||
|
|
||||||
def add_edit_export_version_increment(context: bpy.types.Context) -> str:
|
def add_edit_export_version_increment(context: bpy.types.Context) -> str:
|
||||||
# Init model if it did not happen.
|
# Init model if it did not happen.
|
||||||
if not _edit_render_file_model_init:
|
if not _edit_export_file_model_init:
|
||||||
init_edit_render_file_model(context)
|
init_edit_export_file_model(context)
|
||||||
|
|
||||||
# Should be already sorted.
|
# Should be already sorted.
|
||||||
versions = EDIT_RENDER_FILE_MODEL.versions
|
versions = EDIT_EXPORT_FILE_MODEL.versions
|
||||||
|
|
||||||
if len(versions) > 0:
|
if len(versions) > 0:
|
||||||
latest_version = versions[0]
|
latest_version = versions[0]
|
||||||
@ -81,7 +81,7 @@ def add_edit_export_version_increment(context: bpy.types.Context) -> str:
|
|||||||
else:
|
else:
|
||||||
increment = "v001"
|
increment = "v001"
|
||||||
|
|
||||||
EDIT_RENDER_FILE_MODEL.append_item(increment)
|
EDIT_EXPORT_FILE_MODEL.append_item(increment)
|
||||||
return increment
|
return increment
|
||||||
|
|
||||||
|
|
||||||
@ -89,24 +89,24 @@ def get_edit_export_versions_enum_list(
|
|||||||
self: Any,
|
self: Any,
|
||||||
context: bpy.types.Context,
|
context: bpy.types.Context,
|
||||||
) -> List[Tuple[str, str, str]]:
|
) -> List[Tuple[str, str, str]]:
|
||||||
global _edit_render_enum_list
|
global _edit_export_enum_list
|
||||||
global EDIT_RENDER_FILE_MODEL
|
global EDIT_EXPORT_FILE_MODEL
|
||||||
global init_edit_render_file_model
|
global init_edit_export_file_model
|
||||||
global _edit_render_file_model_init
|
global _edit_export_file_model_init
|
||||||
|
|
||||||
# Init model if it did not happen.
|
# Init model if it did not happen.
|
||||||
if not _edit_render_file_model_init:
|
if not _edit_export_file_model_init:
|
||||||
init_edit_render_file_model(context)
|
init_edit_export_file_model(context)
|
||||||
|
|
||||||
# Clear all versions in enum list.
|
# Clear all versions in enum list.
|
||||||
_edit_render_enum_list.clear()
|
_edit_export_enum_list.clear()
|
||||||
_edit_render_enum_list.extend(EDIT_RENDER_FILE_MODEL.versions_as_enum_list)
|
_edit_export_enum_list.extend(EDIT_EXPORT_FILE_MODEL.versions_as_enum_list)
|
||||||
|
|
||||||
return _edit_render_enum_list
|
return _edit_export_enum_list
|
||||||
|
|
||||||
|
|
||||||
def add_version_custom(custom_version: str) -> None:
|
def add_version_custom(custom_version: str) -> None:
|
||||||
global _edit_render_enum_list
|
global _edit_export_enum_list
|
||||||
global EDIT_RENDER_FILE_MODEL
|
global EDIT_EXPORT_FILE_MODEL
|
||||||
|
|
||||||
EDIT_RENDER_FILE_MODEL.append_item(custom_version)
|
EDIT_EXPORT_FILE_MODEL.append_item(custom_version)
|
||||||
|
Loading…
Reference in New Issue
Block a user