Blender Kitsu: Rename Edit Render to Edit Export #249

Merged
Nick Alberelli merged 11 commits from TinyNick/blender-studio-pipeline:fix/rename-edit-render-to-edit-export into main 2024-02-26 18:17:54 +01:00
4 changed files with 20 additions and 21 deletions
Showing only changes of commit d37282819c - Show all commits

View File

@ -4,32 +4,31 @@ import re
from pathlib import Path
def edit_render_get_latest(context: bpy.types.Context):
"""Find latest render in editorial render directory"""
def edit_export_get_latest(context: bpy.types.Context):
"""Find latest render in editorial export directory"""
files_list = edit_renders_get_all(context)
files_list = edit_export_get_all(context)
if len(files_list) >= 1:
files_list = sorted(files_list, reverse=True)
return files_list[0]
return None
def edit_renders_get_all(context: bpy.types.Context):
"""Find latest render in editorial render directory"""
def edit_export_get_all(context: bpy.types.Context):
"""Find all renders in editorial export directory"""
addon_prefs = prefs.addon_prefs_get(context)
edit_render_path = Path(addon_prefs.edit_export_dir)
edit_export_path = Path(addon_prefs.edit_export_dir)
files_list = [
f
for f in edit_render_path.iterdir()
if f.is_file()
and edit_render_is_valid_edit_name(addon_prefs.edit_export_file_pattern, f.name)
for f in edit_export_path.iterdir()
if f.is_file() and edit_export_is_valid_name(addon_prefs.edit_export_file_pattern, f.name)
]
return files_list
def edit_render_is_valid_edit_name(file_pattern: str, filename: str) -> bool:
def edit_export_is_valid_name(file_pattern: str, filename: str) -> bool:
"""Verify file name matches file pattern set in preferences"""
# Prevents un-expected matches
file_pattern = re.escape(file_pattern)
@ -40,13 +39,13 @@ def edit_render_is_valid_edit_name(file_pattern: str, filename: str) -> bool:
return False
def edit_render_import_latest(
def edit_export_import_latest(
context: bpy.types.Context, shot
) -> list[bpy.types.Sequence]: # TODO add info to shot
"""Loads latest render from editorial department"""
"""Loads latest export from editorial department"""
addon_prefs = prefs.addon_prefs_get(context)
strip_channel = 1
latest_file = edit_render_get_latest(context)
latest_file = edit_export_get_latest(context)
if not latest_file:
return None
# Check if Kitsu server returned empty shot

View File

@ -8,7 +8,7 @@ from ..types import Task, TaskStatus
from ..playblast.core import override_render_path, override_render_format
from . import opsdata
from ..logger import LoggerFactory
from .core import edit_render_import_latest, edit_renders_get_all, edit_render_get_latest
from .core import edit_export_import_latest, edit_export_get_all, edit_export_get_latest
logger = LoggerFactory.getLogger()
@ -199,7 +199,7 @@ class KITSU_OT_edit_render_increment_version(bpy.types.Operator):
class KITSU_OT_edit_render_import_latest(bpy.types.Operator):
bl_idname = "kitsu.edit_render_import_latest"
bl_idname = "kitsu.edit_export_import_latest"
bl_label = "Import Latest Edit Render"
bl_description = (
"Find and import the latest editorial render found in the Editorial Render Directory for the current shot. "
@ -258,7 +258,7 @@ class KITSU_OT_edit_render_import_latest(bpy.types.Operator):
def check_if_latest_edit_render_is_imported(self, context: Context) -> bool:
# Check if latest edit render is already loaded.
for strip in self._existing_edit_renders:
latest_edit_render_path = edit_render_get_latest(context)
latest_edit_render_path = edit_export_get_latest(context)
if self.compare_strip_to_path(strip, latest_edit_render_path):
self._latest_render_name = latest_edit_render_path.name
return True
@ -283,7 +283,7 @@ class KITSU_OT_edit_render_import_latest(bpy.types.Operator):
addon_prefs = prefs.addon_prefs_get(context)
# Get paths to all edit renders
all_edit_render_paths = edit_renders_get_all(context)
all_edit_render_paths = edit_export_get_all(context)
if all_edit_render_paths == []:
self.report(
{"WARNING"},
@ -307,7 +307,7 @@ class KITSU_OT_edit_render_import_latest(bpy.types.Operator):
# Import new edit render
shot = cache.shot_active_get()
strips = edit_render_import_latest(context, shot)
strips = edit_export_import_latest(context, shot)
if strips is None:
self.report({"WARNING"}, f"Loaded Latest Editorial Render failed to import!")

View File

@ -41,7 +41,7 @@ from .auth.ops import (
)
from .context.ops import KITSU_OT_con_productions_load
from .lookdev.prefs import LOOKDEV_preferences
from .edit.core import edit_render_get_latest
from .edit.core import edit_export_get_latest
logger = LoggerFactory.getLogger()

View File

@ -16,7 +16,7 @@ from .core import (
)
from ..context import core as context_core
from ..edit.core import edit_render_import_latest
from ..edit.core import edit_export_import_latest
from .file_save import save_shot_builder_file
from .template import replace_workspace_with_template
from .assets import get_shot_assets
@ -236,7 +236,7 @@ class KITSU_OT_build_new_shot(bpy.types.Operator):
link_task_type_output_collections(shot, task_type)
if bkglobals.LOAD_EDITORIAL_REF.get(task_type_short_name):
edit_render_import_latest(context, shot)
edit_export_import_latest(context, shot)
# Run Hooks
hooks_instance = Hooks()