1 # SPDX-FileCopyrightText: 2016-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
7 "description": "Viewport Shading Menus",
8 "author": "pitiwazou, meta-androcto",
10 "blender": (2, 80, 0),
11 "location": "3D View",
14 "category": "Shading Pie"
18 from bpy
.types
import Menu
22 class PIE_MT_ShadingView(Menu
):
23 bl_idname
= "PIE_MT_shadingview"
24 bl_label
= "Pie Shading"
26 def draw(self
, context
):
29 pie
= layout
.menu_pie()
30 pie
.prop(context
.space_data
.shading
, "type", expand
=True)
32 if context
.active_object
:
33 if context
.mode
== 'EDIT_MESH':
34 pie
.operator("MESH_OT_faces_shade_smooth")
35 pie
.operator("MESH_OT_faces_shade_flat")
37 pie
.operator("OBJECT_OT_shade_smooth")
38 pie
.operator("OBJECT_OT_shade_flat")
50 bpy
.utils
.register_class(cls
)
52 wm
= bpy
.context
.window_manager
53 if wm
.keyconfigs
.addon
:
55 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
='3D View Generic', space_type
='VIEW_3D')
56 kmi
= km
.keymap_items
.new('wm.call_menu_pie', 'Z', 'PRESS')
57 kmi
.properties
.name
= "PIE_MT_shadingview"
58 addon_keymaps
.append((km
, kmi
))
63 bpy
.utils
.unregister_class(cls
)
65 wm
= bpy
.context
.window_manager
66 kc
= wm
.keyconfigs
.addon
68 for km
, kmi
in addon_keymaps
:
69 km
.keymap_items
.remove(kmi
)
73 if __name__
== "__main__":