1 # SPDX-FileCopyrightText: 2016-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 "name": "Hotkey: 'Alt Spacebar'",
7 "description": "Manipulator Menu",
8 "author": "pitiwazou, meta-androcto",
10 "blender": (2, 80, 0),
11 "location": "3D View",
14 "category": "Manipulator Pie"
18 from bpy
.types
import (
22 from bpy
.props
import (
28 class PIE_OT_WManupulators(Operator
):
29 bl_idname
= "w.manipulators"
30 bl_label
= "W Manupulators"
31 bl_options
= {'REGISTER', 'UNDO'}
32 bl_description
= " Show/Hide Manipulator"
39 ('TRANSLATE', "Move", ""),
40 ('ROTATE', "Rotate", ""),
41 ('SCALE', "Scale", ""),
45 def execute(self
, context
):
46 space_data
= context
.space_data
47 space_data
.show_gizmo_context
= True
50 "show_gizmo_object_translate",
51 "show_gizmo_object_rotate",
52 "show_gizmo_object_scale",
54 attr_t
, attr_r
, attr_s
= attrs
55 attr_index
= ('TRANSLATE', 'ROTATE', 'SCALE').index(self
.type)
56 attr_active
= attrs
[attr_index
]
59 setattr(space_data
, attr_active
, not getattr(space_data
, attr_active
))
62 setattr(space_data
, attr
, attr
== attr_active
)
65 def invoke(self
, context
, event
):
66 self
.extend
= event
.shift
67 return self
.execute(context
)
70 # Pie Manipulators - Ctrl + Space
71 class PIE_MT_Manipulator(Menu
):
72 bl_idname
= "PIE_MT_manipulator"
73 bl_label
= "Pie Manipulator"
75 def draw(self
, context
):
77 pie
= layout
.menu_pie()
79 pie
.operator("w.manipulators", text
="Rotate", icon
='NONE').type = 'ROTATE'
81 pie
.operator("w.manipulators", text
="Scale", icon
='NONE').type = 'SCALE'
83 props
= pie
.operator("wm.context_toggle", text
="Show/Hide Toggle", icon
='NONE')
84 props
.data_path
= "space_data.show_gizmo_context"
86 pie
.operator("w.manipulators", text
="Translate", icon
='NONE').type = 'TRANSLATE'
99 bpy
.utils
.register_class(cls
)
101 wm
= bpy
.context
.window_manager
102 if wm
.keyconfigs
.addon
:
104 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
='3D View Generic', space_type
='VIEW_3D')
105 kmi
= km
.keymap_items
.new('wm.call_menu_pie', 'SPACE', 'PRESS', alt
=True)
106 kmi
.properties
.name
= "PIE_MT_manipulator"
107 addon_keymaps
.append((km
, kmi
))
112 bpy
.utils
.unregister_class(cls
)
114 wm
= bpy
.context
.window_manager
115 kc
= wm
.keyconfigs
.addon
117 for km
, kmi
in addon_keymaps
:
118 km
.keymap_items
.remove(kmi
)
119 addon_keymaps
.clear()
122 if __name__
== "__main__":