1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
22 "name": "Hotkey: 'Alt Spacebar'",
23 "description": "Manipulator Menu",
24 "author": "pitiwazou, meta-androcto",
26 "blender": (2, 80, 0),
27 "location": "3D View",
30 "category": "Manipulator Pie"
34 from bpy
.types
import (
38 from bpy
.props
import (
44 class PIE_OT_WManupulators(Operator
):
45 bl_idname
= "w.manipulators"
46 bl_label
= "W Manupulators"
47 bl_options
= {'REGISTER', 'UNDO'}
48 bl_description
= " Show/Hide Manipulator"
55 ('TRANSLATE', "Move", ""),
56 ('ROTATE', "Rotate", ""),
57 ('SCALE', "Scale", ""),
61 def execute(self
, context
):
62 space_data
= context
.space_data
63 space_data
.show_gizmo_context
= True
66 "show_gizmo_object_translate",
67 "show_gizmo_object_rotate",
68 "show_gizmo_object_scale",
70 attr_t
, attr_r
, attr_s
= attrs
71 attr_index
= ('TRANSLATE', 'ROTATE', 'SCALE').index(self
.type)
72 attr_active
= attrs
[attr_index
]
75 setattr(space_data
, attr_active
, not getattr(space_data
, attr_active
))
78 setattr(space_data
, attr
, attr
== attr_active
)
81 def invoke(self
, context
, event
):
82 self
.extend
= event
.shift
83 return self
.execute(context
)
86 # Pie Manipulators - Ctrl + Space
87 class PIE_MT_Manipulator(Menu
):
88 bl_idname
= "PIE_MT_manipulator"
89 bl_label
= "Pie Manipulator"
91 def draw(self
, context
):
93 pie
= layout
.menu_pie()
95 pie
.operator("w.manipulators", text
="Rotate", icon
='NONE').type = 'ROTATE'
97 pie
.operator("w.manipulators", text
="Scale", icon
='NONE').type = 'SCALE'
99 props
= pie
.operator("wm.context_toggle", text
="Show/Hide Toggle", icon
='NONE')
100 props
.data_path
= "space_data.show_gizmo_context"
102 pie
.operator("w.manipulators", text
="Translate", icon
='NONE').type = 'TRANSLATE'
107 PIE_OT_WManupulators
,
116 bpy
.utils
.register_class(cls
)
118 wm
= bpy
.context
.window_manager
119 if wm
.keyconfigs
.addon
:
121 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
='3D View Generic', space_type
='VIEW_3D')
122 kmi
= km
.keymap_items
.new('wm.call_menu_pie', 'SPACE', 'PRESS', alt
=True)
123 kmi
.properties
.name
= "PIE_MT_manipulator"
124 addon_keymaps
.append((km
, kmi
))
129 bpy
.utils
.unregister_class(cls
)
131 wm
= bpy
.context
.window_manager
132 kc
= wm
.keyconfigs
.addon
134 for km
, kmi
in addon_keymaps
:
135 km
.keymap_items
.remove(kmi
)
136 addon_keymaps
.clear()
139 if __name__
== "__main__":