Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-05-21 07:39:09 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-21 08:06:44 +0300
commit6640bcca742210fa3dc9c8a0675ebf71a9e9e7f6 (patch)
tree0798bbbc04b0f175a5b0284d5537246ed44ceaf7 /source/blender/editors/include/UI_interface.h
parent87fda5bc608322dbddbe57303ad3ae5d737216e0 (diff)
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.
Diffstat (limited to 'source/blender/editors/include/UI_interface.h')
-rw-r--r--source/blender/editors/include/UI_interface.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 5912a3a59e4..5efe5a7e07c 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1714,15 +1714,28 @@ enum {
UI_ITEM_O_RETURN_PROPS = 1 << 0,
UI_ITEM_R_EXPAND = 1 << 1,
UI_ITEM_R_SLIDER = 1 << 2,
+ /**
+ * Use for booleans, causes the button to draw with an outline (emboss),
+ * instead of text with a checkbox.
+ * This is implied when toggle buttons have an icon
+ * unless #UI_ITEM_R_ICON_NEVER flag is set.
+ */
UI_ITEM_R_TOGGLE = 1 << 3,
- UI_ITEM_R_ICON_ONLY = 1 << 4,
- UI_ITEM_R_EVENT = 1 << 5,
- UI_ITEM_R_FULL_EVENT = 1 << 6,
- UI_ITEM_R_NO_BG = 1 << 7,
- UI_ITEM_R_IMMEDIATE = 1 << 8,
- UI_ITEM_O_DEPRESS = 1 << 9,
- UI_ITEM_R_COMPACT = 1 << 10,
- UI_ITEM_R_CHECKBOX_INVERT = 1 << 11,
+ /**
+ * Don't attempt to use an icon when the icon is set to #ICON_NONE.
+ *
+ * Use for boolean's, causes the buttons to always show as a checkbox
+ * even when there is an icon (which would normally show the button as a toggle).
+ */
+ UI_ITEM_R_ICON_NEVER = 1 << 4,
+ UI_ITEM_R_ICON_ONLY = 1 << 5,
+ UI_ITEM_R_EVENT = 1 << 6,
+ UI_ITEM_R_FULL_EVENT = 1 << 7,
+ UI_ITEM_R_NO_BG = 1 << 8,
+ UI_ITEM_R_IMMEDIATE = 1 << 9,
+ UI_ITEM_O_DEPRESS = 1 << 10,
+ UI_ITEM_R_COMPACT = 1 << 11,
+ UI_ITEM_R_CHECKBOX_INVERT = 1 << 12,
};
#define UI_HEADER_OFFSET ((void)0, 0.4f * UI_UNIT_X)