forked from bartvdbraak/blender
Fix T52442: bl_app_templates_system not working
Portable builds LOCAL files need to be treated as system instead of using as a fallback to USER templates.
This commit is contained in:
parent
909da553e3
commit
2aa2bec43a
@ -400,27 +400,26 @@ def app_template_paths(subdir=None):
|
|||||||
:return: app template paths.
|
:return: app template paths.
|
||||||
:rtype: generator
|
: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 ()
|
subdir_tuple = (subdir,) if subdir is not None else ()
|
||||||
|
|
||||||
path = _os.path.join(*(
|
# Avoid adding 'bl_app_templates_system' twice.
|
||||||
resource_path('LOCAL'), "scripts", "startup",
|
# Either we have a portable build or an installed system build.
|
||||||
"bl_app_templates_user", *subdir_tuple))
|
for resource_type, module_name in (
|
||||||
if _os.path.isdir(path):
|
('USER', "bl_app_templates_user"),
|
||||||
yield path
|
('LOCAL', "bl_app_templates_system"),
|
||||||
else:
|
('SYSTEM', "bl_app_templates_system"),
|
||||||
path = _os.path.join(*(
|
):
|
||||||
resource_path('USER'), "scripts", "startup",
|
path = resource_path(resource_type)
|
||||||
"bl_app_templates_user", *subdir_tuple))
|
if path:
|
||||||
if _os.path.isdir(path):
|
path = _os.path.join(
|
||||||
yield path
|
*(path, "scripts", "startup", module_name, *subdir_tuple))
|
||||||
|
if _os.path.isdir(path):
|
||||||
path = _os.path.join(*(
|
yield path
|
||||||
resource_path('SYSTEM'), "scripts", "startup",
|
# Only load LOCAL or SYSTEM (never both).
|
||||||
"bl_app_templates_system", *subdir_tuple))
|
if resource_type == 'LOCAL':
|
||||||
if _os.path.isdir(path):
|
break
|
||||||
yield path
|
|
||||||
|
|
||||||
|
|
||||||
def preset_paths(subdir):
|
def preset_paths(subdir):
|
||||||
|
@ -691,13 +691,16 @@ bool BKE_appdir_program_python_search(
|
|||||||
return is_found;
|
return is_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Keep in sync with `bpy.utils.app_template_paths()` */
|
||||||
static const char *app_template_directory_search[2] = {
|
static const char *app_template_directory_search[2] = {
|
||||||
"startup" SEP_STR "bl_app_templates_user",
|
"startup" SEP_STR "bl_app_templates_user",
|
||||||
"startup" SEP_STR "bl_app_templates_system",
|
"startup" SEP_STR "bl_app_templates_system",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int app_template_directory_id[2] = {
|
static const int app_template_directory_id[2] = {
|
||||||
|
/* Only 'USER' */
|
||||||
BLENDER_USER_SCRIPTS,
|
BLENDER_USER_SCRIPTS,
|
||||||
|
/* Covers 'LOCAL' & 'SYSTEM'. */
|
||||||
BLENDER_SYSTEM_SCRIPTS,
|
BLENDER_SYSTEM_SCRIPTS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user