fix load project

pull/5/head
ChristopheSeux 2024-02-14 11:19:17 +01:00
parent 9fc423d6be
commit 571f7d5807
1 changed files with 7 additions and 4 deletions

View File

@ -108,7 +108,8 @@ class VSETB_OT_load_projects(Operator):
prefs = get_addon_prefs()
tracker = prefs.tracker
# old_project_name = settings.project_name.replace(' ', '_').upper()
prev_project_name = settings.project_name#.replace(' ', '_').upper()
print("prev_project_name", prev_project_name)
# old_episode_name = None
# if settings.active_project:
@ -120,7 +121,7 @@ class VSETB_OT_load_projects(Operator):
tracker.connect()
project_datas = tracker.get_projects()
for project_data in project_datas:
for project_data in sorted(project_datas, key=lambda x: x['name']):
project = settings.projects.get(project_data['name'])
if not project:
project = settings.projects.add()
@ -182,14 +183,16 @@ class VSETB_OT_load_projects(Operator):
project.set_spreadsheet()
bpy.ops.vse_toolbox.load_settings()
# Remove deleted projects
project_names = [p['name'] for p in project_datas]
for project in reversed(settings.projects):
if project.name not in project_names:
settings.projects.remove(list(settings.projects).index(project))
# Restore previous project
settings.project_name = prev_project_name
bpy.ops.vse_toolbox.load_settings()
#if settings.active_project:
# settings.active_project.set_strip_metadata()