1
0
mirror of https://github.com/DarklightGames/io_scene_psk_psa.git synced 2024-11-28 00:20: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,28 +239,29 @@ 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()
flow.use_property_split = True
flow.use_property_decorate = False
flow.prop(pg, 'sequence_source', text='Source')
if pg.sequence_source in {'TIMELINE_MARKERS', 'NLA_TRACK_STRIPS'}: if pg.sequence_source in {'TIMELINE_MARKERS', 'NLA_TRACK_STRIPS'}:
# ANIMDATA SOURCE # ANIMDATA SOURCE
layout.prop(pg, 'should_override_animation_data') flow.prop(pg, 'should_override_animation_data')
if pg.should_override_animation_data: if pg.should_override_animation_data:
layout.prop(pg, 'animation_data_override', text='') flow.prop(pg, 'animation_data_override', text=' ')
if pg.sequence_source == 'NLA_TRACK_STRIPS': if pg.sequence_source == 'NLA_TRACK_STRIPS':
flow = layout.grid_flow() flow = sequences_panel.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, 'nla_track')
# SELECT ALL/NONE # SELECT ALL/NONE
row = layout.row(align=True) row = sequences_panel.row(align=True)
row.label(text='Select') row.label(text='Select')
row.operator(PSA_OT_export_actions_select_all.bl_idname, text='All', icon='CHECKBOX_HLT') row.operator(PSA_OT_export_actions_select_all.bl_idname, text='All', icon='CHECKBOX_HLT')
row.operator(PSA_OT_export_actions_deselect_all.bl_idname, text='None', icon='CHECKBOX_DEHLT') row.operator(PSA_OT_export_actions_deselect_all.bl_idname, text='None', icon='CHECKBOX_DEHLT')
@ -268,19 +269,19 @@ class PSA_OT_export(Operator, ExportHelper):
# ACTIONS # ACTIONS
if pg.sequence_source == 'ACTIONS': if pg.sequence_source == 'ACTIONS':
rows = max(3, min(len(pg.action_list), 10)) rows = max(3, min(len(pg.action_list), 10))
layout.template_list('PSA_UL_export_sequences', '', pg, 'action_list', pg, 'action_list_index', rows=rows) sequences_panel.template_list('PSA_UL_export_sequences', '', pg, 'action_list', pg, 'action_list_index', rows=rows)
elif pg.sequence_source == 'TIMELINE_MARKERS': elif pg.sequence_source == 'TIMELINE_MARKERS':
rows = max(3, min(len(pg.marker_list), 10)) 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) sequences_panel.template_list('PSA_UL_export_sequences', '', pg, 'marker_list', pg, 'marker_list_index', rows=rows)
elif pg.sequence_source == 'NLA_TRACK_STRIPS': elif pg.sequence_source == 'NLA_TRACK_STRIPS':
rows = max(3, min(len(pg.nla_strip_list), 10)) 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) sequences_panel.template_list('PSA_UL_export_sequences', '', pg, 'nla_strip_list', pg, 'nla_strip_list_index', rows=rows)
col = layout.column() flow = sequences_panel.grid_flow()
col.use_property_split = True flow.use_property_split = True
col.use_property_decorate = False flow.use_property_decorate = False
col.prop(pg, 'sequence_name_prefix') flow.prop(pg, 'sequence_name_prefix', text='Name Prefix')
col.prop(pg, 'sequence_name_suffix') flow.prop(pg, 'sequence_name_suffix')
# Determine if there is going to be a naming conflict and display an error, if so. # 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] selected_items = [x for x in pg.action_list if x.is_selected]
@ -291,27 +292,41 @@ class PSA_OT_export(Operator, ExportHelper):
layout.label(text=f'Duplicate action: {action_name}', icon='ERROR') layout.label(text=f'Duplicate action: {action_name}', icon='ERROR')
break break
layout.separator() # 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)
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') 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)
) )
) )