I'm trying to hotkey Blender's function of a mesh object in the viewport to be displayed as a wireframe (the one that can be found in the Object --> Viewport Display tab --> Display as wire). I need it so that I don't have to quit the fullscreen mode while I'm modelling.

Now, I am aware that there are free and paid add-ons available that automatically do that when you use an object for a boolean operation (like Jaynam's Fast carve or Hardops), but I try to keep my workflow add-on free as much as possible, as those add-ons have their own problems and disadvantages (slow updates causing problems with latest builds of 2.8, for example, Jaynam's fast carve creates hidden geometry rubbish in latest versions and etc, and this is why I don't want to rely on those workflows, especially when I can bind everything on hotkeys and do it quite fast straight out of the box and have zero problems migrating to future builds).

I've tried creating a hotkey bind in input preferences on a command Object.display_type, but nothing happens (It's obvious that I'm not using it correctly). I'm not acquainted with Blender python API, neither am I a good python coder. Can someone, pretty please, direct me in the correct destination?

Help me bind this function to a hotkey please


1 Answer 1


You would have to code it as an add-on. First make an operator than make it into an addon for it to be available every time you start Blender. Something like this:

bl_info = {
    "name": "Toggle Wireframe",
    "author": "Martynas Žiemys",
    "version": (1, 0),
    "blender": (2, 80, 0),
    "location": "View3D - ctrl + alt + shift + z",
    "description": "Toggles display mode of selected objects between Wire and Textured",
    "warning": "",
    "wiki_url": "",
    "category": "View 3D",

import bpy

class OBJECT_OT_wire_toggle(bpy.types.Operator):
    """Toggles display mode of selected objects between Wire and Textured"""
    bl_idname = "object.wire_toggle"
    bl_label = "Display as Wire Toggle"

    def poll(cls, context):
        return context.object is not None

    def execute(self, context):
        if context.object.display_type == 'WIRE':
            display_type = 'TEXTURED'
            display_type = 'WIRE'       
        for obj in context.selected_objects: 
            obj.display_type = display_type
        return {'FINISHED'}

addon_keymaps = []
def registerKeymaps():
    wm = bpy.context.window_manager
    if wm.keyconfigs.addon:
        km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
        kmi = km.keymap_items.new('object.wire_toggle', 'Z', 'PRESS', shift=True, alt=True,ctrl=True)
        addon_keymaps.append((km, kmi))

def unregisterKeymaps():
    for km, kmi in addon_keymaps:

classes = (

def register():
    from bpy.utils import register_class
    for cls in classes:

def unregister():
    from bpy.utils import unregister_class
    for cls in reversed(classes):

if __name__ == "__main__":

You can change it to your liking, save it as .py and install it as an add-on.

There is no reason to try to keep your workflow 'add-on free'. A big part of using Blender is using its many addons. The software cannot and should not come with all possible functionality - it would be massive and inefficient. Add-ons help you have the functionality you need.

  • $\begingroup$ Holy momma! Thank you so much for this, works like a charm! Aye, I totally agree there's no way devs can think about all the possible functionality, and I try to use add-ons where I can, but I try not to depend on them as add-on creators are not always keeping up with updates and I'm just a muggle in terms of coding within Blender framework. I'm used to maya and usually you can just lookup a mel-script command in your script editor history of anything happening in the viewport and bind it to a hotkey, or create a script inside of it and store it in the preferences hotkey panel afterwards. $\endgroup$ Dec 24, 2018 at 11:57
  • $\begingroup$ Thank you so much again! Words can't describe my happiness =))! It helped me so much! I've gotten rid of hotkey part of the script and use it as a startup script and assigned a custom hotkey to script's idname. $\endgroup$ Dec 24, 2018 at 12:38
  • $\begingroup$ Let's just not forget that 2.80 is not released yet, so we cannot really say anything about add-on creators updating their add-ons when talking about 2.80. If you choose to use unfinished software you should be very aware that it is what it is - unfinished softwarem, and not an update that developers should be keeping up with. We will see how it is when it is realeased, but until then generalizing like this is wrong. $\endgroup$ Dec 24, 2018 at 12:39
  • $\begingroup$ Aye, I agree. I'm not criticising addon-creators or trying to drop shade on their work =), I love them all and the work they are doing, and I wish I could make some fast fixes on my own (I'll get there sooner or later), and I'm not advising anyone to follow my workflow. Just trying to stay as safe as possible in my workflow all the time, It's just that I model for 8-10 hours every day and little disruptions in the workflow if they emerge, can be really disruptive. I've started using blender 2.8 for hard surface modelling and some other stuff just recently, but I do use other stuff as well. $\endgroup$ Dec 24, 2018 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.