# 2.8 Shortcut to turn on/off “Emulate 3 Button Mouse”..?

Could use some insight please, I am not sure how to properly formulate this question (brand new to 3D and Blender 2.8). After reading up on various forums there maybe a way to reprogram a keymap shortcut for the ALT key?

I prefer having the "emulate 3 Button Mouse" checked for general tumbling/navigation so I don't have to use the MMB when zooming or nudging viewport but when "emulate 3 Button Mouse" is checked it nukes the ability to employ the ALT key for selecting edge loops/rings.

I found that Left Double Click works although selection is limited and does not do half of what is available as far as selecting/deselecting goes... Hmmm?

Sorry for long scenario here, not sure if there is a workaround. It's be nice though.

Thanks in advance. :)

Blender's keymap requires an operator to execute when the shortcut is pressed. Currently there is no operator to toggle the Emulate 3 Button Mouse option from the preferences, but this can be solved by writing a little add-on.

The following add-on creates an operator that allows to toggle the preference option and can therefore be added as a shortcut into your keymap. Copy & paste the script into a file and save it with the .py file extension.

bl_info = {
"name": "Toggle 'Emulate 3 Button Mouse'",
"author": "Robert Guetzkow",
"version": (1, 0),
"blender": (2, 80, 0),
"location": "Edit > Operator Search",
"description": "Operator for toggeling the 'Emulate 3 Button Mouse' option.",
"warning": "",
"wiki_url": "",
"category": "Preferences"}

import bpy

class PREFERENCES_OT_toggle_emulate_3_button_mouse(bpy.types.Operator):
bl_idname = "preferences.toggle_emulate_3_button_mouse"
bl_label = "Toggle 'Emulate 3 Button Mouse'"

def execute(self, context):
context.preferences.inputs.use_mouse_emulate_3_button = not context.preferences.inputs.use_mouse_emulate_3_button
return {"FINISHED"}

classes = (PREFERENCES_OT_toggle_emulate_3_button_mouse,)

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

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

if __name__ == "__main__":
register()


You can install the add-on in Edit > Preferences > Add-ons.

Once it's installed you will have to enable it. You can find it in the Preferences category.

Then switch to the Keymap in the preferences and add a shortcut referencing the operator from the add-on. You'll have to decide what key binding you'd like to use.

• wow thank you, this is way above my level of expertise but I will try my best. I am only guessing but do I save the script as a .py or is there a file extension blender prefers ? – halipino Oct 15 at 15:12
• Yes, you need to copy & paste the code into a file and save it with .py extension, for example toggle_emulate_3_mouse_button.py. In the preferences in the Add-ons section there is an Install button at the top. Click it and select the file. – Robert Gützkow Oct 15 at 15:17
• It should show up in the list of add-ons afterwards. You need to enable it by clicking on the checkbox next to it. – Robert Gützkow Oct 15 at 15:18
• I did it..! You Sir are a genius! Thank you so much. It took a bunch of attempts but made it work. – halipino Oct 15 at 16:05
• @halipino You're welcome! If my answer solved your problem, please mark it as accepted by clicking on the checkmark. – Robert Gützkow Oct 15 at 16:08