Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ##### BEGIN GPL LICENSE BLOCK #####
- #
- # This program is free software; you can redistribute it and/or
- # modify it under the terms of the GNU General Public License
- # as published by the Free Software Foundation; either version 2
- # of the License, or (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software Foundation,
- # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- #
- # ##### END GPL LICENSE BLOCK #####
- bl_info = {
- "name": "Toggle Simplify",
- "description": "Toggle Simplify",
- "author": "poor",
- "version": (0, 0, 1),
- "blender": (2, 75, 0),
- "location": "3D View",
- "category": "3D View"
- }
- import bpy
- # operator
- class ToggleSimplify(bpy.types.Operator):
- """Tooltip"""
- bl_idname = "view3d.toggle_simplify"
- bl_label = "Toggle Simplify"
- bl_options = {'REGISTER', 'UNDO'}
- def execute(self, context):
- context.scene.render.use_simplify = not context.scene.render.use_simplify
- return {'FINISHED'}
- addon_keymaps = []
- # register
- def register():
- bpy.utils.register_class(ToggleSimplify)
- # handle the keymap
- wm = bpy.context.window_manager
- kc = wm.keyconfigs.addon
- if kc:
- km = wm.keyconfigs.addon.keymaps.new(name='3D View', space_type='VIEW_3D')
- kmi = km.keymap_items.new(ToggleSimplify.bl_idname, type='Q', value='PRESS', shift=True)
- addon_keymaps.append((km, kmi))
- # unregister
- def unregister():
- for km, kmi in addon_keymaps:
- km.keymap_items.remove(kmi)
- addon_keymaps.clear()
- bpy.utils.unregister_class(ToggleSimplify)
- if __name__ == "__main__":
- register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement