1 #re creating the functionality of the manipulator menu from 2.49
3 # ##### BEGIN GPL LICENSE BLOCK #####
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # ##### END GPL LICENSE BLOCK #####
23 'name': '3d View: Manipulator Menu',
27 'location': 'View3D > Ctrl Space ',
28 'description': 'Menu to change the manipulator type and/or disable it',
29 'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.6/Py/'\
30 'Scripts/3D_interaction/Manipulator_Menu',
31 'tracker_url': 'https://projects.blender.org/tracker/index.php?'\
32 'func=detail&aid=22092',
33 'category': '3D View'}
43 bpy.context.space_data.manipulator = False
45 #class VIEW3D_OT_disable_manipulator(bpy.types.Operator):
47 # bl_idname = "VIEW3D_OT_disable_manipulator"
48 # bl_label = "disable manipulator"
50 # def poll(self, context):
51 # return context.active_object != None
53 # def execute(self, context):
59 class VIEW3D_MT_ManipulatorMenu(bpy.types.Menu):
60 bl_label = "ManipulatorType"
62 def draw(self, context):
64 layout.operator_context = 'INVOKE_REGION_WIN'
66 props = layout.operator("view3d.enable_manipulator",text ='Translate', icon='MAN_TRANS')
67 props.translate = True
69 props = layout.operator("view3d.enable_manipulator",text ='Rotate', icon='MAN_ROT')
72 props = layout.operator("view3d.enable_manipulator",text ='Scale', icon='MAN_SCALE')
76 props = layout.operator("view3d.enable_manipulator",text ='Combo', icon='MAN_SCALE')
79 props.translate = True
83 props = layout.operator("view3d.enable_manipulator",text ='Hide', icon='MAN_SCALE')
86 props.translate = False
93 bpy.utils.register_module(__name__)
95 wm = bpy.context.window_manager
96 km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
97 kmi = km.keymap_items.new('wm.call_menu', 'SPACE', 'PRESS', ctrl=True)
98 kmi.properties.name = "VIEW3D_MT_ManipulatorMenu"
102 bpy.utils.unregister_module(__name__)
104 wm = bpy.context.window_manager
105 km = wm.keyconfigs.addon.keymaps['3D View Generic']
106 for kmi in km.keymap_items:
107 if kmi.idname == 'wm.call_menu':
108 if kmi.properties.name == "VIEW3D_MT_ManipulatorMenu":
109 km.keymap_items.remove(kmi)
112 if __name__ == "__main__":