Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add highlight to the relationship lines of selected Tree items #48546

Merged

Conversation

YuriSizov
Copy link
Contributor

@YuriSizov YuriSizov commented May 7, 2021

Closes godotengine/godot-proposals#2654.

This adds several theme properties related to highlighting parents (up to the root) and direct children of the selected Tree item. In the editor these new options are used to improve visuals of our trees. In the default theme I've set it up so there is no immediate difference. Though this would still affect custom themes, as they need to override these new properties. Otherwise this could be cherrypicked.

Following the arguments I've provided in the linked proposal, all parents but only direct children are selected. Parents also have a thicker line and more saturated color to it. Colors are controlled by their opacity based on the existing "relationship line opacity" setting, so at some point they all become completely opaque. I don't think that accent color can be used here as it ends up being too distracting.

Parent lines also have a small margin area around them pushing away non-highlighted relationship lines to improve the looks.

2021-05-07_21-01-42.mp4

This also fixes a little visual issue I've noticed with the relationship lines when the parent node doesn't have folding enabled. Lines tend to go off-screen in such scenarios if the root node is involved, or just look weirdly offset.

The problem is present in both the default theme and the editor theme. For this reason I've decided to address it directly in the control by adjusting the drawing logic. This should positively affect everyone's trees. Here's the default theme and the editor theme after the change.

@YuriSizov YuriSizov added this to the 4.0 milestone May 7, 2021
@YuriSizov YuriSizov requested review from a team as code owners May 7, 2021 18:19
@YuriSizov YuriSizov force-pushed the tree-highlight-selected-relationships branch from e307501 to 7194f8d Compare May 7, 2021 18:19
@YuriSizov YuriSizov force-pushed the tree-highlight-selected-relationships branch 2 times, most recently from f3438e6 to 54e4bc9 Compare May 7, 2021 19:50
@YuriSizov
Copy link
Contributor Author

YuriSizov commented May 7, 2021

Initially forgot to test with multiselect, but with a small tweak or two it's all good:

image

scene/gui/tree.cpp Outdated Show resolved Hide resolved
Copy link
Member

@KoBeWi KoBeWi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok, but needs rebase after #46773

@YuriSizov YuriSizov force-pushed the tree-highlight-selected-relationships branch from 54e4bc9 to 9c92e9d Compare May 25, 2021 15:56
@YuriSizov
Copy link
Contributor Author

YuriSizov commented May 25, 2021

Rebased and corrected to use the new API. Seems to still be working as intended.

@akien-mga akien-mga merged commit 6a64a98 into godotengine:master May 25, 2021
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Highlight parent and child connections of selected node in Tree
4 participants