1
0
mirror of https://github.com/DarklightGames/io_scene_psk_psa.git synced 2025-02-17 10:08:31 +01:00

PSA import dialog now uses new Blender 4.1 UI panels

This commit is contained in:
Colin Basnett 2024-03-14 19:06:29 -07:00
parent a93450eab9
commit d4d46bea66

View File

@ -190,67 +190,71 @@ class PSA_OT_import(Operator, ImportHelper):
layout = self.layout
pg = getattr(context.scene, 'psa_import')
if pg.psa_error:
row = layout.row()
row.label(text='Select a PSA file', icon='ERROR')
else:
box = layout.box()
sequences_header, sequences_panel = layout.panel('sequences_panel_id', default_closed=False)
sequences_header.label(text='Sequences')
box.label(text=f'Sequences ({len(pg.sequence_list)})', icon='ARMATURE_DATA')
if sequences_panel:
if pg.psa_error:
row = sequences_panel.row()
row.label(text='Select a PSA file', icon='ERROR')
else:
# Select buttons.
rows = max(3, min(len(pg.sequence_list), 10))
# Select buttons.
rows = max(3, min(len(pg.sequence_list), 10))
row = sequences_panel.row()
col = row.column()
row = box.row()
col = row.column()
row2 = col.row(align=True)
row2.label(text='Select')
row2.operator(PSA_OT_import_sequences_from_text.bl_idname, text='', icon='TEXT')
row2.operator(PSA_OT_import_sequences_select_all.bl_idname, text='All', icon='CHECKBOX_HLT')
row2.operator(PSA_OT_import_sequences_deselect_all.bl_idname, text='None', icon='CHECKBOX_DEHLT')
row2 = col.row(align=True)
row2.label(text='Select')
row2.operator(PSA_OT_import_sequences_from_text.bl_idname, text='', icon='TEXT')
row2.operator(PSA_OT_import_sequences_select_all.bl_idname, text='All', icon='CHECKBOX_HLT')
row2.operator(PSA_OT_import_sequences_deselect_all.bl_idname, text='None', icon='CHECKBOX_DEHLT')
col = col.row()
col.template_list('PSA_UL_import_sequences', '', pg, 'sequence_list', pg, 'sequence_list_index', rows=rows)
col = col.row()
col.template_list('PSA_UL_import_sequences', '', pg, 'sequence_list', pg, 'sequence_list_index', rows=rows)
col = layout.column(heading='')
col.use_property_split = True
col.use_property_decorate = False
col.prop(pg, 'should_overwrite')
col = layout.column(heading='Write')
col.use_property_split = True
col.use_property_decorate = False
col.prop(pg, 'should_write_keyframes')
col.prop(pg, 'should_write_metadata')
col = layout.column()
col.use_property_split = True
col.use_property_decorate = False
col.prop(pg, 'bone_mapping_mode')
if pg.should_write_keyframes:
col = layout.column(heading='Keyframes')
col = sequences_panel.column(heading='')
col.use_property_split = True
col.use_property_decorate = False
col.prop(pg, 'should_convert_to_samples')
col.separator()
# FPS
col.prop(pg, 'fps_source')
if pg.fps_source == 'CUSTOM':
col.prop(pg, 'fps_custom')
col.prop(pg, 'should_overwrite')
col.prop(pg, 'should_use_action_name_prefix')
if pg.should_use_action_name_prefix:
col.prop(pg, 'action_name_prefix')
col = layout.column(heading='Options')
col.use_property_split = True
col.use_property_decorate = False
col.prop(pg, 'should_use_fake_user')
col.prop(pg, 'should_stash')
col.prop(pg, 'should_use_config_file')
data_header, data_panel = layout.panel('data_panel_id', default_closed=False)
data_header.label(text='Data')
col.prop(pg, 'should_use_action_name_prefix')
if data_panel:
col = data_panel.column(heading='Write')
col.use_property_split = True
col.use_property_decorate = False
col.prop(pg, 'should_write_keyframes')
col.prop(pg, 'should_write_metadata')
if pg.should_use_action_name_prefix:
col.prop(pg, 'action_name_prefix')
if pg.should_write_keyframes:
col = col.column(heading='Keyframes')
col.use_property_split = True
col.use_property_decorate = False
col.prop(pg, 'should_convert_to_samples')
advanced_header, advanced_panel = layout.panel('advanced_panel_id', default_closed=True)
advanced_header.label(text='Advanced')
if advanced_panel:
col = advanced_panel.column()
col.use_property_split = True
col.use_property_decorate = False
col.prop(pg, 'bone_mapping_mode')
col = advanced_panel.column(heading='Options')
col.use_property_split = True
col.use_property_decorate = False
col.prop(pg, 'should_use_fake_user')
col.prop(pg, 'should_stash')
col.prop(pg, 'should_use_config_file')
class PSA_FH_import(FileHandler):