📋 Metadata
- Author: roaoao
- Date: 2016-03-12 20:20:50
- Type:
answer - Reply to: post_00077
- Replies (1): post_00080
💬 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