[Bf-blender-cvs] [7fb4010137a] temp-checkbox-layout-tweaks: Option to insert blank dummy decorator for uiItemFullR
Julian Eisel
noreply at git.blender.org
Sat Apr 11 23:55:09 CEST 2020
Commit: 7fb4010137aace23511b8e71a329b7f8257f91e3
Author: Julian Eisel
Date: Sat Apr 11 23:50:43 2020 +0200
Branches: temp-checkbox-layout-tweaks
https://developer.blender.org/rB7fb4010137aace23511b8e71a329b7f8257f91e3
Option to insert blank dummy decorator for uiItemFullR
When there are multiple items in a property split row (e.g. mirror axes
in the mirror modifier) the decorator would only apply to the first
element. A dummy decorator could be inserted manually by using
`uiItemL_respect_property_split()`, but it's better to let the UI code
have an option for that, the case is common enough.
===================================================================
M source/blender/editors/include/UI_interface.h
M source/blender/editors/interface/interface_layout.c
===================================================================
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 079527c4456..4932c461b0d 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1770,6 +1770,8 @@ enum {
UI_ITEM_O_DEPRESS = 1 << 10,
UI_ITEM_R_COMPACT = 1 << 11,
UI_ITEM_R_CHECKBOX_INVERT = 1 << 12,
+ /** Don't add a real decorator item, just blank space. */
+ UI_ITEM_R_FORCE_BLANK_DECORATE = 1 << 13,
};
#define UI_HEADER_OFFSET ((void)0, 0.4f * UI_UNIT_X)
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 6847d63c768..1ea4850904f 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -2319,14 +2319,18 @@ void uiItemFullR(uiLayout *layout,
#ifdef UI_PROP_DECORATE
if (ui_decorate.use_prop_decorate) {
uiBut *but_decorate = ui_decorate.but ? ui_decorate.but->next : block->buttons.first;
+ const bool use_blank_decorator = (flag & UI_ITEM_R_FORCE_BLANK_DECORATE);
uiLayout *layout_col = uiLayoutColumn(ui_decorate.layout, false);
layout_col->space = 0;
layout_col->emboss = UI_EMBOSS_NONE;
+
int i;
for (i = 0; i < ui_decorate.len && but_decorate; i++) {
+ PointerRNA *ptr_dec = use_blank_decorator ? NULL : &but_decorate->rnapoin;
+ PropertyRNA *prop_dec = use_blank_decorator ? NULL : but_decorate->rnaprop;
+
/* The icons are set in 'ui_but_anim_flag' */
- uiItemDecoratorR_prop(
- layout_col, &but_decorate->rnapoin, but_decorate->rnaprop, but_decorate->rnaindex);
+ uiItemDecoratorR_prop(layout_col, ptr_dec, prop_dec, but_decorate->rnaindex);
but = block->buttons.last;
/* Order the decorator after the button we decorate, this is used so we can always
@@ -2903,10 +2907,14 @@ void uiItemMContents(uiLayout *layout, const char *menuname)
UI_menutype_draw(C, mt, layout);
}
+/**
+ * Insert a decorator item for a button with the same property as \a prop.
+ * To force inserting a blank dummy element, NULL can be passed for \a ptr and \a prop.
+ */
void uiItemDecoratorR_prop(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index)
{
uiBlock *block = layout->root->block;
- const bool is_anim = RNA_property_animateable(ptr, prop);
+ const bool is_anim = ptr && prop && RNA_property_animateable(ptr, prop);
uiBut *but = NULL;
uiLayout *row;
More information about the Bf-blender-cvs
mailing list