diff options
author | lijenstina <lijenstina@gmail.com> | 2017-07-05 02:22:14 +0300 |
---|---|---|
committer | lijenstina <lijenstina@gmail.com> | 2017-07-05 02:22:14 +0300 |
commit | 99ed610784b804c175d9e189d9a1b3036973ed61 (patch) | |
tree | 9865ee8d7e95d9747a349409139e0849db6d1d60 /space_view3d_pie_menus/pie_save_open_menu.py | |
parent | 759595b17b3a4b04f800d2c12e2af80aa63e4c29 (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_save_open_menu.py')
-rw-r--r-- | space_view3d_pie_menus/pie_save_open_menu.py | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/space_view3d_pie_menus/pie_save_open_menu.py b/space_view3d_pie_menus/pie_save_open_menu.py index 0a43eb2b..bdd9b63c 100644 --- a/space_view3d_pie_menus/pie_save_open_menu.py +++ b/space_view3d_pie_menus/pie_save_open_menu.py @@ -71,7 +71,6 @@ class pie_link(Menu): layout = self.layout pie = layout.menu_pie() box = pie.split().column() - row = box.row(align=True) box.operator("wm.link", text="Link", icon='LINK_BLEND') box.operator("wm.append", text="Append", icon='APPEND_BLEND') box.menu("external.data", text="External Data", icon='EXTERNAL_DATA') @@ -85,7 +84,6 @@ class pie_recover(Menu): layout = self.layout pie = layout.menu_pie() box = pie.split().column() - row = box.row(align=True) box.operator("wm.recover_auto_save", text="Recover Auto Save...", icon='RECOVER_AUTO') box.operator("wm.recover_last_session", text="Recover Last Session", icon='RECOVER_LAST') box.operator("wm.revert_mainfile", text="Revert", icon='FILE_REFRESH') @@ -99,7 +97,6 @@ class pie_fileio(Menu): layout = self.layout pie = layout.menu_pie() box = pie.split().column() - row = box.row(align=True) box.menu("INFO_MT_file_import", icon='IMPORT') box.separator() box.menu("INFO_MT_file_export", icon='EXPORT') @@ -128,7 +125,7 @@ class ExternalData(Menu): class FileIncrementalSave(Operator): bl_idname = "file.save_incremental" bl_label = "Save Incremental" - bl_description = "Save First!then Incremental, .blend will get _001 extension" + bl_description = "Save First! then Incremental, .blend will get _001 extension" bl_options = {"REGISTER"} @classmethod @@ -163,7 +160,8 @@ class FileIncrementalSave(Operator): try: bpy.ops.wm.save_as_mainfile(filepath=output) except: - self.report({'WARNING'}, "File could not be saved. Check the System Console for errors") + self.report({'WARNING'}, + "File could not be saved. Check the System Console for errors") return {'CANCELLED'} self.report( @@ -189,29 +187,27 @@ 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: # Save/Open/... km = wm.keyconfigs.addon.keymaps.new(name='Window') kmi = km.keymap_items.new('wm.call_menu_pie', 'S', 'PRESS', ctrl=True) kmi.properties.name = "pie.saveopen" -# 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['Window'] - for kmi in km.keymap_items: - if kmi.idname == 'wm.call_menu_pie': - if kmi.properties.name == "pie.saveopen": - km.keymap_items.remove(kmi) + for km, kmi in addon_keymaps: + km.keymap_items.remove(kmi) + addon_keymaps.clear() + if __name__ == "__main__": register() |