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