def get_tools_from_context(context): tools = {} active = view3d_tools.tool_active_from_context(context) for tool in view3d_tools.tools_from_context(context): if tool: # tuple tool if type(tool) is tuple: for subtool in tool: tools[subtool.idname] = { 'label': subtool.label, 'icon_value': view3d_tools._icon_value_from_icon_handle( subtool.icon), 'active': subtool.idname == active.idname } # single tool else: tools[tool.idname] = { 'label': tool.label, 'icon_value': view3d_tools._icon_value_from_icon_handle(tool.icon), 'active': tool.idname == active.idname } return tools
def get_active_tool(): return view3d_tools.tool_active_from_context(bpy.context)
def get_active_tool(context): return view3d_tools.tool_active_from_context(context).idname
def get_tools(): return view3d_tools.tools_from_context(bpy.context)