Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijenstina <lijenstina@gmail.com>2017-07-05 02:22:14 +0300
committerlijenstina <lijenstina@gmail.com>2017-07-05 02:22:14 +0300
commit99ed610784b804c175d9e189d9a1b3036973ed61 (patch)
tree9865ee8d7e95d9747a349409139e0849db6d1d60 /space_view3d_pie_menus/pie_shading_menu.py
parent759595b17b3a4b04f800d2c12e2af80aa63e4c29 (diff)
3D Viewport Pie Menus: Cleanup, refactor, fix key register
Bumped version to 1.1.5 Pep8 cleanup Remove the pie_origin_cursor.py since it is not needed anymore Part of the T51547: refactor the key unregister code so it matches the official pies Note: using this code was crashing blender because of Bool Tool key registration that left out some lingering keys on unregister reload Also there were some wrong calls with the unregister within the pies themselves Merge some operators where possible (around 7 less in total) and use passing arguments instead Add Enable All / Disable all buttons in the preferences Comment out the code for authors in the init instead of in individual scripts Remove unused imports and cameratoto scene prop Add an icon at end of registrations line Fix several crashes with operators being called out of context
Diffstat (limited to 'space_view3d_pie_menus/pie_shading_menu.py')
-rw-r--r--space_view3d_pie_menus/pie_shading_menu.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/space_view3d_pie_menus/pie_shading_menu.py b/space_view3d_pie_menus/pie_shading_menu.py
index 8c9f1f50..e7eb03b9 100644
--- a/space_view3d_pie_menus/pie_shading_menu.py
+++ b/space_view3d_pie_menus/pie_shading_menu.py
@@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'Z'",
"description": "Viewport Shading Menus",
- # "author": "pitiwazou, meta-androcto",
- # "version": (0, 1, 0),
+ "author": "pitiwazou, meta-androcto",
+ "version": (0, 1, 1),
"blender": (2, 77, 0),
"location": "3D View",
"warning": "",
@@ -33,9 +33,8 @@ bl_info = {
import bpy
from bpy.types import Menu
-# Pie Shading - Z
-
+# Pie Shading - Z
class PieShadingView(Menu):
bl_idname = "pie.shadingview"
bl_label = "Pie Shading"
@@ -47,7 +46,7 @@ class PieShadingView(Menu):
pie.prop(context.space_data, "viewport_shade", expand=True)
if context.active_object:
- if(context.mode == 'EDIT_MESH'):
+ if context.mode == 'EDIT_MESH':
pie.operator("MESH_OT_faces_shade_smooth")
pie.operator("MESH_OT_faces_shade_flat")
else:
@@ -65,29 +64,26 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
- wm = bpy.context.window_manager
+ wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Shading
km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
kmi = km.keymap_items.new('wm.call_menu_pie', 'Z', 'PRESS')
kmi.properties.name = "pie.shadingview"
-# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
- wm = bpy.context.window_manager
+ wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
- km = kc.keymaps['3D View Generic']
- for kmi in km.keymap_items:
- if kmi.idname == 'wm.call_menu_pie':
- if kmi.properties.name == "pie.shadingview":
- km.keymap_items.remove(kmi)
+ for km, kmi in addon_keymaps:
+ km.keymap_items.remove(kmi)
+ addon_keymaps.clear()
if __name__ == "__main__":