revert [Blender_Kitsu] Remove metastrip filepath (#15) #31
@ -154,6 +154,9 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
|
|||||||
return ""
|
return ""
|
||||||
return self.project_root_path.joinpath("pipeline/blender_kitsu").as_posix()
|
return self.project_root_path.joinpath("pipeline/blender_kitsu").as_posix()
|
||||||
|
|
||||||
|
def get_metastrip_file(self) -> str:
|
||||||
|
res_dir = bkglobals.RES_DIR_PATH
|
||||||
|
return res_dir.joinpath("metastrip.mp4").as_posix()
|
||||||
|
|
||||||
def init_playblast_file_model(self, context: bpy.types.Context) -> None:
|
def init_playblast_file_model(self, context: bpy.types.Context) -> None:
|
||||||
ops_playblast_data.init_playblast_file_model(context)
|
ops_playblast_data.init_playblast_file_model(context)
|
||||||
@ -225,6 +228,16 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
|
|||||||
get=get_config_dir,
|
get=get_config_dir,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
metastrip_file: bpy.props.StringProperty( # type: ignore
|
||||||
|
name="Meta Strip File",
|
||||||
|
description=(
|
||||||
|
"Filepath to black .mp4 file that will be used as metastrip for shots in the sequence editor"
|
||||||
|
),
|
||||||
|
default="",
|
||||||
|
subtype="FILE_PATH",
|
||||||
|
get=get_metastrip_file,
|
||||||
|
)
|
||||||
|
|
||||||
project_active_id: bpy.props.StringProperty( # type: ignore
|
project_active_id: bpy.props.StringProperty( # type: ignore
|
||||||
name="Project Active ID",
|
name="Project Active ID",
|
||||||
description="Server Id that refers to the last active project",
|
description="Server Id that refers to the last active project",
|
||||||
|
@ -1705,6 +1705,7 @@ class KITSU_OT_sqe_pull_edit(bpy.types.Operator):
|
|||||||
return bool(
|
return bool(
|
||||||
prefs.session_auth(context)
|
prefs.session_auth(context)
|
||||||
and cache.project_active_get()
|
and cache.project_active_get()
|
||||||
|
and addon_prefs.metastrip_file
|
||||||
)
|
)
|
||||||
|
|
||||||
def execute(self, context: bpy.types.Context) -> Set[str]:
|
def execute(self, context: bpy.types.Context) -> Set[str]:
|
||||||
@ -1785,12 +1786,12 @@ class KITSU_OT_sqe_pull_edit(bpy.types.Operator):
|
|||||||
frame_end,
|
frame_end,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
# TODO Refactor as this reuses code from KITSU_OT_sqe_create_meta_strip
|
|
||||||
if not strip:
|
if not strip:
|
||||||
# Create new strip.
|
# Create new strip.
|
||||||
strip = context.scene.sequence_editor.sequences.new_movie(
|
strip = context.scene.sequence_editor.sequences.new_movie(
|
||||||
shot.name,
|
shot.name,
|
||||||
"",
|
addon_prefs.metastrip_file,
|
||||||
channel,
|
channel,
|
||||||
frame_start,
|
frame_start,
|
||||||
)
|
)
|
||||||
@ -1974,7 +1975,8 @@ class KITSU_OT_sqe_create_meta_strip(bpy.types.Operator):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context: bpy.types.Context) -> bool:
|
def poll(cls, context: bpy.types.Context) -> bool:
|
||||||
return bool(context.selected_sequences)
|
addon_prefs = prefs.addon_prefs_get(context)
|
||||||
|
return bool(context.selected_sequences and addon_prefs.metastrip_file)
|
||||||
|
|
||||||
def execute(self, context: bpy.types.Context) -> Set[str]:
|
def execute(self, context: bpy.types.Context) -> Set[str]:
|
||||||
addon_prefs = prefs.addon_prefs_get(context)
|
addon_prefs = prefs.addon_prefs_get(context)
|
||||||
@ -1985,6 +1987,14 @@ class KITSU_OT_sqe_create_meta_strip(bpy.types.Operator):
|
|||||||
|
|
||||||
selected_sequences = context.selected_sequences
|
selected_sequences = context.selected_sequences
|
||||||
|
|
||||||
|
# Check if metastrip file actually exists.
|
||||||
|
if not Path(addon_prefs.metastrip_file).exists():
|
||||||
|
self.report(
|
||||||
|
{"ERROR"},
|
||||||
|
f"Failed to load metastrip file: {addon_prefs.metastrip_file}. Path does not exist",
|
||||||
|
)
|
||||||
|
return {"CANCELLED"}
|
||||||
|
|
||||||
for strip in selected_sequences:
|
for strip in selected_sequences:
|
||||||
|
|
||||||
# Get frame range information from current strip.
|
# Get frame range information from current strip.
|
||||||
@ -2011,7 +2021,7 @@ class KITSU_OT_sqe_create_meta_strip(bpy.types.Operator):
|
|||||||
# on the first try, EDIT: seems to work maybe per python overlaps of sequences possible?
|
# on the first try, EDIT: seems to work maybe per python overlaps of sequences possible?
|
||||||
meta_strip = context.scene.sequence_editor.sequences.new_movie(
|
meta_strip = context.scene.sequence_editor.sequences.new_movie(
|
||||||
f"{strip.name}_metastrip",
|
f"{strip.name}_metastrip",
|
||||||
"",
|
addon_prefs.metastrip_file,
|
||||||
strip.channel + 1,
|
strip.channel + 1,
|
||||||
strip.frame_final_start,
|
strip.frame_final_start,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user