diff --git a/source/blender/editors/interface/tree_view.cc b/source/blender/editors/interface/tree_view.cc index 3010aaba5a3..8cccc90fdad 100644 --- a/source/blender/editors/interface/tree_view.cc +++ b/source/blender/editors/interface/tree_view.cc @@ -583,49 +583,54 @@ class TreeViewLayoutBuilder { void build_from_tree(const AbstractTreeView &tree_view); void build_row(AbstractTreeViewItem &item) const; uiBlock &block() const; uiLayout *current_layout() const; private: /* Created through #TreeViewBuilder. */ TreeViewLayoutBuilder(uiBlock &block); - static void polish_layout(const uiBlock &block); + static void polish_layout(const uiBlock &block, const bool active); }; TreeViewLayoutBuilder::TreeViewLayoutBuilder(uiBlock &block) : block_(block) { } void TreeViewLayoutBuilder::build_from_tree(const AbstractTreeView &tree_view) { uiLayout *prev_layout = current_layout(); uiLayout *box = uiLayoutBox(prev_layout); uiLayoutColumn(box, false); tree_view.foreach_item([this](AbstractTreeViewItem &item) { build_row(item); }, AbstractTreeView::IterOptions::SkipCollapsed); UI_block_layout_set_current(&block(), prev_layout); } -void TreeViewLayoutBuilder::polish_layout(const uiBlock &block) +void TreeViewLayoutBuilder::polish_layout(const uiBlock &block, const bool active) { LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block.buttons) { if (AbstractTreeViewItem::is_collapse_chevron_but(but) && but->next && /* Embossed buttons with padding-less text padding look weird, so don't touch them. */ ELEM(but->next->emboss, UI_EMBOSS_NONE, UI_EMBOSS_NONE_OR_STATUS)) { UI_but_drawflag_enable(static_cast(but->next), UI_BUT_NO_TEXT_PADDING); } + if (active && but->type != UI_BTYPE_TREEROW && + ELEM(but->emboss, UI_EMBOSS_NONE, UI_EMBOSS_NONE_OR_STATUS)) { + UI_but_flag_enable(but, UI_SELECT); + } + if (but->type == UI_BTYPE_TREEROW) { break; } } } void TreeViewLayoutBuilder::build_row(AbstractTreeViewItem &item) const { uiBlock &block_ = block(); @@ -644,21 +649,21 @@ void TreeViewLayoutBuilder::build_row(AbstractTreeViewItem &item) const uiLayout *row = uiLayoutRow(overlap, true); item.add_indent(*row); item.add_collapse_chevron(block_); if (item.is_renaming()) { item.add_rename_button(*row); } else { item.build_row(*row); } - polish_layout(block_); + polish_layout(block_, item.is_active()); UI_block_emboss_set(&block_, previous_emboss); UI_block_layout_set_current(&block_, prev_layout); } uiBlock &TreeViewLayoutBuilder::block() const { return block_; }