Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. # ##### BEGIN GPL LICENSE BLOCK #####
  2. #
  3. # This program is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU General Public License
  5. # as published by the Free Software Foundation; either version 2
  6. # of the License, or (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software Foundation,
  15. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. #
  17. # ##### END GPL LICENSE BLOCK #####
  18.  
  19.  
  20. bl_info = {
  21. "name": "Toggle Simplify",
  22. "description": "Toggle Simplify",
  23. "author": "poor",
  24. "version": (0, 0, 1),
  25. "blender": (2, 75, 0),
  26. "location": "3D View",
  27. "category": "3D View"
  28. }
  29.  
  30. import bpy
  31.  
  32. # operator
  33. class ToggleSimplify(bpy.types.Operator):
  34. """Tooltip"""
  35. bl_idname = "view3d.toggle_simplify"
  36. bl_label = "Toggle Simplify"
  37. bl_options = {'REGISTER', 'UNDO'}
  38.  
  39. def execute(self, context):
  40. context.scene.render.use_simplify = not context.scene.render.use_simplify
  41. return {'FINISHED'}
  42.  
  43. addon_keymaps = []
  44. # register
  45. def register():
  46. bpy.utils.register_class(ToggleSimplify)
  47.  
  48. # handle the keymap
  49. wm = bpy.context.window_manager
  50. kc = wm.keyconfigs.addon
  51. if kc:
  52. km = wm.keyconfigs.addon.keymaps.new(name='3D View', space_type='VIEW_3D')
  53. kmi = km.keymap_items.new(ToggleSimplify.bl_idname, type='Q', value='PRESS', shift=True)
  54. addon_keymaps.append((km, kmi))
  55.  
  56. # unregister
  57. def unregister():
  58.  
  59. for km, kmi in addon_keymaps:
  60. km.keymap_items.remove(kmi)
  61. addon_keymaps.clear()
  62.  
  63. bpy.utils.unregister_class(ToggleSimplify)
  64.  
  65. if __name__ == "__main__":
  66. register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement