4
$\begingroup$

As a long time user of other prominent 3d software, I'm used to being able to be in object mode and press 1 hotkey to go directly to vertex, edge, or face mode.

I'm using 2.8 and love it, but for the life of me, I can't get used to pressing "Tab" before I hit 1,2,or 3. To make things worse, those keys (in object mode) hide and unhide collections. It's driving me crazy.

I just want a smart hotkey that allows me to press 1,2,or 3 in object mode and automatically puts me in edit mode. Pressing "Tab" would behave as it already does - toggling between object or edit mode.

Is there a way to do this?

Thanks, Chris

$\endgroup$
3
  • $\begingroup$ Since as you mentioned object mode has different functions when pressing 1,2 .. and you want to skip the tab to switch to edit mode, it's not gonna be possible with a simple change of keymapping. The switch between modes is needed to get to the vertex, edge or face mode, so you most certainly would need to use a script (little addon) that would be called by a pressing a key. While that is possible, the fact remains that it would need to overwrite the 1,2 .. key in object mode to prevent Blender from doing the wrong thing. $\endgroup$
    – Xylvier
    Nov 20 '19 at 18:06
  • $\begingroup$ As much as i can understand having used other software for a long time comes with habits and a problem to just getting used to different workflows, it does not mean there is no reason for the difference. It can be changed, but that would lead to other changes needed to be made to keep the functionality of the collections available. Finding not used keys for shortcuts can be hard and would also estrange you from the default more and more, making it harder,not impossible, to follow tutorials as well as explanations from people not knowing your setup or using a different one all together. $\endgroup$
    – Xylvier
    Nov 20 '19 at 18:14
  • $\begingroup$ The tab key is also context-sensitive.. it will toggle to and from Edit mode from whichever mode you were in .. (Pose, Vertex Paint... etc) so overriding it would have to be done with care $\endgroup$ Nov 21 '19 at 16:37
6
$\begingroup$

The operator for this is bpy.ops.object.mode_set_with_submode(). It allows you to create custom shortcuts that both switch to edit mode and enable a combination of vertex, edge and/or face select.

The keymap can be edited through Edit > Preferences > Keymap. As shown in the screenshot below, you need to set the Identifier to object.mode_set_with_submode, select Edit Mode and choose the desired Submode.

enter image description here

The complicated part is the choice of shortcut though, since the number keys are already used in Object Mode. You'd either have to remap the shortcuts for hiding collections to e.g. CTRL + ALT + the number key or use a different key combination for your new shortcuts that don't involve the number keys.

$\endgroup$
2
  • $\begingroup$ Wow.. where did you track that one down? $\endgroup$ Nov 21 '19 at 16:39
  • 1
    $\begingroup$ @RobinBetts The industry compatible keymap used to define its own operator for this purpose which caused problems when people created a new keymap based on it, since the operator wouldn't be registered for the custom keymap. This was originally brought to my attention through this question. The issue was fixed by Campbell Barton by using the aforementioned operator. $\endgroup$
    – Robert Gützkow
    Nov 21 '19 at 17:12
1
$\begingroup$

I adjusted the template of "operator_simple.py" to do the switching into edit mode followed by the activation of "vertex" selection mode. This is by no means a perfect solution as i already mentioned in the comment, but as you asked, and i said it's possible, here the proof.

using a script to change object and selection mode Above i deactivated the 1 shortcut key and added a new one instead. In the new one i called the "object.simple_operator" without ()! And assigned the 1 key to it, afterwards i made sure the edit mode is not already in vertex mode to show the functionality of the code. With the Screencast Keys active you can see the 1 showing up at the lower left side when i press the 1 in the 3D View while in Object Mode. The result is the change to Edit Mode and vertex selection chosen in one go.

While this works as long as the script is used once in blender, or is registered to be executed on startup of blender, you would need 3 of these for each key ( 1 vertex, 2 edge, 3 faces). If you want you can even make it an addon by adding some more code to the top like in the code below.

bl_info = {
    "name": "Mode Switcher",
    "author": "Your Name Here",
    "version": (1, 0),
    "blender": (2, 80, 0),
    "location": "F3->simple_operator",
    "description": "Combines the switching to Edit Mode with activation of vertex select mode",
    "warning": "",
    "wiki_url": "",
    "category": "mode",
}

import bpy


def main(context):
    # switch to edit mode
    bpy.ops.object.mode_set(mode='EDIT', toggle=False)
    # activate vertex selection ( vertex, edge, face) possible to activate all or 2 as well
    bpy.context.tool_settings.mesh_select_mode = (True, False, False)


class SimpleOperator(bpy.types.Operator):
    """Change to edit mode and activate vertex select"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

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


def register():
    bpy.utils.register_class(SimpleOperator)


def unregister():
    bpy.utils.unregister_class(SimpleOperator)


if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.simple_operator()

This here does not include the naming and such, there sure is a lot that can be done. But the point is, it's possible, to which extend you want to change the workflow to be more close to what you are used to, that is essentially up to you. Please use separate names for the addon if you use this, i only used the template to explain it fast.

$\endgroup$
0

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.