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

Fixed map reload in case map is open as part of a world #3939

Merged
merged 2 commits into from
Jun 11, 2024

Commits on Jun 11, 2024

  1. Reimplemented map reload to happen in-place

    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
    bjorn committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    eb0dcd1 View commit details
    Browse the repository at this point in the history
  2. Watch and reload all documents rather than just opened editors

    When a map is loaded as part of a world, or a tileset is loaded as part
    of a map, but not open in its own editor, previously its file was not
    watched for changes.
    
    Now these files are also watched. When a change is detected and no
    unsaved changes are present, the affected map or tileset will be reloaded.
    
    Closes mapeditor#1785
    bjorn committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    839d9b3 View commit details
    Browse the repository at this point in the history