After running the script, go to viewport,
ctrl
+ mouse_wheel_up
: Resolution Scale + 0.1
ctrl
+ mouse_wheel_down
: Resolution Scale - 0.1
(Go to keymap settings, make sure there are no shortcut conflicts)
import bpy
from bpy.utils import register_class, unregister_class
class SCALE_RES_UP(bpy.types.Operator):
bl_idname = "view3d.scale_res_up"
bl_label = "Resolution Scale Up"
def invoke(self, context, event):
bpy.context.preferences.view.ui_scale += 0.1
return {'FINISHED'}
class SCALE_RES_DN(bpy.types.Operator):
bl_idname = "view3d.scale_res_dn"
bl_label = "Resolution Scale Down"
def invoke(self, context, event):
bpy.context.preferences.view.ui_scale -= 0.1
return {'FINISHED'}
classes = (SCALE_RES_UP, SCALE_RES_DN)
addon_keymaps = []
def register():
for cls in classes: register_class(cls)
# Add the hotkey
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("view3d.scale_res_up", type='WHEELUPMOUSE', value='PRESS', ctrl=True)
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new("view3d.scale_res_dn", type='WHEELDOWNMOUSE', value='PRESS', ctrl=True)
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes: unregister_class(cls)
# Remove the hotkey
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":
register()
Example to make a script to add-on: How to duplicate parented objects as one object