1 # SPDX-License-Identifier: GPL-2.0-or-later
4 "name": "Hotkey: 'Alt Spacebar'",
5 "description": "Manipulator Menu",
6 "author": "pitiwazou, meta-androcto",
12 "category": "Manipulator Pie"
16 from bpy
.types
import (
20 from bpy
.props
import (
26 class PIE_OT_WManupulators(Operator
):
27 bl_idname
= "w.manipulators"
28 bl_label
= "W Manupulators"
29 bl_options
= {'REGISTER', 'UNDO'}
30 bl_description
= " Show/Hide Manipulator"
37 ('TRANSLATE', "Move", ""),
38 ('ROTATE', "Rotate", ""),
39 ('SCALE', "Scale", ""),
43 def execute(self
, context
):
44 space_data
= context
.space_data
45 space_data
.show_gizmo_context
= True
48 "show_gizmo_object_translate",
49 "show_gizmo_object_rotate",
50 "show_gizmo_object_scale",
52 attr_t
, attr_r
, attr_s
= attrs
53 attr_index
= ('TRANSLATE', 'ROTATE', 'SCALE').index(self
.type)
54 attr_active
= attrs
[attr_index
]
57 setattr(space_data
, attr_active
, not getattr(space_data
, attr_active
))
60 setattr(space_data
, attr
, attr
== attr_active
)
63 def invoke(self
, context
, event
):
64 self
.extend
= event
.shift
65 return self
.execute(context
)
68 # Pie Manipulators - Ctrl + Space
69 class PIE_MT_Manipulator(Menu
):
70 bl_idname
= "PIE_MT_manipulator"
71 bl_label
= "Pie Manipulator"
73 def draw(self
, context
):
75 pie
= layout
.menu_pie()
77 pie
.operator("w.manipulators", text
="Rotate", icon
='NONE').type = 'ROTATE'
79 pie
.operator("w.manipulators", text
="Scale", icon
='NONE').type = 'SCALE'
81 props
= pie
.operator("wm.context_toggle", text
="Show/Hide Toggle", icon
='NONE')
82 props
.data_path
= "space_data.show_gizmo_context"
84 pie
.operator("w.manipulators", text
="Translate", icon
='NONE').type = 'TRANSLATE'
97 bpy
.utils
.register_class(cls
)
99 wm
= bpy
.context
.window_manager
100 if wm
.keyconfigs
.addon
:
102 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
='3D View Generic', space_type
='VIEW_3D')
103 kmi
= km
.keymap_items
.new('wm.call_menu_pie', 'SPACE', 'PRESS', alt
=True)
104 kmi
.properties
.name
= "PIE_MT_manipulator"
105 addon_keymaps
.append((km
, kmi
))
110 bpy
.utils
.unregister_class(cls
)
112 wm
= bpy
.context
.window_manager
113 kc
= wm
.keyconfigs
.addon
115 for km
, kmi
in addon_keymaps
:
116 km
.keymap_items
.remove(kmi
)
117 addon_keymaps
.clear()
120 if __name__
== "__main__":