[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3358] contrib/py/scripts/addons/ presets/keyconfig/blender_2012_experimental.py: Keymap now clears everything other than what I've worked on.
Nathan Vegdahl
cessen at cessen.com
Thu May 10 08:51:22 CEST 2012
Revision: 3358
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3358
Author: cessen
Date: 2012-05-10 06:51:22 +0000 (Thu, 10 May 2012)
Log Message:
-----------
Keymap now clears everything other than what I've worked on.
This will help me work in a "building things back up" kind of way.
Also a bunch of changes to the keymap, which I unfortunately didn't
keep great track of. I need to start logging this stuff.
Modified Paths:
--------------
contrib/py/scripts/addons/presets/keyconfig/blender_2012_experimental.py
Modified: contrib/py/scripts/addons/presets/keyconfig/blender_2012_experimental.py
===================================================================
--- contrib/py/scripts/addons/presets/keyconfig/blender_2012_experimental.py 2012-05-09 14:12:54 UTC (rev 3357)
+++ contrib/py/scripts/addons/presets/keyconfig/blender_2012_experimental.py 2012-05-10 06:51:22 UTC (rev 3358)
@@ -3,25 +3,88 @@
"""
import bpy
-###############################################################
-# Some configuration variables to toggle various ideas on/off #
-###############################################################
+######################
+# Misc configuration
+######################
DEVELOPER_HOTKEYS = False # Weird hotkeys that only developers use
-
-WINDOW_TYPE_SWITCHING = False # Shift-f# hotkeys for switching window types
-
+MAYA_STYLE_MANIPULATORS = False # Maya-style "QWER" hotkeys for manipulators
SUBSURF_RELATIVE = True # Make subsurf hotkeys work by relative
# shifting instead of absolute setting
+# Left mouse-button select
+bpy.context.user_preferences.inputs.select_mouse = 'LEFT'
-MAYA_STYLE_MANIPULATORS = False # Maya-style "QWER" hotkeys for manipulators
+################################
+# Helper functions and classes
+################################
+class SetManipulator(bpy.types.Operator):
+ '''Set's the manipulator mode.'''
+ bl_idname = "view3d.manipulator_set"
+ bl_label = "Set Manipulator"
+ mode = bpy.props.EnumProperty(items=[("NONE", "None", ""),
+ ("TRANSLATE", "Translate", ""),
+ ("ROTATE", "Rotate", ""),
+ ("SCALE", "Scale", "")],
+ default="NONE")
+ def execute(self, context):
+ if self.mode == "NONE":
+ context.space_data.show_manipulator = False
+ elif self.mode == "TRANSLATE":
+ context.space_data.show_manipulator = True
+ context.space_data.use_manipulator_translate = True
+ context.space_data.use_manipulator_rotate = False
+ context.space_data.use_manipulator_scale = False
+ elif self.mode == "ROTATE":
+ context.space_data.show_manipulator = True
+ context.space_data.use_manipulator_translate = False
+ context.space_data.use_manipulator_rotate = True
+ context.space_data.use_manipulator_scale = False
+ elif self.mode == "SCALE":
+ context.space_data.show_manipulator = True
+ context.space_data.use_manipulator_translate = False
+ context.space_data.use_manipulator_rotate = False
+ context.space_data.use_manipulator_scale = True
+ return {'FINISHED'}
+bpy.utils.register_class(SetManipulator)
-###############################
-# Custom operators/menus/etc. #
-###############################
+class ModeSwitchMenu(bpy.types.Menu):
+ """ A menu for switching between object modes.
+ """
+ bl_idname = "OBJECT_MT_mode_switch_menu"
+ bl_label = "Switch Mode"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_enum("object.mode_set", "mode")
+bpy.utils.register_class(ModeSwitchMenu)
+
+# Temporary work around: Blender does not properly limit the mode switch menu
+# items until the first mode switch (e.g. mesh objects will show pose mode as
+# an option).
+# TODO: file a bug report for this behavior.
+bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+
+
+class ObjectDeleteNoConfirm(bpy.types.Operator):
+ '''Deletes selected objects without the confirmation popup.'''
+ bl_idname = "object.delete_no_confirm"
+ bl_label = "Delete Objects No Confirm"
+ bl_options = {"UNDO"}
+
+ @classmethod
+ def poll(cls, context):
+ return context.active_object is not None
+
+ def execute(self, context):
+ bpy.ops.object.delete()
+
+ return {'FINISHED'}
+bpy.utils.register_class(ObjectDeleteNoConfirm)
+
+
class ShiftSubsurfLevel(bpy.types.Operator):
''' Shifts the subsurf level of the selected objects up or
down by the given amount. Has maximum limit, to avoid
@@ -63,736 +126,846 @@
bpy.utils.register_class(ShiftSubsurfLevel)
-class SetManipulator(bpy.types.Operator):
- '''Set's the manipulator mode.'''
- bl_idname = "view3d.manipulator_set"
- bl_label = "Set Manipulator"
- mode = bpy.props.EnumProperty(items=[("NONE", "None", ""),
- ("TRANSLATE", "Translate", ""),
- ("ROTATE", "Rotate", ""),
- ("SCALE", "Scale", "")],
- default="NONE")
-
+class SetEditMeshSelectMode(bpy.types.Operator):
+ '''Set's edit mesh select mode (vert, edge, face).'''
+ bl_idname = "view3d.set_edit_mesh_select_mode"
+ bl_label = "Set Edit Mesh Select Mode"
+ mode = bpy.props.EnumProperty(items=[("VERT", "Vertex", ""),
+ ("EDGE", "Edge", ""),
+ ("FACE", "Face", "")],
+ default="VERT")
+ toggle = bpy.props.BoolProperty(name="Toggle", default=False)
+
+ @classmethod
+ def poll(cls, context):
+ return context.active_object is not None
+
def execute(self, context):
- if self.mode == "NONE":
- context.space_data.show_manipulator = False
- elif self.mode == "TRANSLATE":
- context.space_data.show_manipulator = True
- context.space_data.use_manipulator_translate = True
- context.space_data.use_manipulator_rotate = False
- context.space_data.use_manipulator_scale = False
- elif self.mode == "ROTATE":
- context.space_data.show_manipulator = True
- context.space_data.use_manipulator_translate = False
- context.space_data.use_manipulator_rotate = True
- context.space_data.use_manipulator_scale = False
- elif self.mode == "SCALE":
- context.space_data.show_manipulator = True
- context.space_data.use_manipulator_translate = False
- context.space_data.use_manipulator_rotate = False
- context.space_data.use_manipulator_scale = True
-
+ if self.mode == "VERT":
+ mode = 0
+ elif self.mode == "EDGE":
+ mode = 1
+ else: # self.mode == "FACE"
+ mode = 2
+
+ select_mode = context.tool_settings.mesh_select_mode
+ if self.toggle:
+ select_mode[mode] = [True, False][select_mode[mode]]
+ else:
+ select_mode[mode] = True
+ for i in range(0,3):
+ if i != mode:
+ select_mode[i] = False
+
return {'FINISHED'}
-bpy.utils.register_class(SetManipulator)
+bpy.utils.register_class(SetEditMeshSelectMode)
-class ModeSwitchMenu(bpy.types.Menu):
- """ A menu for switching between object modes.
+###########
+# Keymaps
+###########
+
+def clear_keymap(kc):
+ """ Clears all the keymaps, so we can start from scratch, building
+ things back up again one-by-one.
"""
- bl_idname = "OBJECT_MT_mode_switch_menu"
- bl_label = "Switch Mode"
+ # Map Window
+ km = kc.keymaps.new('Window', space_type='EMPTY', region_type='WINDOW', modal=False)
- def draw(self, context):
- layout = self.layout
- layout.operator_enum("object.mode_set", "mode")
+ # Map Screen
+ km = kc.keymaps.new('Screen', space_type='EMPTY', region_type='WINDOW', modal=False)
-bpy.utils.register_class(ModeSwitchMenu)
-# Work around
-bpy.ops.object.mode_set(mode='OBJECT', toggle=False) # XXX, WHY IS THE KEYMAP DOING THIS? - campbell
+ # Editing this part of the keymap seems
+ # to cause problems, so leaving alone.
+ # Map Screen Editing
+ #km = kc.keymaps.new('Screen Editing', space_type='EMPTY', region_type='WINDOW', modal=False)
+ # Map View2D
+ km = kc.keymaps.new('View2D', space_type='EMPTY', region_type='WINDOW', modal=False)
+ # Map Frames
+ km = kc.keymaps.new('Frames', space_type='EMPTY', region_type='WINDOW', modal=False)
+ # Map Header
+ km = kc.keymaps.new('Header', space_type='EMPTY', region_type='WINDOW', modal=False)
+ # Map View2D Buttons List
+ km = kc.keymaps.new('View2D Buttons List', space_type='EMPTY', region_type='WINDOW', modal=False)
+ # Map Property Editor
+ km = kc.keymaps.new('Property Editor', space_type='PROPERTIES', region_type='WINDOW', modal=False)
-######################################################################
-######################################################################
-############### KEYMAP BEGINS ########################################
-######################################################################
-######################################################################
-wm = bpy.context.window_manager
-kc = wm.keyconfigs.new('Blender 2012 (experimental!)')
+ # Map Markers
+ km = kc.keymaps.new('Markers', space_type='EMPTY', region_type='WINDOW', modal=False)
+ # Map Animation
+ km = kc.keymaps.new('Animation', space_type='EMPTY', region_type='WINDOW', modal=False)
-##############
-# Map Window #
-##############
-km = kc.keymaps.new('Window', space_type='EMPTY', region_type='WINDOW', modal=False)
+ # Map Timeline
+ km = kc.keymaps.new('Timeline', space_type='TIMELINE', region_type='WINDOW', modal=False)
-#------
-# Quit
-#------
-kmi = km.keymap_items.new('wm.quit_blender', 'Q', 'PRESS', ctrl=True)
+ # Map Outliner
+ km = kc.keymaps.new('Outliner', space_type='OUTLINER', region_type='WINDOW', modal=False)
-#----------------------
-# Operator search menu
-#----------------------
-kmi = km.keymap_items.new('wm.search_menu', 'TAB', 'PRESS')
+ # Map 3D View Generic
+ km = kc.keymaps.new('3D View Generic', space_type='VIEW_3D', region_type='WINDOW', modal=False)
-#-----------------
-# File management
-#-----------------
-# Open
-kmi = km.keymap_items.new('wm.read_homefile', 'N', 'PRESS', ctrl=True)
-kmi = km.keymap_items.new('wm.save_homefile', 'U', 'PRESS', ctrl=True)
-kmi = km.keymap_items.new('wm.open_mainfile', 'O', 'PRESS', ctrl=True)
-kmi = km.keymap_items.new('wm.link_append', 'O', 'PRESS', ctrl=True, alt=True)
+ # Map Grease Pencil
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list