check for presets in addons dirs. this way addons can install their own presets too.
This commit is contained in:
@@ -349,6 +349,14 @@ def preset_paths(subdir):
|
|||||||
raise Exception("invalid subdir given %r" % subdir)
|
raise Exception("invalid subdir given %r" % subdir)
|
||||||
elif _os.path.isdir(directory):
|
elif _os.path.isdir(directory):
|
||||||
dirs.append(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
|
return dirs
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ class AddPresetBase():
|
|||||||
if hasattr(self, "add"):
|
if hasattr(self, "add"):
|
||||||
self.add(context, filepath)
|
self.add(context, filepath)
|
||||||
else:
|
else:
|
||||||
|
print("Writing Preset: %r" % filepath)
|
||||||
file_preset = open(filepath, 'w')
|
file_preset = open(filepath, 'w')
|
||||||
file_preset.write("import bpy\n")
|
file_preset.write("import bpy\n")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user