[Bf-blender-cvs] [52d8b3a014b] blender-v2.83-release: Fix T76849: Duplicate templates show in the New menu

Campbell Barton noreply at git.blender.org
Mon May 18 10:02:49 CEST 2020


Commit: 52d8b3a014b463fbc22faca258ae4e2608e2c97e
Author: Campbell Barton
Date:   Mon May 18 17:59:52 2020 +1000
Branches: blender-v2.83-release
https://developer.blender.org/rB52d8b3a014b463fbc22faca258ae4e2608e2c97e

Fix T76849: Duplicate templates show in the New menu

===================================================================

M	release/scripts/startup/bl_ui/space_topbar.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 1e6f03c2b0c..9cc979f7546 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -316,16 +316,18 @@ class TOPBAR_MT_file_new(Menu):
 
         template_paths = bpy.utils.app_template_paths()
 
-        # expand template paths
-        app_templates = []
+        # Expand template paths.
+
+        # Use a set to avoid duplicate user/system templates.
+        # This is a corner case, but users managed to do it! T76849.
+        app_templates = set()
         for path in template_paths:
             for d in os.listdir(path):
                 if d.startswith(("__", ".")):
                     continue
                 template = os.path.join(path, d)
                 if os.path.isdir(template):
-                    # template_paths_expand.append(template)
-                    app_templates.append(d)
+                    app_templates.add(d)
 
         return sorted(app_templates)



More information about the Bf-blender-cvs mailing list