import csv from clipboard
This commit is contained in:
+28
-8
@@ -171,11 +171,13 @@ def get_cell_items(self, context):
|
||||
settings = get_scene_settings()
|
||||
project = settings.active_project
|
||||
|
||||
return [(cell, cell, '') for cell in project.get_cell_names()]
|
||||
return [(cell, cell, '') for cell in project.get_cell_types().keys()]
|
||||
|
||||
class SpreadsheetImportCell(PropertyGroup):
|
||||
enabled : BoolProperty(default=True)
|
||||
import_name : EnumProperty(items=get_cell_items)
|
||||
|
||||
#type : EnumProperty(items=[(t, t, "") for t in ('METADATA', 'SHOT', 'ASSET_TYPE')])
|
||||
|
||||
|
||||
def get_custom_name_items(self, context):
|
||||
@@ -200,7 +202,7 @@ class SpreadsheetExport(PropertyGroup):
|
||||
|
||||
|
||||
class SpreadsheetImport(PropertyGroup):
|
||||
use_custom_cells: BoolProperty(default=False)
|
||||
#use_custom_cells: BoolProperty(default=False)
|
||||
separator : StringProperty(default='\\n')
|
||||
delimiter : StringProperty(default=';')
|
||||
use_custom_name : BoolProperty(default=False)
|
||||
@@ -258,23 +260,26 @@ class Project(PropertyGroup):
|
||||
|
||||
type : StringProperty()
|
||||
|
||||
def get_cell_names(self):
|
||||
def get_cell_types(self):
|
||||
settings = get_scene_settings()
|
||||
project = settings.active_project
|
||||
|
||||
cell_types = {}
|
||||
cell_names = ['Sequence', 'Shot', 'Frames', 'Description']
|
||||
|
||||
if project.type == 'TVSHOW':
|
||||
cell_names.insert(0, 'Episode')
|
||||
|
||||
cell_types = {cell_name: 'SHOT' for cell_name in cell_names}
|
||||
|
||||
for metadata_type in project.metadata_types:
|
||||
if metadata_type['entity_type'] == "SHOT":
|
||||
cell_names += [metadata_type.name]
|
||||
cell_types[metadata_type.name] = 'METADATA'
|
||||
|
||||
for asset_type in project.asset_types:
|
||||
cell_names += [asset_type.name]
|
||||
cell_types[asset_type.name] = 'ASSET_TYPE'
|
||||
|
||||
return cell_names
|
||||
return cell_types
|
||||
|
||||
def set_spreadsheet(self):
|
||||
|
||||
@@ -406,12 +411,27 @@ class VSETB_UL_spreadsheet_import(UIList):
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
item_type = project.get_cell_types()[item.import_name]
|
||||
|
||||
enabled = True
|
||||
if item_type == 'METADATA' and not project.spreadsheet_import.import_custom_data:
|
||||
enabled = False
|
||||
elif item_type == 'ASSET_TYPE' and not project.spreadsheet_import.import_casting:
|
||||
enabled = False
|
||||
elif item.import_name == 'Frames' and not project.spreadsheet_import.update_edit:
|
||||
enabled = False
|
||||
|
||||
layout.enabled = enabled
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.alignment = 'LEFT'
|
||||
|
||||
row.prop(item, 'enabled', text='')
|
||||
layout.label(text=item.name)
|
||||
layout.prop(item, 'import_name', text='')
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.enabled = item.enabled
|
||||
row.label(text=item.name)
|
||||
row.prop(item, 'import_name', text='')
|
||||
|
||||
|
||||
class VSETB_UL_spreadsheet_export(UIList):
|
||||
|
||||
Reference in New Issue
Block a user