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
6 changed files with 48 additions and 48 deletions
Showing only changes of commit 76a23889ad - Show all commits

View File

@ -18,13 +18,13 @@ def edit_renders_get_all(context: bpy.types.Context):
"""Find latest render in editorial render directory"""
addon_prefs = prefs.addon_prefs_get(context)
edit_render_path = Path(addon_prefs.edit_render_dir)
edit_render_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_render_file_pattern, f.name)
and edit_render_is_valid_edit_name(addon_prefs.edit_export_file_pattern, f.name)
]
return files_list
@ -78,7 +78,7 @@ def edit_render_import_latest(
frame_in = shot.data.get("frame_in")
frame_3d_start = shot.get_3d_start()
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.
for strip in new_strips:

View File

@ -51,10 +51,10 @@ class KITSU_OT_edit_render_publish(bpy.types.Operator):
if kitsu_props.task_type_active_id == "":
cls.poll_message_set("Select a task type from Kitsu Context Menu")
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")
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")
return False
return True
@ -149,7 +149,7 @@ class KITSU_OT_edit_render_set_version(bpy.types.Operator):
@classmethod
def poll(cls, context: bpy.types.Context) -> bool:
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]:
kitsu_props = context.scene.kitsu
@ -223,7 +223,7 @@ class KITSU_OT_edit_render_import_latest(bpy.types.Operator):
if cache.shot_active_get().id == "":
cls.poll_message_set("Please set an active shot in Kitsu Context UI")
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")
return False
return True
@ -287,7 +287,7 @@ class KITSU_OT_edit_render_import_latest(bpy.types.Operator):
if all_edit_render_paths == []:
self.report(
{"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 Renders found in '{addon_prefs.edit_export_dir}' using pattern '{addon_prefs.edit_export_file_pattern}' See Add-On Preferences",
)
return {"CANCELLED"}

View File

@ -43,17 +43,17 @@ def init_edit_render_file_model(
addon_prefs = prefs.addon_prefs_get(context)
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.
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(
"Failed to initialize edit render file model. Invalid path. Check addon preferences"
)
return
EDIT_RENDER_FILE_MODEL.reset()
EDIT_RENDER_FILE_MODEL.root_path = edit_render_dir
EDIT_RENDER_FILE_MODEL.root_path = edit_export_dir
if not EDIT_RENDER_FILE_MODEL.versions:
EDIT_RENDER_FILE_MODEL.append_item("v001")

View File

@ -33,7 +33,7 @@ class KITSU_PT_edit_render_publish(bpy.types.Panel):
split_factor_small = 0.95
# # 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)
ui.draw_error_invalid_edit_render_root_dir(box)

View File

@ -358,60 +358,60 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
subtype='DIR_PATH',
)
def set_edit_render_dir(self, input):
self['edit_render_dir'] = input
def set_edit_export_dir(self, input):
self['edit_export_dir'] = input
return
def get_edit_render_dir(
def get_edit_export_dir(
self,
) -> 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/")
if dir.exists():
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
name="Render Directory",
edit_export_dir: bpy.props.StringProperty( # type: ignore
name="Export Directory",
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",
get=get_edit_render_dir,
set=set_edit_render_dir,
get=get_edit_export_dir,
set=set_edit_export_dir,
)
def set_edit_render_file_pattern(self, input):
self['edit_render_file_pattern'] = input
def set_edit_export_file_pattern(self, input):
self['edit_export_file_pattern'] = input
return
def get_edit_render_file_pattern(
def get_edit_export_file_pattern(
self,
) -> str:
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()
# HACK for Project Gold at Blender Studio
if proj_name == "project_gold":
return f"gold-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
name="Render File Pattern",
edit_export_file_pattern: bpy.props.StringProperty( # type: ignore
name="Export File Pattern",
options={"HIDDEN", "SKIP_SAVE"},
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. "
"Pattern must contain exactly v### representing the version, pattern must end in .mp4"
),
default="",
get=get_edit_render_file_pattern,
set=set_edit_render_file_pattern,
get=get_edit_export_file_pattern,
set=set_edit_export_file_pattern,
)
edit_render_frame_offset: bpy.props.IntProperty( # type: ignore
name="Render Offset",
description="Shift Editorial Render by this frame-range after import",
edit_export_frame_offset: bpy.props.IntProperty( # type: ignore
name="Export Offset",
description="Shift Editorial Export by this frame-range after import",
default=-101, # HARD CODED FOR GOLD PROJECTS BLENDER FILM
)
@ -491,10 +491,10 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
# Editorial Settings
box = col.box()
box.label(text="Editorial", icon="SEQ_SEQUENCER")
box.row().prop(self, "edit_render_dir")
box.row().prop(self, "edit_export_dir")
file_pattern_row = box.row(align=True)
file_pattern_row.alert = not self.is_edit_render_pattern_valid
file_pattern_row.prop(self, "edit_render_file_pattern")
file_pattern_row.alert = not self.is_edit_export_pattern_valid
file_pattern_row.prop(self, "edit_export_file_pattern")
# Lookdev tools settings.
self.lookdev.draw(context, col)
@ -527,7 +527,7 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
# Shot_Builder settings.
box = col.box()
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")
if self.shot_builder_show_advanced:
start_frame_row = box.row()
@ -573,18 +573,18 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
return True
@property
def is_edit_render_root_valid(self) -> bool:
if self.edit_render_dir.strip() == "":
def is_edit_export_root_valid(self) -> bool:
if self.edit_export_dir.strip() == "":
return False
if not Path(self.edit_render_dir).exists():
if not Path(self.edit_export_dir).exists():
return False
return True
@property
def is_edit_render_pattern_valid(self) -> bool:
if not self.edit_render_file_pattern.endswith(".mp4"):
def is_edit_export_pattern_valid(self) -> bool:
if not self.edit_export_file_pattern.endswith(".mp4"):
return False
if not "###" in self.edit_render_file_pattern:
if not "###" in self.edit_export_file_pattern:
return False
return True

View File

@ -170,12 +170,12 @@ def get_playblast_file(self: Any) -> str:
def get_edit_export_file(self: Any) -> str:
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 ""
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)
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