Python: Support multiple custom script directories in Preferences #104876
|
@ -30,7 +30,6 @@ __all__ = (
|
|||
"previews",
|
||||
"resource_path",
|
||||
"script_path_user",
|
||||
"script_path_pref",
|
||||
"script_paths",
|
||||
"smpte_from_frame",
|
||||
"smpte_from_seconds",
|
||||
|
@ -340,21 +339,6 @@ def script_path_user():
|
|||
return _os.path.normpath(path) if path else None
|
||||
|
||||
|
||||
def script_path_pref():
|
||||
"""
|
||||
DEPRECATED. Use `script_paths_pref` which supports multiple script paths now. Returns the
|
||||
first valid of these script paths for now, for compatibility.
|
||||
"""
|
||||
from warnings import warn
|
||||
warn(
|
||||
"bpy.utils.script_path_pref() is deprecated use script_paths_pref() instead!",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
script_paths = script_paths_pref()
|
||||
return script_paths[0] if len(script_paths) > 0 else ""
|
||||
|
||||
|
||||
def script_paths_pref():
|
||||
"""Returns a list of user preference script directories."""
|
||||
paths = []
|
||||
JulianEisel marked this conversation as resolved
|
||||
|
@ -403,9 +387,6 @@ def script_paths(*, subdir=None, user_pref=True, check_all=False, use_user=True)
|
|||
if use_user:
|
||||
base_paths.append(path_user)
|
||||
|
||||
if user_pref:
|
||||
base_paths.append(script_path_pref())
|
||||
|
||||
scripts = []
|
||||
for path in base_paths:
|
||||
if not path:
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#include "BLO_readfile.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "GPU_platform.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
@ -804,7 +806,9 @@ void blo_do_versions_userdef(UserDef *userdef)
|
|||
if (userdef->pythondir_legacy[0]) {
|
||||
bUserScriptDirectory *script_dir = MEM_callocN(sizeof(*script_dir),
|
||||
"Versioning user script path");
|
||||
|
||||
STRNCPY(script_dir->dir_path, userdef->pythondir_legacy);
|
||||
STRNCPY(script_dir->name, DATA_("Untitled"));
|
||||
BLI_addhead(&userdef->script_directories, script_dir);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -354,8 +354,6 @@ static void rna_userdef_script_directory_name_set(PointerRNA *ptr, const char *v
|
|||
value_invalid = true;
|
||||
}
|
||||
if (STREQ(value, "DEFAULT")) {
|
||||
BKE_report(
|
||||
NULL, RPT_WARNING, "Name 'DEFAULT' is reserved for internal use and cannot be used");
|
||||
value_invalid = true;
|
||||
}
|
||||
JulianEisel marked this conversation as resolved
Campbell Barton
commented
Rather not warn as in the rare case a user runs into this - it's not as if there is anything to "fix", besides the script author adding explicit checks for "DEFAULT" which isn't useful. Over long names will also be clipped for e.g. which doesn't warn. In general it's possible the name requested in Blender is manipulated. It can't be assumed a string literal will be used verbatim. Rather not warn as in the rare case a user runs into this - it's not as if there is anything to "fix", besides the script author adding explicit checks for "DEFAULT" which isn't useful.
Over long names will also be clipped for e.g. which doesn't warn. In general it's possible the name requested in Blender is manipulated. It can't be assumed a string literal will be used verbatim.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Prefer this be removed as scripts that use it will have incorrect behavior.