Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-05-18 10:59:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-05-18 10:59:52 +0300
commit52d8b3a014b463fbc22faca258ae4e2608e2c97e (patch)
treeaed5c455d91898a9d51c66a766f1ab6aa23e8b7c /release/scripts/startup/bl_ui/space_topbar.py
parent98e18c41b6fd9509a561ac7a05ac81e6b3cbeda9 (diff)
Fix T76849: Duplicate templates show in the New menu
Diffstat (limited to 'release/scripts/startup/bl_ui/space_topbar.py')
-rw-r--r--release/scripts/startup/bl_ui/space_topbar.py10
1 files changed, 6 insertions, 4 deletions
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)