Fix Issue when reloading Assets multiple times

Crash because of previews already loaded
pull/5/head
Clément Ducarteron 2023-03-23 17:34:59 +01:00
parent 8dae79cd35
commit 2504c5ac53
1 changed files with 9 additions and 2 deletions

View File

@ -295,7 +295,8 @@ class VSETB_OT_load_assets(Operator):
preview_path = Path(PREVIEWS_DIR / project.id / preview_id).with_suffix('.png')
tracker.download_preview(preview_id, preview_path)
ASSET_PREVIEWS.load(preview_id, preview_path.as_posix(), 'IMAGE')
if preview_id not in ASSET_PREVIEWS:
ASSET_PREVIEWS.load(preview_id, preview_path.as_posix(), 'IMAGE', True)
self.report({'INFO'}, f'Assets for {project.name} successfully loaded')
@ -330,6 +331,12 @@ class VSETB_OT_load_projects(Operator):
episode.name = episode_data['name']
episode.id = episode_data['id']
for metadata_data in tracker.get_shots_metadata(project_data):
metadata_type = project.metadata_types.add()
metadata_type.name = metadata_data
# settings.load_metadata_types()
return {'FINISHED'}