Last active
May 21, 2023 18:01
-
-
Save p2or/e0568d20cca23c8f5673 to your computer and use it in GitHub Desktop.
Blender - Toggle Simplify using Shift+Q, for http://blender.stackexchange.com/a/46864/3710 #Blender
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ##### 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": "p2or", | |
"version": (0, 0, 3), | |
"blender": (2, 93, 0), | |
"tracker_url": "https://gist.github.com/p2or/e0568d20cca23c8f5673", | |
"location": "3D View", | |
"category": "3D View" | |
} | |
import bpy | |
# Operator | |
class ToggleSimplify(bpy.types.Operator): | |
"""Toggle Simplify""" | |
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 | |
self.report({'INFO'}, "Simplify: {}" | |
.format(['Off','On'][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() |
Hi @Vignatzy,
'Simplify' is only available in Cycles and I guess your default engine is Eevee. You might want to use the second script mentioned in my answer: http://blender.stackexchange.com/a/46864/3710. Does this help?
Cheers Christian
Dear Christian,
First of all, thank you for replying.
I only use Cycles, so I have it set by default. I resolved it. The problem was: Default simplify settings were not set to Max Subd:0 . That is why It wasn't really simplyfing anything. Every user needs to set Max SubD to 0 and save as a startup file.
Regards,
Ignacy
Hi @Vignatzy. No problem, glad it works! Regards, Christian
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @Vignatzy,
'Simplify' is only available in Cycles and I guess your default engine is Eevee. You might want to use the second script mentioned in my answer: http://blender.stackexchange.com/a/46864/3710. Does this help?
Cheers
Christian