Post #447: fj

📋 Metadata

  • Author: roaoao
  • Date: 2016-11-23 22:26:23
  • Type: answer
  • Quality Score: 8/10
  • Reply to: post_00446

🏷️ Tags

popup-dialog pie-menu custom-scripting intermediate

  • Popup Dialog Editor
  • Pie Menu Editor
  • Python Scripting
  • Custom Tab

💬 Content

fjg3d:

Is it possible to have buttons in panels and pies be highlighted when active? Some items do this by default like ‘snapping’ and ‘toggle occlusion’ in the Mesh edit mode header, but not all. For example I’ve made a pop up panel of buttons for setting the pivot of a transform - bounding box, median, individual, etc. which is normally a menu. It would be great if the active pivot mode button was highlighted when the panel is brought up.

Yes, some buttons can be highlighted. Try this code in Custom tab:
Buttons without label (row):

L.row().prop(bl_context.space_data, "pivot_point", expand=True, icon_only=True)

Buttons with label (column):

L.prop(bl_context.space_data, "pivot_point", expand=True)

If you want to display only 1 button (for example in pie menus) use this code:

L.prop_enum(bl_context.space_data, "pivot_point", 'INDIVIDUAL_ORIGINS')

You can find all available pivot modes here.


🔗 View on Blender Artists