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: user actions in Project Explorer cause items & folders recreation, loss of folder states #2105

Closed
ivan-mogilko opened this issue Aug 24, 2023 · 2 comments · Fixed by #2170
Assignees
Labels
context: ui/ux type: bug unexpected/erroneous behavior in the existing functionality what: editor related to the game editor

Comments

@ivan-mogilko
Copy link
Contributor

Describe the bug
Whenever you do (almost) any operation with items within a Project Explorer, such as moving items around, changing their names, adding and deleting items, and so forth, the Editor regenerates whole project subtree with items and folders. Not only this is an inefficient operation, but also it causes all folders to loose their collapsed/expanded state. This makes it very inconvenient for users to work with these folders, especially when they rearrange items.

AGS Version
Any version starting with 3.2.2 which introduced folders.

To Reproduce

  1. Create several characters and several folders and subfolders.
  2. Move one characters to any folder.
  3. Move another character to any other folder.
  4. Notice how the first folder has collapsed.

Expected behavior
Folders don't expand or collapse unless by user's direct command.

Cause and solution
The root of the problem is RePopulateTreeView method, which is sprinkled around all the Editor's Component classes. Whenever there's a change to a project item (added, deleted, moved, modified) this method is called, with the purpose of synchronizing project data and Explorer tree.
As mentioned above, this is very inefficient, and also is causing inconveniences.

The way I see this, the solution is to write another method for data->ui synchronization that would not blindly recreate whole tree structure, but do it more gracefully. For example, compare item by item and see which have changed. Alternatively, make this method accept a hint from the caller, which tells about recent changes.

@ivan-mogilko ivan-mogilko added type: bug unexpected/erroneous behavior in the existing functionality what: editor related to the game editor context: ui/ux labels Aug 24, 2023
@ivan-mogilko ivan-mogilko changed the title Editor: most of the operations within a Project Explorer recreate items & folders, loosing folder state Editor: user actions in Project Explorer cause items & folders recreation, loss of folder states Aug 24, 2023
@ericoporto
Copy link
Member

ericoporto commented Aug 26, 2023

there is an approach that is to save the state of everything and then reload it after repopulating. Example

The way I see this, the solution is to write another method for data->ui synchronization that would not blindly recreate whole tree structure, but do it more gracefully.

This could work too, we probably still would have places where a large change is applied so the repopulating would still be something to account, so maybe two solutions could be done.

@ivan-mogilko
Copy link
Contributor Author

ivan-mogilko commented Aug 26, 2023

there is an approach that is to save the state of everything and then reload it after repopulating.

This is true, I mentioned this in the original forum thread, but forgot to mention here.
Although honestly I don't like recreating whole tree which may contain hundreds of items (in a big project) just if you edited an item's name or moved it to neighbour subfolder.

So, right, there may be both solutions in parallel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context: ui/ux type: bug unexpected/erroneous behavior in the existing functionality what: editor related to the game editor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants