0
$\begingroup$

I need to simplify Blender UI, and I need to recode template_header_3D() from space_view3d.py

I already replaced all the UI elements succesfully, except for the mesh selection mode widget.

I tried several options:

1)

row.operator("mesh.select_mode", text="", icon='VERTEXSEL').type = 'VERT'
row.operator("mesh.select_mode", text="", icon='EDGESEL').type = 'EDGE'
row.operator("mesh.select_mode", text="", icon='FACESEL').type = 'FACE'

But this does not higlights which selection modes are chosen

2)

row.prop(toolsettings, "mesh_select_mode",icon='VERTEXSEL', text='',  toggle=True, icon_only=True)

This would work fine, but I cannot set the three different icons, because this is not accepted:

icon=('VERTEXSEL','EDGESEL','FACESEL')

Suggestions?

$\endgroup$

1 Answer 1

1
$\begingroup$

Here is the solution:

if obj and obj.mode == 'EDIT':
    row = layout.row(align=True)
    row.prop(toolsettings, "mesh_select_mode", icon='VERTEXSEL', text='', index=0, toggle=True)
    row.prop(toolsettings, "mesh_select_mode", icon='EDGESEL', text='', index=1, toggle=True)
    row.prop(toolsettings, "mesh_select_mode", icon='FACESEL', text='', index=2, toggle=True)

Using the index parameter it is possible to select elements of the bool vector.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .