When saving presets, the try_preset_path_create() function only tries the first item returned by bpy.utils.preset_paths().
I changed this and here is the resulting .diff:
- Code: Select all
diff -r a30b6b757171 src/luxrender/operators/__init__.py
--- a/src/luxrender/operators/__init__.py Sat Dec 11 23:30:48 2010 +0000
+++ b/src/luxrender/operators/__init__.py Sun Dec 12 04:17:56 2010 +0000
@@ -47,9 +47,16 @@
# Per-IDPropertyGroup preset handling
def try_preset_path_create(preset_subdir):
- target_path = os.path.join(bpy.utils.preset_paths('')[0], preset_subdir)
- if not os.path.exists(target_path):
- os.makedirs(target_path)
+ # iterate through all the possible preset paths
+ for p in bpy.utils.preset_paths(''):
+ # build path with subdir
+ target_path = os.path.join(p, preset_subdir)
+ if not os.path.exists(target_path):
+ if os.access(p, os.W_OK):
+ os.makedirs(target_path)
+ return
+ else:
+ return
class LUXRENDER_MT_base(object):
preset_operator = "script.execute_preset"
@@ -372,4 +379,4 @@
return {'FINISHED'}
menu_func = lambda self, context: self.layout.operator("export.luxrender", text="Export LuxRender Scene...")
-bpy.types.INFO_MT_file_export.append(menu_func)
\ No newline at end of file
+bpy.types.INFO_MT_file_export.append(menu_func)
I tested this and it's working nicely. Now the only thing needed is to convince the blender devs to automatically create the directory structure (scripts, presets, etc) in the user's home folder at blender's startup, if not yet created.
Feedback is welcome.
