1 # SPDX-License-Identifier: GPL-2.0-or-later
5 "description": "Viewport Shading Menus",
6 "author": "pitiwazou, meta-androcto",
12 "category": "Shading Pie"
16 from bpy
.types
import Menu
20 class PIE_MT_ShadingView(Menu
):
21 bl_idname
= "PIE_MT_shadingview"
22 bl_label
= "Pie Shading"
24 def draw(self
, context
):
27 pie
= layout
.menu_pie()
28 pie
.prop(context
.space_data
.shading
, "type", expand
=True)
30 if context
.active_object
:
31 if context
.mode
== 'EDIT_MESH':
32 pie
.operator("MESH_OT_faces_shade_smooth")
33 pie
.operator("MESH_OT_faces_shade_flat")
35 pie
.operator("OBJECT_OT_shade_smooth")
36 pie
.operator("OBJECT_OT_shade_flat")
48 bpy
.utils
.register_class(cls
)
50 wm
= bpy
.context
.window_manager
51 if wm
.keyconfigs
.addon
:
53 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
='3D View Generic', space_type
='VIEW_3D')
54 kmi
= km
.keymap_items
.new('wm.call_menu_pie', 'Z', 'PRESS')
55 kmi
.properties
.name
= "PIE_MT_shadingview"
56 addon_keymaps
.append((km
, kmi
))
61 bpy
.utils
.unregister_class(cls
)
63 wm
= bpy
.context
.window_manager
64 kc
= wm
.keyconfigs
.addon
66 for km
, kmi
in addon_keymaps
:
67 km
.keymap_items
.remove(kmi
)
71 if __name__
== "__main__":