diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-09-15 10:30:58 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-09-15 10:35:20 +0300 |
commit | 028c5592cd80469c695fba9cd5276bba354df2cd (patch) | |
tree | c9a4698132e8a0738f6bb565bc8240edacb1370b /release | |
parent | 4bd014e951a1b2c30e035a24eda3fbb32f3fdd62 (diff) | |
parent | 8b3ad25862e47fca9e4ec923f4e9157b278173ed (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/bpy/utils/__init__.py | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py index 185a0e73279..c3175f93f4e 100644 --- a/release/scripts/modules/bpy/utils/__init__.py +++ b/release/scripts/modules/bpy/utils/__init__.py @@ -400,27 +400,26 @@ def app_template_paths(subdir=None): :return: app template paths. :rtype: generator """ + # Note: keep in sync with: Blender's BKE_appdir_app_template_any - # note: LOCAL, USER, SYSTEM order matches script resolution order. subdir_tuple = (subdir,) if subdir is not None else () - path = _os.path.join(*( - resource_path('LOCAL'), "scripts", "startup", - "bl_app_templates_user", *subdir_tuple)) - if _os.path.isdir(path): - yield path - else: - path = _os.path.join(*( - resource_path('USER'), "scripts", "startup", - "bl_app_templates_user", *subdir_tuple)) - if _os.path.isdir(path): - yield path - - path = _os.path.join(*( - resource_path('SYSTEM'), "scripts", "startup", - "bl_app_templates_system", *subdir_tuple)) - if _os.path.isdir(path): - yield path + # Avoid adding 'bl_app_templates_system' twice. + # Either we have a portable build or an installed system build. + for resource_type, module_name in ( + ('USER', "bl_app_templates_user"), + ('LOCAL', "bl_app_templates_system"), + ('SYSTEM', "bl_app_templates_system"), + ): + path = resource_path(resource_type) + if path: + path = _os.path.join( + *(path, "scripts", "startup", module_name, *subdir_tuple)) + if _os.path.isdir(path): + yield path + # Only load LOCAL or SYSTEM (never both). + if resource_type == 'LOCAL': + break def preset_paths(subdir): |