This fails because some tool contexts define their tools with functions
[see the following list for context that fail]:
- PARTICLE (_defs_particle.generate_from_brushes)
- SCULPT (_defs_sculpt.generate_from_brushes)
- PAINT_TEXTURE (_defs_texture_paint.generate_from_brushes)
- PAINT_VERTEX (_defs_vertex_paint.generate_from_brushes)
- PAINT_WEIGHT (_defs_weight_paint.generate_from_brushes)
- PAINT_GPENCIL (_defs_gpencil_paint.generate_from_brushes)
- SCULPT_GPENCIL (_defs_gpencil_sculpt.generate_from_brushes)
- WEIGHT_GPENCIL (_defs_gpencil_weight.generate_from_brushes)
ToolSelectPanelHelper._tools_flatten() is usually called with
cls.tools_from_context(context) [that already yields from the function].
But when registering a tool, _tools_flatten() will still give back this
function, not a ToolDef - and we cannot get a bl_idname from that.
Suggest to just yield None in that case (we cannot really get the
ToolDefs from the function at this point without context it seems)