Add highlight to the relationship lines of selected Tree
items
#48546
+134
−17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.