Moved Create New Level logic out from SaveToStream (#967)

This commit is contained in:
Terry Michaels
2021-05-26 17:52:34 -05:00
committed by GitHub
parent f1a5160fe7
commit 5ed4454e8b
4 changed files with 87 additions and 46 deletions
+10
View File
@@ -69,6 +69,7 @@ AZ_POP_DISABLE_WARNING
#include <AzToolsFramework/API/EditorPythonConsoleBus.h>
#include <AzToolsFramework/API/EditorPythonRunnerRequestsBus.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h>
#include <AzToolsFramework/PythonTerminal/ScriptHelpDialog.h>
// AzQtComponents
@@ -3105,6 +3106,15 @@ CCryEditApp::ECreateLevelResult CCryEditApp::CreateLevel(const QString& levelNam
GetIEditor()->GetDocument()->SetPathName(fullyQualifiedLevelName);
GetIEditor()->GetGameEngine()->SetLevelPath(levelPath);
if (usePrefabSystemForLevels)
{
auto* service = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
if (service)
{
service->CreateNewLevelPrefab((const char*)fullyQualifiedLevelName.toUtf8());
}
}
if (GetIEditor()->GetDocument()->Save())
{
if (!usePrefabSystemForLevels)