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
9 changed files with 193 additions and 194 deletions

View File

@ -4,32 +4,31 @@ import re
from pathlib import Path from pathlib import Path
def edit_render_get_latest(context: bpy.types.Context): def edit_export_get_latest(context: bpy.types.Context):
"""Find latest render in editorial render directory""" """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: if len(files_list) >= 1:
files_list = sorted(files_list, reverse=True) files_list = sorted(files_list, reverse=True)
return files_list[0] return files_list[0]
return None return None
def edit_renders_get_all(context: bpy.types.Context): def edit_export_get_all(context: bpy.types.Context):
"""Find latest render in editorial render directory""" """Find all renders in editorial export directory"""
addon_prefs = prefs.addon_prefs_get(context) addon_prefs = prefs.addon_prefs_get(context)
edit_render_path = Path(addon_prefs.edit_render_dir) edit_export_path = Path(addon_prefs.edit_export_dir)
files_list = [ files_list = [
f f
for f in edit_render_path.iterdir() for f in edit_export_path.iterdir()
if f.is_file() if f.is_file() and edit_export_is_valid_name(addon_prefs.edit_export_file_pattern, f.name)
and edit_render_is_valid_edit_name(addon_prefs.edit_render_file_pattern, f.name)
] ]
return files_list 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""" """Verify file name matches file pattern set in preferences"""
# Prevents un-expected matches # Prevents un-expected matches
file_pattern = re.escape(file_pattern) 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 return False
def edit_render_import_latest( def edit_export_import_latest(
context: bpy.types.Context, shot context: bpy.types.Context, shot
) -> list[bpy.types.Sequence]: # TODO add info to 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) addon_prefs = prefs.addon_prefs_get(context)
strip_channel = 1 strip_channel = 1
latest_file = edit_render_get_latest(context) latest_file = edit_export_get_latest(context)
if not latest_file: if not latest_file:
return None return None
# Check if Kitsu server returned empty shot # Check if Kitsu server returned empty shot
@ -78,7 +77,7 @@ def edit_render_import_latest(
frame_in = shot.data.get("frame_in") frame_in = shot.data.get("frame_in")
frame_3d_start = shot.get_3d_start() frame_3d_start = shot.get_3d_start()
frame_3d_offset = frame_3d_start - addon_prefs.shot_builder_frame_offset frame_3d_offset = frame_3d_start - addon_prefs.shot_builder_frame_offset
edit_export_offset = addon_prefs.edit_render_frame_offset edit_export_offset = addon_prefs.edit_export_frame_offset
# Set sequence strip start kitsu data. # Set sequence strip start kitsu data.
for strip in new_strips: for strip in new_strips:

View File

@ -8,14 +8,14 @@ from ..types import Task, TaskStatus
from ..playblast.core import override_render_path, override_render_format from ..playblast.core import override_render_path, override_render_format
from . import opsdata from . import opsdata
from ..logger import LoggerFactory 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() logger = LoggerFactory.getLogger()
class KITSU_OT_edit_render_publish(bpy.types.Operator): class KITSU_OT_edit_export_publish(bpy.types.Operator):
bl_idname = "kitsu.edit_render_publish" bl_idname = "kitsu.edit_export_publish"
bl_label = "Render & Publish" bl_label = "Export & Publish"
bl_description = ( bl_description = (
"Renders current VSE Edit as .mp4" "Renders current VSE Edit as .mp4"
"Saves the set version to disk and uploads it to Kitsu with the specified " "Saves the set version to disk and uploads it to Kitsu with the specified "
@ -51,18 +51,18 @@ class KITSU_OT_edit_render_publish(bpy.types.Operator):
if kitsu_props.task_type_active_id == "": if kitsu_props.task_type_active_id == "":
cls.poll_message_set("Select a task type from Kitsu Context Menu") cls.poll_message_set("Select a task type from Kitsu Context Menu")
return False return False
if not addon_prefs.is_edit_render_root_valid: if not addon_prefs.is_edit_export_root_valid:
cls.poll_message_set("Edit Render Directory is Invalid, see Add-On preferences") cls.poll_message_set("Edit Export Directory is Invalid, see Add-On preferences")
return False return False
if not addon_prefs.is_edit_render_pattern_valid: if not addon_prefs.is_edit_export_pattern_valid:
cls.poll_message_set("Edit Render File Pattern is Invalid, see Add-On preferences") cls.poll_message_set("Edit Export File Pattern is Invalid, see Add-On preferences")
return False return False
return True return True
def invoke(self, context, event): def invoke(self, context, event):
self.thumbnail_frame = context.scene.frame_current self.thumbnail_frame = context.scene.frame_current
# Remove file name if set in render.filepath # Remove file name if set in render filepath
dir_path = bpy.path.abspath(context.scene.render.filepath) dir_path = bpy.path.abspath(context.scene.render.filepath)
if not os.path.isdir(Path(dir_path)): if not os.path.isdir(Path(dir_path)):
dir_path = Path(dir_path).parent dir_path = Path(dir_path).parent
@ -101,7 +101,7 @@ class KITSU_OT_edit_render_publish(bpy.types.Operator):
return {"CANCELLED"} return {"CANCELLED"}
# Build render_path # Build render_path
render_path = Path(kitsu_props.edit_render_file) render_path = Path(kitsu_props.edit_export_file)
render_path_str = render_path.as_posix() render_path_str = render_path.as_posix()
render_name = render_path.name render_name = render_path.name
if not render_path.parent.exists(): if not render_path.parent.exists():
@ -129,27 +129,27 @@ class KITSU_OT_edit_render_publish(bpy.types.Operator):
if self.use_frame_start: if self.use_frame_start:
edit_entity.set_frame_start(self.frame_start) edit_entity.set_frame_start(self.frame_start)
self.report({"INFO"}, f"Submitted new comment 'Revision {kitsu_props.edit_render_version}'") self.report({"INFO"}, f"Submitted new comment 'Revision {kitsu_props.edit_export_version}'")
return {"FINISHED"} return {"FINISHED"}
class KITSU_OT_edit_render_set_version(bpy.types.Operator): class KITSU_OT_edit_export_set_version(bpy.types.Operator):
bl_idname = "kitsu.edit_render_set_version" bl_idname = "kitsu.edit_export_set_version"
bl_label = "Version" bl_label = "Version"
bl_property = "versions" bl_property = "versions"
bl_description = ( bl_description = (
"Sets version of edit render. Warning triangle in ui " "Sets version of edit export. Warning triangle in ui "
"indicates that version already exists on disk" "indicates that version already exists on disk"
) )
versions: bpy.props.EnumProperty( versions: bpy.props.EnumProperty(
items=opsdata.get_edit_render_versions_enum_list, name="Versions" items=opsdata.get_edit_export_versions_enum_list, name="Versions"
) )
@classmethod @classmethod
def poll(cls, context: bpy.types.Context) -> bool: def poll(cls, context: bpy.types.Context) -> bool:
addon_prefs = prefs.addon_prefs_get(context) addon_prefs = prefs.addon_prefs_get(context)
return bool(addon_prefs.edit_render_dir != "") return bool(addon_prefs.edit_export_dir != "")
def execute(self, context: bpy.types.Context) -> Set[str]: def execute(self, context: bpy.types.Context) -> Set[str]:
kitsu_props = context.scene.kitsu kitsu_props = context.scene.kitsu
@ -158,12 +158,12 @@ class KITSU_OT_edit_render_set_version(bpy.types.Operator):
if not version: if not version:
return {"CANCELLED"} return {"CANCELLED"}
if kitsu_props.get('edit_render_version') == version: if kitsu_props.get('edit_export_version') == version:
return {"CANCELLED"} return {"CANCELLED"}
# Update global scene cache version prop. # Update global scene cache version prop.
kitsu_props.edit_render_version = version kitsu_props.edit_export_version = version
logger.info("Set edit render version to %s", version) logger.info("Set edit export version to %s", version)
# Redraw ui. # Redraw ui.
util.ui_redraw() util.ui_redraw()
@ -175,10 +175,10 @@ class KITSU_OT_edit_render_set_version(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class KITSU_OT_edit_render_increment_version(bpy.types.Operator): class KITSU_OT_edit_export_increment_version(bpy.types.Operator):
bl_idname = "kitsu.edit_render_increment_version" bl_idname = "kitsu.edit_export_increment_version"
bl_label = "Add Version Increment" bl_label = "Add Version Increment"
bl_description = "Increment the edit_render version by one" bl_description = "Increment the edit export version by one"
@classmethod @classmethod
def poll(cls, context: bpy.types.Context) -> bool: def poll(cls, context: bpy.types.Context) -> bool:
@ -186,31 +186,31 @@ class KITSU_OT_edit_render_increment_version(bpy.types.Operator):
def execute(self, context: bpy.types.Context) -> Set[str]: def execute(self, context: bpy.types.Context) -> Set[str]:
# Incremenet version. # Incremenet version.
version = opsdata.add_edit_render_version_increment(context) version = opsdata.add_edit_export_version_increment(context)
# Update cache_version prop. # Update cache_version prop.
context.scene.kitsu.edit_render_version = version context.scene.kitsu.edit_export_version = version
# Report. # Report.
self.report({"INFO"}, f"Add edit_render version {version}") self.report({"INFO"}, f"Add edit export version {version}")
util.ui_redraw() util.ui_redraw()
return {"FINISHED"} return {"FINISHED"}
class KITSU_OT_edit_render_import_latest(bpy.types.Operator): class KITSU_OT_edit_export_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_label = "Import Latest Edit Export"
bl_description = ( bl_description = (
"Find and import the latest editorial render found in the Editorial Render Directory for the current shot. " "Find and import the latest editorial render found in the Editorial Export Directory for the current shot. "
"Will only Import if the latest render is not already imported. " "Will only Import if the latest export is not already imported. "
"Will remove any previous renders currently in the file's Video Sequence Editor" "Will remove any previous exports currently in the file's Video Sequence Editor"
) )
_existing_edit_renders = [] _existing_edit_exports = []
_removed_movie = 0 _removed_movie = 0
_removed_audio = 0 _removed_audio = 0
_latest_render_name = "" _latest_export_name = ""
@classmethod @classmethod
def poll(cls, context: bpy.types.Context) -> bool: def poll(cls, context: bpy.types.Context) -> bool:
@ -223,8 +223,8 @@ class KITSU_OT_edit_render_import_latest(bpy.types.Operator):
if cache.shot_active_get().id == "": if cache.shot_active_get().id == "":
cls.poll_message_set("Please set an active shot in Kitsu Context UI") cls.poll_message_set("Please set an active shot in Kitsu Context UI")
return False return False
if not prefs.addon_prefs_get(context).is_edit_render_root_valid: if not prefs.addon_prefs_get(context).is_edit_export_root_valid:
cls.poll_message_set("Edit Render Directory is Invalid, see Add-On Preferences") cls.poll_message_set("Edit Export Directory is Invalid, see Add-On Preferences")
return False return False
return True return True
@ -244,29 +244,29 @@ class KITSU_OT_edit_render_import_latest(bpy.types.Operator):
return True return True
return False return False
def get_existing_edit_renders( def get_existing_edit_exports(
self, context: Context, all_edit_render_paths: List[Path] self, context: Context, all_edit_export_paths: List[Path]
) -> List[Sequence]: ) -> List[Sequence]:
sequences = context.scene.sequence_editor.sequences sequences = context.scene.sequence_editor.sequences
# Collect Existing Edit Renders # Collect Existing Edit Export
for strip in sequences: for strip in sequences:
if self.compare_strip_to_paths(strip, all_edit_render_paths): if self.compare_strip_to_paths(strip, all_edit_export_paths):
self._existing_edit_renders.append(strip) self._existing_edit_exports.append(strip)
return self._existing_edit_renders return self._existing_edit_exports
def check_if_latest_edit_render_is_imported(self, context: Context) -> bool: def check_if_latest_edit_export_is_imported(self, context: Context) -> bool:
# Check if latest edit render is already loaded. # Check if latest edit export is already loaded.
for strip in self._existing_edit_renders: for strip in self._existing_edit_exports:
latest_edit_render_path = edit_render_get_latest(context) latest_edit_export_path = edit_export_get_latest(context)
if self.compare_strip_to_path(strip, latest_edit_render_path): if self.compare_strip_to_path(strip, latest_edit_export_path):
self._latest_render_name = latest_edit_render_path.name self._latest_export_name = latest_edit_export_path.name
return True return True
def remove_existing_edit_renders(self, context: Context) -> None: def remove_existing_edit_exports(self, context: Context) -> None:
# Remove Existing Strips to make way for new Strip # Remove Existing Strips to make way for new Strip
sequences = context.scene.sequence_editor.sequences sequences = context.scene.sequence_editor.sequences
for strip in self._existing_edit_renders: for strip in self._existing_edit_exports:
if strip.type == "MOVIE": if strip.type == "MOVIE":
self._removed_movie += 1 self._removed_movie += 1
if strip.type == "SOUND": if strip.type == "SOUND":
@ -275,42 +275,42 @@ class KITSU_OT_edit_render_import_latest(bpy.types.Operator):
def execute(self, context: bpy.types.Context) -> Set[str]: def execute(self, context: bpy.types.Context) -> Set[str]:
# Reset Values # Reset Values
self._existing_edit_renders = [] self._existing_edit_exports = []
self._removed_movie = 0 self._removed_movie = 0
self._removed_audio = 0 self._removed_audio = 0
self._latest_render_name = "" self._latest_export_name = ""
addon_prefs = prefs.addon_prefs_get(context) addon_prefs = prefs.addon_prefs_get(context)
# Get paths to all edit renders # Get paths to all edit exports
all_edit_render_paths = edit_renders_get_all(context) all_edit_export_paths = edit_export_get_all(context)
if all_edit_render_paths == []: if all_edit_export_paths == []:
self.report( self.report(
{"WARNING"}, {"WARNING"},
f"No Edit Renders found in '{addon_prefs.edit_render_dir}' using pattern '{addon_prefs.edit_render_file_pattern}' See Add-On Preferences", f"No Edit Exports found in '{addon_prefs.edit_export_dir}' using pattern '{addon_prefs.edit_export_file_pattern}' See Add-On Preferences",
) )
return {"CANCELLED"} return {"CANCELLED"}
# Collect all existing edit renders # Collect all existing edit exports
self.get_existing_edit_renders(context, all_edit_render_paths) self.get_existing_edit_exports(context, all_edit_export_paths)
# Stop latest render is already imported # Stop latest export is already imported
if self.check_if_latest_edit_render_is_imported(context): if self.check_if_latest_edit_export_is_imported(context):
self.report( self.report(
{"WARNING"}, {"WARNING"},
f"Latest Editorial Render already loaded '{self._latest_render_name}'", f"Latest Editorial Export already loaded '{self._latest_export_name}'",
) )
return {"CANCELLED"} return {"CANCELLED"}
# Remove old edit renders # Remove old edit exports
self.remove_existing_edit_renders(context) self.remove_existing_edit_exports(context)
# Import new edit render # Import new edit export
shot = cache.shot_active_get() shot = cache.shot_active_get()
strips = edit_render_import_latest(context, shot) strips = edit_export_import_latest(context, shot)
if strips is None: if strips is None:
self.report({"WARNING"}, f"Loaded Latest Editorial Render failed to import!") self.report({"WARNING"}, f"Loaded Latest Editorial Export failed to import!")
return {"CANCELLED"} return {"CANCELLED"}
# Report. # Report.
@ -319,18 +319,18 @@ class KITSU_OT_edit_render_import_latest(bpy.types.Operator):
f"Removed {self._removed_movie} Movie Strips and {self._removed_audio} Audio Strips" f"Removed {self._removed_movie} Movie Strips and {self._removed_audio} Audio Strips"
) )
self.report( self.report(
{"INFO"}, f"Loaded Latest Editorial Render, '{strips[0].name}'. {removed_msg}" {"INFO"}, f"Loaded Latest Editorial Export, '{strips[0].name}'. {removed_msg}"
) )
else: else:
self.report({"INFO"}, f"Loaded Latest Editorial Render, '{strips[0].name}'") self.report({"INFO"}, f"Loaded Latest Editorial Export, '{strips[0].name}'")
return {"FINISHED"} return {"FINISHED"}
classes = [ classes = [
KITSU_OT_edit_render_publish, KITSU_OT_edit_export_publish,
KITSU_OT_edit_render_set_version, KITSU_OT_edit_export_set_version,
KITSU_OT_edit_render_increment_version, KITSU_OT_edit_export_increment_version,
KITSU_OT_edit_render_import_latest, KITSU_OT_edit_export_import_latest,
] ]

View File

@ -26,54 +26,54 @@ 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
edit_render_dir = Path(addon_prefs.edit_render_dir) edit_export_dir = Path(addon_prefs.edit_export_dir)
# Is None if invalid. # Is None if invalid.
if addon_prefs.edit_render_dir == "" or not edit_render_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_render_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_render_version prop. # Update edit_export_version prop.
kitsu_props.edit_render_Version = "v001" kitsu_props.edit_export_version = "v001"
else: else:
# Update edit_render_version prop. # Update edit_export_version prop.
kitsu_props.edit_render_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_render_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,32 +81,32 @@ def add_edit_render_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
def get_edit_render_versions_enum_list( 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)

View File

@ -3,21 +3,21 @@ from .. import prefs, ui
from ..context import core as context_core from ..context import core as context_core
from pathlib import Path from pathlib import Path
from .ops import ( from .ops import (
KITSU_OT_edit_render_set_version, KITSU_OT_edit_export_set_version,
KITSU_OT_edit_render_increment_version, KITSU_OT_edit_export_increment_version,
KITSU_OT_edit_render_publish, KITSU_OT_edit_export_publish,
KITSU_OT_edit_render_import_latest, KITSU_OT_edit_export_import_latest,
) )
from ..generic.ops import KITSU_OT_open_path from ..generic.ops import KITSU_OT_open_path
class KITSU_PT_edit_render_publish(bpy.types.Panel): class KITSU_PT_edit_export_publish(bpy.types.Panel):
""" """
Panel in sequence editor that exposes a set of tools that are used to render latest edit Panel in sequence editor that exposes a set of tools that are used to export latest edit
""" """
bl_category = "Kitsu" bl_category = "Kitsu"
bl_label = "Render & Publish" bl_label = "Export & Publish"
bl_space_type = "SEQUENCE_EDITOR" bl_space_type = "SEQUENCE_EDITOR"
bl_region_type = "UI" bl_region_type = "UI"
bl_options = {"DEFAULT_CLOSED"} bl_options = {"DEFAULT_CLOSED"}
@ -33,46 +33,46 @@ class KITSU_PT_edit_render_publish(bpy.types.Panel):
split_factor_small = 0.95 split_factor_small = 0.95
# # ERROR. # # ERROR.
if not addon_prefs.is_edit_render_root_valid: if not addon_prefs.is_edit_export_root_valid:
box = ui.draw_error_box(layout) box = ui.draw_error_box(layout)
ui.draw_error_invalid_edit_render_root_dir(box) ui.draw_error_invalid_edit_export_root_dir(box)
# Edit Render version op. # Edit Export version op.
row = layout.row(align=True) row = layout.row(align=True)
row.operator( row.operator(
KITSU_OT_edit_render_set_version.bl_idname, KITSU_OT_edit_export_set_version.bl_idname,
text=context.scene.kitsu.edit_render_version, text=context.scene.kitsu.edit_export_version,
icon="DOWNARROW_HLT", icon="DOWNARROW_HLT",
) )
# Edit Render increment version op. # Edit Export increment version op.
row.operator( row.operator(
KITSU_OT_edit_render_increment_version.bl_idname, KITSU_OT_edit_export_increment_version.bl_idname,
text="", text="",
icon="ADD", icon="ADD",
) )
# Edit Render op. # Edit Export op.
row = layout.row(align=True) row = layout.row(align=True)
row.operator(KITSU_OT_edit_render_publish.bl_idname, icon="RENDER_ANIMATION") row.operator(KITSU_OT_edit_export_publish.bl_idname, icon="RENDER_ANIMATION")
# Edit Render path label. # Edit Export path label.
if Path(context.scene.kitsu.edit_render_file).exists(): if Path(context.scene.kitsu.edit_export_file).exists():
split = layout.split(factor=1 - split_factor_small, align=True) split = layout.split(factor=1 - split_factor_small, align=True)
split.label(icon="ERROR") split.label(icon="ERROR")
sub_split = split.split(factor=split_factor_small) sub_split = split.split(factor=split_factor_small)
sub_split.label(text=context.scene.kitsu.edit_render_file) sub_split.label(text=context.scene.kitsu.edit_export_file)
sub_split.operator( sub_split.operator(
KITSU_OT_open_path.bl_idname, icon="FILE_FOLDER", text="" KITSU_OT_open_path.bl_idname, icon="FILE_FOLDER", text=""
).filepath = context.scene.kitsu.edit_render_file ).filepath = context.scene.kitsu.edit_export_file
else: else:
row = layout.row(align=True) row = layout.row(align=True)
row.label(text=context.scene.kitsu.edit_render_file) row.label(text=context.scene.kitsu.edit_export_file)
row.operator(KITSU_OT_open_path.bl_idname, icon="FILE_FOLDER", text="").filepath = ( row.operator(KITSU_OT_open_path.bl_idname, icon="FILE_FOLDER", text="").filepath = (
context.scene.kitsu.edit_render_file context.scene.kitsu.edit_export_file
) )
class KITSU_PT_edit_render_tools(bpy.types.Panel): class KITSU_PT_edit_export_tools(bpy.types.Panel):
""" """
Panel in sequence editor that exposes a set of tools that are used to load the latest edit Panel in sequence editor that exposes a set of tools that are used to load the latest edit
""" """
@ -96,10 +96,10 @@ class KITSU_PT_edit_render_tools(bpy.types.Panel):
def draw(self, context: bpy.types.Context) -> None: def draw(self, context: bpy.types.Context) -> None:
box = self.layout.box() box = self.layout.box()
box.label(text="General", icon="MODIFIER") box.label(text="General", icon="MODIFIER")
box.operator(KITSU_OT_edit_render_import_latest.bl_idname) box.operator(KITSU_OT_edit_export_import_latest.bl_idname)
classes = [KITSU_PT_edit_render_publish, KITSU_PT_edit_render_tools] classes = [KITSU_PT_edit_export_publish, KITSU_PT_edit_export_tools]
def register(): def register():

View File

@ -41,7 +41,7 @@ from .auth.ops import (
) )
from .context.ops import KITSU_OT_con_productions_load from .context.ops import KITSU_OT_con_productions_load
from .lookdev.prefs import LOOKDEV_preferences 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() logger = LoggerFactory.getLogger()
@ -358,60 +358,60 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
subtype='DIR_PATH', subtype='DIR_PATH',
) )
def set_edit_render_dir(self, input): def set_edit_export_dir(self, input):
self['edit_render_dir'] = input self['edit_export_dir'] = input
return return
def get_edit_render_dir( def get_edit_export_dir(
self, self,
) -> str: ) -> str:
if get_safely_string_prop(self, 'edit_render_dir') == "" and self.project_root_path: if get_safely_string_prop(self, 'edit_export_dir') == "" and self.project_root_path:
dir = self.project_root_path.joinpath("shared/editorial/export/") dir = self.project_root_path.joinpath("shared/editorial/export/")
if dir.exists(): if dir.exists():
return dir.as_posix() return dir.as_posix()
return get_safely_string_prop(self, 'edit_render_dir') return get_safely_string_prop(self, 'edit_export_dir')
edit_render_dir: bpy.props.StringProperty( # type: ignore edit_export_dir: bpy.props.StringProperty( # type: ignore
name="Render Directory", name="Edit Export Directory",
options={"HIDDEN", "SKIP_SAVE"}, options={"HIDDEN", "SKIP_SAVE"},
description="Directory path to editorial's render folder containing storyboard/animatic renders. Path should be similar to '~/shared-{proj_name}/editorial/export/'", description="Directory path to editorial's export folder containing storyboard/animatic renders. Path should be similar to '~/shared-{proj_name}/editorial/export/'",
subtype="DIR_PATH", subtype="DIR_PATH",
get=get_edit_render_dir, get=get_edit_export_dir,
set=set_edit_render_dir, set=set_edit_export_dir,
) )
def set_edit_render_file_pattern(self, input): def set_edit_export_file_pattern(self, input):
self['edit_render_file_pattern'] = input self['edit_export_file_pattern'] = input
return return
def get_edit_render_file_pattern( def get_edit_export_file_pattern(
self, self,
) -> str: ) -> str:
active_project = cache.project_active_get() active_project = cache.project_active_get()
if get_safely_string_prop(self, 'edit_render_file_pattern') == "" and active_project: if get_safely_string_prop(self, 'edit_export_file_pattern') == "" and active_project:
proj_name = active_project.name.replace(' ', bkglobals.SPACE_REPLACER).lower() proj_name = active_project.name.replace(' ', bkglobals.SPACE_REPLACER).lower()
# HACK for Project Gold at Blender Studio # HACK for Project Gold at Blender Studio
if proj_name == "project_gold": if proj_name == "project_gold":
return f"gold-edit-v###.mp4" return f"gold-edit-v###.mp4"
return f"{proj_name}-edit-v###.mp4" return f"{proj_name}-edit-v###.mp4"
return get_safely_string_prop(self, 'edit_render_file_pattern') return get_safely_string_prop(self, 'edit_export_file_pattern')
edit_render_file_pattern: bpy.props.StringProperty( # type: ignore edit_export_file_pattern: bpy.props.StringProperty( # type: ignore
name="Render File Pattern", name="Edit Export File Pattern",
options={"HIDDEN", "SKIP_SAVE"}, options={"HIDDEN", "SKIP_SAVE"},
description=( description=(
"File pattern for latest editorial render file. " "File pattern for latest editorial export file. "
"Typically '{proj_name}-edit-v###.mp4' where # represents a number. " "Typically '{proj_name}-edit-v###.mp4' where # represents a number. "
"Pattern must contain exactly v### representing the version, pattern must end in .mp4" "Pattern must contain exactly v### representing the version, pattern must end in .mp4"
), ),
default="", default="",
get=get_edit_render_file_pattern, get=get_edit_export_file_pattern,
set=set_edit_render_file_pattern, set=set_edit_export_file_pattern,
) )
edit_render_frame_offset: bpy.props.IntProperty( # type: ignore edit_export_frame_offset: bpy.props.IntProperty( # type: ignore
name="Render Offset", name="Edit Export Offset",
description="Shift Editorial Render by this frame-range after import", description="Shift Editorial Export by this frame-range after import",
default=-101, # HARD CODED FOR GOLD PROJECTS BLENDER FILM default=-101, # HARD CODED FOR GOLD PROJECTS BLENDER FILM
) )
@ -491,10 +491,10 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
# Editorial Settings # Editorial Settings
box = col.box() box = col.box()
box.label(text="Editorial", icon="SEQ_SEQUENCER") box.label(text="Editorial", icon="SEQ_SEQUENCER")
box.row().prop(self, "edit_render_dir") box.row().prop(self, "edit_export_dir", text="Export Directory")
file_pattern_row = box.row(align=True) file_pattern_row = box.row(align=True)
file_pattern_row.alert = not self.is_edit_render_pattern_valid file_pattern_row.alert = not self.is_edit_export_pattern_valid
file_pattern_row.prop(self, "edit_render_file_pattern") file_pattern_row.prop(self, "edit_export_file_pattern", text="Export File Pattern")
# Lookdev tools settings. # Lookdev tools settings.
self.lookdev.draw(context, col) self.lookdev.draw(context, col)
@ -527,7 +527,7 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
# Shot_Builder settings. # Shot_Builder settings.
box = col.box() box = col.box()
box.label(text="Shot Builder", icon="MOD_BUILD") box.label(text="Shot Builder", icon="MOD_BUILD")
box.row().prop(self, "edit_render_frame_offset") box.row().prop(self, "edit_export_frame_offset")
box.row().prop(self, "shot_builder_show_advanced") box.row().prop(self, "shot_builder_show_advanced")
if self.shot_builder_show_advanced: if self.shot_builder_show_advanced:
start_frame_row = box.row() start_frame_row = box.row()
@ -573,18 +573,18 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
return True return True
@property @property
def is_edit_render_root_valid(self) -> bool: def is_edit_export_root_valid(self) -> bool:
if self.edit_render_dir.strip() == "": if self.edit_export_dir.strip() == "":
return False return False
if not Path(self.edit_render_dir).exists(): if not Path(self.edit_export_dir).exists():
return False return False
return True return True
@property @property
def is_edit_render_pattern_valid(self) -> bool: def is_edit_export_pattern_valid(self) -> bool:
if not self.edit_render_file_pattern.endswith(".mp4"): if not self.edit_export_file_pattern.endswith(".mp4"):
return False return False
if not "###" in self.edit_render_file_pattern: if not "###" in self.edit_export_file_pattern:
return False return False
return True return True

