I was looking into this: https://github.com/CenekStrichel/CendaTools/wiki/Render-Tools And there´s 1 key assignment to do the render region.

Basically you have: step 1: If user presses "(key)", invoke view3d.render_border command step 2: view3d.toggle_renderer step 3: Render area gets represented. step 4: IF a render area exist, and user presses "(key)" THEN view3d.clear_render_border

How could an .addon be created bindig all those commands and IF statement to a single keystroke?

Please help. Thanks.

Could this code get us started?

import bpy

class QuickRenderRegion(bpy.types.Operator):
    bl_idname = "view3d.toggle_render"
    bl_label = "QuickRenderRegion"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        #return {'FINISHED'}

def register():

def unregister():

if __name__ == "__main__":
  • $\begingroup$ Modal operator. Have a look into Templates > Python > Operator Modal. However that's cumbersome in this case. Out of curiosity: why you can't just use Ctrl+B? $\endgroup$
    – p2or
    Commented Jun 18, 2018 at 9:48
  • 1
    $\begingroup$ ctrl+b, shift+z, wait for render, shift+z, ctrl+alt+b <---- Outrageous combo! Ultra finish. (I think you get me). Keybinding it to 1 key: genius. $\endgroup$ Commented Jun 18, 2018 at 17:17
  • $\begingroup$ Simple example on how to bind an operaor to any shortcut. I think you get the idea, copy the operator and just replace the name of the class when calling keymap_items.new() and you are literally done. But notice that the operator you've linked to, actually needs a cleanup before using it in a production: there are bad references, bpy is imported multiple times etc... $\endgroup$
    – p2or
    Commented Jun 19, 2018 at 13:48
  • $\begingroup$ Actually it would be necessary to anchor 3 commands to the same keybind: 1-that starts the drawing rectangle area, 2 shifts to render, 3 if the same key is pressed again and there is a render preview area, then clear the area first and go into rectangle draw area again unless "ESC" is pressed and session will cancel (toggle back to regular selection mode). $\endgroup$ Commented Jun 21, 2018 at 16:00
  • $\begingroup$ @PierreSchiller you should make your solution into an answer to close this question. I don't think there is any better solution. $\endgroup$
    – HenrikD
    Commented Mar 5, 2019 at 16:35

1 Answer 1


I took p2or link and modified a little. After running the script, shortcut key is Shift + Q. def register() part has type = "Q" and shift = True alt = False and ctrl = False.

bl_info = {
    "name": "Toggle Simplify",
    "description": "Toggle Simplify",
    "author": "poor",
    "version": (0, 0, 2),
    "blender": (2, 79, 6),
    "location": "3D View",
    "category": "3D View"

import bpy

# operator
class ToggleSimplify(bpy.types.Operator):
    bl_idname = "view3d.toggle_simplify"
    bl_label = "Toggle Simplify"
    bl_options = {'REGISTER'}

    border = bpy.props.BoolProperty(default=False)

    def execute(self, context):

        if bpy.context.area.spaces.active.use_render_border:
            bpy.context.area.spaces.active.use_render_border = False
            self.border = False

        return {'RUNNING_MODAL'}

    def modal(self, context, event):

        if not self.border and context.area.spaces.active.use_render_border:
            self.border = True
            return {'FINISHED'}
        return {'PASS_THROUGH'}

addon_keymaps = []

# register
def register():

    # 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, alt=False, ctrl=False)
        addon_keymaps.append((km, kmi))

# unregister
def unregister():
    for km, kmi in addon_keymaps:


if __name__ == "__main__":
  • $\begingroup$ Hi. I´ll test this code. Question: What if I do SHIFT+Q for the shortcut instead of "Q" on edit mode, or object mode? Is the interaction mode going to affect the script? Say I am in wireframe mode, will it toggle to full render and back to wireframe? Also: How do I clear the region using the same Shotcut key but just "tap" to clear render region? Could this line change to: "ToggleSimplify.bl_idname, type='SHIFT Q', value='PRESS', shift=True" ? $\endgroup$ Commented Mar 5, 2019 at 19:44
  • $\begingroup$ I installed your .py addon, but when I press "Q", nothing happens. $\endgroup$ Commented Mar 5, 2019 at 19:58
  • $\begingroup$ Shift+Q is already the shortcut key combination for that script. $\endgroup$
    – JuhaW
    Commented Mar 5, 2019 at 20:50
  • $\begingroup$ Right now it´s triggering the render toggle first, then it launches area select mode. It should be area select mode first, end selecting area and when defined, then it should launch the toggle render function. Otherwise it beats the purpose of having a render preview. Could that be adjusted? $\endgroup$ Commented Mar 5, 2019 at 21:08
  • $\begingroup$ I updated the script. $\endgroup$
    – JuhaW
    Commented Mar 6, 2019 at 9:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .