Improve drag and drop in Tree#112993
Conversation
86954ce to
3119777
Compare
|
this looks like an incredible improvement! looking at the video, i do have one question though: why do some items in the tree become blue temporarily? is that a remnant of the old method that didn’t take x pos into account? if so, it should probably go, as the hierarchy like this pr consistently adds is a much clearer indication of the result of the drag and drop. |
|
Blue means pushed to inspector! I realised while working on this, and it's an indicator that's unrelated to this PR. Hovering on something for a bit turns it blue and shows it in the inspector, so that you can then drag the node into the blue node's export slots, if any. |
3119777 to
ab2cd02
Compare
|
Looks very promising! But note that drag dropping is not for nodes only (or rather just for the tree items, which in case of the scene tree represent nodes). E.g. you can drag resources onto the nodes, in such case the new indicators are wrong:
Also be sure to take in mind potential user-usages of the Tree node. |
|
@kleonc Makes sense, I'll start moving in that direction. Thank you for having a look. |
191f64f to
b1c5c7e
Compare
b1c5c7e to
ef8689d
Compare
21100e9 to
b5f3eb7
Compare
There was a problem hiding this comment.
Tested this PR and generally think it's an improvement, or at least heading in the right direction.
Before:
Screen.Recording.2026-02-20.at.16.04.49.mp4
After:
Screen.Recording.2026-02-20.at.16.05.55.mp4
The one thing that bugs me is that dragging a node onto its already current position also shows the "you'll be parented to this node as the child" visuals even though you can obviously not parent a node onto itself. I'd probably address that before merging.
|
Thank you for the feedback. Not only should what you mentioned be addressed, but it also looks like the drop line is too thin compared to the relationship line in hiDPI. I turned this into a draft once I was made aware how much of the engine interface relied on Tree, for very different purposes. I've been meaning to do a proper survey to ensure I don't mess with any of the visual metaphors for the many ways it's used. Additionally, I've identified an improvement to be made in the input editor tree that I'd like to PR first, before this one. Will resume work on this soon. |
b5f3eb7 to
a0aa9ac
Compare
|
Thank you for the approvals. I was aware of the problem with multiple nodes, but due to the present solution's reliance on |
Calinou
left a comment
There was a problem hiding this comment.
Tested locally, it works as expected. Code looks good to me.
Note that you can't drag-and-drop the last item of a tree outside its parent by moving it at the bottom (after the end of the tree). You have to make it a child of the root node all the way to the top instead:
drag-and-drop-tree.mp4
It's not a big issue, but I thought I'd mention it nonetheless.
Try dragging to the left. 😊 |
4413b0d to
8ca3907
Compare
This comment was marked as outdated.
This comment was marked as outdated.
e357630 to
123a48e
Compare
|
Summarising my thoughts from earlier. The addition of a new
This also lays the groundwork for...
These are best saved for successive PR's. |
4096409 to
9ee0d88
Compare
|
Sounds good to me! |
9ee0d88 to
8c42aeb
Compare
|
Thanks! |
|
For the case of the FileSystem tree drag & drops, a theme change that totally hides inactionable sibling relationships and just indicates parents is in the works. It would look exactly like how dragging a node from the SceneTree into the FileSystem already looks. filesystem-drop.mp4This is also addresses @kleonc's concern above.
|
|
@vaner-org Thank you for working on this. I'm just now playing with 4.7 and noticed when dragging and dropping an object or another scene into the viewport there is no visual representation of where it will be placed within the scene tree when dropped like there is when dropping it into the scene tree itself. Would this be hard to maybe update sometime in the future? |
|
@ChildLearningClub That would be a great addition, I would also find it useful. I will add it to my personal todo list but please consider writing a proposal for it as well, so that you may track its progress. |






Closes #54400, closes #3201.
This PR improves intuitiveness and usability for moving nodes via drag and drop in
Tree, by:Adding an always-present vertical component to the drop indicator, that points up to a to-be parent in the future place of their relationship line, as well as a phantom dropdown arrow when about to be the first ever child of a node.
Considering the x position of the cursor in determining to-be parent when in indent space (negative space to the left), akin to functionality seen in vector design software. When in item space, the current behaviour that users expect is largely maintained.
tree-improvement.mp4
draw_item, and placing it on its own CanvasItem, that StyleBoxes that could previously occlude it no longer do.These changes allow for much more fluid interactions with the tree, where any kind of rearrangement the user might want to do is possible within a single mouse click, while also more clearly telegraphing relationships post-release.
cc @kleonc