[#24658] Switching to "maya" via interaction preset breaks when switching back
authorMartin Poirier <theeth@yahoo.com>
Sun, 27 Mar 2011 21:45:37 +0000 (21:45 +0000)
committerMartin Poirier <theeth@yahoo.com>
Sun, 27 Mar 2011 21:45:37 +0000 (21:45 +0000)
[#25045] User Preferences Input, not enough menu choices
[#26525] Saving the Maya preset and another key configs

Untangle keyconfig presets and interaction presets (maya keyconfig would set interaction setting, blender interaction would set keyconfig).

Preset menu on slash screen now displays a list of available keyconfigs (as before) but will also set the correspondant interaction presets, if it exists)

release/scripts/presets/interaction/blender.py
release/scripts/presets/interaction/maya.py [new file with mode: 0644]
release/scripts/presets/keyconfig/maya.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/space_userpref.py

index 7ac9cd1eb0b33571765dd8c478265eb671e22886..603158ed936636e5884781483a8d91c0dc120c07 100644 (file)
@@ -1,9 +1,6 @@
 # Configuration Blender
 import bpy
 
-wm = bpy.context.window_manager
-wm.keyconfigs.active = wm.keyconfigs['Blender']
-
 bpy.context.user_preferences.view.use_mouse_auto_depth = False
 bpy.context.user_preferences.view.use_zoom_to_mouse = False
 bpy.context.user_preferences.view.use_rotate_around_active = False
diff --git a/release/scripts/presets/interaction/maya.py b/release/scripts/presets/interaction/maya.py
new file mode 100644 (file)
index 0000000..4b4bb3c
--- /dev/null
@@ -0,0 +1,10 @@
+# Configuration Blender
+import bpy
+
+bpy.context.user_preferences.edit.use_drag_immediately = True
+bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False
+bpy.context.user_preferences.inputs.select_mouse = 'LEFT'
+bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY'
+bpy.context.user_preferences.inputs.view_zoom_axis = 'HORIZONTAL'
+bpy.context.user_preferences.inputs.view_rotate_method = 'TURNTABLE'
+bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom = True
\ No newline at end of file
index 4014920698d05e36db31c6fb55424aea8743986b..87f4791ec51ee893d88e881fd3dbc3237165099d 100644 (file)
@@ -376,11 +376,3 @@ kmi = km.keymap_items.new('mesh.select_all', 'SELECTMOUSE', 'CLICK')
 kmi.properties.action = 'DESELECT'
 
 wm.keyconfigs.active = kc
-
-bpy.context.user_preferences.edit.use_drag_immediately = True
-bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False
-bpy.context.user_preferences.inputs.select_mouse = 'LEFT'
-bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY'
-bpy.context.user_preferences.inputs.view_zoom_axis = 'HORIZONTAL'
-bpy.context.user_preferences.inputs.view_rotate_method = 'TURNTABLE'
-bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom = True
index bb5f3a3a2a9fea828bade3c4ec27377add7ad257..6ed461910990736f99bba0b7452f57af50f89aa9 100644 (file)
@@ -859,6 +859,38 @@ class WM_OT_keyconfig_activate(bpy.types.Operator):
         bpy.utils.keyconfig_set(self.filepath)
         return {'FINISHED'}
 
+class WM_OT_appconfig_default(bpy.types.Operator):
+    bl_idname = "wm.appconfig_default"
+    bl_label = "Default Application Configuration"
+
+    def execute(self, context):
+        import os
+
+        context.window_manager.keyconfigs.active = context.window_manager.keyconfigs.default
+
+        filepath = os.path.join(bpy.utils.preset_paths("interaction")[0], "blender.py")        
+        
+        if os.path.exists(filepath):
+            bpy.ops.script.execute_preset(filepath = filepath, menu_idname = "USERPREF_MT_interaction_presets")
+        
+        return {'FINISHED'}
+
+class WM_OT_appconfig_activate(bpy.types.Operator):
+    bl_idname = "wm.appconfig_activate"
+    bl_label = "Activate Application Configuration"
+
+    filepath = StringProperty(name="File Path", maxlen=1024)
+
+    def execute(self, context):
+        import os
+        bpy.utils.keyconfig_set(self.filepath)
+        
+        filepath = self.filepath.replace("keyconfig", "interaction")
+        
+        if os.path.exists(filepath):
+            bpy.ops.script.execute_preset(filepath = filepath, menu_idname = "USERPREF_MT_interaction_presets")
+        
+        return {'FINISHED'}
 
 class WM_OT_sysinfo(bpy.types.Operator):
     '''Generate System Info'''
index 67174db1d3db5735f7745d28680cd3fa7bd84131..59d9aef12f2bf3eab6caaf0d4622fc57d47af901 100644 (file)
@@ -119,6 +119,16 @@ class USERPREF_MT_interaction_presets(bpy.types.Menu):
     preset_operator = "script.execute_preset"
     draw = bpy.types.Menu.draw_preset
 
+class USERPREF_MT_appconfigs(bpy.types.Menu):
+    bl_label = "AppPresets"
+    preset_subdir = "keyconfig"
+    preset_operator = "wm.appconfig_activate"
+
+    def draw(self, context):
+        props = self.layout.operator("wm.appconfig_default", text="Blender (default)")
+
+        # now draw the presets
+        bpy.types.Menu.draw_preset(self, context)
 
 class USERPREF_MT_splash(bpy.types.Menu):
     bl_label = "Splash"
@@ -134,7 +144,7 @@ class USERPREF_MT_splash(bpy.types.Menu):
         # text = bpy.path.display_name(context.window_manager.keyconfigs.active.name)
         # if not text:
         #     text = "Blender (default)"
-        row.menu("USERPREF_MT_keyconfigs", text="Preset")
+        row.menu("USERPREF_MT_appconfigs", text="Preset")
 
 
 class USERPREF_PT_interface(bpy.types.Panel):