I was reading this and this about switching the pivot point.
And I managed to reproduce its 4 steps:
bpy.ops.mesh.primitive_cube_add(radius=1, view_align=False, enter_editmode=False, location=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_all(action='TOGGLE')
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
bpy.ops.view3d.snap_cursor_to_selected()
bpy.ops.object.editmode_toggle()
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
So the logical question is: Can we get it down to 1 "keybind"?
The usual workflow should be:
- I change from object to edit mode.
- I select "VERTS" to grab different points between what I need to place the CENTER of the object (the purpose of this is that every time I want to manipulate/rotate/translate) this object, those selected vertices will have the TRUE center of the object in LOCAL mode.
- I choose "CENTER to SELECTED" (from somewhere/my function/addon, etc..)
- (internally blender moves the pivot to selected, changes (snaps) the CENTER to pivot, and then returns the PIVOT to the center of the world. The idea is that the PIVOT will not get lost or in the way once it has completed its task).
- The center of the object gets placed between the selected vertices (or edges/faces).
Is it possible to do this on a code or addon? Thanks.