Post #2271:
Wa
π Metadata
- Author: roaoao
- Date: 2019-05-12 09:08:55
- Type:
answer - Quality Score: 8/10
- Reply to: post_02270
- Replies (1): post_02272
π·οΈ Tags
pie-menu custom-scripting intermediate solved
βοΈ Related PME Features
- Pie Menu Editor
- Custom tab scripting
- Command execution
- Python scripting
π¬ Content
Way2Close:
Hey, anyone know how to highlight a button and also change a property?
Looks like we canβt highlight pie buttons this way.
But you can add the button to the subrow (Custom tab):
row = L.row(); row.scale_y = 1.5; ts = C.tool_settings; enabled = ts.proportional_edit == 'ENABLED'; row.alert = True if not enabled else False; row.operator("pme.exec", text="Enabled" if enabled else "Disabled").cmd="C.tool_settings.proportional_edit = '%s'" % ('ENABLED' if not enabled else 'DISABLED')
Note that the Custom tab should be used to draw buttons. Eg:
L.operator(...)
If you want to execute the code you can use Command tab:
C.tool_settings.proportional_edit = 'ENABLED'
If you want to draw the button that executes that code in Custom tab you need to use this:
L.operator("pme.exec", text="My Label").cmd="C.tool_settings.proportional_edit = 'ENABLED'"
Or this:
operator(L, "pme.exec", text="My Label", cmd="C.tool_settings.proportional_edit = 'ENABLED'")
β€οΈ 1 likes