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""" """Find latest render in editorial render 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_render_path = Path(addon_prefs.edit_export_dir)
files_list = [ files_list = [
f f
for f in edit_render_path.iterdir() for f in edit_render_path.iterdir()
if f.is_file() 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 return files_list
@ -78,7 +78,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

@ -51,10 +51,10 @@ 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 Render 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 Render File Pattern is Invalid, see Add-On preferences")
return False return False
return True return True
@ -149,7 +149,7 @@ class KITSU_OT_edit_render_set_version(bpy.types.Operator):
@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
@ -223,7 +223,7 @@ 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 Render Directory is Invalid, see Add-On Preferences")
return False return False
return True return True
@ -287,7 +287,7 @@ class KITSU_OT_edit_render_import_latest(bpy.types.Operator):
if all_edit_render_paths == []: if all_edit_render_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 Renders found in '{addon_prefs.edit_export_dir}' using pattern '{addon_prefs.edit_export_file_pattern}' See Add-On Preferences",
) )
return {"CANCELLED"} return {"CANCELLED"}

View File

@ -43,17 +43,17 @@ def init_edit_render_file_model(
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 render file model. Invalid path. Check addon preferences"
) )
return return
EDIT_RENDER_FILE_MODEL.reset() 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: if not EDIT_RENDER_FILE_MODEL.versions:
EDIT_RENDER_FILE_MODEL.append_item("v001") 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 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_render_root_dir(box)

View File

@ -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="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="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="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")
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")
# 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

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