How can I tell what mesh selection mode blender is in I'm not very experienced with scripting but was hoping to be able to find out what mesh selection mode (edges,faces or verts) Blender is in while in edit mode to make some custom hotkey assignments that takes this into account.

I have worked out how to set up a basic modal operator so need something to feed into an if statement.

Thanks
You can access this via the Scene property:


http://www.blender.org/api/blender_python_api_2_76_release/bpy.types.ToolSettings.html#bpy.types.ToolSettings.mesh_select_mode


Or if you're editing meshes using the BMesh API (if you're modifying the mesh in BMesh already).


http://www.blender.org/api/blender_python_api_2_76_release/bmesh.types.html#bmesh.types.BMesh.select_mode




Example to run in the console:

&gt;&gt;&gt; print(bpy.context.scene.tool_settings.mesh_select_mode)
&lt;bpy_boolean[3], ToolSettings.mesh_select_mode&gt;


To see the values, you can get get the sequence as a tuple

&gt;&gt;&gt; print(tuple(bpy.context.scene.tool_settings.mesh_select_mode))
(True, False, False)