How do i add sculpt brushes to the pie menu?

I hope this is the right area to post that kind of stuff.
It seems like this is the brush operator that is running the brush select menu:

ops.brush.active_index_set(<i>mode=""</i>, <i>index=0</i>)

But it dosen’t work if i try to integrate it to the pie menu template. It’s ignoring the mode and index and just select the current brush that i selected via shortcut.

Hi!
You can first init like this :

from bl_ui.properties_paint_common import (
UnifiedPaintPanel,
brush_texture_settings,
brush_texpaint_common,
brush_mask_texture_settings,
)

if neccessary, define the context or add any condition like if
bpy.context.area.type == ‘VIEW_3D’ and bpy.context.object.mode == ‘SCULPT’:

For some operators you will need intermediates like :

brush = context.tool_settings.sculpt.brush
ups = context.tool_settings.unified_paint_settings

then use some operators like :

row.operator(“paint.brush_select”, text=’’, icon=‘BRUSH_SCULPT_DRAW’).sculpt_tool=‘DRAW’
row.operator(“paint.brush_select”, text=’’, icon=‘BRUSH_GRAB’).sculpt_tool=‘GRAB’
row.operator(“paint.brush_select”, text=’’, icon=‘BRUSH_MASK’).sculpt_tool=‘MASK’
row.operator(“paint.brush_select”, text=’’, icon=‘BRUSH_CREASE’).sculpt_tool=‘CREASE’

for special props like radius or strength :
row.prop(ups, “size”, text=“Radius”, slider=False)
row.prop(ups, “use_locked_size”, text=“L”)

hope it will be useful!

Thank you very much!

The row operator was exactly what i needed to make the python pie template to run the brushes.

Can You tell, how change in this line from px to mm or other units
row.prop(ups, “size”, text=“Radius”, slider=False)
Thanks for help.
Greets