Expect input coordinates for the mesh projection function to be in world
[blender-addons-contrib.git] / space_view3d_manipulator_Menu.py
index 569a8464ffe7dccb5b8f39913e61d52aab7932c9..c45af7deb1e03e9a1559b2fc9140ce43dd208426 100644 (file)
@@ -1,7 +1,5 @@
 #re creating the functionality of the manipulator menu from 2.49
-#
-#ported by Michael Williamson
-#
+
 # ##### BEGIN GPL LICENSE BLOCK #####
 #
 #  This program is free software; you can redistribute it and/or
 #
 # ##### END GPL LICENSE BLOCK #####
 
-bl_addon_info = {
-    'name': 'Manipulator Menu',
-    'author': 'MichaelW',
-    'version': (1,),
-    'blender': (2, 5, 3),
-    'api': 33907,
-    'location': 'View3D > Ctrl Space ',
-    'description': 'Menu to change the manipulator type and/or disable it',
-    'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.5/Py/'\
-        'Scripts/3D_interaction/Manipulator_Menu',
-    'tracker_url': 'https://projects.blender.org/tracker/index.php?'\
-        'func=detail&aid=22092',
-    'category': '3D View'}
-
-"Add manipulator menu  (Ctrl-space in 3d view)"
-
-"""
-This adds a popup menu to change the manipulator mode.
-to move, rotate, scale or combo like in 2.49
 
-Usage:
-* Ctrl Space in the 3d view
+bl_info = {
+    "name": "3d View: Manipulator Menu",
+    "author": "MichaelW",
+    "version": (1, 2, 1),
+    "blender": (2, 61, 0),
+    "location": "View3D > Ctrl Space ",
+    "description": "Menu to change the manipulator type and/or disable it",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
+                "Scripts/3D_interaction/Manipulator_Menu",
+    "tracker_url": "https://developer.blender.org/T22092",
+    "category": "3D View"}
 
-* Choose your function from the menu.
-
-Version history:
-V1(MichaelW) initial port form 2.49
-"""
 
 import bpy
 
@@ -55,7 +38,7 @@ def main(context):
     bpy.context.space_data.manipulator = False
 
 #class VIEW3D_OT_disable_manipulator(bpy.types.Operator):
-#    ''''''
+#    """"""
 #    bl_idname = "VIEW3D_OT_disable_manipulator"
 #    bl_label = "disable manipulator"
 #
@@ -75,43 +58,51 @@ class VIEW3D_MT_ManipulatorMenu(bpy.types.Menu):
         layout = self.layout
         layout.operator_context = 'INVOKE_REGION_WIN'
 
+        props = layout.operator("view3d.enable_manipulator",text ='Translate', icon='MAN_TRANS')
+        props.translate = True
 
+        props = layout.operator("view3d.enable_manipulator",text ='Rotate', icon='MAN_ROT')
+        props.rotate = True
 
-        prop = layout.operator("view3d.enable_manipulator",text ='Translate', icon='MAN_TRANS')
-        prop.translate = True
+        props = layout.operator("view3d.enable_manipulator",text ='Scale', icon='MAN_SCALE')
+        props.scale = True
+        layout.separator()
 
-        prop = layout.operator("view3d.enable_manipulator",text ='Rotate', icon='MAN_ROT')
-        prop.rotate = True
+        props = layout.operator("view3d.enable_manipulator",text ='Combo', icon='MAN_SCALE')
+        props.scale = True
+        props.rotate = True
+        props.translate = True
 
-        prop = layout.operator("view3d.enable_manipulator",text ='Scale', icon='MAN_SCALE')
-        prop.scale = True
         layout.separator()
 
-        prop = layout.operator("view3d.enable_manipulator",text ='Combo', icon='MAN_SCALE')
-        prop.scale = True
-        prop.rotate = True
-        prop.translate = True
+        props = layout.operator("view3d.enable_manipulator",text ='Hide', icon='MAN_SCALE')
+        props.scale = False
+        props.rotate = False
+        props.translate = False
 
         layout.separator()
 
-        bpy.context.space_data.show_manipulator =True
-#        layout.operator("view3d.disable_manipulator",text ='Disable', icon='MANIPUL')
-#        layout.separator()
 
 
-            
 def register():
-    km = bpy.context.window_manager.keyconfigs.default.keymaps['3D View Generic']
-    kmi = km.items.new('wm.call_menu', 'SPACE', 'PRESS' , ctrl=True)
+    bpy.utils.register_module(__name__)
+
+    wm = bpy.context.window_manager
+    km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
+    kmi = km.keymap_items.new('wm.call_menu', 'SPACE', 'PRESS', ctrl=True)
     kmi.properties.name = "VIEW3D_MT_ManipulatorMenu"
 
 
 def unregister():
-    for kmi in km.items:
+    bpy.utils.unregister_module(__name__)
+
+    wm = bpy.context.window_manager
+    km = wm.keyconfigs.addon.keymaps['3D View Generic']
+    for kmi in km.keymap_items:
         if kmi.idname == 'wm.call_menu':
             if kmi.properties.name == "VIEW3D_MT_ManipulatorMenu":
-                km.items.remove(kmi)
+                km.keymap_items.remove(kmi)
                 break
 
 if __name__ == "__main__":
-    register()
+    register