Remove bl_options from menus which caused tests to fail
[blender-addons.git] / space_view3d_pie_menus / pie_shading_menu.py
blob66a169c3c5a5825c7715dfd753cf3e57f40800ab
1 # SPDX-FileCopyrightText: 2016-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 bl_info = {
6 "name": "Hotkey: 'Z'",
7 "description": "Viewport Shading Menus",
8 "author": "pitiwazou, meta-androcto",
9 "version": (0, 1, 1),
10 "blender": (2, 80, 0),
11 "location": "3D View",
12 "warning": "",
13 "doc_url": "",
14 "category": "Shading Pie"
17 import bpy
18 from bpy.types import Menu
21 # Pie Shading - Z
22 class PIE_MT_ShadingView(Menu):
23 bl_idname = "PIE_MT_shadingview"
24 bl_label = "Pie Shading"
26 def draw(self, context):
27 layout = self.layout
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")
36 else:
37 pie.operator("OBJECT_OT_shade_smooth")
38 pie.operator("OBJECT_OT_shade_flat")
41 classes = (
42 PIE_MT_ShadingView,
45 addon_keymaps = []
48 def register():
49 for cls in classes:
50 bpy.utils.register_class(cls)
52 wm = bpy.context.window_manager
53 if wm.keyconfigs.addon:
54 # Shading
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))
61 def unregister():
62 for cls in classes:
63 bpy.utils.unregister_class(cls)
65 wm = bpy.context.window_manager
66 kc = wm.keyconfigs.addon
67 if kc:
68 for km, kmi in addon_keymaps:
69 km.keymap_items.remove(kmi)
70 addon_keymaps.clear()
73 if __name__ == "__main__":
74 register()