Skip to content

Commit

Permalink
Add new map event for preprocessing the map
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jan 23, 2017
1 parent b4fa4ee commit 8af4c2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/imap.h
Expand Up @@ -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
};

Expand Down
12 changes: 9 additions & 3 deletions radiant/map/Map.cpp
Expand Up @@ -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();
Expand All @@ -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();

Expand Down

0 comments on commit 8af4c2d

Please sign in to comment.