diff options
5 files changed, 27 insertions, 9 deletions
diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c index 865e06bf0b6..d3da7b80765 100644 --- a/source/blender/editors/space_outliner/outliner_dragdrop.c +++ b/source/blender/editors/space_outliner/outliner_dragdrop.c @@ -854,7 +854,8 @@ static bool datastack_drop_poll(bContext *C, SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); ARegion *region = CTX_wm_region(C); - bool changed = outliner_flag_set(&space_outliner->tree, TSE_HIGHLIGHTED | TSE_DRAG_ANY, false); + bool changed = outliner_flag_set( + &space_outliner->tree, TSE_HIGHLIGHTED_ANY | TSE_DRAG_ANY, false); StackDropData *drop_data = drag->poin; if (!drop_data) { @@ -1173,7 +1174,8 @@ static bool collection_drop_poll(bContext *C, { SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); ARegion *region = CTX_wm_region(C); - bool changed = outliner_flag_set(&space_outliner->tree, TSE_HIGHLIGHTED | TSE_DRAG_ANY, false); + bool changed = outliner_flag_set( + &space_outliner->tree, TSE_HIGHLIGHTED_ANY | TSE_DRAG_ANY, false); CollectionDrop data; if (!event->shift && collection_drop_init(C, drag, event, &data)) { diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index ea2e3ce2565..6364fbc0a87 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -2782,7 +2782,7 @@ static void outliner_draw_iconrow_doit(uiBlock *block, icon_border); } - if (tselem->flag & TSE_HIGHLIGHTED) { + if (tselem->flag & TSE_HIGHLIGHTED_ICON) { alpha_fac += 0.5; } tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, alpha_fac, false); @@ -3078,8 +3078,14 @@ static void outliner_draw_tree_element(bContext *C, /* datatype icon */ if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, TSE_ID_BASE))) { - tselem_draw_icon( - block, xmax, (float)startx + offsx, (float)*starty, tselem, te, alpha_fac, true); + tselem_draw_icon(block, + xmax, + (float)startx + offsx, + (float)*starty, + tselem, + te, + (tselem->flag & TSE_HIGHLIGHTED_ICON) ? alpha_fac + 0.5f : alpha_fac, + true); offsx += UI_UNIT_X + 4 * ufac; } else { diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index bf94e9e04a4..6c0759b9842 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -117,19 +117,27 @@ static int outliner_highlight_update(bContext *C, wmOperator *UNUSED(op), const TreeElement *hovered_te = outliner_find_item_at_y( space_outliner, &space_outliner->tree, view_mval[1]); + TreeElement *icon_te = NULL; bool is_over_icon; if (hovered_te) { - hovered_te = outliner_find_item_at_x_in_row( + icon_te = outliner_find_item_at_x_in_row( space_outliner, hovered_te, view_mval[0], NULL, &is_over_icon); } + bool changed = false; - if (!hovered_te || !(hovered_te->store_elem->flag & TSE_HIGHLIGHTED)) { - changed = outliner_flag_set(&space_outliner->tree, TSE_HIGHLIGHTED | TSE_DRAG_ANY, false); + if (!hovered_te || !is_over_icon || !(hovered_te->store_elem->flag & TSE_HIGHLIGHTED) || + !(icon_te->store_elem->flag & TSE_HIGHLIGHTED_ICON)) { + /* Clear highlights when nothing is hovered or when a new item is hovered. */ + changed = outliner_flag_set(&space_outliner->tree, TSE_HIGHLIGHTED_ANY | TSE_DRAG_ANY, false); if (hovered_te) { hovered_te->store_elem->flag |= TSE_HIGHLIGHTED; changed = true; } + if (is_over_icon) { + icon_te->store_elem->flag |= TSE_HIGHLIGHTED_ICON; + changed = true; + } } if (changed) { diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 5ec55eee7fb..cd8e8a0be98 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -426,7 +426,7 @@ static void outliner_deactivate(struct ScrArea *area) { /* Remove hover highlights */ SpaceOutliner *space_outliner = area->spacedata.first; - outliner_flag_set(&space_outliner->tree, TSE_HIGHLIGHTED, false); + outliner_flag_set(&space_outliner->tree, TSE_HIGHLIGHTED_ANY, false); ED_region_tag_redraw_no_rebuild(BKE_area_find_region_type(area, RGN_TYPE_WINDOW)); } diff --git a/source/blender/makesdna/DNA_outliner_types.h b/source/blender/makesdna/DNA_outliner_types.h index cc376c0cebf..d561b489ae4 100644 --- a/source/blender/makesdna/DNA_outliner_types.h +++ b/source/blender/makesdna/DNA_outliner_types.h @@ -66,7 +66,9 @@ enum { /* Needed because outliner-only elements can be active */ TSE_ACTIVE = (1 << 9), /* TSE_ACTIVE_WALK = (1 << 10), */ /* Unused */ + TSE_HIGHLIGHTED_ICON = (1 << 11), TSE_DRAG_ANY = (TSE_DRAG_INTO | TSE_DRAG_BEFORE | TSE_DRAG_AFTER), + TSE_HIGHLIGHTED_ANY = (TSE_HIGHLIGHTED | TSE_HIGHLIGHTED_ICON), }; /* TreeStoreElem->types */ |