start import csv
parent
2d24e3da7f
commit
ec4212740c
|
@ -262,6 +262,7 @@ class VSETB_OT_paste_casting(Operator):
|
|||
|
||||
for strip in context.selected_sequences:
|
||||
strip_settings = strip.vsetb_strip_settings
|
||||
strip.vsetb_strip_settings.casting.clear()
|
||||
for casting_data in casting_datas:
|
||||
|
||||
item = strip.vsetb_strip_settings.casting.add()
|
||||
|
|
|
@ -117,8 +117,22 @@ class VSETB_OT_export_spreadsheet(Operator):
|
|||
#options = project.spreadsheet_options
|
||||
|
||||
layout = self.layout
|
||||
row = layout.row(align=True)
|
||||
row.prop(spreadsheet, 'use_custom_cells', text='Custom Cells')
|
||||
|
||||
row = layout.row()
|
||||
col = layout.column(align=False)
|
||||
col.enabled = spreadsheet.use_custom_cells
|
||||
|
||||
row = col.row(align=True, heading='Custom Asset Name')
|
||||
row.use_property_split = True
|
||||
row.use_property_decorate = False
|
||||
row.prop(spreadsheet, 'use_custom_name', text='')
|
||||
sub = row.row(align=False)
|
||||
sub.enabled = spreadsheet.use_custom_name
|
||||
sub.prop(spreadsheet, 'custom_name', text='')
|
||||
sub.label(icon='BLANK1')
|
||||
|
||||
row = col.row()
|
||||
row.template_list("VSETB_UL_spreadsheet", "spreadsheet_export", spreadsheet, "cells", spreadsheet, "cell_index", rows=8)
|
||||
|
||||
col_tool = row.column(align=True)
|
||||
|
@ -136,13 +150,7 @@ class VSETB_OT_export_spreadsheet(Operator):
|
|||
|
||||
col = layout.column()
|
||||
col.use_property_split = True
|
||||
|
||||
row = col.row(align=True, heading='Custom Name')
|
||||
#row.use_property_split = True
|
||||
row.prop(spreadsheet, 'use_custom_name', text='')
|
||||
sub = row.row(align=True)
|
||||
sub.enabled = spreadsheet.use_custom_name
|
||||
sub.prop(spreadsheet, 'custom_name', text='')
|
||||
col.use_property_decorate = False
|
||||
|
||||
col.separator()
|
||||
|
||||
|
@ -295,10 +303,62 @@ class VSETB_OT_import_spreadsheet(Operator):
|
|||
settings = get_scene_settings()
|
||||
project = settings.active_project
|
||||
|
||||
return context.window_manager.invoke_props_dialog(self)
|
||||
context.window_manager.fileselect_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
def draw(self, context):
|
||||
scn = context.scene
|
||||
settings = get_scene_settings()
|
||||
project = settings.active_project
|
||||
spreadsheet = project.spreadsheet_import
|
||||
#options = project.spreadsheet_options
|
||||
|
||||
layout = self.layout
|
||||
row = layout.row(align=True)
|
||||
row.prop(spreadsheet, 'use_custom_cells', text='Custom Cells')
|
||||
|
||||
col = layout.column(align=False)
|
||||
col.enabled = spreadsheet.use_custom_cells
|
||||
|
||||
row = col.row(align=True, heading='Custom Asset Name')
|
||||
row.use_property_split = True
|
||||
row.use_property_decorate = False
|
||||
row.prop(spreadsheet, 'use_custom_name', text='')
|
||||
sub = row.row(align=False)
|
||||
sub.enabled = spreadsheet.use_custom_name
|
||||
sub.prop(spreadsheet, 'custom_name', text='')
|
||||
sub.label(icon='BLANK1')
|
||||
|
||||
row = layout.row()
|
||||
row.enabled = spreadsheet.use_custom_cells
|
||||
row.template_list("VSETB_UL_spreadsheet", "spreadsheet_import", spreadsheet, "cells", spreadsheet, "cell_index", rows=8)
|
||||
|
||||
col_tool = row.column(align=True)
|
||||
|
||||
#bpy.types.VSETB_PT_presets.draw_panel_header(col_tool)
|
||||
#col_tool.operator('wm.call_menu', icon="PRESET").name = 'VSETB_MT_spreadsheet_presets'
|
||||
#col_tool.operator('vse_toolbox.load_spreadsheet_preset', icon='PRESET', text="")
|
||||
op = col_tool.operator('wm.call_panel', icon="PRESET", emboss=False, text='')
|
||||
op.name = 'VSETB_PT_presets'
|
||||
op.keep_open = False
|
||||
|
||||
col_tool.separator()
|
||||
col_tool.operator('vse_toolbox.spreadsheet_move', icon='TRIA_UP', text="").direction = 'UP'
|
||||
col_tool.operator('vse_toolbox.spreadsheet_move', icon='TRIA_DOWN', text="").direction = 'DOWN'
|
||||
|
||||
col = layout.column()
|
||||
col.use_property_split = True
|
||||
row.use_property_decorate = False
|
||||
|
||||
#col.separator()
|
||||
|
||||
row = col.row(align=False)
|
||||
|
||||
col.prop(spreadsheet, "separator", expand=True, text='Separator')
|
||||
if self.filepath.endwith('.csv'):
|
||||
col.prop(spreadsheet, "delimiter", expand=True, text='Delimiter')
|
||||
|
||||
col.separator()
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
|
@ -310,6 +370,7 @@ classes = (
|
|||
VSETB_MT_export_spreadsheet_presets,
|
||||
VSETB_OT_spreadsheet_cell_move,
|
||||
VSETB_OT_export_spreadsheet,
|
||||
VSETB_OT_import_spreadsheet
|
||||
)
|
||||
|
||||
def register():
|
||||
|
|
|
@ -160,7 +160,8 @@ class VSETB_PT_imports(VSETB_main, Panel):
|
|||
|
||||
col = layout.column()
|
||||
#row = col.row(align=True)
|
||||
col.operator('vse_toolbox.import_files', text='Import', icon='IMPORT')
|
||||
#col.operator('vse_toolbox.import_files', text='Import', icon='IMPORT')
|
||||
col.operator('vse_toolbox.import_spreadsheet', text='Import Spreadsheet', icon='SPREADSHEET')
|
||||
|
||||
|
||||
class VSETB_PT_presets(PresetPanel, Panel):
|
||||
|
|
|
@ -173,6 +173,7 @@ def get_custom_name_items(self, context):
|
|||
return [(m.field_name, m.name, '') for m in project.metadata_types if m.entity_type=='ASSET']
|
||||
|
||||
class SpreadsheetExport(PropertyGroup):
|
||||
use_custom_cells: BoolProperty(default=False)
|
||||
format : EnumProperty(items=[(i, i, '') for i in ('CSV', 'XLSX')])
|
||||
separator : StringProperty(default='\\n')
|
||||
delimiter : StringProperty(default=';')
|
||||
|
@ -188,13 +189,13 @@ class SpreadsheetExport(PropertyGroup):
|
|||
|
||||
|
||||
class SpreadsheetImport(PropertyGroup):
|
||||
use_custom_cells: BoolProperty(default=False)
|
||||
separator : StringProperty(default='\\n')
|
||||
delimiter : StringProperty(default=';')
|
||||
use_custom_name : BoolProperty(default=False)
|
||||
custom_name : EnumProperty(items=get_custom_name_items,
|
||||
description='Use a custom name for asset using a metadata value')
|
||||
|
||||
show_settings : BoolProperty(default=False)
|
||||
cells: CollectionProperty(type=SpreadsheetCell)
|
||||
cell_index : IntProperty(name='Spreadsheet Index', default=0)
|
||||
|
||||
|
|
Loading…
Reference in New Issue