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

📋 Metadata

🏷️ Tags

pie-menu custom-scripting intermediate solved

  • Pie Menu Editor
  • Custom tab scripting
  • Python scripting

💬 Content

draguu:

how do i make toggle button ? like suppose i want to toggle looptools addon , it should be on/off from pie menu, right now when i tried it doesnt asked me to select if its property or command , it just took it as command ,

Use this code in Custom tab:

addon = 'mesh_looptools'; enabled = addon in C.user_preferences.addons; icon = 'CHECKBOX_HLT' if enabled else 'CHECKBOX_DEHLT'; op_idname = 'wm.addon_disable' if enabled else 'wm.addon_enable'; L.operator(op_idname, 'Loop Tools', icon=icon).module = addon

🔗 View on Blender Artists