View File

@ -498,14 +498,14 @@ class KITSU_property_group_scene(bpy.types.PropertyGroup):
search_options={'SORT'}, search_options={'SORT'},
) )
edit_render_version: bpy.props.StringProperty(name="Version", default="v001") edit_export_version: bpy.props.StringProperty(name="Version", default="v001")
edit_render_file: bpy.props.StringProperty( # type: ignore edit_export_file: bpy.props.StringProperty( # type: ignore
name="Edit Render Filepath", name="Edit Export Filepath",
description="Output filepath of Edit Render", description="Output filepath of Edit Export",
default="", default="",
subtype="FILE_PATH", subtype="FILE_PATH",
get=propsdata.get_edit_render_file, get=propsdata.get_edit_export_file,
) )
# Thumbnail props. # Thumbnail props.

View File

@ -168,14 +168,14 @@ def get_playblast_file(self: Any) -> str:
return Path(self.playblast_dir).joinpath(file_name).as_posix() return Path(self.playblast_dir).joinpath(file_name).as_posix()
def get_edit_render_file(self: Any) -> str: def get_edit_export_file(self: Any) -> str:
addon_prefs = prefs.addon_prefs_get(bpy.context) addon_prefs = prefs.addon_prefs_get(bpy.context)
if not bool(addon_prefs.edit_render_dir): if not bool(addon_prefs.edit_export_dir):
return "" return ""
version = self.edit_render_version version = self.edit_export_version
file_pattern = addon_prefs.edit_render_file_pattern file_pattern = addon_prefs.edit_export_file_pattern
file_name = file_pattern.replace('v###', version) file_name = file_pattern.replace('v###', version)
return Path(addon_prefs.edit_render_dir).joinpath(file_name).as_posix() return Path(addon_prefs.edit_export_dir).joinpath(file_name).as_posix()
_active_category_cache_init: bool = False _active_category_cache_init: bool = False

