Fix import csv and update edit
This commit is contained in:
@@ -86,6 +86,7 @@ class VSETB_OT_import_files(Operator):
|
||||
|
||||
import_edit : BoolProperty(name='', default=True)
|
||||
edit: EnumProperty(name='', items=lambda s, c: EDITS)
|
||||
match_by : EnumProperty(name='Match By', items=[('NAME', 'Name', ''), ('INDEX', 'Index', '')])
|
||||
|
||||
import_movie : BoolProperty(name='', default=False)
|
||||
movie: EnumProperty(name='', items=lambda s, c: MOVIES)
|
||||
@@ -108,19 +109,23 @@ class VSETB_OT_import_files(Operator):
|
||||
col = layout.column(align=True)
|
||||
col.operator('import.auto_select_files', text='Auto Select')
|
||||
|
||||
row = self.layout.row(heading="Import Edit", align=True)
|
||||
row = layout.row(heading="Import Edit", align=True)
|
||||
row.prop(self, 'import_edit')
|
||||
sub = row.row(align=True)
|
||||
sub.active = self.import_edit
|
||||
sub.prop(self, 'edit')
|
||||
row = layout.row(align=True)
|
||||
row.prop(self, 'match_by', expand=True)
|
||||
|
||||
row = self.layout.row(heading="Import Movie", align=True)
|
||||
layout.separator()
|
||||
|
||||
row = layout.row(heading="Import Movie", align=True)
|
||||
row.prop(self, 'import_movie')
|
||||
sub = row.row()
|
||||
sub.active = self.import_movie
|
||||
sub.prop(self, 'movie')
|
||||
|
||||
row = self.layout.row(heading="Import Sound", align=True)
|
||||
row = layout.row(heading="Import Sound", align=True)
|
||||
row.prop(self, 'import_sound')
|
||||
sub = row.row()
|
||||
sub.active = self.import_sound
|
||||
@@ -159,7 +164,7 @@ class VSETB_OT_import_files(Operator):
|
||||
if self.import_edit:
|
||||
print(f'[>.] Loading Edit from: {str(edit_filepath)}')
|
||||
|
||||
import_edit(edit_filepath, adapter="cmx_3600")
|
||||
import_edit(edit_filepath, adapter="cmx_3600", match_by=self.match_by)
|
||||
|
||||
if self.import_movie:
|
||||
print(f'[>.] Loading Movie from: {str(movie_filepath)}')
|
||||
|
||||
@@ -106,8 +106,12 @@ class VSETB_OT_spreadsheet_from_file(Operator):
|
||||
def execute(self, context):
|
||||
scn = context.scene
|
||||
project = get_scene_settings().active_project
|
||||
spreadsheet = project.spreadsheet_import
|
||||
|
||||
import_cells = project.spreadsheet_import.cells
|
||||
separator = spreadsheet.separator.replace('\\n', '\n').replace('\\t', '\t').replace('\\r', '\r')
|
||||
delimiter = spreadsheet.delimiter.replace('\\n', '\n').replace('\\t', '\t').replace('\\r', '\r')
|
||||
|
||||
import_cells = spreadsheet.cells
|
||||
import_cells.clear()
|
||||
|
||||
if not self.filepath:
|
||||
@@ -121,8 +125,8 @@ class VSETB_OT_spreadsheet_from_file(Operator):
|
||||
filepath = Path(self.filepath)
|
||||
|
||||
if filepath.suffix.lower() == '.csv':
|
||||
with open(filepath, newline='\n') as csvfile:
|
||||
rows = list(csv.reader(csvfile))
|
||||
with open(filepath, newline=separator) as csvfile:
|
||||
rows = list(csv.reader(csvfile, delimiter=delimiter))
|
||||
|
||||
elif filepath.suffix.lower() == '.xlsx':
|
||||
try:
|
||||
@@ -144,6 +148,8 @@ class VSETB_OT_spreadsheet_from_file(Operator):
|
||||
|
||||
rows = [r for r in rows if any(r)]
|
||||
|
||||
print('rows', rows)
|
||||
|
||||
cell_types = project.get_cell_types()
|
||||
for cell_name in rows[0]:
|
||||
if not cell_name:
|
||||
@@ -338,7 +344,7 @@ class VSETB_OT_import_spreadsheet(Operator):
|
||||
cell_types = project.get_cell_types()
|
||||
cell_names = {k: spreadsheet.cells[k].import_name for k in header if k}
|
||||
|
||||
separator = spreadsheet.separator.replace('\\n', '\n').replace('\\t', '\t').replace('\\r', '\r')
|
||||
#separator = spreadsheet.separator.replace('\\n', '\n').replace('\\t', '\t').replace('\\r', '\r')
|
||||
|
||||
shot_strips = get_strips('Shots')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user