I remember that it was possible in previous versions to do this, but I cannot find anything in the 2.5 API.
I have a script that needs to detect whether mesh_edit mode is active, and I can do that, but there seems to be no way to detect (or set!) whether the user is in vertex-select, edge-select, or face-select mode.
It’s on the header of the 3D view.
Also, Ctrl+Tab. It would be better if ctrl+Tab would toggle through them instead of giving you a menu, but oh well, it is how it is…
Works only in Edit mode.
Umm, yeah, using python…
bpy.context.tool_settings.mesh_selection_mode
gives you an array where you can tell which mode == ‘True’.
Many thanks, Uncle Entity! I can’t wait to get home and try this ( crosses fingers, hoping this property is not read-only…)
Hello All.
What I’ve done is to map Alt+1, Alt+2 and Alt+3 to each of the selection modes. It took a little poking around.
Under User Preferences > Input > 3DView > Mesh I added a new keyboard assignment named: wm.context_set_value with Context Attributes: tool_settings.mesh_select_mode and Value: (True, False, False)
Works like a charm.
Kind regards,
Vince
Edit to add: It just occurred to me that my post completely missed the subject on the account of this being the Python and Plug-ins forum. Apologies.
>>> bpy.context.tool_settings.mesh_select_mode=[True,False,False] #vertexmode
>>> bpy.context.tool_settings.mesh_select_mode=[False,False,True] #facemode
the third possibility you can guess, can’t you?
Works nicely!