Fix: Missing Metadata Strip Media #288
BIN
docs/media/addons/blender_kitsu/sqe_fix_metadata_media.jpg
(Stored with Git LFS)
Normal file
BIN
docs/media/addons/blender_kitsu/sqe_fix_metadata_media.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -151,6 +151,11 @@ If you linked in a sequence that has no `["data"]["color"]` attribute on Kitsu y
|
|||||||
|
|
||||||
All this information and more can be `pushed` to kitsu which bring us to the next panel. <br/>
|
All this information and more can be `pushed` to kitsu which bring us to the next panel. <br/>
|
||||||
|
|
||||||
|
##### Missing Metadata Strip Media
|
||||||
|
If your scene contains any metadata strips that have "missing media" a **Fix Metadata Strips** box will appear in your Kitsu Panel. Simply select the metadata strips that have missing media, or none to fix all strips, and run the `Fix Missing Media` operator. <br/>
|
||||||
|
|
||||||
|
![image info](/media/addons/blender_kitsu/sqe_fix_metadata_media.jpg)
|
||||||
|
|
||||||
##### Push
|
##### Push
|
||||||
|
|
||||||
In the `Push` panel you will find all the operators that push data to Kitsu. <br/>
|
In the `Push` panel you will find all the operators that push data to Kitsu. <br/>
|
||||||
|
@ -121,6 +121,20 @@ class KITSU_addon_preferences(bpy.types.AddonPreferences):
|
|||||||
how some of the operators work.
|
how some of the operators work.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def get_metadatastrip_file(self) -> str:
|
||||||
|
res_dir = bkglobals.RES_DIR_PATH
|
||||||
|
return res_dir.joinpath("metastrip.mp4").as_posix()
|
||||||
|
|
||||||
|
metadatastrip_file: bpy.props.StringProperty( # type: ignore
|
||||||
|
name="Metadata 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_metadatastrip_file,
|
||||||
|
)
|
||||||
|
|
||||||
def get_datadir(self) -> Path:
|
def get_datadir(self) -> Path:
|
||||||
"""Returns a Path where persistent application data can be stored.
|
"""Returns a Path where persistent application data can be stored.
|
||||||
|
|
||||||
|
@ -1807,7 +1807,7 @@ class KITSU_OT_sqe_pull_edit(bpy.types.Operator):
|
|||||||
# 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.metadatastrip_file,
|
||||||
channel,
|
channel,
|
||||||
frame_start,
|
frame_start,
|
||||||
)
|
)
|
||||||
@ -2012,7 +2012,7 @@ class KITSU_OT_sqe_create_metadata_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?
|
||||||
metadata_strip = context.scene.sequence_editor.sequences.new_movie(
|
metadata_strip = context.scene.sequence_editor.sequences.new_movie(
|
||||||
f"{strip.name}{bkglobals.DELIMITER}metadata{bkglobals.SPACE_REPLACER}strip",
|
f"{strip.name}{bkglobals.DELIMITER}metadata{bkglobals.SPACE_REPLACER}strip",
|
||||||
"",
|
addon_prefs.metadatastrip_file,
|
||||||
strip.channel + 1,
|
strip.channel + 1,
|
||||||
strip.frame_final_start,
|
strip.frame_final_start,
|
||||||
)
|
)
|
||||||
@ -2059,6 +2059,32 @@ class KITSU_OT_sqe_create_metadata_strip(bpy.types.Operator):
|
|||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
class KITSU_OT_sqe_fix_metadata_strips(bpy.types.Operator):
|
||||||
|
|
||||||
|
bl_idname = "kitsu.sqe_fix_metadata_strip"
|
||||||
|
bl_label = "Fix Metadata Strip Missing Media"
|
||||||
|
bl_description = "Fixes missing media error in metadata strips. "
|
||||||
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
def execute(self, context: Context):
|
||||||
|
addon_prefs = prefs.addon_prefs_get(context)
|
||||||
|
|
||||||
|
if len(context.selected_sequences) == 0:
|
||||||
|
all_strips = context.scene.sequence_editor.sequences
|
||||||
|
else:
|
||||||
|
all_strips = context.selected_sequences
|
||||||
|
|
||||||
|
offline_metadata_strips = [
|
||||||
|
strip
|
||||||
|
for strip in all_strips
|
||||||
|
if strip.kitsu.shot_id != '' and not Path(strip.filepath).is_file()
|
||||||
|
]
|
||||||
|
|
||||||
|
for strip in offline_metadata_strips:
|
||||||
|
strip.filepath = addon_prefs.metadatastrip_file
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class KITSU_OT_sqe_add_sequence_color(bpy.types.Operator):
|
class KITSU_OT_sqe_add_sequence_color(bpy.types.Operator):
|
||||||
"""
|
"""
|
||||||
Adds sequence of active strip to scene.kitsu.sequence_colors collection property
|
Adds sequence of active strip to scene.kitsu.sequence_colors collection property
|
||||||
@ -2761,6 +2787,7 @@ classes = [
|
|||||||
KITSU_OT_sqe_pull_edit,
|
KITSU_OT_sqe_pull_edit,
|
||||||
KITSU_OT_sqe_init_strip_start_frame,
|
KITSU_OT_sqe_init_strip_start_frame,
|
||||||
KITSU_OT_sqe_create_metadata_strip,
|
KITSU_OT_sqe_create_metadata_strip,
|
||||||
|
KITSU_OT_sqe_fix_metadata_strips,
|
||||||
KITSU_OT_sqe_add_sequence_color,
|
KITSU_OT_sqe_add_sequence_color,
|
||||||
KITSU_OT_sqe_scan_for_media_updates,
|
KITSU_OT_sqe_scan_for_media_updates,
|
||||||
KITSU_OT_sqe_change_strip_source,
|
KITSU_OT_sqe_change_strip_source,
|
||||||
|
@ -46,6 +46,7 @@ from ..sqe.ops import (
|
|||||||
KITSU_OT_sqe_pull_edit,
|
KITSU_OT_sqe_pull_edit,
|
||||||
KITSU_OT_sqe_init_strip_start_frame,
|
KITSU_OT_sqe_init_strip_start_frame,
|
||||||
KITSU_OT_sqe_create_metadata_strip,
|
KITSU_OT_sqe_create_metadata_strip,
|
||||||
|
KITSU_OT_sqe_fix_metadata_strips,
|
||||||
KITSU_OT_sqe_add_sequence_color,
|
KITSU_OT_sqe_add_sequence_color,
|
||||||
KITSU_OT_sqe_scan_for_media_updates,
|
KITSU_OT_sqe_scan_for_media_updates,
|
||||||
KITSU_OT_sqe_change_strip_source,
|
KITSU_OT_sqe_change_strip_source,
|
||||||
@ -119,6 +120,9 @@ class KITSU_PT_sqe_shot_tools(bpy.types.Panel):
|
|||||||
if self.poll_metadata(context):
|
if self.poll_metadata(context):
|
||||||
self.draw_metadata(context)
|
self.draw_metadata(context)
|
||||||
|
|
||||||
|
if self.poll_offline_metadata(context):
|
||||||
|
self.draw_offline_metadata(context)
|
||||||
|
|
||||||
if self.poll_multi_edit(context):
|
if self.poll_multi_edit(context):
|
||||||
self.draw_multi_edit(context)
|
self.draw_multi_edit(context)
|
||||||
|
|
||||||
@ -353,6 +357,31 @@ class KITSU_PT_sqe_shot_tools(bpy.types.Panel):
|
|||||||
row.prop(strip.kitsu, "frame_start_offset", text="In")
|
row.prop(strip.kitsu, "frame_start_offset", text="In")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def poll_offline_metadata(cls, context: bpy.types.Context) -> bool:
|
||||||
|
offline_metadata_strips = [
|
||||||
|
strip
|
||||||
|
for strip in context.scene.sequence_editor.sequences
|
||||||
|
if strip.kitsu.shot_id != '' and not Path(strip.filepath).is_file()
|
||||||
|
]
|
||||||
|
|
||||||
|
return len(offline_metadata_strips) > 0
|
||||||
|
|
||||||
|
def draw_offline_metadata(self, context: bpy.types.Context) -> None:
|
||||||
|
# Create box.
|
||||||
|
layout = self.layout
|
||||||
|
box = layout.box()
|
||||||
|
box.label(text="Fix Metadata Strips", icon="ERROR")
|
||||||
|
offline_metadata_strips = [
|
||||||
|
strip
|
||||||
|
for strip in context.selected_sequences
|
||||||
|
if strip.kitsu.shot_id != '' and not Path(strip.filepath).is_file()
|
||||||
|
]
|
||||||
|
if len(offline_metadata_strips) == 0:
|
||||||
|
text = "Fix All Missing Media"
|
||||||
|
else:
|
||||||
|
text = f"Fix {len(offline_metadata_strips)} Missing Media"
|
||||||
|
box.operator(KITSU_OT_sqe_fix_metadata_strips.bl_idname, text=text)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll_multi_edit(cls, context: bpy.types.Context) -> bool:
|
def poll_multi_edit(cls, context: bpy.types.Context) -> bool:
|
||||||
if not prefs.session_auth(context):
|
if not prefs.session_auth(context):
|
||||||
|
@ -57,10 +57,11 @@ def create_metadata_strip(
|
|||||||
strip_range = range(strip.frame_final_start, strip.frame_final_end)
|
strip_range = range(strip.frame_final_start, strip.frame_final_end)
|
||||||
channel = strip.channel + 1
|
channel = strip.channel + 1
|
||||||
|
|
||||||
|
addon_prefs = prefs.addon_prefs_get(context)
|
||||||
# Create new metadata strip.
|
# Create new metadata strip.
|
||||||
metadata_strip = context.scene.sequence_editor.sequences.new_movie(
|
metadata_strip = context.scene.sequence_editor.sequences.new_movie(
|
||||||
f"{strip.name}_metadata-strip",
|
f"{strip.name}_metadata-strip",
|
||||||
"",
|
addon_prefs.metadatastrip_file,
|
||||||
strip.channel + 1,
|
strip.channel + 1,
|
||||||
strip.frame_final_start,
|
strip.frame_final_start,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user