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:
authorJulian Eisel <julian@blender.org>2022-03-22 17:38:08 +0300
committerJulian Eisel <julian@blender.org>2022-03-22 20:09:46 +0300
commitb40ac9684c497f2ba49d3a2b372d05b97874bbf0 (patch)
treea360f1f6c2d7fa920d82967d411561fbb3eb82e9
parent87a0770bb969ce37d9a41a04c1658ea09c63933a (diff)
Tiny visual fixes/tweaks for new library override buttons in Outliner
Tweaks: - Increase horizontal padding for the buttons from 1 point to 2, looked like an unintentional placement error before. Fixes: - Missing horizontal padding for array buttons - Small gap between separator line and right column when using a high interface scale - Properly center buttons vertically.
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.cc20
1 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc
index a50dde68d28..8b03047b1dd 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -1785,6 +1785,11 @@ static void outliner_draw_overrides_rna_buts(uiBlock *block,
const ListBase *lb,
const int x)
{
+ const float pad_x = 2.0f * UI_DPI_FAC;
+ const float pad_y = 0.5f * U.pixelsize;
+ const float item_max_width = round_fl_to_int(OL_RNA_COL_SIZEX - 2 * pad_x);
+ const float item_height = round_fl_to_int(UI_UNIT_Y - 2.0f * pad_y);
+
LISTBASE_FOREACH (const TreeElement *, te, lb) {
const TreeStoreElem *tselem = TREESTORE(te);
if (TSELEM_OPEN(tselem, space_outliner)) {
@@ -1805,10 +1810,6 @@ static void outliner_draw_overrides_rna_buts(uiBlock *block,
PropertyRNA *prop = &override_elem.override_rna_prop;
const PropertyType prop_type = RNA_property_type(prop);
- const float pad_x = 1 * UI_DPI_FAC;
- const float max_width = OL_RNA_COL_SIZEX - 2 * pad_x;
- const float height = UI_UNIT_Y - U.pixelsize;
-
uiBut *auto_but = uiDefAutoButR(block,
ptr,
prop,
@@ -1816,9 +1817,9 @@ static void outliner_draw_overrides_rna_buts(uiBlock *block,
(prop_type == PROP_ENUM) ? nullptr : "",
ICON_NONE,
x + pad_x,
- te->ys,
- max_width,
- height);
+ te->ys + pad_y,
+ item_max_width,
+ item_height);
/* Added the button successfully, nothing else to do. Otherwise, cases for multiple buttons
* need to be handled. */
if (auto_but) {
@@ -1828,7 +1829,8 @@ static void outliner_draw_overrides_rna_buts(uiBlock *block,
if (!auto_but) {
/* TODO what if the array is longer, and doesn't fit nicely? What about multi-dimension
* arrays? */
- uiDefAutoButsArrayR(block, ptr, prop, ICON_NONE, x, te->ys, max_width, height);
+ uiDefAutoButsArrayR(
+ block, ptr, prop, ICON_NONE, x + pad_x, te->ys + pad_y, item_max_width, item_height);
}
}
}
@@ -3915,7 +3917,7 @@ void draw_outliner(const bContext *C)
block, region, space_outliner, &space_outliner->tree, true);
UI_block_emboss_set(block, UI_EMBOSS);
- const int x = region->v2d.cur.xmax - OL_RNA_COL_SIZEX;
+ const int x = region->v2d.cur.xmax - right_column_width;
outliner_draw_separator(region, x);
outliner_draw_overrides_rna_buts(block, region, space_outliner, &space_outliner->tree, x);
UI_block_emboss_set(block, UI_EMBOSS_NONE_OR_STATUS);