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: 'Z'",
23 "description": "Viewport Shading Menus",
24 "author": "pitiwazou, meta-androcto",
26 "blender": (2, 80, 0),
27 "location": "3D View",
30 "category": "Shading Pie"
34 from bpy
.types
import Menu
38 class PIE_MT_ShadingView(Menu
):
39 bl_idname
= "PIE_MT_shadingview"
40 bl_label
= "Pie Shading"
42 def draw(self
, context
):
45 pie
= layout
.menu_pie()
46 pie
.prop(context
.space_data
.shading
, "type", expand
=True)
48 if context
.active_object
:
49 if context
.mode
== 'EDIT_MESH':
50 pie
.operator("MESH_OT_faces_shade_smooth")
51 pie
.operator("MESH_OT_faces_shade_flat")
53 pie
.operator("OBJECT_OT_shade_smooth")
54 pie
.operator("OBJECT_OT_shade_flat")
66 bpy
.utils
.register_class(cls
)
68 wm
= bpy
.context
.window_manager
69 if wm
.keyconfigs
.addon
:
71 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
='3D View Generic', space_type
='VIEW_3D')
72 kmi
= km
.keymap_items
.new('wm.call_menu_pie', 'Z', 'PRESS')
73 kmi
.properties
.name
= "PIE_MT_shadingview"
74 addon_keymaps
.append((km
, kmi
))
79 bpy
.utils
.unregister_class(cls
)
81 wm
= bpy
.context
.window_manager
82 kc
= wm
.keyconfigs
.addon
84 for km
, kmi
in addon_keymaps
:
85 km
.keymap_items
.remove(kmi
)
89 if __name__
== "__main__":