Post #84: ![](https://blenderartists.org/user_avatar/blenderartists.org/draguu/48/15444_2.

📋 Metadata

  • Author: roaoao
  • Date: 2016-03-14 11:16:04
  • Type: answer
  • Quality Score: 8/10
  • Reply to: post_00083

🏷️ Tags

macro hotkeys intermediate solved

  • Macro Editor
  • Custom Icons
  • Python Scripting

💬 Content

draguu:

what if i want to enable bunch of addons together and toggle them off together?

Save this script as scripts/custom_addons.py and use it as external script in Custom tab.

addons = ['mesh_looptools', 'mesh_inset']
enabled = addons[0] in C.user_preferences.addons
icon = 'CHECKBOX_HLT' if enabled else 'CHECKBOX_DEHLT'
op_idname = 'wm.addon_disable' if enabled else 'wm.addon_enable'
cmds = []
for addon in addons:
    cmds.append('bpy.ops.%s(module="%s")' % (op_idname, addon))
cmd = "; ".join(cmds)
L.operator('wm.pme_user_command_exec', 'Addons', icon=icon).cmd = cmd

❤️ 1 likes


🔗 View on Blender Artists