Small updates on pinkified theme for some object types, background gradient and other...
[blender-addons-contrib.git] / space_view3d_manipulator_Menu.py
1 #re creating the functionality of the manipulator menu from 2.49
2
3 # ##### BEGIN GPL LICENSE BLOCK #####
4 #
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.
9 #
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.
14 #
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.
18 #
19 # ##### END GPL LICENSE BLOCK #####
20
21
22 bl_info = {
23     "name": "3d View: Manipulator Menu",
24     "author": "MichaelW",
25     "version": (1, 2 ,1),
26     "blender": (2, 61, 0),
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"}
34
35
36 import bpy
37
38 def main(context):
39     bpy.context.space_data.manipulator = False
40
41 #class VIEW3D_OT_disable_manipulator(bpy.types.Operator):
42 #    """"""
43 #    bl_idname = "VIEW3D_OT_disable_manipulator"
44 #    bl_label = "disable manipulator"
45 #
46 #    def poll(self, context):
47 #        return context.active_object != None
48 #
49 #    def execute(self, context):
50 #        main(context)
51 #        return {'FINISHED'}
52 #
53
54
55 class VIEW3D_MT_ManipulatorMenu(bpy.types.Menu):
56     bl_label = "ManipulatorType"
57
58     def draw(self, context):
59         layout = self.layout
60         layout.operator_context = 'INVOKE_REGION_WIN'
61
62         props = layout.operator("view3d.enable_manipulator",text ='Translate', icon='MAN_TRANS')
63         props.translate = True
64
65         props = layout.operator("view3d.enable_manipulator",text ='Rotate', icon='MAN_ROT')
66         props.rotate = True
67
68         props = layout.operator("view3d.enable_manipulator",text ='Scale', icon='MAN_SCALE')
69         props.scale = True
70         layout.separator()
71
72         props = layout.operator("view3d.enable_manipulator",text ='Combo', icon='MAN_SCALE')
73         props.scale = True
74         props.rotate = True
75         props.translate = True
76
77         layout.separator()
78
79         props = layout.operator("view3d.enable_manipulator",text ='Hide', icon='MAN_SCALE')
80         props.scale = False
81         props.rotate = False
82         props.translate = False
83         
84         layout.separator()
85
86
87             
88 def register():
89     bpy.utils.register_module(__name__)
90
91     wm = bpy.context.window_manager
92     km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
93     kmi = km.keymap_items.new('wm.call_menu', 'SPACE', 'PRESS', ctrl=True)
94     kmi.properties.name = "VIEW3D_MT_ManipulatorMenu"
95
96
97 def unregister():
98     bpy.utils.unregister_module(__name__)
99
100     wm = bpy.context.window_manager
101     km = wm.keyconfigs.addon.keymaps['3D View Generic']
102     for kmi in km.keymap_items:
103         if kmi.idname == 'wm.call_menu':
104             if kmi.properties.name == "VIEW3D_MT_ManipulatorMenu":
105                 km.keymap_items.remove(kmi)
106                 break
107
108 if __name__ == "__main__":
109     register