diff --git a/operators/tracker.py b/operators/tracker.py index 996a980..83aeb98 100644 --- a/operators/tracker.py +++ b/operators/tracker.py @@ -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()