1
0
mirror of https://github.com/DarklightGames/io_scene_psk_psa.git synced 2024-11-27 16:10:48 +01:00

PSA export dialog now uses inline panels

This commit is contained in:
Colin Basnett 2024-07-10 01:30:45 -07:00
parent 02913f6922
commit d26d195a85
2 changed files with 75 additions and 60 deletions

View File

@ -239,79 +239,94 @@ class PSA_OT_export(Operator, ExportHelper):
layout = self.layout layout = self.layout
pg = getattr(context.scene, 'psa_export') pg = getattr(context.scene, 'psa_export')
# FPS sequences_header, sequences_panel = layout.panel('Sequences', default_closed=False)
layout.prop(pg, 'fps_source', text='FPS') sequences_header.label(text='Sequences', icon='ACTION')
if pg.fps_source == 'CUSTOM':
layout.prop(pg, 'fps_custom', text='Custom')
# SOURCE if sequences_panel:
layout.prop(pg, 'sequence_source', text='Source') flow = sequences_panel.grid_flow()
if pg.sequence_source in {'TIMELINE_MARKERS', 'NLA_TRACK_STRIPS'}:
# ANIMDATA SOURCE
layout.prop(pg, 'should_override_animation_data')
if pg.should_override_animation_data:
layout.prop(pg, 'animation_data_override', text='')
if pg.sequence_source == 'NLA_TRACK_STRIPS':
flow = layout.grid_flow()
flow.use_property_split = True flow.use_property_split = True
flow.use_property_decorate = False flow.use_property_decorate = False
flow.prop(pg, 'nla_track') flow.prop(pg, 'sequence_source', text='Source')
# SELECT ALL/NONE if pg.sequence_source in {'TIMELINE_MARKERS', 'NLA_TRACK_STRIPS'}:
row = layout.row(align=True) # ANIMDATA SOURCE
row.label(text='Select') flow.prop(pg, 'should_override_animation_data')
row.operator(PSA_OT_export_actions_select_all.bl_idname, text='All', icon='CHECKBOX_HLT') if pg.should_override_animation_data:
row.operator(PSA_OT_export_actions_deselect_all.bl_idname, text='None', icon='CHECKBOX_DEHLT') flow.prop(pg, 'animation_data_override', text=' ')
# ACTIONS if pg.sequence_source == 'NLA_TRACK_STRIPS':
if pg.sequence_source == 'ACTIONS': flow = sequences_panel.grid_flow()
rows = max(3, min(len(pg.action_list), 10)) flow.use_property_split = True
layout.template_list('PSA_UL_export_sequences', '', pg, 'action_list', pg, 'action_list_index', rows=rows) flow.use_property_decorate = False
elif pg.sequence_source == 'TIMELINE_MARKERS': flow.prop(pg, 'nla_track')
rows = max(3, min(len(pg.marker_list), 10))
layout.template_list('PSA_UL_export_sequences', '', pg, 'marker_list', pg, 'marker_list_index', rows=rows)
elif pg.sequence_source == 'NLA_TRACK_STRIPS':
rows = max(3, min(len(pg.nla_strip_list), 10))
layout.template_list('PSA_UL_export_sequences', '', pg, 'nla_strip_list', pg, 'nla_strip_list_index', rows=rows)
col = layout.column() # SELECT ALL/NONE
col.use_property_split = True row = sequences_panel.row(align=True)
col.use_property_decorate = False row.label(text='Select')
col.prop(pg, 'sequence_name_prefix') row.operator(PSA_OT_export_actions_select_all.bl_idname, text='All', icon='CHECKBOX_HLT')
col.prop(pg, 'sequence_name_suffix') row.operator(PSA_OT_export_actions_deselect_all.bl_idname, text='None', icon='CHECKBOX_DEHLT')
# Determine if there is going to be a naming conflict and display an error, if so. # ACTIONS
selected_items = [x for x in pg.action_list if x.is_selected] if pg.sequence_source == 'ACTIONS':
action_names = [x.name for x in selected_items] rows = max(3, min(len(pg.action_list), 10))
action_name_counts = Counter(action_names) sequences_panel.template_list('PSA_UL_export_sequences', '', pg, 'action_list', pg, 'action_list_index', rows=rows)
for action_name, count in action_name_counts.items(): elif pg.sequence_source == 'TIMELINE_MARKERS':
if count > 1: rows = max(3, min(len(pg.marker_list), 10))
layout.label(text=f'Duplicate action: {action_name}', icon='ERROR') sequences_panel.template_list('PSA_UL_export_sequences', '', pg, 'marker_list', pg, 'marker_list_index', rows=rows)
break elif pg.sequence_source == 'NLA_TRACK_STRIPS':
rows = max(3, min(len(pg.nla_strip_list), 10))
sequences_panel.template_list('PSA_UL_export_sequences', '', pg, 'nla_strip_list', pg, 'nla_strip_list_index', rows=rows)
layout.separator() flow = sequences_panel.grid_flow()
flow.use_property_split = True
flow.use_property_decorate = False
flow.prop(pg, 'sequence_name_prefix', text='Name Prefix')
flow.prop(pg, 'sequence_name_suffix')
# Determine if there is going to be a naming conflict and display an error, if so.
selected_items = [x for x in pg.action_list if x.is_selected]
action_names = [x.name for x in selected_items]
action_name_counts = Counter(action_names)
for action_name, count in action_name_counts.items():
if count > 1:
layout.label(text=f'Duplicate action: {action_name}', icon='ERROR')
break
# FPS
flow.prop(pg, 'fps_source')
if pg.fps_source == 'CUSTOM':
flow.prop(pg, 'fps_custom', text='Custom')
# BONES # BONES
row = layout.row(align=True) bones_header, bones_panel = layout.panel('Bones', default_closed=False)
row.prop(pg, 'bone_filter_mode', text='Bones') bones_header.label(text='Bones', icon='BONE_DATA')
if bones_panel:
row = bones_panel.row(align=True)
row.prop(pg, 'bone_filter_mode', text='Bones')
if pg.bone_filter_mode == 'BONE_COLLECTIONS': if pg.bone_filter_mode == 'BONE_COLLECTIONS':
row = layout.row(align=True) row = bones_panel.row(align=True)
row.label(text='Select') row.label(text='Select')
row.operator(PSA_OT_export_bone_collections_select_all.bl_idname, text='All', icon='CHECKBOX_HLT') row.operator(PSA_OT_export_bone_collections_select_all.bl_idname, text='All', icon='CHECKBOX_HLT')
row.operator(PSA_OT_export_bone_collections_deselect_all.bl_idname, text='None', icon='CHECKBOX_DEHLT') row.operator(PSA_OT_export_bone_collections_deselect_all.bl_idname, text='None', icon='CHECKBOX_DEHLT')
rows = max(3, min(len(pg.bone_collection_list), 10)) rows = max(3, min(len(pg.bone_collection_list), 10))
layout.template_list('PSX_UL_bone_collection_list', '', pg, 'bone_collection_list', pg, 'bone_collection_list_index', bones_panel.template_list('PSX_UL_bone_collection_list', '', pg, 'bone_collection_list', pg, 'bone_collection_list_index',
rows=rows) rows=rows)
layout.prop(pg, 'should_enforce_bone_name_restrictions') flow = bones_panel.grid_flow()
flow.use_property_split = True
flow.use_property_decorate = False
flow.prop(pg, 'should_enforce_bone_name_restrictions')
layout.separator() # ADVANCED
advanced_header, advanced_panel = layout.panel('Advanced', default_closed=False)
advanced_header.label(text='Advanced')
# ROOT MOTION if advanced_panel:
layout.prop(pg, 'root_motion', text='Root Motion') flow = advanced_panel.grid_flow()
flow.use_property_split = True
flow.use_property_decorate = False
flow.prop(pg, 'root_motion', text='Root Motion')
@classmethod @classmethod
def _check_context(cls, context): def _check_context(cls, context):

View File

@ -125,7 +125,7 @@ class PSA_PG_export(PropertyGroup):
description='', description='',
items=( items=(
('SCENE', 'Scene', '', 'SCENE_DATA', 0), ('SCENE', 'Scene', '', 'SCENE_DATA', 0),
('ACTION_METADATA', 'Action Metadata', 'The frame rate will be determined by action\'s FPS property found in the PSA Export panel.\n\nIf the Sequence Source is Timeline Markers, the lowest value of all contributing actions will be used', 'PROPERTIES', 1), ('ACTION_METADATA', 'Action Metadata', 'The frame rate will be determined by action\'s FPS property found in the PSA Export panel.\n\nIf the Sequence Source is Timeline Markers, the lowest value of all contributing actions will be used', 'ACTION', 1),
('CUSTOM', 'Custom', '', 2) ('CUSTOM', 'Custom', '', 2)
) )
) )