Why isn't there "Set origin to selected" by default?

A lot of times, I need to change the origin to the bottom side of the object (mostly because things are on top of a surface, in our real world?). If I see the solutions for this question, a lot of answers are complex requiring multiple unintuitive steps like moving the 3D cursor to the selected vertex and then setting the origin to the 3D cursor, etc. The easiest answer seems to be using the add-on “3D Viewport Pie Menus” which needs a complicated shortcut "Ctrl+Alt+X. Why doesn’t the Object->Set Origin menu just have “Set origin to selected”? Since the add-on can do it, it is not that hard, is it?

Hey … maybe a great idea. “Pitch it to the developers …”

bl_info = {
    "name": "AutoSnap Cursor",
    "author": "CDMJ",
    "version": (1, 0),
    "blender": (2, 80, 0),
    "location": "View3D - EDit Mode - Mesh Menu",
    "description": "Snap Orign to Editmode Selection",
    "warning": "",
    "doc_url": "",
    "category": "Edit Mode",
}


import bpy


class AUTOSNAP_ot_snaporiginop(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "autosnap.snaporiginop"
    bl_label = "Autosnap Operator"

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

    def execute(self, context):
        bpy.ops.view3d.snap_cursor_to_selected()
        bpy.ops.object.editmode_toggle()
        bpy.ops.object.origin_set(type='ORIGIN_CURSOR', center='MEDIAN')
        bpy.ops.object.editmode_toggle()
        return {'FINISHED'}

def menu_func(self, context):
    self.layout.operator(AUTOSNAP_ot_snaporiginop.bl_idname, text=AUTOSNAP_ot_snaporiginop.bl_label)


def register():
    bpy.utils.register_class(AUTOSNAP_ot_snaporiginop)
    bpy.types.VIEW3D_MT_edit_mesh.append(menu_func)


def unregister():
    bpy.utils.unregister_class(AUTOSNAP_ot_snaporiginop)
    bpy.types.VIEW3D_MT_edit_mesh.remove(menu_func)


if __name__ == "__main__":
    register()

1 Like

I messed up my post - I made the addon from the templates included, but for some reason I’m having some issues getting ti to show up in my menu correctly, but still shows up when I search for the operator and type ‘auto’. It’d be better if you can make the operator called from a key map item for edit mode or add it to your own pie menu.

Yeah, I find pie menus confusing. Your code seems to be working on my computer, and it does show up at the bottom of Mesh menu. Why not publish it officially (I don’t know how, but I mean showing up in the “Preferences → Add-ons”), so that other users could benefit from this function?

If they search the topic they may very well find this here and resolve what issue they have. If others already use the pie menu, then might not need this. The only thing I did was to copy three lines of code and stuff them into the python template for Simple Operator, and add unique names where needed. No magic beyond what is normal for most digging into python in blender.