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>2011-05-02 21:29:30 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-02 21:29:30 +0400
commitd8eafe14c676d7915623ae2471b51b775c4e03ba (patch)
tree16e0fb93f0a8ab276109cc8f82d7b7c832ec2a5d /release/scripts/modules/bpy/utils.py
parenta9b066a9c637932d7288a1e65972dd93fc681e83 (diff)
fix [#27148] *Invalid Path* in all "operator presets" dropdowns
Diffstat (limited to 'release/scripts/modules/bpy/utils.py')
-rw-r--r--release/scripts/modules/bpy/utils.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py
index eee98bdca37..96967a8e4be 100644
--- a/release/scripts/modules/bpy/utils.py
+++ b/release/scripts/modules/bpy/utils.py
@@ -226,21 +226,35 @@ def user_script_path():
return None
-def script_paths(subdir=None, user=True):
+def script_paths(subdir=None, user_pref=True, all=False):
"""
- Returns a list of valid script paths from the home directory and user preferences.
+ Returns a list of valid script paths.
- Accepts any number of string arguments which are joined to make a path.
+ :arg subdir: Optional subdir.
+ :type subdir: string
+ :arg user_pref: Include the user preference script path.
+ :type user_pref: bool
+ :arg all: Include local, user and system paths rather just the paths blender uses.
+ :type all: bool
+ :return: script paths.
+ :rtype: list
"""
scripts = list(_scripts)
# add user scripts dir
- if user:
+ if user_pref:
user_script_path = _bpy.context.user_preferences.filepaths.script_directory
else:
user_script_path = None
- for path in _bpy_script_paths() + (user_script_path, ):
+ if all:
+ # all possible paths
+ base_paths = tuple(_os.path.join(resource_path(res), "scripts") for res in ('LOCAL', 'USER', 'SYSTEM'))
+ else:
+ # only paths blender uses
+ base_paths = _bpy_script_paths()
+
+ for path in base_paths + (user_script_path, ):
if path:
path = _os.path.normpath(path)
if path not in scripts and _os.path.isdir(path):
@@ -266,7 +280,7 @@ def preset_paths(subdir):
Returns a list of paths for a specific preset.
"""
dirs = []
- for path in script_paths("presets"):
+ for path in script_paths("presets", all=True):
directory = _os.path.join(path, subdir)
if _os.path.isdir(directory):
dirs.append(directory)