Post #2271: Wa

πŸ“‹ Metadata

🏷️ Tags

pie-menu custom-scripting intermediate solved

  • 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


πŸ”— View on Blender Artists