As requested in T90025, this adds a subtle mouse hover highlight when
selecting items in the Monkey 101 Template.
This patch adds a subtle mouse hover highlight for UIList items and preview tile elements.
Differential D12549
UI: Blender 101: Mouse Hover Highlight Authored by Harley Acheson (harley) on Sep 17 2021, 10:42 PM.
Details As requested in T90025, this adds a subtle mouse hover highlight when This patch adds a subtle mouse hover highlight for UIList items and preview tile elements.
Diff Detail
Event TimelineComment Actions Code wise looks ok. Will let @Dalai Felinto (dfelinto) do the review on functionality. Comment Actions Working as expected. I wonder if Julian has anything to add. I know he had some thoughts on how to do that. Comment Actions No, all the theme colors are all really strong and we don’t have a separate setting for the strength of the hover highlight. This dumb, hard-coded 0.1 is pretty equivalent to the other dumb, hard-coded calculations elsewhere for that. Comment Actions The highlight is super strong for me. Is that intentional? We should generally keep mouse-hover feedback subtle.Comment Actions
No, I could find not other places to test this besides inside that 101 template. Your example should help. Thanks! Comment Actions
It made sense. That widget does not draw a background under normal circumstances so we can't really mix with any of its theme colors. Instead now just using a low-opacity version of the text color - works in your example and in 101. Comment Actions Hi @Harley Acheson (harley), by the way the widget preview tile should use the UI List colors, not the regular colors. It is not something caused by this patch, but it is related (it can be addressed indepedently). As for this patch, it would be nice to also tackle the regular UI List items like UV, ShapeKeys, ... not only the tiles. Comment Actions To use the UI list theme colors, the UI_BLOCK_LIST_ITEM flag needs to be set for the UI_BTYPE_PREVIEW_TILE. I experimented with that yesterday, because then we could let the normal widget_state() handle the state related theme colors. This would also enable mouse-hover highlighting for regular UI lists. But there were some issues that I don't have the time to debug (and we'd also have to version patch theme colors). Comment Actions
This version now uses List Item coloring for preview tiles.
This version shows hover highlight for regular list items too: Comment Actions Better treatment of UIList items that are already selected. This seems to work fine on dark themes & light themes and inside the Monkey app. Comment Actions Yes, but this (unfortunately) needs a second LGTM from @Julian Eisel (Severin) since changes were made after he approved it. Comment Actions The only thing missing about this patch (UI-wise), is that when hovering widgets inside the row, the row should stay highlighted. Currently, the list item loses the hover effect when hovering over widgets inside the row like sliders or properties/operators. Comment Actions This is a problem that should be addressed. I've done so already for the new tree-views, see ui_handle_tree_hover(). Not really nice but our UI code doesn't support this better. Not worth the extra hassles. Comment Actions @Julian Eisel (Severin) - I've done so already for the new tree-views, see ui_handle_tree_hover() I've tried that, without success. Following your pattern should be even easier since ui_region_handler already correctly identifies hovered lists. So it is just a matter of adding UI_ACTIVE to the hovered row. This revision does so but you see it doesn't give the desired result. I can see that row getting the flag but it doesn't display as such. Comment Actions Checking this together with D13858: UI: Unify drawing style of UILists and Tree row buttons., which adds highlights to list rows. I think that patch is the better solution, since it actually lets the list-row highlight, whereas this patch only adds a highlight to UI_WTYPE_PREVIEW_TILE which just is what we happen to draw on top of the list-row in this case. Comment Actions
No, this patch also highlights regular list-rows, now including hovering over nested buttons. |