Blender Kitsu: Rename Edit Render to Edit Export #249
@ -13,9 +13,9 @@ from .core import edit_export_import_latest, edit_export_get_all, edit_export_ge
|
|||||||
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 "
|
||||||
@ -52,17 +52,17 @@ class KITSU_OT_edit_render_publish(bpy.types.Operator):
|
|||||||
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_export_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_export_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
|
||||||
@ -133,17 +133,17 @@ class KITSU_OT_edit_render_publish(bpy.types.Operator):
|
|||||||
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
|
||||||
@ -163,7 +163,7 @@ class KITSU_OT_edit_render_set_version(bpy.types.Operator):
|
|||||||
|
|
||||||
# Update global scene cache version prop.
|
# Update global scene cache version prop.
|
||||||
kitsu_props.edit_export_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_export_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_export_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:
|
||||||
@ -224,7 +224,7 @@ class KITSU_OT_edit_render_import_latest(bpy.types.Operator):
|
|||||||
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_export_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_export_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_export_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_export_dir}' using pattern '{addon_prefs.edit_export_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_export_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,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ def init_edit_render_file_model(
|
|||||||
_edit_render_file_model_init = True
|
_edit_render_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_render_file_model_init:
|
||||||
init_edit_render_file_model(context)
|
init_edit_render_file_model(context)
|
||||||
@ -85,7 +85,7 @@ def add_edit_render_version_increment(context: bpy.types.Context) -> str:
|
|||||||
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]]:
|
||||||
|
@ -3,10 +3,10 @@ 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
|
||||||
|
|
||||||
@ -40,20 +40,20 @@ class KITSU_PT_edit_render_publish(bpy.types.Panel):
|
|||||||
# Edit Render version op.
|
# Edit Render 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_export_version,
|
text=context.scene.kitsu.edit_export_version,
|
||||||
icon="DOWNARROW_HLT",
|
icon="DOWNARROW_HLT",
|
||||||
)
|
)
|
||||||
# Edit Render increment version op.
|
# Edit Render 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 Render 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 Render path label.
|
||||||
if Path(context.scene.kitsu.edit_export_file).exists():
|
if Path(context.scene.kitsu.edit_export_file).exists():
|
||||||
@ -96,7 +96,7 @@ 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_render_publish, KITSU_PT_edit_render_tools]
|
||||||
|
Loading…
Reference in New Issue
Block a user