diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-07-12 22:15:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-07-12 22:15:48 +0400 |
commit | 3b81c67353b9b0b9539fe7befbba0d7e449e912b (patch) | |
tree | 69d0daa9309c7d5b1d241909f283f5a6632a5e23 /release/scripts/op/presets.py | |
parent | a586541d74a3ba9a7c841efa0f06f1da9977ed53 (diff) |
- presets were not being written with 'import bpy' at the start.
- attribute save_keyconfig defaulted to True when unset, not sure why, but .
- use repr() rather then str() so strings are quoted without manually checking. also converts less common chars properly \m \" etc.
Diffstat (limited to 'release/scripts/op/presets.py')
-rw-r--r-- | release/scripts/op/presets.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py index a813cb5339d..9552a5e6785 100644 --- a/release/scripts/op/presets.py +++ b/release/scripts/op/presets.py @@ -47,19 +47,17 @@ class AddPresetBase(bpy.types.Operator): target_path = bpy.utils.preset_paths(self.preset_subdir)[0] # we need some way to tell the user and system preset path filepath = os.path.join(target_path, filename) - if getattr(self, "save_keyconfig", True): + if getattr(self, "save_keyconfig", False): bpy.ops.wm.keyconfig_export(filepath=filepath, kc_name=self.properties.name) file_preset = open(filepath, 'a') file_preset.write("wm.active_keyconfig = kc\n\n") else: file_preset = open(filepath, 'w') + file_preset.write("import bpy\n") for rna_path in self.preset_values: value = eval(rna_path) - if type(value) == str: - value = "'%s'" % value - - file_preset.write("%s = %s\n" % (rna_path, value)) + file_preset.write("%s = %s\n" % (rna_path, repr(value))) file_preset.close() |