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

Editor scene tree dock scrolling is not persisted when items are removed then readded (which occurs when switching scene tabs) #52165

Open
Torguen opened this issue Aug 27, 2021 · 3 comments

Comments

@Torguen
Copy link

Torguen commented Aug 27, 2021

Godot version

3.3.3 stable mono

System information

w10 64

Issue description

the tree scroll restarts when the tab is changed
gif gif

Steps to reproduce

view the gif

Minimal reproduction project

not necessary

@Calinou
Copy link
Member

Calinou commented Aug 27, 2021

I think this is expected. When elements are removed from the tree then readded, there is no logic for Tree to restore its previous scroll position.

The same thing likely happens with ScrollContainer in general.

@Calinou Calinou changed the title The scroll of the tree is restarted when changing the tab Editor scene tree dock scrolling is not persisted when items are removed then readded Aug 27, 2021
@Calinou Calinou changed the title Editor scene tree dock scrolling is not persisted when items are removed then readded Editor scene tree dock scrolling is not persisted when items are removed then readded (which occurs when switching scene tabs) Aug 27, 2021
@Torguen
Copy link
Author

Torguen commented Aug 27, 2021

Sorry I did not understand.
It is not what I expected, for me it is logical that the scroll should remain where I left it when I changed the scene in the tabs, so what is the discussion ?.

I mean, isn't that logical for everyone?, the scroll should persist when switching tabs.

@foxydevloper
Copy link
Contributor

foxydevloper commented Aug 28, 2021

I think this is expected. When elements are removed from the tree then readded, there is no logic for Tree to restore its previous scroll position.

The same thing likely happens with ScrollContainer in general.

I think a good fix would be for the scene tree dock to store a separate scene tree for each scene tab, and to swap the scene tree when you change tab, rather than having to regenerate the whole scene tree each time you change tabs. That way, the ScrollContainer's current position persists between switching tabs since it never clears the old scene tree.
This may result in more memory usage by keeping the scene tree stored for each open tab, but it seems like a more elegant solution than just storing the previous scroll position and restoring it when you change a tab. Wouldn't it also make switching tabs more responsive since it doesn't have to do a full regeneration of the scene tree when it's opened, especially for large scenes?

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

No branches or pull requests

3 participants