Post #4825: C.scene.tool_settings.uv_select_mode

πŸ“‹ Metadata

🏷️ Tags

scripting intermediate solved

  • Python Scripting
  • Macro Editor
  • Poll Method

πŸ’¬ Content

C.scene.tool_settings.uv_select_mode
I believe this code is correct. How did you test it? Running the code in the console should help clarify any uncertainties you might have.

Please note that this code returns a string:

>>> bpy.context.tool_settings.uv_select_mode
'VERTEX'

>>> bpy.types.ToolSettings.bl_rna.properties["uv_select_mode"].description
'UV selection and display mode'

>>> bpy.types.ToolSettings.bl_rna.properties["uv_select_mode"].enum_items.keys()
['VERTEX', 'EDGE', 'FACE', 'ISLAND']

>>> bpy.context.tool_settings.mesh_select_mode[:]
(True, True, False)

The primary feature of mesh_select_mode is its ability to handle all three selection modes (vertex, edge, and face) simultaneously. This attribute is represented as a tuple containing three Boolean values. For instance, the value (True, True, False) indicates that both the vertex and edge selection modes are enabled, while the face selection mode is disabled.

In contrast, uv_select_mode is represented as a string and indicates only one selection mode. As such, you can’t access it using an index like you would with a list.

If you’re using the poll method, you might consider the following code. You can adjust the list contents based on your specific requirements:

m = C.tool_settings.uv_select_mode; return m in ['VERTEX', 'EDGE']

❀️ 2 likes


πŸ”— View on Blender Artists