Home Technical Talk

Blender Hotkey Help

polycounter lvl 11
Offline / Send Message
YakZSmelk polycounter lvl 11

Hi all! Max/Maya user finally working up the nerve to switch over to Blender. I'm hitting a snag with getting a hotkey setup, that is sorta my bread and butter when it comes to modeling.

The function I'm trying to emulate is the 'Connect' command from Maya, the way it works is if you select two verts on a face an edge will be created between them, if you select two edges it will create an edge between them.


From what I can see doing some Google searches there is nothing native to Blender that works this way so I need to use two commands;

mesh.subdivide

mesh.vert_connect_path

These commands work great but I'm not sure how to only have the subdivide hotkey work when I'm in Edge Mode, is there an easy way to do this, or will this require a script? If it does, do you have an example of the script I could get?


Thanks for any help you can provide!

Replies

  • StormyBA
    Options
    Offline / Send Message
    StormyBA polycounter lvl 8

    "J" for join will connect your verts.

    You can add loop cuts or chop in geo with the knife tool "K" to add edges pretty easy.

  • okidoki
    Options
    Offline / Send Message
    okidoki polycounter lvl 2

    The docu changed a little back in (June 2020) for 2.83 and there is now connect vertex pairs and connect vertex path where the first just cuts in one polygon and the later between/across polygons (so if you only want the first you.. and the limitation is long gone)..

    Also the subdivide edges (Ctrl-E gives the menu) may be what you looking for because it also connects the edges (see docu https://docs.blender.org/manual/en/latest/modeling/meshes/editing/edge/subdivide.html also since 2.83 June 2020).

    ( But that's the nice thing in blender: if you need and older version.. it works.. in parallel to any other one... even 2.49 😉 from 2009 )

  • pior
    Options
    Offline / Send Message
    pior grand marshal polycounter

    @YakZSmelk You mention "hitting a snag with getting a hotkey setup", which seems to suggest that your mode of operation was to look for a given funtion through the hotkey manager (just like how one would do in Max, as the hotkey manager there lists everything that can be hotkeyed).

    Blender isn't structured the same way. At its core every tool/operation calls a python command ; and then there's a UI with menus that has been populated with (nearly) all said commands, as well as key bindings that got setup to some of these commands - but not all. Put differently : The hotkey manager is not the place where to find all the things that can be hotkeyed - it is the place where any hotkey that was setup shows up and is available for further editing.

    All that to say that your first step when looking for a vert connect tool isn't to dig into the hotkey manager, but rather to look into the Mesh Edit/Vertex menu (or, performing a global search for "vertex" or "connect", which will list any phtyon command that has one of these terms in its handle).

    Once found you'll have the generic name of the operation, as well as its actual python command. Armed with that you'll be able to find if there is any hotkey bound to it already, or create your own.

    The TLDR is that the hotkey manager doesn't hold all possible commands, whereas the relevant context menus and the global search do.

    I hope this makes sense !

    As for a multi-context tool doing a certain thing on verts selection and a diffeent thing on a edge selection (in this case Subdivide set to a value of 1) : if an addon for it doesn't exist already then that would likely require some light scripting by a programmer.

  • YakZSmelk
    Options
    Offline / Send Message
    YakZSmelk polycounter lvl 11

    Thank you all for the responses!


    Apologizes I don't think my request was clear now that I'm looking at it again after reading the responses; what I was trying to accomplish was having a single hotkey (no menu/pie menu/marking menu) control two different commands based on the edit mode I'm in (VERTEX or EDGE).

    I managed to accomplish this (it's rough), there's a handful of things I'm positive are wrong since I'm pulling from various tutorials and documentation to make to throw it together. Feel free to critique and/or use this if you're a Maya user trying to figure out how to get a function similar to Maya's connect.


    @pior good looks on the path vs pairs


    import bpy
    class MESH_OT_context_connect(bpy.types.Operator):
        bl_idname = "operator.context_connect"
        bl_label = "Context Connect"
        
        def execute(self, context):
            #Check to see if the current object is in EDIT Mode
            if((bpy.context.active_object.mode)=="EDIT"):
        
                #If the object is in EDIT mode, which subobject mode is it in 
                if(tuple(bpy.context.scene.tool_settings.mesh_select_mode)==(True, False, False)):
                    #Vertex Mode
                    bpy.ops.mesh.vert_connect()
    
                elif(tuple(bpy.context.scene.tool_settings.mesh_select_mode)==(False, True, False)):
                    #Edge Mode
                    bpy.ops.mesh.subdivide()
             
                else:
                    #Face Mode
                    print((bpy.context.active_object.mode) + " FACE MODE")
            else:
                #Object Mode
                print(bpy.context.active_object.mode)
                
            return{'FINISHED'}
    
    #Tell Blender this operator exsists by registering it
    def register():
        bpy.utils.register_class(MESH_OT_context_connect)
        
    def unregister():
        bpy.utils.unregister_class(MESH_OT_context_connect)
    
    if __name__ == "__main__":
        register()
        
    bpy.ops.operator.context_connect()
    


Sign In or Register to comment.