fix import spreadsheet
parent
ba47d6c94f
commit
a14b28362f
|
@ -154,7 +154,7 @@ class VSETB_OT_spreadsheet_from_clipboard(Operator):
|
||||||
spreadsheet = context.window_manager.clipboard
|
spreadsheet = context.window_manager.clipboard
|
||||||
|
|
||||||
cell_types = project.get_cell_types()
|
cell_types = project.get_cell_types()
|
||||||
rows = list(csv.reader(StringIO(spreadsheet), delimiter='\t'))
|
rows = [r for r in csv.reader(StringIO(spreadsheet), delimiter='\t') if any(r)]
|
||||||
for cell_name in rows[0]:
|
for cell_name in rows[0]:
|
||||||
if not cell_name:
|
if not cell_name:
|
||||||
continue
|
continue
|
||||||
|
@ -307,27 +307,30 @@ class VSETB_OT_import_spreadsheet(Operator):
|
||||||
|
|
||||||
header = SPREADSHEET[0]
|
header = SPREADSHEET[0]
|
||||||
|
|
||||||
|
print(SPREADSHEET[:2])
|
||||||
|
|
||||||
cell_types = project.get_cell_types()
|
cell_types = project.get_cell_types()
|
||||||
cell_names = {k: spreadsheet.cells[k].import_name for k in header if k}
|
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')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
frame_start = scn.frame_start
|
frame_start = scn.frame_start
|
||||||
for row in SPREADSHEET[1:]:
|
for row in SPREADSHEET[1:]:
|
||||||
|
print(row)
|
||||||
cell_data = {cell_names[k]: v for k, v in zip(header, row) if k}
|
cell_data = {cell_names[k]: v for k, v in zip(header, row) if k}
|
||||||
#cell_data = {k: v for k, v in zip(header, row)}
|
#cell_data = {k: v for k, v in zip(header, row)}
|
||||||
shot_name = cell_data['Shot']
|
shot_name = cell_data['Shot']
|
||||||
nb_frames = int(cell_data['Nb Frames'])
|
|
||||||
|
|
||||||
strip = next((s for s in sequencer if s.vsetb_strip_settings.source_name == shot_name), None)
|
#strip = next((s for s in sequencer if s.vsetb_strip_settings.source_name == shot_name), None)
|
||||||
|
strip = next((s for s in shot_strips if s.name == shot_name), None)
|
||||||
|
|
||||||
|
print(cell_data)
|
||||||
print("shot_name", shot_name, strip)
|
print("shot_name", shot_name, strip)
|
||||||
|
|
||||||
if spreadsheet.update_edit and nb_frames_cell.enabled:
|
if spreadsheet.update_edit and (nb_frames_cell and nb_frames_cell.enabled):
|
||||||
|
nb_frames = int(cell_data['Nb Frames'])
|
||||||
print('Import Edit')
|
print('Import Edit')
|
||||||
|
|
||||||
#print(frame_start, nb_frames, type(nb_frames))
|
#print(frame_start, nb_frames, type(nb_frames))
|
||||||
|
@ -356,6 +359,7 @@ class VSETB_OT_import_spreadsheet(Operator):
|
||||||
|
|
||||||
if not strip:
|
if not strip:
|
||||||
self.report({"WARNING"}, f'No strip found with source name {shot_name}, update the edit')
|
self.report({"WARNING"}, f'No strip found with source name {shot_name}, update the edit')
|
||||||
|
continue
|
||||||
|
|
||||||
strip_settings = strip.vsetb_strip_settings
|
strip_settings = strip.vsetb_strip_settings
|
||||||
|
|
||||||
|
@ -502,6 +506,8 @@ class VSETB_OT_export_spreadsheet(Operator):
|
||||||
for strip in get_strips('Shots'):
|
for strip in get_strips('Shots'):
|
||||||
row = []
|
row = []
|
||||||
for cell in cells:
|
for cell in cells:
|
||||||
|
#print(cell.field_name)
|
||||||
|
|
||||||
if cell.type == "METADATA":
|
if cell.type == "METADATA":
|
||||||
row += [getattr(strip.vsetb_strip_settings.metadata, cell.field_name)]
|
row += [getattr(strip.vsetb_strip_settings.metadata, cell.field_name)]
|
||||||
elif cell.type == "ASSET_TYPE":
|
elif cell.type == "ASSET_TYPE":
|
||||||
|
|
Loading…
Reference in New Issue