2

I'm always working with big images (> 4K) and very often I use the % Resolution to make quick renders with the original proportion to progressively see the results/issues of the render. Unfortunately, there's no option to add this slider to the Quick Preferences (Q), and I have to adjust this value manually.

enter image description here

Are there other ways to quickly change this value without going to the Output Properties every time?

1 Answers1

4

There is a way to assign this action to a shortcut. Head to the Scripting tab (or open a Text Editor view) and paste this script:

bl_info = {
    "name": "Quick Render",
    "category": "Rendering",
}

import bpy

class QuickRender(bpy.types.Operator): bl_idname = "quick.render" bl_label = "Quick render" bl_options = {'REGISTER'}

def execute(self, context):
    # setup quick render settings and kick off render
    old_percentage = context.scene.render.resolution_percentage
    context.scene.render.resolution_percentage = 50
    bpy.ops.render.render('INVOKE_DEFAULT')
    # restore old render settings
    context.scene.render.resolution_percentage = old_percentage
    return {'FINISHED'}

addon_keymaps = []

def register(): bpy.utils.register_class(QuickRender) wm = bpy.context.window_manager # setup where to run the shortcut km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY') # setup the shortcut key kmi = km.keymap_items.new(QuickRender.bl_idname, 'R', 'PRESS', alt=True) addon_keymaps.append(km)

def unregister(): bpy.utils.unregister_class(QuickRender) wm = bpy.context.window_manager for km in addon_keymaps: wm.keyconfigs.addon.keymaps.remove(km) del addon_keymaps[:]

if name == 'main': register()

Running the script will enable Alt+R in the 3D view which starts a render with 50% resolution. Look at the comments in the code if you want to change the shortcut details. You can also register the script, so you don't need to run it everytime you open up your project:

enter image description here

I have adopted the code from the Blender addon tutorial. How to setup the shortcut is here and the render call here.

taiyo
  • 3,384
  • 1
  • 3
  • 18
  • I accepted the answer, because it does facilitate the change of the resolution percentage. The only thing is that the resolution is now changed to the new value defined, and I have to go back to the Output Properties if I want to change the value to another one. I believe that now it is just a new thing that I have to append to your script. Thanks for helping! – Julio Arvellos Oct 10 '23 at 15:21
  • The script just changes the percentage for rendering, but restores the old setting. I don't know if it's possible to have a "shortcut slider". You could extend the script with multiple shortcuts for different percentages (like Alt+1, Alt+2 etc.). If the shortcut slider is not possible yet, you could make a feature request to the Blender team https://blender.stackexchange.com/questions/1190/best-place-to-put-feature-requests/1211#1211 – taiyo Oct 10 '23 at 15:29
  • You're right about restoring the old settings! I may have done something wrong or edited it somewhere not needed. – Julio Arvellos Oct 10 '23 at 15:34