View File

@ -16,7 +16,7 @@ from .core import (
) )
from ..context import core as context_core 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 .file_save import save_shot_builder_file
from .template import replace_workspace_with_template from .template import replace_workspace_with_template
from .assets import get_shot_assets 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) link_task_type_output_collections(shot, task_type)
if bkglobals.LOAD_EDITORIAL_REF.get(task_type_short_name): if bkglobals.LOAD_EDITORIAL_REF.get(task_type_short_name):
edit_render_import_latest(context, shot) edit_export_import_latest(context, shot)
# Run Hooks # Run Hooks
hooks_instance = Hooks() hooks_instance = Hooks()

View File

@ -47,11 +47,11 @@ def draw_error_invalid_playblast_root_dir(
).module = __package__ ).module = __package__
def draw_error_invalid_edit_render_root_dir( def draw_error_invalid_edit_export_root_dir(
box: bpy.types.UILayout, box: bpy.types.UILayout,
) -> bpy.types.UILayout: ) -> bpy.types.UILayout:
row = box.row(align=True) row = box.row(align=True)
row.label(text="Invalid Edit Render Directory") row.label(text="Invalid Edit Export Directory")
row.operator("preferences.addon_show", text="Open Addon Preferences").module = __package__ row.operator("preferences.addon_show", text="Open Addon Preferences").module = __package__