Add a default world for standalone maps#4562
Conversation
68f297f to
51f0d5d
Compare
Worlds created through the world tool's "Add another map" action were not stored in the session, so they were no longer loaded after a restart. The same applied to unloading worlds through "Unload All Worlds". Now MainWindow updates the session whenever the WorldManager reports that a world was loaded or unloaded, instead of doing it at each call site.
When a map is resized from its top or left edge, its content shifts, while a map that is not part of a world stays anchored at 0,0 in the scene. The view was only kept steady for maps that are part of a world, based on their world position, so for other maps the content appeared to jump on mouse release. Now the view is also recentered for maps that are not part of a world, based on the pixel offset resulting from the resize.
Moved the code for asking the user for a world file name and creating an empty world at that location into MainWindow::createNewWorld, which is now used both by the New World menu action and by the world tool when it needs to create a world for the current map. As a side effect, the world tool's dialog now also updates the last used world path in the session and offers the All Files filter.
|
I pushed a few fixes for problems I found during review:
There are a few other potential issues:
In general, I wonder if it would be better to separate the creation of the world. I think automatically creating the world when using the "add map" action might be too confusing. When the "New World" dialog pops up I think many people see just a file dialog and interpret it as the dialog to select the map from. What do you think? |
|
I think the confusion mostly comes from the save dialog showing up right after clicking "add map", since it's easy to mistake it for the map picker. Maybe instead of separating the world creation completely, we could show a small confirmation first, like "This map is not part of a world. Create a new world containing it?", then let the user pick the map, and only create the world file at the end. That way cancelling anywhere leaves nothing behind, which also fixes the cancel case you mentioned. |
I think that's worth a try. You can implement it and see how it feels. :-) |
This makes the resize handles of the world tool work on maps that are not part of any world.
Resizing only changes the map itself so it doesn't really need a world, and undo just works since it goes through the map's own undo stack.