mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Don't touch LastOpenedScenes when we didn't save
This commit is contained in:
@@ -1044,19 +1044,26 @@ namespace GlitchyEditor
|
||||
return;
|
||||
}
|
||||
|
||||
bool savedScene;
|
||||
|
||||
if (SceneFilePath.IsWhiteSpace)
|
||||
{
|
||||
SaveCurrentSceneAs();
|
||||
savedScene = SaveCurrentSceneAs();
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveScene(_editorScene, SceneFilePath);
|
||||
// TODO: SaveScene can probably fail too!
|
||||
savedScene = true;
|
||||
}
|
||||
|
||||
// Note: We only update the last opened scene if the CURRENT scene is saved, NOT when ANY scene is saved.
|
||||
String relativePath = scope .();
|
||||
Path.GetRelativePath(SceneFilePath, _currentProject.WorkspacePath, relativePath);
|
||||
_currentProject.UserSettings.LastOpenedScene = relativePath;
|
||||
if (savedScene)
|
||||
{
|
||||
// Note: We only update the last opened scene if the CURRENT scene is saved, NOT when ANY scene is saved.
|
||||
String relativePath = scope .();
|
||||
Path.GetRelativePath(SceneFilePath, _currentProject.WorkspacePath, relativePath);
|
||||
_currentProject.UserSettings.LastOpenedScene = relativePath;
|
||||
}
|
||||
}
|
||||
|
||||
/// Saves the given scene with the specified file name.
|
||||
@@ -1067,15 +1074,15 @@ namespace GlitchyEditor
|
||||
}
|
||||
|
||||
/// Opens a save file dialog and saves the scene at the user specified location.
|
||||
private void SaveCurrentSceneAs()
|
||||
private bool SaveCurrentSceneAs()
|
||||
{
|
||||
if (_currentProject == null)
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (!CanSaveScene)
|
||||
{
|
||||
Log.ClientLogger.Error("Scene can't be saved while playing the game!");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
SaveFileDialog sfd = scope .();
|
||||
@@ -1086,7 +1093,11 @@ namespace GlitchyEditor
|
||||
{
|
||||
SceneFilePath = sfd.FileNames[0];
|
||||
SaveCurrentScene();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Opens a open file dialog and load the scene selected by the user specified.
|
||||
|
||||
Reference in New Issue
Block a user