Blender Kitsu: Use new Kitsu Context UI in Multi Edit / Metadata #280
@ -670,10 +670,44 @@ def _add_window_manager_props():
|
||||
get=propsdata._get_project_active,
|
||||
)
|
||||
|
||||
bpy.types.WindowManager.sequence_enum = bpy.props.EnumProperty(
|
||||
name="Sequences",
|
||||
items=propsdata._get_sequences,
|
||||
###########
|
||||
# Sequence
|
||||
###########
|
||||
bpy.types.WindowManager.selected_sequence_id = bpy.props.StringProperty( # type: ignore
|
||||
name="Active Sequence ID",
|
||||
description="ID that refers to the active sequence on server",
|
||||
default="",
|
||||
)
|
||||
|
||||
def get_sequences_via_name(self):
|
||||
return get_safely_string_prop(self, "selected_sequence_name")
|
||||
|
||||
def set_sequences_via_name(self, input):
|
||||
key = set_kitsu_entity_id_via_enum_name(
|
||||
self=self,
|
||||
input_name=input,
|
||||
items=cache.get_sequences_enum_list(self, bpy.context),
|
||||
name_prop='selected_sequence_name',
|
||||
id_prop='selected_sequence_id',
|
||||
)
|
||||
if key:
|
||||
cache.sequence_active_set_by_id(bpy.context, key)
|
||||
else:
|
||||
cache.sequence_active_reset_entity()
|
||||
return
|
||||
|
||||
def get_sequence_search_list(self, context, edit_text):
|
||||
return get_enum_item_names(cache.get_sequences_enum_list(self, bpy.context))
|
||||
|
||||
bpy.types.WindowManager.selected_sequence_name = bpy.props.StringProperty(
|
||||
name="Sequence",
|
||||
description="Name of Sequence the generated Shots will be assinged to",
|
||||
default="", # type: ignore
|
||||
get=get_sequences_via_name,
|
||||
set=set_sequences_via_name,
|
||||
options=set(),
|
||||
search=get_sequence_search_list,
|
||||
search_options={'SORT'},
|
||||
)
|
||||
|
||||
# Advanced delete props.
|
||||
@ -693,7 +727,8 @@ def _clear_window_manager_props():
|
||||
del bpy.types.WindowManager.shot_counter_start
|
||||
del bpy.types.WindowManager.shot_preview
|
||||
del bpy.types.WindowManager.var_project_active
|
||||
del bpy.types.WindowManager.sequence_enum
|
||||
del bpy.types.WindowManager.selected_sequence_id
|
||||
del bpy.types.WindowManager.selected_sequence_name
|
||||
|
||||
|
||||
def _calc_kitsu_3d_start(self):
|
||||
|
@ -77,12 +77,17 @@ def _gen_shot_preview(self: Any) -> str:
|
||||
shot_counter_start = self.shot_counter_start
|
||||
shot_pattern = addon_prefs.shot_pattern
|
||||
examples: List[str] = []
|
||||
sequence = self.sequence_enum
|
||||
sequence = self.selected_sequence_name
|
||||
episode = cache.episode_active_get()
|
||||
var_project = (
|
||||
self.var_project_custom if self.var_use_custom_project else self.var_project_active
|
||||
)
|
||||
var_sequence = self.var_sequence_custom if self.var_use_custom_seq else sequence
|
||||
var_lookup_table = {"Sequence": var_sequence, "Project": var_project}
|
||||
var_lookup_table = {
|
||||
"Sequence": var_sequence,
|
||||
"Project": var_project,
|
||||
"Episode": episode.name,
|
||||
}
|
||||
|
||||
for count in range(3):
|
||||
counter_number = shot_counter_start + (shot_counter_increment * count)
|
||||
|
@ -672,7 +672,7 @@ class KITSU_OT_sqe_multi_edit_strip(bpy.types.Operator):
|
||||
shot_counter_start = context.window_manager.shot_counter_start
|
||||
shot_pattern = addon_prefs.shot_pattern
|
||||
strip = context.scene.sequence_editor.active_strip
|
||||
sequence = context.window_manager.sequence_enum
|
||||
sequence = context.window_manager.selected_sequence_name
|
||||
var_project = (
|
||||
addon_prefs.var_project_custom
|
||||
if context.window_manager.var_use_custom_project
|
||||
@ -692,12 +692,14 @@ class KITSU_OT_sqe_multi_edit_strip(bpy.types.Operator):
|
||||
selected_sequences = sorted(
|
||||
selected_sequences, key=lambda x: x.frame_final_start
|
||||
)
|
||||
episode = cache.episode_active_get()
|
||||
|
||||
for idx, strip in enumerate(selected_sequences):
|
||||
# Gen data for resolver.
|
||||
counter_number = shot_counter_start + (shot_counter_increment * idx)
|
||||
counter = str(counter_number).rjust(shot_counter_digits, "0")
|
||||
var_lookup_table = {
|
||||
"Episode": episode.name,
|
||||
"Sequence": var_sequence,
|
||||
"Project": var_project,
|
||||
"Counter": counter,
|
||||
@ -708,7 +710,9 @@ class KITSU_OT_sqe_multi_edit_strip(bpy.types.Operator):
|
||||
|
||||
# Set metadata.
|
||||
strip.kitsu.sequence_name = sequence
|
||||
strip.kitsu.sequence_id = context.window_manager.selected_sequence_id
|
||||
strip.kitsu.shot_name = shot
|
||||
strip.name = shot
|
||||
|
||||
succeeded.append(strip)
|
||||
logger.info(
|
||||
|
Loading…
Reference in New Issue
Block a user