check for presets in addons dirs. this way addons can install their own presets too.

This commit is contained in:
Campbell Barton 2011-12-30 08:39:40 +00:00
parent 7c5c256fd5
commit a8b19260cf
2 changed files with 9 additions and 0 deletions

@ -349,6 +349,14 @@ def preset_paths(subdir):
raise Exception("invalid subdir given %r" % subdir)
elif _os.path.isdir(directory):
dirs.append(directory)
# Find addons preset paths
import addon_utils
for path in addon_utils.paths():
directory = _os.path.join(path, "presets", subdir)
if _os.path.isdir(directory):
dirs.append(directory)
return dirs

@ -76,6 +76,7 @@ class AddPresetBase():
if hasattr(self, "add"):
self.add(context, filepath)
else:
print("Writing Preset: %r" % filepath)
file_preset = open(filepath, 'w')
file_preset.write("import bpy\n")