-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
World Map chunks getting loaded twice. #3927
Comments
Can you clarify what you mean by "chunk" please? Normally, this term refers to the data chunks used by layers within a single map, but it sounds like by "chunk" you mean separate maps in a World? One thing to try to avoid this is disable "restore previous session on startup", and load your Project manually after starting Tiled. At least, I suspect Tiled's issues with occasionally opening the same document twice (it's been more often reported happening with tilesets) are related to that feature. |
By chunk I mean the sub-maps that make up a world in Tiled. |
Those are all separate, wholly independent maps, they're just displayed together as part of a World. However, it is possible that a map being opened as part of restoring the session and as part of a World could be part of the issue. It shouldn't happen, and normally doesn't, but I suspect there's something weird happening specifically when automatically restoring the last session. |
I was able to reproduce this issue today. The problem happens because the implementation of reload-on-change only replaces the map in its own editor tab and not the instances of the same map within the world in other tabs. So after the reload, we have both the old and the new version loaded. When you then click an old version of the map, it will get its own tab alongside the new version. :-/ I will look for ways to make sure no old versions of maps will stay around in a world. This also means they need to be watched for changes even when no editor is currently open for them. Until this is fixed, I can only advice to close Tiled while updating files using version control. |
PR #3939 basically fixes this issue, since it should prevent multiple versions of the same map being loaded or even opened side-by-side. However, I'm keeping this issue open until I've also implemented reloading for world maps that aren't currently open for editing, since otherwise you can still end up with an unexpected old version. |
Maps are now reloaded the same way as tilesets, by swapping the internal data of the MapDocument rather than replacing the entire document. This also means undo history is kept, since the reload is added as an undoable action. This fixes map reload to also affect instances that are open as part of a world. Previously, the old version would stay open in the world. However, maps that are only open as part of a world are not yet watched for changes. This is a somewhat risky change since the code was never prepared for the map and its internal structures to be replaced entirely without any specific change events. New "DocumentAboutToReload" and "DocumentReloaded" events were added, which are hopefully handled in all the right places. Selected layers and objects, as well as expanded group layers, are restored after reload by ID. This change also addresses several issues with reloading tilesets. Added tiled.assetReloaded signal to the scripting API. Most scripts will not have to do anything,, but some might. Fixed enabled state of Reload action, which shouldn't be always enabled for maps (since we can only reload maps when they have a file name and we know the file format). Closes mapeditor#3927
Maps are now reloaded the same way as tilesets, by swapping the internal data of the MapDocument rather than replacing the entire document. This also means undo history is kept, since the reload is added as an undoable action. This fixes map reload to also affect instances that are open as part of a world. Previously, the old version would stay open in the world. However, maps that are only open as part of a world are not yet watched for changes. This is a somewhat risky change since the code was never prepared for the map and its internal structures to be replaced entirely without any specific change events. New "DocumentAboutToReload" and "DocumentReloaded" events were added, which are hopefully handled in all the right places. Selected layers and objects, as well as expanded group layers, are restored after reload by ID. This change also addresses several issues with reloading tilesets. Added tiled.assetReloaded signal to the scripting API. Most scripts will not have to do anything,, but some might. Fixed enabled state of Reload action, which shouldn't be always enabled for maps (since we can only reload maps when they have a file name and we know the file format). Closes mapeditor#3927
I have notice some odd behavior when editing world maps. A map chuck gets opened twice (2 tabs) and one of them is a old version, it seems these come from a chuck loaded due to it being next to an active chunk and it's showing an old in-memory copy, not the current. I have lost work with this due to the outdated chucking being saved. Closing Tiled and restarting always fixes it.
The text was updated successfully, but these errors were encountered: