bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.mode_set(mode='EDIT')
The above API commands allow me to switch between OBJECT and EDIT modes. Once I am in EDIT mode, is there a Python command to specify or switch between Vertex Select Mode, Edge Select Mode, and Face Select Mode?????
My goal is to merge certain vertices by doing this:
current_obj.data.vertices[0].select = True
current_obj.data.vertices[1].select = True
bpy.ops.mesh.merge(type='CENTER', uvs=False)
But if the context in EDIT mode is anything other than vertex select mode, in my case it is usually in face select mode) then setting vertices[n] = True does not work. So I need to set context to vertex selection mode with a Python command.
By the way, why do I have to be in OBJECT mode to select vertices (but prior to this, while in EDIT mode, set vertex selection mode), then go back in EDIT mode to merge them. This seems counterintuitive and a lot of jumping back and forth when it really all should happen in EDIT mode?
Thanks ahead of time for any help!
Thank you 'ldo', that works great.
If you don't mind a combo... [Ctrl]+[Tab] then hit [1], [2], or [3] while in edit mode, for vert,edge,face, respectively.
Most of the menu items respond to numeric keys according to their index on the menu -- for example: [shift] + [s] brings up the menu for 3d-cursor-type-stuff, since the fourth thing is cursor to center, so [shift] + [s] , [4] is the shortcut to set the cursor to the origin.
Although I must admit, I have thought about how nice it would be to have single-key shortcuts for the v e and f modes. I just never bothered to write a script.
I was using the combo but I realized it was a bit tedious to have use three keys for that instead of using only one, what would be faster.
you can, see here:
http://cgcookie.com/blender/2010/05/17/custom-hot-keys/
basically add hotkeys,
operator: wm.context_set_value
data path: tool_settings.mesh_select_mode
value: False, True, False (for edge mode)
_________________
I'm sitting, waiting, wishing, building Blender in superstition...