UI: support drawing booleans with icons as check-boxes
authorCampbell Barton <ideasman42@gmail.com>
Tue, 21 May 2019 04:39:09 +0000 (14:39 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 21 May 2019 05:06:44 +0000 (15:06 +1000)
commit6640bcca742210fa3dc9c8a0675ebf71a9e9e7f6
tree0798bbbc04b0f175a5b0284d5537246ed44ceaf7
parent87fda5bc608322dbddbe57303ad3ae5d737216e0
UI: support drawing booleans with icons as check-boxes

Previously, if a boolean happened to use an icon there was no way
to make it display as a check-box from Python scripts.

The previous logic meant we ended up having to edit the RNA.
Since booleans with icons don't work well with the split-property layout
(now used for most of the interface).
Icons were being removed from RNA then added back using awkward Python
ternary expressions in the interface scripts.

The toggle argument now has an unset state (-1).

- toggle=True: no checkbox (emboss).
- toggle=False: always use a checkbox (no icon).
- toggle=(unset/-1): depends on the icon status, default as before.

Since toggle=False was default, this isn't used in existing UI logic.
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_layout.c
source/blender/makesrna/intern/rna_ui_api.c