From 8af4c2d694902e8b7ad96ce66552b291ad8558c7 Mon Sep 17 00:00:00 2001 From: codereader Date: Mon, 23 Jan 2017 13:26:02 +0100 Subject: [PATCH] Add new map event for preprocessing the map --- include/imap.h | 1 + radiant/map/Map.cpp | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/imap.h b/include/imap.h index 999bdddcc5..eea5b7321a 100644 --- a/include/imap.h +++ b/include/imap.h @@ -66,6 +66,7 @@ class IMap : MapLoaded, // emitted when the current map is done loading MapUnloading, // emitted just before a map is unloaded from memory MapUnloaded, // emitted after a map has been unloaded + MapSaving, // emitted before a map is about to be saved (changes are possible) MapSaved, // emitted right after a map has been saved }; diff --git a/radiant/map/Map.cpp b/radiant/map/Map.cpp index 9182eb40fd..6f73fb85d1 100644 --- a/radiant/map/Map.cpp +++ b/radiant/map/Map.cpp @@ -438,7 +438,11 @@ bool Map::save(const MapFormatPtr& mapFormat) _saveInProgress = true; // Disable screen updates for the scope of this function - ui::ScreenUpdateBlocker blocker(_("Processing..."), _("Saving Map")); + ui::ScreenUpdateBlocker blocker(_("Processing..."), ""); + + blocker.setMessage(_("Preprocessing")); + + signal_mapEvent().emit(IMap::MapSaving); // write out scaled models saveScaledModels(); @@ -449,13 +453,15 @@ bool Map::save(const MapFormatPtr& mapFormat) // Store the map positions into the worldspawn spawnargs GlobalMapPosition().savePositions(); - signal_mapEvent().emit(IMap::MapSaved); + wxutil::ScopeTimer timer("map save"); - wxutil::ScopeTimer timer("map save"); + blocker.setMessage(_("Saving Map")); // Save the actual map resource bool success = _resource->save(mapFormat); + signal_mapEvent().emit(IMap::MapSaved); + // Remove the saved camera position removeCameraPosition();