read spreadsheet

pull/5/head
florentin.luce 2024-02-14 15:04:11 +01:00
parent 10f9824ac2
commit 0baf457abd
2 changed files with 9 additions and 4 deletions

View File

@ -148,8 +148,6 @@ 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:
@ -157,8 +155,12 @@ class VSETB_OT_spreadsheet_from_file(Operator):
cell = import_cells.add()
cell.name = cell_name
cell.import_name = max(cell_types.keys(), key=lambda x: fuzzy_match(cell_name, x))
cell.enabled = True
matches = [(k, fuzzy_match(cell_name, k)) for k in cell_types.keys()]
best_name, best_match = max(matches, key=lambda x: x[1])
cell.import_name = best_name
cell.enabled = best_match > 0.75
project.spreadsheet_import.use_custom_cells = True

View File

@ -308,6 +308,9 @@ class Project(PropertyGroup):
for asset_type in project.asset_types:
cell_types[asset_type.name] = 'ASSET_TYPE'
for task_type in project.task_types:
cell_types[task_type.name] = 'TASK_TYPE'
return cell_types
def set_spreadsheet(self):