Browse Source

Remove references to IsPrefabSystemEnabled across the Editor's core.

Signed-off-by: Danilo Aimini <[email protected]>
Danilo Aimini 1 year ago
parent
commit
ed0018ce77
43 changed files with 323 additions and 2578 deletions
  1. 0 12
      Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp
  2. 0 17
      Code/Editor/Core/EditorActionsHandler.cpp
  3. 0 3
      Code/Editor/Core/EditorActionsHandler.h
  4. 48 214
      Code/Editor/CryEdit.cpp
  5. 76 607
      Code/Editor/CryEditDoc.cpp
  6. 2 36
      Code/Editor/CryEditDoc.h
  7. 1 12
      Code/Editor/EditorToolsApplication.cpp
  8. 0 16
      Code/Editor/GameEngine.cpp
  9. 3 124
      Code/Editor/GameExporter.cpp
  10. 2 10
      Code/Editor/GameExporter.h
  11. 12 577
      Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp
  12. 1 56
      Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.h
  13. 0 14
      Code/Editor/QtViewPaneManager.cpp
  14. 1 0
      Code/Framework/AzFramework/AzFramework/API/ApplicationAPI.h
  15. 3 65
      Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp
  16. 12 18
      Code/Framework/AzFramework/AzFramework/Entity/GameEntityContextComponent.cpp
  17. 20 115
      Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp
  18. 0 16
      Code/Framework/AzToolsFramework/AzToolsFramework/AssetBundle/AssetBundleComponent.cpp
  19. 19 98
      Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityContextComponent.cpp
  20. 0 2
      Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityContextComponent.h
  21. 1 6
      Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityHelpers.cpp
  22. 1 23
      Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityModel.cpp
  23. 3 8
      Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntitySortComponent.cpp
  24. 8 15
      Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoCache.cpp
  25. 1 8
      Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Procedural/ProceduralPrefabAsset.cpp
  26. 31 67
      Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp
  27. 0 1
      Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx
  28. 0 6
      Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestFixture.cpp
  29. 0 3
      Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestFixture.h
  30. 2 2
      Code/Framework/AzToolsFramework/Tests/PythonLoaderTests.cpp
  31. 4 82
      Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp
  32. 1 13
      Code/Legacy/CrySystem/SystemInit.cpp
  33. 0 22
      Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp
  34. 0 49
      Gems/AtomLyIntegration/CommonFeatures/Code/Source/EditorCommonFeaturesSystemComponent.cpp
  35. 0 4
      Gems/AtomLyIntegration/CommonFeatures/Code/Source/EditorCommonFeaturesSystemComponent.h
  36. 32 80
      Gems/GameStateSamples/Code/Include/GameStateSamples/GameStateMainMenu.inl
  37. 35 55
      Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYCommonMenu.cpp
  38. 0 25
      Gems/LmbrCentral/Code/Source/Builders/LevelBuilder/LevelBuilderComponent.cpp
  39. 0 30
      Gems/LmbrCentral/Code/Source/Scripting/RandomTimedSpawnerComponent.cpp
  40. 0 33
      Gems/LmbrCentral/Code/Source/Scripting/SpawnerComponent.cpp
  41. 4 17
      Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp
  42. 0 8
      Gems/NvCloth/Code/Tests/NvClothEditorTestEnvironment.cpp
  43. 0 9
      Gems/PhysX/Core/Code/Editor/Source/Components/Conversion/CollidersPrefabConversion.cpp

+ 0 - 12
Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp

@@ -344,18 +344,6 @@ namespace AzAssetBrowserRequestHandlerPrivate
                         }
                     }
 
-                    bool isPrefabSystemEnabled = false;
-                    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                        isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-                    if (!isPrefabSystemEnabled)
-                    {
-                        // Prepare undo command last so it captures the final state of the entity.
-                        EntityCreateCommand* command = aznew EntityCreateCommand(static_cast<AZ::u64>(newEntity->GetId()));
-                        command->Capture(newEntity);
-                        command->SetParent(undo.GetUndoBatch());
-                    }
-
                     ToolsApplicationRequests::Bus::Broadcast(&ToolsApplicationRequests::AddDirtyEntity, newEntity->GetId());
                     createdEntities.push_back(newEntity->GetId());
                 }

+ 0 - 17
Code/Editor/Core/EditorActionsHandler.cpp

@@ -236,15 +236,6 @@ void EditorActionsHandler::OnActionUpdaterRegistrationHook()
     m_actionManagerInterface->RegisterActionUpdater(EditorIdentifiers::RecentFilesChangedUpdaterIdentifier);
     m_actionManagerInterface->RegisterActionUpdater(EditorIdentifiers::UndoRedoUpdaterIdentifier);
     m_actionManagerInterface->RegisterActionUpdater(EditorIdentifiers::ViewportDisplayInfoStateChangedUpdaterIdentifier);
-
-    // If the Prefab system is not enabled, have a backup to update actions based on level loading.
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        m_isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-    if (!m_isPrefabSystemEnabled)
-    {
-        m_actionManagerInterface->RegisterActionUpdater(EditorIdentifiers::LevelLoadedUpdaterIdentifier);
-    }
 }
 
 void EditorActionsHandler::OnActionRegistrationHook()
@@ -2169,14 +2160,6 @@ void EditorActionsHandler::OnStopPlayInEditor()
     );
 }
 
-void EditorActionsHandler::OnEntityStreamLoadSuccess()
-{
-    if (!m_isPrefabSystemEnabled)
-    {
-        m_actionManagerInterface->TriggerActionUpdater(EditorIdentifiers::LevelLoadedUpdaterIdentifier);
-    }
-}
-
 void EditorActionsHandler::AfterEntitySelectionChanged(
     [[maybe_unused]] const AzToolsFramework::EntityIdList& newlySelectedEntities,
     [[maybe_unused]] const AzToolsFramework::EntityIdList& newlyDeselectedEntities)

+ 0 - 3
Code/Editor/Core/EditorActionsHandler.h

@@ -73,7 +73,6 @@ private:
     // EditorEntityContextNotificationBus overrides ...
     void OnStartPlayInEditor() override;
     void OnStopPlayInEditor() override;
-    void OnEntityStreamLoadSuccess() override;
 
     // ToolsApplicationNotificationBus overrides ...
     void AfterEntitySelectionChanged(
@@ -135,6 +134,4 @@ private:
     AZStd::vector<AZStd::string> m_layoutMenuIdentifiers;
     AZStd::vector<AZStd::string> m_toolActionIdentifiers;
     AZStd::vector<AZStd::string> m_toolboxMacroActionIdentifiers;
-
-    bool m_isPrefabSystemEnabled = false;
 };

+ 48 - 214
Code/Editor/CryEdit.cpp

@@ -599,24 +599,13 @@ void CCryEditApp::OnFileSave()
 
     const QScopedValueRollback<bool> rollback(m_savingLevel, true);
 
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
+    auto* prefabIntegrationInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabIntegrationInterface>::Get();
+    AZ_Assert(prefabIntegrationInterface != nullptr, "PrefabIntegrationInterface is not found.");
 
-    if (!usePrefabSystemForLevels)
-    {
-        GetIEditor()->GetDocument()->DoFileSave();
-    }
-    else
-    {
-        auto* prefabIntegrationInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabIntegrationInterface>::Get();
-        AZ_Assert(prefabIntegrationInterface != nullptr, "PrefabIntegrationInterface is not found.");
+    prefabIntegrationInterface->SaveCurrentPrefab();
 
-        prefabIntegrationInterface->SaveCurrentPrefab();
-
-        // when attempting to save, update the last known location using the active camera transform
-        AzToolsFramework::StoreViewBookmarkLastKnownLocationFromActiveCamera();
-    }
+    // when attempting to save, update the last known location using the active camera transform
+    AzToolsFramework::StoreViewBookmarkLastKnownLocationFromActiveCamera();
 }
 
 //////////////////////////////////////////////////////////////////////////
@@ -2329,29 +2318,10 @@ void CCryEditApp::DisplayLevelLoadErrors()
 }
 
 //////////////////////////////////////////////////////////////////////////
-void CCryEditApp::ExportLevel(bool bExportToGame, bool bExportTexture, bool bAutoExport)
+void CCryEditApp::ExportLevel(bool /* bExportToGame */, bool /* bExportTexture */, bool /* bAutoExport */)
 {
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-    if (usePrefabSystemForLevels)
-    {
-        AZ_Assert(false, "Prefab system doesn't require level exports.");
-        return;
-    }
-
-    if (bExportTexture)
-    {
-        CGameExporter gameExporter;
-        gameExporter.SetAutoExportMode(bAutoExport);
-        gameExporter.Export(eExp_SurfaceTexture);
-    }
-    else if (bExportToGame)
-    {
-        CGameExporter gameExporter;
-        gameExporter.SetAutoExportMode(bAutoExport);
-        gameExporter.Export();
-    }
+    AZ_Assert(false, "Prefab system doesn't require level exports.");
+    return;
 }
 
 
@@ -2370,85 +2340,16 @@ void CCryEditApp::OnEditFetch()
 
 
 //////////////////////////////////////////////////////////////////////////
-bool CCryEditApp::UserExportToGame(bool bNoMsgBox)
+bool CCryEditApp::UserExportToGame(bool /* bNoMsgBox */)
 {
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-    if (usePrefabSystemForLevels)
-    {
-        AZ_Assert(false, "Export Level should no longer exist.");
-        return false;
-    }
-
-    if (!GetIEditor()->GetGameEngine()->IsLevelLoaded())
-    {
-        if (bNoMsgBox == false)
-        {
-            QMessageBox::warning(AzToolsFramework::GetActiveWindow(), QString(), QObject::tr("Please load a level before attempting to export."));
-        }
-        return false;
-    }
-    else
-    {
-        EditorUtils::AzWarningAbsorber absorb("Source Control");
-
-        // Record errors and display a dialog with them at the end.
-        CErrorsRecorder errRecorder(GetIEditor());
-
-        // Temporarily disable auto backup.
-        CScopedVariableSetter<bool> autoBackupEnabledChange(gSettings.autoBackupEnabled, false);
-        CScopedVariableSetter<int> autoRemindTimeChange(gSettings.autoRemindTime, 0);
-
-        m_bIsExportingLegacyData = true;
-        CGameExporter gameExporter;
-
-        unsigned int flags = eExp_CoverSurfaces;
-
-        // Change the cursor to show that we're busy.
-        QWaitCursor wait;
-
-        if (gameExporter.Export(flags, eLittleEndian, "."))
-        {
-            m_bIsExportingLegacyData = false;
-            return true;
-        }
-        m_bIsExportingLegacyData = false;
-        return false;
-    }
+    AZ_Assert(false, "Export Level should no longer exist.");
+    return false;
 }
 
-void CCryEditApp::ExportToGame(bool bNoMsgBox)
+void CCryEditApp::ExportToGame(bool /* bNoMsgBox */)
 {
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-    if (usePrefabSystemForLevels)
-    {
-        AZ_Assert(false, "Prefab system no longer exports levels.");
-        return;
-    }
-
-    CGameEngine* pGameEngine = GetIEditor()->GetGameEngine();
-    if (!pGameEngine->IsLevelLoaded())
-    {
-        if (pGameEngine->GetLevelPath().isEmpty())
-        {
-            QMessageBox::critical(AzToolsFramework::GetActiveWindow(), QString(), ("Open or create a level first."));
-            return;
-        }
-
-        CErrorsRecorder errRecorder(GetIEditor());
-        // If level not loaded first fast export the level.
-        m_bIsExportingLegacyData = true;
-        CGameExporter gameExporter;
-        gameExporter.Export();
-        m_bIsExportingLegacyData = false;
-    }
-
-    {
-        UserExportToGame(bNoMsgBox);
-    }
+    AZ_Assert(false, "Prefab system no longer exports levels.");
+    return;
 }
 
 void CCryEditApp::OnFileExportToGameNoSurfaceTexture()
@@ -2829,10 +2730,6 @@ void CCryEditApp::OnUpdatePlayGame(QAction* action)
 //////////////////////////////////////////////////////////////////////////
 CCryEditApp::ECreateLevelResult CCryEditApp::CreateLevel(const QString& levelName, QString& fullyQualifiedLevelName /* ={} */)
 {
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
     // If we are creating a new level and we're in simulate mode, then switch it off before we do anything else
     if (GetIEditor()->GetGameEngine() && GetIEditor()->GetGameEngine()->GetSimulationMode())
     {
@@ -2841,13 +2738,10 @@ CCryEditApp::ECreateLevelResult CCryEditApp::CreateLevel(const QString& levelNam
         OnSwitchPhysics();
         GetIEditor()->GetDocument()->SetModifiedFlag(bIsDocModified);
 
-        if (usePrefabSystemForLevels)
+        auto* rootSpawnableInterface = AzFramework::RootSpawnableInterface::Get();
+        if (rootSpawnableInterface)
         {
-            auto* rootSpawnableInterface = AzFramework::RootSpawnableInterface::Get();
-            if (rootSpawnableInterface)
-            {
-                rootSpawnableInterface->ProcessSpawnableQueue();
-            }
+            rootSpawnableInterface->ProcessSpawnableQueue();
         }
     }
 
@@ -2899,7 +2793,6 @@ CCryEditApp::ECreateLevelResult CCryEditApp::CreateLevel(const QString& levelNam
         sv_map->Set(levelName.toUtf8().data());
     }
 
-
     GetIEditor()->GetDocument()->InitEmptyLevel(128, 1);
 
     GetIEditor()->SetStatusText("Creating Level...");
@@ -2908,38 +2801,20 @@ 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)
     {
-        auto* service = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
-        if (service)
-        {
-            service->CreateNewLevelPrefab(fullyQualifiedLevelName.toUtf8().constData(), DefaultLevelTemplateName);
-        }
+        service->CreateNewLevelPrefab(fullyQualifiedLevelName.toUtf8().constData(), DefaultLevelTemplateName);
     }
 
     if (GetIEditor()->GetDocument()->Save())
     {
-        if (!usePrefabSystemForLevels)
-        {
-            m_bIsExportingLegacyData = true;
-            CGameExporter gameExporter;
-            gameExporter.Export();
-            m_bIsExportingLegacyData = false;
-        }
-
         GetIEditor()->GetGameEngine()->LoadLevel(true, true);
         GetIEditor()->GetSystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_PRECACHE_START, 0, 0);
 
         GetIEditor()->GetSystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_PRECACHE_END, 0, 0);
     }
 
-    if (!usePrefabSystemForLevels)
-    {
-        // export default octree and visarea data.
-        CGameExporter gameExporter;
-        gameExporter.Export(eExp_CoverSurfaces | eExp_SurfaceTexture, eLittleEndian, ".");
-    }
-
     GetIEditor()->GetDocument()->CreateDefaultLevelAssets(128, 1);
     GetIEditor()->GetDocument()->SetDocumentReady(true);
     GetIEditor()->SetStatusText("Ready");
@@ -2975,70 +2850,36 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
     bool bIsDocModified = GetIEditor()->GetDocument()->IsModified();
     if (GetIEditor()->GetDocument()->IsDocumentReady() && bIsDocModified)
     {
-        bool usePrefabSystemForLevels = false;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(
-            usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-        if (!usePrefabSystemForLevels)
-        {
-            QString str = QObject::tr("Level %1 has been changed. Save Level?").arg(GetIEditor()->GetGameEngine()->GetLevelName());
-            int result = QMessageBox::question(
-                AzToolsFramework::GetActiveWindow(), QObject::tr("Save Level"), str,
-                QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
-            if (QMessageBox::Yes == result)
-            {
-                if (!GetIEditor()->GetDocument()->DoFileSave())
-                {
-                    // if the file save operation failed, assume that the user was informed of why
-                    // already and treat it as a cancel
-                    wasCreateLevelOperationCancelled = true;
-                    return false;
-                }
+        auto* prefabEditorEntityOwnershipInterface = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
+        auto* prefabIntegrationInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabIntegrationInterface>::Get();
+        AZ_Assert(prefabEditorEntityOwnershipInterface != nullptr, "PrefabEditorEntityOwnershipInterface is not found.");
+        AZ_Assert(prefabIntegrationInterface != nullptr, "PrefabIntegrationInterface is not found.");
 
-                bIsDocModified = false;
-            }
-            else if (QMessageBox::No == result)
-            {
-                // Set Modified flag to false to prevent show Save unchanged dialog again
-                GetIEditor()->GetDocument()->SetModifiedFlag(false);
-            }
-            else if (QMessageBox::Cancel == result)
-            {
-                wasCreateLevelOperationCancelled = true;
-                return false;
-            }
-        }
-        else
+        if (prefabEditorEntityOwnershipInterface == nullptr || prefabIntegrationInterface == nullptr)
         {
-            auto* prefabEditorEntityOwnershipInterface = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
-            auto* prefabIntegrationInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabIntegrationInterface>::Get();
-            AZ_Assert(prefabEditorEntityOwnershipInterface != nullptr, "PrefabEditorEntityOwnershipInterface is not found.");
-            AZ_Assert(prefabIntegrationInterface != nullptr, "PrefabIntegrationInterface is not found.");
-
-            if (prefabEditorEntityOwnershipInterface == nullptr || prefabIntegrationInterface == nullptr)
-            {
-                return false;
-            }
+            return false;
+        }
 
-            AzToolsFramework::Prefab::TemplateId rootPrefabTemplateId = prefabEditorEntityOwnershipInterface->GetRootPrefabTemplateId();
-            int prefabSaveSelection = prefabIntegrationInterface->HandleRootPrefabClosure(rootPrefabTemplateId);
+        AzToolsFramework::Prefab::TemplateId rootPrefabTemplateId = prefabEditorEntityOwnershipInterface->GetRootPrefabTemplateId();
+        int prefabSaveSelection = prefabIntegrationInterface->HandleRootPrefabClosure(rootPrefabTemplateId);
 
-            // In order to get the accept and reject codes of QDialog and QDialogButtonBox aligned, we do (1-prefabSaveSelection) here.
-            // For example, QDialog::Rejected(0) is emitted when dialog is closed. But the int value corresponds to
-            // QDialogButtonBox::AcceptRole(0).
-            switch (1 - prefabSaveSelection)
-            {
-            case QDialogButtonBox::AcceptRole:
-                bIsDocModified = false;
-                break;
-            case QDialogButtonBox::RejectRole:
-                wasCreateLevelOperationCancelled = true;
-                return false;
-            case QDialogButtonBox::InvalidRole:
-                // Set Modified flag to false to prevent show Save unchanged dialog again
-                GetIEditor()->GetDocument()->SetModifiedFlag(false);
-                break;
-            }
+        // In order to get the accept and reject codes of QDialog and QDialogButtonBox aligned, we do (1-prefabSaveSelection) here.
+        // For example, QDialog::Rejected(0) is emitted when dialog is closed. But the int value corresponds to
+        // QDialogButtonBox::AcceptRole(0).
+        switch (1 - prefabSaveSelection)
+        {
+        case QDialogButtonBox::AcceptRole:
+            bIsDocModified = false;
+            break;
+        case QDialogButtonBox::RejectRole:
+            wasCreateLevelOperationCancelled = true;
+            return false;
+        case QDialogButtonBox::InvalidRole:
+            // Set Modified flag to false to prevent show Save unchanged dialog again
+            GetIEditor()->GetDocument()->SetModifiedFlag(false);
+            break;
         }
+        
     }
 
     const char* temporaryLevelName = GetIEditor()->GetDocument()->GetTemporaryLevelName();
@@ -3189,10 +3030,6 @@ CCryEditDoc* CCryEditApp::OpenDocumentFile(const char* filename, bool addToMostR
         return GetIEditor()->GetDocument();
     }
 
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
     // If we are loading and we're in simulate mode, then switch it off before we do anything else
     if (GetIEditor()->GetGameEngine() && GetIEditor()->GetGameEngine()->GetSimulationMode())
     {
@@ -3201,13 +3038,10 @@ CCryEditDoc* CCryEditApp::OpenDocumentFile(const char* filename, bool addToMostR
         OnSwitchPhysics();
         GetIEditor()->GetDocument()->SetModifiedFlag(bIsDocModified);
 
-        if (usePrefabSystemForLevels)
+        auto* rootSpawnableInterface = AzFramework::RootSpawnableInterface::Get();
+        if (rootSpawnableInterface)
         {
-            auto* rootSpawnableInterface = AzFramework::RootSpawnableInterface::Get();
-            if (rootSpawnableInterface)
-            {
-                rootSpawnableInterface->ProcessSpawnableQueue();
-            }
+            rootSpawnableInterface->ProcessSpawnableQueue();
         }
     }
 

+ 76 - 607
Code/Editor/CryEditDoc.cpp

@@ -74,11 +74,6 @@ static const char* kBackupOrTempFolders[] =
 
 static const char* kLevelPathForSliceEditing = "EngineAssets/LevelForSliceEditing/LevelForSliceEditing.ly";
 
-static bool IsSliceFile(const QString& filePath)
-{
-    return filePath.endsWith(AzToolsFramework::SliceUtilities::GetSliceFileExtension().c_str(), Qt::CaseInsensitive);
-}
-
 namespace Internal
 {
     bool SaveLevel()
@@ -117,19 +112,14 @@ CCryEditDoc::CCryEditDoc()
     GetIEditor()->SetDocument(this);
     CLogFile::WriteLine("Document created");
     
-    bool isPrefabSystemEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-    if (isPrefabSystemEnabled)
-    {
-        m_prefabSystemComponentInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabSystemComponentInterface>::Get();
-        AZ_Assert(m_prefabSystemComponentInterface, "PrefabSystemComponentInterface is not found.");
-        m_prefabEditorEntityOwnershipInterface = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
-        AZ_Assert(m_prefabEditorEntityOwnershipInterface, "PrefabEditorEntityOwnershipInterface is not found.");
-        m_prefabLoaderInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabLoaderInterface>::Get();
-        AZ_Assert(m_prefabLoaderInterface, "PrefabLoaderInterface is not found.");
-        m_prefabIntegrationInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabIntegrationInterface>::Get();
-        AZ_Assert(m_prefabIntegrationInterface, "PrefabIntegrationInterface is not found.");
-    }
+    m_prefabSystemComponentInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabSystemComponentInterface>::Get();
+    AZ_Assert(m_prefabSystemComponentInterface, "PrefabSystemComponentInterface is not found.");
+    m_prefabEditorEntityOwnershipInterface = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
+    AZ_Assert(m_prefabEditorEntityOwnershipInterface, "PrefabEditorEntityOwnershipInterface is not found.");
+    m_prefabLoaderInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabLoaderInterface>::Get();
+    AZ_Assert(m_prefabLoaderInterface, "PrefabLoaderInterface is not found.");
+    m_prefabIntegrationInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabIntegrationInterface>::Get();
+    AZ_Assert(m_prefabIntegrationInterface, "PrefabIntegrationInterface is not found.");
 }
 
 CCryEditDoc::~CCryEditDoc()
@@ -137,8 +127,6 @@ CCryEditDoc::~CCryEditDoc()
     GetIEditor()->SetDocument(nullptr);
 
     CLogFile::WriteLine("Document destroyed");
-
-    AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusDisconnect();
 }
 
 bool CCryEditDoc::IsModified() const
@@ -158,32 +146,13 @@ QString CCryEditDoc::GetLevelPathName() const
 
 void CCryEditDoc::SetPathName(const QString& pathName)
 {
-    if (IsSliceFile(pathName))
-    {
-        m_pathName = kLevelPathForSliceEditing;
-        m_slicePathName = pathName;
-    }
-    else
-    {
-        m_pathName = pathName;
-        m_slicePathName.clear();
-    }
+    m_pathName = pathName;
     SetTitle(pathName.isEmpty() ? tr("Untitled") : PathUtil::GetFileName(pathName.toUtf8().data()).c_str());
 }
 
-QString CCryEditDoc::GetSlicePathName() const
-{
-    return m_slicePathName;
-}
-
-CCryEditDoc::DocumentEditingMode CCryEditDoc::GetEditMode() const
-{
-    return m_slicePathName.isEmpty() ? CCryEditDoc::DocumentEditingMode::LevelEdit : CCryEditDoc::DocumentEditingMode::SliceEdit;
-}
-
 QString CCryEditDoc::GetActivePathName() const
 {
-    return GetEditMode() == CCryEditDoc::DocumentEditingMode::SliceEdit ? GetSlicePathName() : GetLevelPathName();
+    return GetLevelPathName();
 }
 
 QString CCryEditDoc::GetTitle() const
@@ -269,42 +238,6 @@ void CCryEditDoc::DeleteContents()
     CrySystemEventBus::Broadcast(&CrySystemEventBus::Events::OnCryEditorSceneClosed);
 }
 
-
-void CCryEditDoc::Save(CXmlArchive& xmlAr)
-{
-    TDocMultiArchive arrXmlAr;
-    FillXmlArArray(arrXmlAr, &xmlAr);
-    Save(arrXmlAr);
-}
-
-void CCryEditDoc::Save(TDocMultiArchive& arrXmlAr)
-{
-    bool isPrefabEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-    if (!isPrefabEnabled)
-    {
-        CAutoDocNotReady autoDocNotReady;
-
-        if (arrXmlAr[DMAS_GENERAL] != nullptr)
-        {
-            (*arrXmlAr[DMAS_GENERAL]).root = XmlHelpers::CreateXmlNode("Level");
-            (*arrXmlAr[DMAS_GENERAL]).root->setAttr("WaterColor", m_waterColor);
-
-            char version[50];
-            GetIEditor()->GetFileVersion().ToString(version, AZ_ARRAY_SIZE(version));
-            (*arrXmlAr[DMAS_GENERAL]).root->setAttr("SandboxVersion", version);
-
-            SerializeViewSettings((*arrXmlAr[DMAS_GENERAL]));
-
-            // Fog settings  ///////////////////////////////////////////////////////
-            SerializeFogSettings((*arrXmlAr[DMAS_GENERAL]));
-        }
-    }
-    AfterSave();
-}
-
-
 void CCryEditDoc::Load(CXmlArchive& xmlAr, const QString& szFilename)
 {
     TDocMultiArchive arrXmlAr;
@@ -313,24 +246,14 @@ void CCryEditDoc::Load(CXmlArchive& xmlAr, const QString& szFilename)
 }
 
 //////////////////////////////////////////////////////////////////////////
-void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
+void CCryEditDoc::Load(TDocMultiArchive& /* arrXmlAr */, const QString& szFilename)
 {
-    bool isPrefabEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
     m_hasErrors = false;
 
     // Register a unique load event
     QString fileName = Path::GetFileName(szFilename);
-    QString levelHash;
-    if (!isPrefabEnabled)
-    {
-        levelHash = GetIEditor()->GetSettingsManager()->GenerateContentHash(arrXmlAr[DMAS_GENERAL]->root, fileName);
-    }
-    else
-    {
-        levelHash = szFilename;
-    }
+    QString levelHash = szFilename;
+    
     SEventLog loadEvent("Level_" + Path::GetFileName(fileName), "", levelHash);
 
     // Register this level and its content hash as version
@@ -368,25 +291,6 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
         const ICVar* pShowErrorDialogOnLoad = gEnv->pConsole->GetCVar("ed_showErrorDialogOnLoad");
         CErrorsRecorder errorsRecorder(pShowErrorDialogOnLoad && (pShowErrorDialogOnLoad->GetIVal() != 0));
 
-        bool usePrefabSystemForLevels = false;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(
-            usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-        if (!usePrefabSystemForLevels)
-        {
-            AZStd::string levelPakPath;
-            if (AzFramework::StringFunc::Path::ConstructFull(szLevelPath.toUtf8().data(), "level", "pak", levelPakPath, true))
-            {
-                // Check whether level.pak is present
-                if (!gEnv->pFileIO->Exists(levelPakPath.c_str()))
-                {
-                    CryWarning(
-                        VALIDATOR_MODULE_EDITOR, VALIDATOR_WARNING,
-                        "level.pak is missing.  This will cause other errors.  To fix this, re-export the level.");
-                }
-            }
-        }
-
         int t0 = GetTickCount();
 
         // Load level-specific audio data.
@@ -400,30 +304,6 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
             GetIEditor()->GetGameEngine()->LoadLevel(true, true);
         }
 
-        if (!isPrefabEnabled)
-        {
-            //////////////////////////////////////////////////////////////////////////
-            // Load water color.
-            //////////////////////////////////////////////////////////////////////////
-            (*arrXmlAr[DMAS_GENERAL]).root->getAttr("WaterColor", m_waterColor);
-
-            //////////////////////////////////////////////////////////////////////////
-            // Load View Settings
-            //////////////////////////////////////////////////////////////////////////
-            SerializeViewSettings((*arrXmlAr[DMAS_GENERAL]));
-
-            //////////////////////////////////////////////////////////////////////////
-            // Fog settings
-            //////////////////////////////////////////////////////////////////////////
-            SerializeFogSettings((*arrXmlAr[DMAS_GENERAL]));
-        }
-
-        if (!isPrefabEnabled)
-        {
-            // Serialize Shader Cache.
-            CAutoLogTime logtime("Load Level Shader Cache");
-        }
-
         {
             // support old version of sequences
             IMovieSystem* pMs = GetIEditor()->GetMovieSystem();
@@ -639,56 +519,28 @@ bool CCryEditDoc::SaveModified()
         return true;
     }
 
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-    if (!usePrefabSystemForLevels)
+    AzToolsFramework::Prefab::TemplateId rootPrefabTemplateId = m_prefabEditorEntityOwnershipInterface->GetRootPrefabTemplateId();
+    if (!m_prefabSystemComponentInterface->AreDirtyTemplatesPresent(rootPrefabTemplateId))
     {
-        QMessageBox saveModifiedMessageBox(AzToolsFramework::GetActiveWindow());
-        saveModifiedMessageBox.setText(QString("Save changes to %1?").arg(GetTitle()));
-        saveModifiedMessageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
-        saveModifiedMessageBox.setIcon(QMessageBox::Icon::Question);
-
-        auto button = QMessageBox::question(
-            AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()),
-            QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
-        switch (button)
-        {
-        case QMessageBox::Cancel:
-            return false;
-        case QMessageBox::Yes:
-            return DoFileSave();
-        case QMessageBox::No:
-            SetModifiedFlag(false);
-            return true;
-        }
-        Q_UNREACHABLE();
+        return true;
     }
-    else
-    {
-        AzToolsFramework::Prefab::TemplateId rootPrefabTemplateId = m_prefabEditorEntityOwnershipInterface->GetRootPrefabTemplateId();
-        if (!m_prefabSystemComponentInterface->AreDirtyTemplatesPresent(rootPrefabTemplateId))
-        {
-            return true;
-        }
 
-        int prefabSaveSelection = m_prefabIntegrationInterface->HandleRootPrefabClosure(rootPrefabTemplateId);
+    int prefabSaveSelection = m_prefabIntegrationInterface->HandleRootPrefabClosure(rootPrefabTemplateId);
 
-        // In order to get the accept and reject codes of QDialog and QDialogButtonBox aligned, we do (1-prefabSaveSelection) here.
-        // For example, QDialog::Rejected(0) is emitted when dialog is closed. But the int value corresponds to
-        // QDialogButtonBox::AcceptRole(0).
-        switch (1 - prefabSaveSelection)
-        {
-        case QDialogButtonBox::AcceptRole:
-            return true;
-        case QDialogButtonBox::RejectRole:
-            return false;
-        case QDialogButtonBox::InvalidRole:
-            SetModifiedFlag(false);
-            return true;
-        }
-        Q_UNREACHABLE();
+    // In order to get the accept and reject codes of QDialog and QDialogButtonBox aligned, we do (1-prefabSaveSelection) here.
+    // For example, QDialog::Rejected(0) is emitted when dialog is closed. But the int value corresponds to
+    // QDialogButtonBox::AcceptRole(0).
+    switch (1 - prefabSaveSelection)
+    {
+    case QDialogButtonBox::AcceptRole:
+        return true;
+    case QDialogButtonBox::RejectRole:
+        return false;
+    case QDialogButtonBox::InvalidRole:
+        SetModifiedFlag(false);
+        return true;
     }
+    Q_UNREACHABLE();
 }
 
 void CCryEditDoc::OnFileSaveAs()
@@ -702,15 +554,10 @@ void CCryEditDoc::OnFileSaveAs()
         if (OnSaveDocument(levelFileDialog.GetFileName()))
         {
             CCryEditApp::instance()->AddToRecentFileList(levelFileDialog.GetFileName());
-            bool usePrefabSystemForLevels = false;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-            if (usePrefabSystemForLevels)
-            {
-                AzToolsFramework::Prefab::TemplateId rootPrefabTemplateId =
-                    m_prefabEditorEntityOwnershipInterface->GetRootPrefabTemplateId();
-                SetModifiedFlag(m_prefabSystemComponentInterface->AreDirtyTemplatesPresent(rootPrefabTemplateId));
-            }
+
+            AzToolsFramework::Prefab::TemplateId rootPrefabTemplateId =
+                m_prefabEditorEntityOwnershipInterface->GetRootPrefabTemplateId();
+            SetModifiedFlag(m_prefabSystemComponentInterface->AreDirtyTemplatesPresent(rootPrefabTemplateId));
         }
     }
 }
@@ -731,19 +578,6 @@ bool CCryEditDoc::BeforeOpenDocument(const QString& lpszPathName, TOpenDocContex
     const double timeSec = AZ::TimeMsToSecondsDouble(timeMs);
     const CTimeValue loading_start_time(timeSec);
 
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-    if (!usePrefabSystemForLevels)
-    {
-        // ensure we close any open packs
-        if (!GetIEditor()->GetLevelFolder().isEmpty())
-        {
-            GetIEditor()->GetSystem()->GetIPak()->ClosePack((GetIEditor()->GetLevelFolder() + "\\level.pak").toUtf8().data());
-        }
-    }
-
     // restore directory to root.
     QDir::setCurrent(GetIEditor()->GetPrimaryCDFolder());
 
@@ -755,16 +589,7 @@ bool CCryEditDoc::BeforeOpenDocument(const QString& lpszPathName, TOpenDocContex
     // normalize the file path.
     absolutePath = Path::ToUnixPath(QFileInfo(absolutePath).canonicalFilePath());
     context.loading_start_time = loading_start_time;
-    if (IsSliceFile(absolutePath))
-    {
-        context.absoluteLevelPath = Path::GamePathToFullPath(kLevelPathForSliceEditing);
-        context.absoluteSlicePath = absolutePath;
-    }
-    else
-    {
-        context.absoluteLevelPath = absolutePath;
-        context.absoluteSlicePath = "";
-    }
+    context.absoluteLevelPath = absolutePath;
     return true;
 }
 
@@ -772,39 +597,16 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
 {
     const CTimeValue& loading_start_time = context.loading_start_time;
 
-    bool isPrefabEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
     // normalize the path so that its the same in all following calls:
     QString levelFilePath = QFileInfo(context.absoluteLevelPath).absoluteFilePath();
     context.absoluteLevelPath = levelFilePath;
 
     m_bLoadFailed = false;
 
-    auto pIPak = GetIEditor()->GetSystem()->GetIPak();
-
     QString levelFolderAbsolutePath = QFileInfo(context.absoluteLevelPath).absolutePath();
 
-
-    if (!isPrefabEnabled)
-    {
-        // if the level pack exists, open that, too:
-        QString levelPackFileAbsolutePath = QDir(levelFolderAbsolutePath).absoluteFilePath("level.pak");
-
-        // we mount the pack (level.pak) using the folder its sitting in as the mountpoint (first parameter)
-        pIPak->OpenPack(levelFolderAbsolutePath.toUtf8().constData(), levelPackFileAbsolutePath.toUtf8().constData());
-    }
-
     TDocMultiArchive arrXmlAr = {};
 
-    if (!isPrefabEnabled)
-    {
-        if (!LoadXmlArchiveArray(arrXmlAr, levelFilePath, levelFolderAbsolutePath))
-        {
-            m_bLoadFailed = true;
-            return false;
-        }
-    }
     if (!LoadLevel(arrXmlAr, context.absoluteLevelPath))
     {
         m_bLoadFailed = true;
@@ -818,19 +620,9 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
     }
 
     // Load AZ entities for the editor.
-    if (context.absoluteSlicePath.isEmpty())
+    if (!LoadEntitiesFromLevel(context.absoluteLevelPath))
     {
-        if (!LoadEntitiesFromLevel(context.absoluteLevelPath))
-        {
-            m_bLoadFailed = true;
-        }
-    }
-    else
-    {
-        if (!LoadEntitiesFromSlice(context.absoluteSlicePath))
-        {
-            m_bLoadFailed = true;
-        }
+        m_bLoadFailed = true;
     }
 
     if (m_bLoadFailed)
@@ -861,7 +653,6 @@ bool CCryEditDoc::OnNewDocument()
 {
     DeleteContents();
     m_pathName.clear();
-    m_slicePathName.clear();
     SetModifiedFlag(false);
     return true;
 }
@@ -963,14 +754,8 @@ bool CCryEditDoc::DoSaveDocument(const QString& filename, TSaveDocContext& conte
     }
 
     QString normalizedPath = Path::ToUnixPath(filename);
-    if (IsSliceFile(normalizedPath))
-    {
-        bSaved = SaveSlice(normalizedPath);
-    }
-    else
-    {
-        bSaved = SaveLevel(normalizedPath);
-    }
+
+    bSaved = SaveLevel(normalizedPath);
 
     // Changes filename for this document.
     SetPathName(normalizedPath);
@@ -1124,9 +909,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
 
     }
 
-    // Save level to XML archive.
-    CXmlArchive xmlAr;
-    Save(xmlAr);
+    AfterSave();
 
     // temp files (to be ignored by AssetProcessor take the form $tmp[0-9]*_...).  we will conform
     // to that to make this file invisible to AP until it has been written completely.
@@ -1141,69 +924,19 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
     auto tempFilenameStrData = tempSaveFile.toStdString();
     auto filenameStrData = fullPathName.toStdString();
 
-    bool isPrefabEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-    if (!isPrefabEnabled)
+    if (m_prefabEditorEntityOwnershipInterface)
     {
-        AZStd::vector<char> entitySaveBuffer;
-        bool savedEntities = false;
-        CPakFile pakFile;
-
-        {
-            AZ_PROFILE_SCOPE(Editor, "CCryEditDoc::SaveLevel Open PakFile");
-            if (!pakFile.Open(tempSaveFile.toUtf8().data(), false))
-            {
-                gEnv->pLog->LogWarning("Unable to open pack file %s for writing", tempSaveFile.toUtf8().data());
-                return false;
-            }
-        }
-
-
-        AZStd::vector<AZ::Entity*> editorEntities;
-        AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
-            &AzToolsFramework::EditorEntityContextRequestBus::Events::GetLooseEditorEntities,
-            editorEntities);
-
-        if (savedEntities)
-        {
-            AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Updated PakFile levelEntities.editor_xml");
-            pakFile.UpdateFile("levelentities.editor_xml", entitySaveBuffer.begin(), static_cast<int>(entitySaveBuffer.size()));
-
-            // Save XML archive to pak file.
-            bool bSaved = xmlAr.SaveToPak(Path::GetPath(tempSaveFile), pakFile);
-            if (bSaved)
-            {
-                contentsAllSaved = true;
-            }
-            else
-            {
-                gEnv->pLog->LogWarning("Unable to write the level data to file %s", tempSaveFile.toUtf8().data());
-            }
-        }
-        else
-        {
-            gEnv->pLog->LogWarning("Unable to generate entity data for level save %s", tempSaveFile.toUtf8().data());
-        }
+        AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
+        AZ_Assert(fileIO, "No File IO implementation available");
 
-        pakFile.Close();
-    }
-    else
-    {
-        if (m_prefabEditorEntityOwnershipInterface)
+        AZ::IO::HandleType tempSaveFileHandle;
+        AZ::IO::Result openResult = fileIO->Open(tempFilenameStrData.c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary, tempSaveFileHandle);
+        contentsAllSaved = openResult;
+        if (openResult)
         {
-            AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
-            AZ_Assert(fileIO, "No File IO implementation available");
-
-            AZ::IO::HandleType tempSaveFileHandle;
-            AZ::IO::Result openResult = fileIO->Open(tempFilenameStrData.c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary, tempSaveFileHandle);
-            contentsAllSaved = openResult;
-            if (openResult)
-            {
-                AZ::IO::FileIOStream stream(tempSaveFileHandle, AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary, false);
-                contentsAllSaved = m_prefabEditorEntityOwnershipInterface->SaveToStream(stream, AZStd::string_view(filenameStrData.data(), filenameStrData.size()));
-                stream.Close();
-            }
+            AZ::IO::FileIOStream stream(tempSaveFileHandle, AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary, false);
+            contentsAllSaved = m_prefabEditorEntityOwnershipInterface->SaveToStream(stream, AZStd::string_view(filenameStrData.data(), filenameStrData.size()));
+            stream.Close();
         }
     }
 
@@ -1228,277 +961,32 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
     return true;
 }
 
-bool CCryEditDoc::SaveSlice(const QString& filename)
-{
-    using namespace AzToolsFramework::SliceUtilities;
-
-    // Gather entities from live slice in memory
-    AZ::SliceComponent* liveSlice = nullptr;
-    AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::BroadcastResult(liveSlice,
-        &AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::Events::GetEditorRootSlice);
-    if (!liveSlice)
-    {
-        gEnv->pLog->LogWarning("Slice data not found.");
-        return false;
-    }
-
-    AZStd::unordered_set<AZ::EntityId> liveEntityIds;
-    if (!liveSlice->GetEntityIds(liveEntityIds))
-    {
-        gEnv->pLog->LogWarning("Error getting entities from slice.");
-        return false;
-    }
-
-
-    // Prevent save when there are multiple root entities.
-    bool foundRootEntity = false;
-    for (AZ::EntityId entityId : liveEntityIds)
-    {
-        AZ::EntityId parentId;
-        AZ::TransformBus::EventResult(parentId, entityId, &AZ::TransformBus::Events::GetParentId);
-        if (!parentId.IsValid())
-        {
-            if (foundRootEntity)
-            {
-                gEnv->pLog->LogWarning("Cannot save a slice with multiple root entities.");
-                return false;
-            }
-
-            foundRootEntity = true;
-        }
-    }
-
-    // Find target slice asset, and check if it's the same asset we opened
-    AZ::Data::AssetId targetAssetId;
-    AZ::Data::AssetCatalogRequestBus::BroadcastResult(targetAssetId, &AZ::Data::AssetCatalogRequestBus::Events::GetAssetIdByPath, filename.toUtf8().data(), azrtti_typeid<AZ::SliceAsset>(), false);
-
-    QString openedFilepath = Path::ToUnixPath(Path::GetRelativePath(m_slicePathName, true));
-    AZ::Data::AssetId openedAssetId;
-    AZ::Data::AssetCatalogRequestBus::BroadcastResult(openedAssetId, &AZ::Data::AssetCatalogRequestBus::Events::GetAssetIdByPath, openedFilepath.toUtf8().data(), azrtti_typeid<AZ::SliceAsset>(), false);
-
-    if (!targetAssetId.IsValid() || openedAssetId != targetAssetId)
-    {
-        gEnv->pLog->LogWarning("Slice editor can only modify existing slices. 'New Slice' and 'Save As' are not currently supported.");
-        return false;
-    }
-
-    AZ::Data::Asset<AZ::SliceAsset> sliceAssetRef = AZ::Data::AssetManager::Instance().GetAsset<AZ::SliceAsset>(targetAssetId, AZ::Data::AssetLoadBehavior::Default);
-
-    sliceAssetRef.BlockUntilLoadComplete();
-
-    if (!sliceAssetRef)
-    {
-        gEnv->pLog->LogWarning("Error loading slice: %s", filename.toUtf8().data());
-        return false;
-    }
-
-    // Get entities from target slice asset.
-    AZ::SliceComponent* assetSlice = sliceAssetRef.Get()->GetComponent();
-    if (!assetSlice)
-    {
-        gEnv->pLog->LogWarning("Error reading slice: %s", filename.toUtf8().data());
-        return false;
-    }
-
-    AZStd::unordered_set<AZ::EntityId> assetEntityIds;
-    if (!assetSlice->GetEntityIds(assetEntityIds))
-    {
-        gEnv->pLog->LogWarning("Error getting entities from slice: %s", filename.toUtf8().data());
-        return false;
-    }
-
-    AZStd::unordered_set<AZ::EntityId> entityAdds;
-    AZStd::unordered_set<AZ::EntityId> entityUpdates;
-    AZStd::unordered_set<AZ::EntityId> entityRemovals = assetEntityIds;
-
-    for (AZ::EntityId liveEntityId : liveEntityIds)
-    {
-        entityRemovals.erase(liveEntityId);
-        if (assetEntityIds.find(liveEntityId) != assetEntityIds.end())
-        {
-            entityUpdates.insert(liveEntityId);
-        }
-        else
-        {
-            entityAdds.insert(liveEntityId);
-        }
-    }
-
-    // Make a transaction targeting the specified slice
-    SliceTransaction::TransactionPtr transaction = SliceTransaction::BeginSlicePush(sliceAssetRef);
-    if (!transaction)
-    {
-        gEnv->pLog->LogWarning("Unable to update slice: %s", filename.toUtf8().data());
-        return false;
-    }
-
-    // Tell the transaction about all adds/updates/removals
-    for (AZ::EntityId id : entityAdds)
-    {
-        SliceTransaction::Result result = transaction->AddEntity(id);
-        if (!result)
-        {
-            gEnv->pLog->LogWarning("Error adding entity with ID %s to slice: %s\n\n%s",
-                id.ToString().c_str(), filename.toUtf8().data(), result.GetError().c_str());
-            return false;
-        }
-    }
-
-    for (AZ::EntityId id : entityRemovals)
-    {
-        SliceTransaction::Result result = transaction->RemoveEntity(id);
-        if (!result)
-        {
-            gEnv->pLog->LogWarning("Error removing entity with ID %s from slice: %s\n\n%s",
-                id.ToString().c_str(), filename.toUtf8().data(), result.GetError().c_str());
-            return false;
-        }
-    }
-
-    for (AZ::EntityId id : entityUpdates)
-    {
-        SliceTransaction::Result result = transaction->UpdateEntity(id);
-        if (!result)
-        {
-            gEnv->pLog->LogWarning("Error updating entity with ID %s in slice: %s\n\n%s",
-                id.ToString().c_str(), filename.toUtf8().data(), result.GetError().c_str());
-            return false;
-        }
-    }
-
-    // Commit
-    SliceTransaction::Result commitResult = transaction->Commit(
-        targetAssetId,
-        SlicePreSaveCallbackForWorldEntities,
-        nullptr,
-        SliceTransaction::SliceCommitFlags::DisableUndoCapture);
-
-    if (!commitResult)
-    {
-        gEnv->pLog->LogWarning("Failed to to save slice \"%s\".\n\nError:\n%s",
-            filename.toUtf8().data(), commitResult.GetError().c_str());
-        return false;
-    }
-
-    return true;
-}
-
 bool CCryEditDoc::LoadEntitiesFromLevel(const QString& levelPakFile)
 {
-    bool isPrefabEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
     bool loadedSuccessfully = false;
 
-    if (!isPrefabEnabled)
-    {
-        auto pakSystem = GetIEditor()->GetSystem()->GetIPak();
-        bool pakOpened = pakSystem->OpenPack(levelPakFile.toUtf8().data());
-        if (pakOpened)
-        {
-            const QString entityFilename = Path::GetPath(levelPakFile) + "levelentities.editor_xml";
+    AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
+    AZ_Assert(fileIO, "No File IO implementation available");
 
-            CCryFile entitiesFile;
-            if (entitiesFile.Open(entityFilename.toUtf8().data(), "rt"))
-            {
-                AZStd::vector<char> fileBuffer;
-                fileBuffer.resize(entitiesFile.GetLength());
-                if (!fileBuffer.empty())
-                {
-                    if (fileBuffer.size() == entitiesFile.ReadRaw(fileBuffer.begin(), fileBuffer.size()))
-                    {
-                        AZ::IO::ByteContainerStream<AZStd::vector<char>> fileStream(&fileBuffer);
-
-                        AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
-                            loadedSuccessfully,
-                            &AzToolsFramework::EditorEntityContextRequestBus::Events::LoadFromStreamWithLayers,
-                            fileStream,
-                            levelPakFile);
-                    }
-                    else
-                    {
-                        AZ_Error(
-                            "Editor", false, "Failed to load level entities because the file \"%s\" could not be read.",
-                            entityFilename.toUtf8().data());
-                    }
-                }
-                else
-                {
-                    AZ_Error(
-                        "Editor", false, "Failed to load level entities because the file \"%s\" is empty.", entityFilename.toUtf8().data());
-                }
-
-                entitiesFile.Close();
-            }
-            else
-            {
-                AZ_Error(
-                    "Editor", false, "Failed to load level entities because the file \"%s\" was not found.",
-                    entityFilename.toUtf8().data());
-            }
-
-            pakSystem->ClosePack(levelPakFile.toUtf8().data());
-        }
-    }
-    else
+    AZ::IO::HandleType fileHandle;
+    AZ::IO::Result openResult = fileIO->Open(levelPakFile.toUtf8().data(), AZ::IO::OpenMode::ModeRead | AZ::IO::OpenMode::ModeBinary, fileHandle);
+    if (openResult)
     {
-        AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
-        AZ_Assert(fileIO, "No File IO implementation available");
-
-        AZ::IO::HandleType fileHandle;
-        AZ::IO::Result openResult = fileIO->Open(levelPakFile.toUtf8().data(), AZ::IO::OpenMode::ModeRead | AZ::IO::OpenMode::ModeBinary, fileHandle);
-        if (openResult)
-        {
-            AZ::IO::FileIOStream stream(fileHandle, AZ::IO::OpenMode::ModeRead | AZ::IO::OpenMode::ModeBinary, false);
-            AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
-                loadedSuccessfully, &AzToolsFramework::EditorEntityContextRequests::LoadFromStreamWithLayers, stream, levelPakFile);
-            stream.Close();
-        }
+        AZ::IO::FileIOStream stream(fileHandle, AZ::IO::OpenMode::ModeRead | AZ::IO::OpenMode::ModeBinary, false);
+        AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
+            loadedSuccessfully, &AzToolsFramework::EditorEntityContextRequests::LoadFromStreamWithLayers, stream, levelPakFile);
+        stream.Close();
     }
 
     return loadedSuccessfully;
 }
 
-bool CCryEditDoc::LoadEntitiesFromSlice(const QString& sliceFile)
-{
-    bool sliceLoaded = false;
-    {
-        AZ::IO::FileIOStream sliceFileStream(sliceFile.toUtf8().data(), AZ::IO::OpenMode::ModeRead);
-        if (!sliceFileStream.IsOpen())
-        {
-            AZ_Error("Editor", false, "Failed to load entities because the file \"%s\" could not be read.", sliceFile.toUtf8().data());
-            return false;
-        }
-
-        AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(sliceLoaded, &AzToolsFramework::EditorEntityContextRequestBus::Events::LoadFromStream, sliceFileStream);
-    }
-
-    if (!sliceLoaded)
-    {
-        AZ_Error("Editor", false, "Failed to load entities from slice file \"%s\"", sliceFile.toUtf8().data());
-        return false;
-    }
-
-    return true;
-}
-
 bool CCryEditDoc::LoadLevel(TDocMultiArchive& arrXmlAr, const QString& absoluteCryFilePath)
 {
-    bool isPrefabEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-    auto pIPak = GetIEditor()->GetSystem()->GetIPak();
-
     QString folderPath = QFileInfo(absoluteCryFilePath).absolutePath();
 
     OnStartLevelResourceList();
 
-    // Load next level resource list.
-    if (!isPrefabEnabled)
-    {
-        pIPak->GetResourceList(AZ::IO::IArchive::RFOM_NextLevel)->Load(Path::Make(folderPath, "resourcelist.txt").toUtf8().data());
-    }
-
     GetIEditor()->Notify(eNotify_OnBeginLoad);
     CrySystemEventBus::Broadcast(&CrySystemEventBus::Events::OnCryEditorBeginLoad);
     //GetISystem()->GetISystemEventDispatcher()->OnSystemEvent( ESYSTEM_EVENT_LEVEL_LOAD_START,0,0 );
@@ -1512,11 +1000,7 @@ bool CCryEditDoc::LoadLevel(TDocMultiArchive& arrXmlAr, const QString& absoluteC
     Load(arrXmlAr, absoluteCryFilePath);
 
     GetISystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_LOAD_END, 0, 0);
-    // We don't need next level resource list anymore.
-    if (!isPrefabEnabled)
-    {
-        pIPak->GetResourceList(AZ::IO::IArchive::RFOM_NextLevel)->Clear();
-    }
+
     SetModifiedFlag(false); // start off with unmodified
     SetModifiedModules(eModifiedNothing);
     SetDocumentReady(true);
@@ -1535,7 +1019,7 @@ void CCryEditDoc::Hold(const QString& holdName)
 
 void CCryEditDoc::Hold(const QString& holdName, const QString& relativeHoldPath)
 {
-    if (!IsDocumentReady() || GetEditMode() == CCryEditDoc::DocumentEditingMode::SliceEdit)
+    if (!IsDocumentReady())
     {
         return;
     }
@@ -1563,7 +1047,7 @@ void CCryEditDoc::Fetch(const QString& relativeHoldPath, bool bShowMessages, boo
 
 void CCryEditDoc::Fetch(const QString& holdName, const QString& relativeHoldPath, bool bShowMessages, FetchPolicy policy)
 {
-    if (!IsDocumentReady() || GetEditMode() == CCryEditDoc::DocumentEditingMode::SliceEdit)
+    if (!IsDocumentReady())
     {
         return;
     }
@@ -1866,28 +1350,26 @@ void CCryEditDoc::OnStartLevelResourceList()
 
 bool CCryEditDoc::DoFileSave()
 {
-    if (GetEditMode() == CCryEditDoc::DocumentEditingMode::LevelEdit)
+    // If the file to save is the temporary level it should 'save as' since temporary levels will get deleted
+    const char* temporaryLevelName = GetTemporaryLevelName();
+    if (QString::compare(GetIEditor()->GetLevelName(), temporaryLevelName) == 0)
     {
-        // If the file to save is the temporary level it should 'save as' since temporary levels will get deleted
-        const char* temporaryLevelName = GetTemporaryLevelName();
-        if (QString::compare(GetIEditor()->GetLevelName(), temporaryLevelName) == 0)
+        QString filename;
+        if (CCryEditApp::instance()->GetDocManager()->DoPromptFileName(filename, ID_FILE_SAVE_AS, 0, false, nullptr)
+            && !filename.isEmpty() && !QFileInfo(filename).exists())
         {
-            QString filename;
-            if (CCryEditApp::instance()->GetDocManager()->DoPromptFileName(filename, ID_FILE_SAVE_AS, 0, false, nullptr)
-                && !filename.isEmpty() && !QFileInfo(filename).exists())
+            if (SaveLevel(filename))
             {
-                if (SaveLevel(filename))
-                {
-                    DeleteTemporaryLevel();
-                    QString newLevelPath = filename.left(filename.lastIndexOf('/') + 1);
-                    GetIEditor()->GetDocument()->SetPathName(filename);
-                    GetIEditor()->GetGameEngine()->SetLevelPath(newLevelPath);
-                    return true;
-                }
+                DeleteTemporaryLevel();
+                QString newLevelPath = filename.left(filename.lastIndexOf('/') + 1);
+                GetIEditor()->GetDocument()->SetPathName(filename);
+                GetIEditor()->GetGameEngine()->SetLevelPath(newLevelPath);
+                return true;
             }
-            return false;
         }
+        return false;
     }
+
     if (!IsDocumentReady())
     {
         return false;
@@ -2063,19 +1545,6 @@ void CCryEditDoc::ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr)
     SAFE_DELETE(arrXmlAr[0]);
 }
 
-//////////////////////////////////////////////////////////////////////////
-// AzToolsFramework::EditorEntityContextNotificationBus interface implementation
-void CCryEditDoc::OnSliceInstantiated([[maybe_unused]] const AZ::Data::AssetId& sliceAssetId, [[maybe_unused]] AZ::SliceComponent::SliceInstanceAddress& sliceAddress, [[maybe_unused]] const AzFramework::SliceInstantiationTicket& ticket)
-{
-    GetIEditor()->ResumeUndo();
-}
-
-void CCryEditDoc::OnSliceInstantiationFailed([[maybe_unused]] const AZ::Data::AssetId& sliceAssetId, [[maybe_unused]] const AzFramework::SliceInstantiationTicket& ticket)
-{
-    GetIEditor()->ResumeUndo();
-}
-//////////////////////////////////////////////////////////////////////////
-
 namespace AzToolsFramework
 {
     void CryEditDocFuncsHandler::Reflect(AZ::ReflectContext* context)

+ 2 - 36
Code/Editor/CryEditDoc.h

@@ -14,7 +14,6 @@
 #if !defined(Q_MOC_RUN)
 #include "DocMultiArchive.h"
 #include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h>
-#include <AzToolsFramework/Entity/SliceEditorEntityOwnershipServiceBus.h>
 #include <AzToolsFramework/Prefab/PrefabLoaderInterface.h>
 #include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h>
 #include <AzToolsFramework/UI/Prefab/PrefabIntegrationInterface.h>
@@ -34,20 +33,13 @@ struct ICVar;
 
 class CCryEditDoc
     : public QObject
-    , protected AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler
 {
     Q_OBJECT
     Q_PROPERTY(bool modified READ IsModified WRITE SetModifiedFlag);
     Q_PROPERTY(QString pathName READ GetLevelPathName WRITE SetPathName);
     Q_PROPERTY(QString title READ GetTitle WRITE SetTitle);
 
-public: // Create from serialization only
-    enum DocumentEditingMode
-    {
-        LevelEdit,
-        SliceEdit
-    };
-
+public:
     Q_INVOKABLE CCryEditDoc();
 
     virtual ~CCryEditDoc();
@@ -60,21 +52,11 @@ public: // Create from serialization only
     int GetModifiedModule();
 
     // Return level path.
-    // If a slice is being edited then the path to a placeholder level is returned.
     QString GetLevelPathName() const;
 
-    // Set path of slice or level being edited.
+    // Set path of level being edited.
     void SetPathName(const QString& pathName);
 
-    // Return slice path, if slice is open, an empty string otherwise. Use GetEditMode() to determine if a slice is open.
-    QString GetSlicePathName() const;
-
-    // Return The current type of document being edited, a level or a slice
-    // While editing a slice, a placeholder level is opened since the editor requires an open level to function.
-    // While editing a slice, saving will only affect the slice and not the placeholder level.
-    DocumentEditingMode GetEditMode() const;
-
-    // Return slice path if editing slice, level path if editing level.
     SANDBOX_API QString GetActivePathName() const;
 
     QString GetTitle() const;
@@ -123,9 +105,6 @@ public: // Create from serialization only
     const char* GetTemporaryLevelName() const;
     void DeleteTemporaryLevel();
 
-    void SetWaterColor(const QColor& col) { m_waterColor = col; }
-    QColor GetWaterColor() const { return m_waterColor; }
-    XmlNodeRef& GetFogTemplate() { return m_fogTemplate; }
     XmlNodeRef& GetEnvironmentTemplate() { return m_environmentTemplate; }
     void OnEnvironmentPropertyChanged(IVariable* pVar);
 
@@ -142,7 +121,6 @@ protected:
     {
         CTimeValue loading_start_time;
         QString absoluteLevelPath;
-        QString absoluteSlicePath;
     };
     bool BeforeOpenDocument(const QString& lpszPathName, TOpenDocContext& context);
     bool DoOpenDocument(TOpenDocContext& context);
@@ -152,14 +130,10 @@ protected:
     virtual void Load(TDocMultiArchive& arrXmlAr, const QString& szFilename);
     virtual void StartStreamingLoad(){}
 
-    void Save(CXmlArchive& xmlAr);
     void Load(CXmlArchive& xmlAr, const QString& szFilename);
-    void Save(TDocMultiArchive& arrXmlAr);
     bool SaveLevel(const QString& filename);
-    bool SaveSlice(const QString& filename);
     bool LoadLevel(TDocMultiArchive& arrXmlAr, const QString& absoluteCryFilePath);
     bool LoadEntitiesFromLevel(const QString& levelPakFile);
-    bool LoadEntitiesFromSlice(const QString& sliceFile);
     void SerializeFogSettings(CXmlArchive& xmlAr);
     virtual void SerializeViewSettings(CXmlArchive& xmlAr);
     void LogLoadTime(int time) const;
@@ -179,12 +153,6 @@ protected:
 
     QString GetCryIndexPath(const char* levelFilePath) const;
 
-    //////////////////////////////////////////////////////////////////////////
-    // SliceEditorEntityOwnershipServiceNotificationBus::Handler
-    void OnSliceInstantiated(const AZ::Data::AssetId& sliceAssetId, AZ::SliceComponent::SliceInstanceAddress& sliceAddress, const AzFramework::SliceInstantiationTicket& /*ticket*/) override;
-    void OnSliceInstantiationFailed(const AZ::Data::AssetId& sliceAssetId, const AzFramework::SliceInstantiationTicket& /*ticket*/) override;
-    //////////////////////////////////////////////////////////////////////////
-
     bool m_bLoadFailed = false;
     QColor m_waterColor = QColor(0, 0, 255);
     XmlNodeRef m_fogTemplate;
@@ -197,9 +165,7 @@ protected:
     bool m_boLevelExported = true;
     bool m_modified = false;
     QString m_pathName;
-    QString m_slicePathName;
     QString m_title;
-    const char* m_envProbeSliceRelativePath = "EngineAssets/Slices/DefaultLevelSetup.slice";
     const float m_envProbeHeight = 200.0f;
     bool m_hasErrors = false; ///< This is used to warn the user that they may lose work when they go to save.
     AzToolsFramework::Prefab::PrefabSystemComponentInterface* m_prefabSystemComponentInterface = nullptr;

+ 1 - 12
Code/Editor/EditorToolsApplication.cpp

@@ -259,18 +259,7 @@ namespace EditorInternal
 
     const char* EditorToolsApplication::GetLevelExtension() const
     {
-        bool prefabSystemEnabled = false;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(
-            prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-        if (!prefabSystemEnabled)
-        {
-            return ".ly";
-        }
-        else
-        {
-            return ".prefab";
-        }
+        return ".prefab";
     }
 
     const char* EditorToolsApplication::GetOldCryLevelExtension() const

+ 0 - 16
Code/Editor/GameEngine.cpp

@@ -465,22 +465,6 @@ bool CGameEngine::LoadLevel(
     // directory is wrong
     QDir::setCurrent(GetIEditor()->GetPrimaryCDFolder());
 
-
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-    if (!usePrefabSystemForLevels)
-    {
-        QString pakFile = m_levelPath + "/level.pak";
-
-        // Open Pak file for this level.
-        if (!m_pISystem->GetIPak()->OpenPack(m_levelPath.toUtf8().data(), pakFile.toUtf8().data()))
-        {
-            CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_WARNING, "Level Pack File %s Not Found", pakFile.toUtf8().data());
-        }
-    }
-
     // Audio: notify audio of level loading start?
     GetIEditor()->GetObjectManager()->SendEvent(EVENT_REFRESH);
 

+ 3 - 124
Code/Editor/GameExporter.cpp

@@ -80,7 +80,7 @@ CGameExporter::~CGameExporter()
 }
 
 //////////////////////////////////////////////////////////////////////////
-bool CGameExporter::Export(unsigned int flags, [[maybe_unused]] EEndian eExportEndian, const char* subdirectory)
+bool CGameExporter::Export(unsigned int /* flags */, EEndian /* eExportEndian */, const char* /* subdirectory */)
 {
     CAutoDocNotReady autoDocNotReady;
     QWaitCursor waitCursor;
@@ -96,129 +96,8 @@ bool CGameExporter::Export(unsigned int flags, [[maybe_unused]] EEndian eExportE
 
     CrySystemEventBus::Broadcast(&CrySystemEventBus::Events::OnCryEditorBeginLevelExport);
 
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-    if (usePrefabSystemForLevels)
-    {
-        // Level.pak and all the data contained within it is unused when using the prefab system for levels, so there's nothing
-        // to do here.
-
-        CCryEditDoc* pDocument = pEditor->GetDocument();
-        pDocument->SetLevelExported(true);
-    }
-    else
-    {
-        QDir::setCurrent(pEditor->GetPrimaryCDFolder());
-
-        QString sLevelPath = Path::AddSlash(pGameEngine->GetLevelPath());
-        if (subdirectory && subdirectory[0] && strcmp(subdirectory, ".") != 0)
-        {
-            sLevelPath = Path::AddSlash(sLevelPath + subdirectory);
-            QDir().mkpath(sLevelPath);
-        }
-
-        m_levelPak.m_sPath = QString(sLevelPath) + GetLevelPakFilename();
-
-        m_levelPath = Path::RemoveBackslash(sLevelPath);
-        QString rootLevelPath = Path::AddSlash(pGameEngine->GetLevelPath());
-
-        CCryEditDoc* pDocument = pEditor->GetDocument();
-
-        if (flags & eExp_Fast)
-        {
-            m_settings.SetLowQuality();
-        }
-        else if (m_bAutoExportMode)
-        {
-            m_settings.SetHiQuality();
-        }
-
-        AZStd::scoped_lock autoLock(CGameEngine::GetPakModifyMutex());
-
-        // Close this pak file.
-        if (!CloseLevelPack(m_levelPak, true))
-        {
-            Error("Cannot close Pak file " + m_levelPak.m_sPath);
-            exportSuccessful = false;
-        }
-
-        if (exportSuccessful && m_bAutoExportMode)
-        {
-            // Remove read-only flags.
-            auto perms = QFile::permissions(m_levelPak.m_sPath) | QFile::Permission::WriteOwner;
-            QFile::setPermissions(m_levelPak.m_sPath, perms);
-        }
-
-        //////////////////////////////////////////////////////////////////////////
-        if (exportSuccessful)
-        {
-            if (!CFileUtil::OverwriteFile(m_levelPak.m_sPath))
-            {
-                Error("Cannot overwrite Pak file " + m_levelPak.m_sPath);
-                exportSuccessful = false;
-            }
-        }
-
-        if (exportSuccessful)
-        {
-            if (!OpenLevelPack(m_levelPak, false))
-            {
-                Error("Cannot open Pak file " + m_levelPak.m_sPath + " for writing.");
-                exportSuccessful = false;
-            }
-        }
-
-        ////////////////////////////////////////////////////////////////////////
-        // Export all data to the game
-        ////////////////////////////////////////////////////////////////////////
-        if (exportSuccessful)
-        {
-            ////////////////////////////////////////////////////////////////////////
-            // Exporting map setttings
-            ////////////////////////////////////////////////////////////////////////
-
-            //! Export Level data.
-            CLogFile::WriteLine("Exporting leveldata.xml");
-            ExportLevelData(sLevelPath);
-            CLogFile::WriteLine("Exporting leveldata.xml done.");
-
-            ExportLevelInfo(sLevelPath);
-
-            ExportLevelResourceList(sLevelPath);
-            ExportLevelUsedResourceList(sLevelPath);
-
-            //////////////////////////////////////////////////////////////////////////
-            // End Exporting Game data.
-            //////////////////////////////////////////////////////////////////////////
-
-            // Close all packs.
-            CloseLevelPack(m_levelPak, false);
-            //  m_texturePakFile.Close();
-
-            pEditor->SetStatusText(QObject::tr("Ready"));
-
-            // Reopen this pak file.
-            if (!OpenLevelPack(m_levelPak, true))
-            {
-                Error("Cannot open Pak file " + m_levelPak.m_sPath);
-                exportSuccessful = false;
-            }
-        }
-
-        if (exportSuccessful)
-        {
-            // Commit changes to the disk.
-            _flushall();
-
-            // finally create filelist.xml
-            QString levelName = Path::GetFileName(pGameEngine->GetLevelPath());
-            ExportFileList(sLevelPath, levelName);
-
-            pDocument->SetLevelExported(true);
-        }
-    }
+    CCryEditDoc* pDocument = pEditor->GetDocument();
+    pDocument->SetLevelExported(true);
 
     // Always notify that we've finished exporting, whether it was successful or not.
     CrySystemEventBus::Broadcast(&CrySystemEventBus::Events::OnCryEditorEndLevelExport, exportSuccessful);

+ 2 - 10
Code/Editor/GameExporter.h

@@ -68,16 +68,8 @@ private:
 
     static const char* GetLevelPakFilename()
     {
-        bool usePrefabSystemForLevels = false;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(
-            usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-        if (usePrefabSystemForLevels)
-        {
-            AZ_Assert(false, "Level.pak should no longer be used when prefabs are used for levels.");
-            return "";
-        }
-
-        return "level.pak";
+        AZ_Assert(false, "Level.pak should no longer be used when prefabs are used for levels.");
+        return "";
     }
 
     void ExportLevelData(const QString& path, bool bExportMission = true);

+ 12 - 577
Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp

@@ -13,7 +13,6 @@
 #include <AzCore/Debug/Profiler.h>
 #include <AzCore/Math/Transform.h>
 #include <AzCore/RTTI/AttributeReader.h>
-#include <AzCore/Slice/SliceComponent.h>
 #include <AzCore/std/functional.h>
 #include <AzCore/std/string/string.h>
 #include <AzCore/std/algorithm.h>
@@ -39,7 +38,6 @@
 #include <AzToolsFramework/AssetBrowser/AssetSelectionModel.h>
 #include <AzToolsFramework/Commands/EntityStateCommand.h>
 #include <AzToolsFramework/Commands/SelectionCommand.h>
-#include <AzToolsFramework/Commands/SliceDetachEntityCommand.h>
 #include <AzToolsFramework/ContainerEntity/ContainerEntityInterface.h>
 #include <AzToolsFramework/Editor/ActionManagerIdentifiers/EditorContextIdentifiers.h>
 #include <AzToolsFramework/Editor/ActionManagerIdentifiers/EditorMenuIdentifiers.h>
@@ -49,13 +47,9 @@
 #include <AzToolsFramework/Entity/EditorEntityHelpers.h>
 #include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
 #include <AzToolsFramework/Entity/ReadOnly/ReadOnlyEntityInterface.h>
-#include <AzToolsFramework/Entity/SliceEditorEntityOwnershipServiceBus.h>
-#include <AzToolsFramework/Slice/SliceRequestBus.h>
-#include <AzToolsFramework/Slice/SliceUtilities.h>
 #include <AzToolsFramework/ToolsComponents/EditorVisibilityComponent.h>
 #include <AzToolsFramework/ToolsComponents/GenericComponentWrapper.h>
 #include <AzToolsFramework/Undo/UndoSystem.h>
-#include <AzToolsFramework/UI/EditorEntityUi/EditorEntityUiInterface.h>
 #include <AzToolsFramework/UI/Prefab/PrefabIntegrationInterface.h>
 #include <AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.h>
 #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
@@ -148,20 +142,14 @@ void GetSelectedEntitiesSetWithFlattenedHierarchy(AzToolsFramework::EntityIdSet&
 SandboxIntegrationManager::SandboxIntegrationManager()
     : m_startedUndoRecordingNestingLevel(0)
     , m_dc(nullptr)
-    , m_notificationWindowManager(new AzToolsFramework::SliceOverridesNotificationWindowManager())
 {
-    // Required to receive events from the Cry Engine undo system
+    // Required to receive events from the Cry Engine undo system.
     GetIEditor()->GetUndoManager()->AddListener(this);
 
-    // Only create the PrefabIntegrationManager if prefabs are enabled
-    bool prefabSystemEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-    if (prefabSystemEnabled)
-    {
-        m_prefabIntegrationManager = aznew AzToolsFramework::Prefab::PrefabIntegrationManager();
-    }
+    // Create the PrefabIntegrationManager, which initializes prefab-related operations.
+    m_prefabIntegrationManager = aznew AzToolsFramework::Prefab::PrefabIntegrationManager();
 
+    // Connect to the Action Manager Registration bus to correctly register actions, menus, toolbars etc.
     AzToolsFramework::ActionManagerRegistrationNotificationBus::Handler::BusConnect();
 }
 
@@ -177,7 +165,6 @@ SandboxIntegrationManager::~SandboxIntegrationManager()
 
 void SandboxIntegrationManager::Setup()
 {
-    AzFramework::AssetCatalogEventBus::Handler::BusConnect();
     AzToolsFramework::ToolsApplicationEvents::Bus::Handler::BusConnect();
     AzToolsFramework::EditorRequests::Bus::Handler::BusConnect();
     AzToolsFramework::EditorWindowRequests::Bus::Handler::BusConnect();
@@ -186,23 +173,10 @@ void SandboxIntegrationManager::Setup()
 
     AzFramework::DisplayContextRequestBus::Handler::BusConnect();
 
-    // Keep a reference to the interface EditorEntityUiInterface.
-    // This is used to register layer entities to their UI handler when the layer component is activated.
-    m_editorEntityUiInterface = AZ::Interface<AzToolsFramework::EditorEntityUiInterface>::Get();
-
-    AZ_Assert((m_editorEntityUiInterface != nullptr),
-        "SandboxIntegrationManager requires a EditorEntityUiInterface instance to be present on Setup().");
-
-    bool prefabSystemEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-    if (prefabSystemEnabled)
-    {
-        m_prefabIntegrationInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabIntegrationInterface>::Get();
-        AZ_Assert(
-            (m_prefabIntegrationInterface != nullptr),
-            "SandboxIntegrationManager requires a PrefabIntegrationInterface instance to be present on Setup().");
-    }
+    m_prefabIntegrationInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabIntegrationInterface>::Get();
+    AZ_Assert(
+        (m_prefabIntegrationInterface != nullptr),
+        "SandboxIntegrationManager requires a PrefabIntegrationInterface instance to be present on Setup().");
 
     m_editorEntityAPI = AZ::Interface<AzToolsFramework::EditorEntityAPI>::Get();
     AZ_Assert(m_editorEntityAPI, "SandboxIntegrationManager requires an EditorEntityAPI instance to be present on Setup().");
@@ -213,185 +187,6 @@ void SandboxIntegrationManager::Setup()
     m_contextMenuBottomHandler.Setup();
 }
 
-void SandboxIntegrationManager::SaveSlice(const bool& QuickPushToFirstLevel)
-{
-    AzToolsFramework::EntityIdList selectedEntities;
-    GetSelectedEntities(selectedEntities);
-    if (selectedEntities.size() == 0)
-    {
-        m_notificationWindowManager->CreateNotificationWindow(AzToolsFramework::SliceOverridesNotificationWindow::EType::TypeError, "Nothing selected - Select a slice entity with overrides and try again");
-        return;
-    }
-
-    AzToolsFramework::EntityIdList relevantEntities;
-    AZ::u32 entitiesInSlices;
-    AZStd::vector<AZ::SliceComponent::SliceInstanceAddress> sliceInstances;
-    GetEntitiesInSlices(selectedEntities, entitiesInSlices, sliceInstances);
-    if (entitiesInSlices > 0)
-    {
-        // Gather the set of relevant entities from the selected entities and all descendants
-        AzToolsFramework::EntityIdSet relevantEntitiesSet;
-        AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(relevantEntitiesSet,
-            &AzToolsFramework::ToolsApplicationRequestBus::Events::GatherEntitiesAndAllDescendents, selectedEntities);
-
-        relevantEntities.reserve(relevantEntitiesSet.size());
-        for (AZ::EntityId& id : relevantEntitiesSet)
-        {
-            relevantEntities.push_back(id);
-        }
-    }
-
-    int numEntitiesToAdd = 0;
-    int numEntitiesToRemove = 0;
-    int numEntitiesToUpdate = 0;
-    if (AzToolsFramework::SliceUtilities::SaveSlice(relevantEntities, numEntitiesToAdd, numEntitiesToRemove, numEntitiesToUpdate, QuickPushToFirstLevel))
-    {
-        if (numEntitiesToAdd > 0 || numEntitiesToRemove > 0 || numEntitiesToUpdate > 0)
-        {
-            m_notificationWindowManager->CreateNotificationWindow(
-                AzToolsFramework::SliceOverridesNotificationWindow::EType::TypeSuccess,
-                QString("Save slice to parent - %1 saved successfully").arg(numEntitiesToUpdate + numEntitiesToAdd + numEntitiesToRemove));
-        }
-        else
-        {
-            m_notificationWindowManager->CreateNotificationWindow(
-                AzToolsFramework::SliceOverridesNotificationWindow::EType::TypeError,
-                "Selected has no overrides - Select a slice entity with overrides and try again");
-        }
-    }
-    else
-    {
-        m_notificationWindowManager->CreateNotificationWindow(
-            AzToolsFramework::SliceOverridesNotificationWindow::EType::TypeError,
-            "Save slice to parent - Failed");
-    }
-}
-
-// This event handler is queued on main thread.
-void SandboxIntegrationManager::OnCatalogAssetAdded(const AZ::Data::AssetId& assetId)
-{
-    bool prefabSystemEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-    if (!prefabSystemEnabled)
-    {
-        AZ::SliceComponent* editorRootSlice = nullptr;
-        AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::BroadcastResult(
-            editorRootSlice, &AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::Events::GetEditorRootSlice);
-        AZ_Assert(editorRootSlice, "Editor root slice missing!");
-
-        for (auto restoreItr = m_sliceAssetDeletionErrorRestoreInfos.begin(); restoreItr != m_sliceAssetDeletionErrorRestoreInfos.end();)
-        {
-            if (restoreItr->m_assetId == assetId)
-            {
-                for (const auto& entityRestore : restoreItr->m_entityRestoreInfos)
-                {
-                    const AZ::EntityId& entityId = entityRestore.first;
-                    const AZ::SliceComponent::EntityRestoreInfo& restoreInfo = entityRestore.second;
-
-                    AZ::Entity* entity = editorRootSlice->FindEntity(entityId);
-                    if (entity)
-                    {
-                        AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::Broadcast(
-                            &AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::Events::RestoreSliceEntity, entity, restoreInfo,
-                            AzToolsFramework::SliceEntityRestoreType::Detached);
-                    }
-                    else
-                    {
-                        AZ_Error(
-                            "DetachSliceEntity", entity, "Unable to find previous detached entity of Id %s. Cannot undo \"Detach\" action.",
-                            entityId.ToString().c_str());
-                    }
-                }
-
-                restoreItr = m_sliceAssetDeletionErrorRestoreInfos.erase(restoreItr);
-            }
-            else
-            {
-                restoreItr++;
-            }
-        }
-    }
-}
-
-// No mutex is used for now because the only 
-// operation writing to shared resource is queued on main thread.
-void SandboxIntegrationManager::OnCatalogAssetRemoved(const AZ::Data::AssetId& assetId, const AZ::Data::AssetInfo& assetInfo)
-{
-    bool isPrefabSystemEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-    // Check to see if the removed slice asset has any instance in the level, then check if 
-    // those dangling instances are directly under the root slice (not sub-slices). If yes,
-    // detach them and save necessary information so they can be restored when their slice asset
-    // comes back.
-
-    if (!isPrefabSystemEnabled && assetInfo.m_assetType == AZ::AzTypeInfo<AZ::SliceAsset>::Uuid())
-    {
-        AZ::SliceComponent* rootSlice = nullptr;
-        AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::BroadcastResult(rootSlice,
-            &AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::Events::GetEditorRootSlice);
-        AZ_Assert(rootSlice, "Editor root slice missing!");
-
-        AZStd::vector<AZ::EntityId> entitiesToDetach;
-        const AZ::SliceComponent::SliceList& subSlices = rootSlice->GetSlices();
-        for (const AZ::SliceComponent::SliceReference& subSliceRef : subSlices)
-        {
-            if (subSliceRef.GetSliceAsset().GetId() == assetId)
-            {
-                for (const AZ::SliceComponent::SliceInstance& sliceInst : subSliceRef.GetInstances())
-                {
-                    const AZ::SliceComponent::InstantiatedContainer* instContainer = sliceInst.GetInstantiated();
-                    for (AZ::Entity* entity : instContainer->m_entities)
-                    {
-                        entitiesToDetach.emplace_back(entity->GetId());
-                    }
-                }
-            }
-        }
-
-        AZ_Error("Editor", false, "The slice asset %s is deleted from disk, to prevent further data corruption, all of its root level slice instances are detached. "
-            "Restoring the slice asset on disk will revert the detaching operation.", assetInfo.m_relativePath.c_str());
-
-        AZ::SystemTickBus::QueueFunction([this, assetId, entitiesToDetach]() {
-            AZStd::vector<AZStd::pair<AZ::EntityId, AZ::SliceComponent::EntityRestoreInfo>> restoreInfos;
-            bool detachSuccess = false;
-            AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
-                detachSuccess, &AzToolsFramework::ToolsApplicationRequestBus::Events::DetachEntities, entitiesToDetach, restoreInfos);
-            if (detachSuccess)
-            {
-                m_sliceAssetDeletionErrorRestoreInfos.emplace_back(assetId, AZStd::move(restoreInfos));
-            }
-        });
-    }
-}
-
-void SandboxIntegrationManager::GetEntitiesInSlices(
-    const AzToolsFramework::EntityIdList& selectedEntities,
-    AZ::u32& entitiesInSlices,
-    AZStd::vector<AZ::SliceComponent::SliceInstanceAddress>& sliceInstances)
-{
-    // Identify all slice instances affected by the selected entity set.
-    entitiesInSlices = 0;
-    for (const AZ::EntityId& entityId : selectedEntities)
-    {
-        AZ::SliceComponent::SliceInstanceAddress sliceAddress;
-        AzFramework::SliceEntityRequestBus::EventResult(sliceAddress, entityId,
-            &AzFramework::SliceEntityRequestBus::Events::GetOwningSlice);
-
-        if (sliceAddress.IsValid())
-        {
-            ++entitiesInSlices;
-
-            if (sliceInstances.end() == AZStd::find(sliceInstances.begin(), sliceInstances.end(), sliceAddress))
-            {
-                sliceInstances.push_back(sliceAddress);
-            }
-        }
-    }
-}
-
 void SandboxIntegrationManager::Teardown()
 {
     m_contextMenuBottomHandler.Teardown();
@@ -514,9 +309,6 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(
     AzToolsFramework::EntityIdList selected;
     GetSelectedOrHighlightedEntities(selected);
 
-    bool prefabSystemEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
     QAction* action = nullptr;
 
     // when nothing is selected, entity is created at root level
@@ -538,7 +330,7 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(
         AZ::EntityId selectedEntityId = selected.front();
         bool selectedEntityIsReadOnly = m_readOnlyEntityPublicInterface->IsReadOnly(selectedEntityId);
         auto containerEntityInterface = AZ::Interface<AzToolsFramework::ContainerEntityInterface>::Get();
-        if (!prefabSystemEnabled || (containerEntityInterface && containerEntityInterface->IsContainerOpen(selectedEntityId) && !selectedEntityIsReadOnly))
+        if (containerEntityInterface && containerEntityInterface->IsContainerOpen(selectedEntityId) && !selectedEntityIsReadOnly)
         {
             action = menu->addAction(QObject::tr("Create entity"));
             action->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_N));
@@ -552,50 +344,6 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(
         }
     }
 
-    if (!prefabSystemEnabled)
-    {
-        menu->addSeparator();
-
-        AzToolsFramework::EntityIdList entities;
-        AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(
-            entities,
-            &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
-
-        AzToolsFramework::EntityIdSet flattenedSelection = AzToolsFramework::GetCulledEntityHierarchy(entities);
-
-        SetupSliceContextMenu(menu);
-
-        if (!selected.empty())
-        {
-            // Don't allow duplication if any of the selected entities are direct descendants of a read-only entity
-            bool selectionContainsDescendantOfReadOnlyEntity = false;
-            for (const auto& entityId : selected)
-            {
-                AZ::EntityId parentEntityId;
-                AZ::TransformBus::EventResult(parentEntityId, entityId, &AZ::TransformBus::Events::GetParentId);
-
-                if (parentEntityId.IsValid() && m_readOnlyEntityPublicInterface->IsReadOnly(parentEntityId))
-                {
-                    selectionContainsDescendantOfReadOnlyEntity = true;
-                    break;
-                }
-            }
-
-            if (!selectionContainsDescendantOfReadOnlyEntity)
-            {
-                action = menu->addAction(QObject::tr("Duplicate"));
-                QObject::connect(action, &QAction::triggered, action, [this] { ContextMenu_Duplicate(); });
-            }
-        }
-
-        action = menu->addAction(QObject::tr("Delete"));
-        QObject::connect(action, &QAction::triggered, action, [this] { ContextMenu_DeleteSelected(); });
-        if (selected.size() == 0)
-        {
-            action->setDisabled(true);
-        }
-    }
-
     menu->addSeparator();
 
     if (selected.size() > 0)
@@ -660,119 +408,6 @@ void SandboxIntegrationManager::ClosePinnedInspector(AzToolsFramework::EntityPro
     }
 }
 
-void SandboxIntegrationManager::SetupSliceContextMenu(QMenu* menu)
-{
-    AZ_PROFILE_FUNCTION(Editor);
-    AzToolsFramework::EntityIdList selectedEntities;
-    GetSelectedOrHighlightedEntities(selectedEntities);
-
-    menu->addSeparator();
-
-    if (!selectedEntities.empty())
-    {
-        bool anySelectedEntityFromExistingSlice = false;
-        for (AZ::EntityId entityId : selectedEntities)
-        {
-            if (!anySelectedEntityFromExistingSlice)
-            {
-                AZ::SliceComponent::SliceInstanceAddress sliceAddress(nullptr, nullptr);
-                AzFramework::SliceEntityRequestBus::EventResult(sliceAddress, entityId,
-                    &AzFramework::SliceEntityRequestBus::Events::GetOwningSlice);
-                if (sliceAddress.GetReference())
-                {
-                    anySelectedEntityFromExistingSlice = true;
-                }
-            }
-        }
-    }
-
-    QAction* instantiateAction = menu->addAction(QObject::tr("Instantiate slice..."));
-    instantiateAction->setToolTip(QObject::tr("Instantiates a pre-existing slice asset into the level"));
-    QObject::connect(instantiateAction, &QAction::triggered, instantiateAction, [this] { ContextMenu_InstantiateSlice(); });
-
-    AzToolsFramework::EditorEvents::Bus::Broadcast(&AzToolsFramework::EditorEvents::Bus::Events::PopulateEditorGlobalContextMenu_SliceSection, menu, AZ::Vector2::CreateZero(),
-        AzToolsFramework::EditorEvents::eECMF_HIDE_ENTITY_CREATION | AzToolsFramework::EditorEvents::eECMF_USE_VIEWPORT_CENTER);
-
-    if (selectedEntities.empty())
-    {
-        return;
-    }
-
-    AZ::u32 entitiesInSlices;
-    AZStd::vector<AZ::SliceComponent::SliceInstanceAddress> sliceInstances;
-    GetEntitiesInSlices(selectedEntities, entitiesInSlices, sliceInstances);
-    // Offer slice-related options if any selected entities belong to slice instances.
-    if (0 == entitiesInSlices)
-    {
-        return;
-    }
-
-    // Setup push and revert options (quick push and 'advanced' push UI).
-    SetupSliceContextMenu_Modify(menu, selectedEntities, entitiesInSlices);
-
-    menu->addSeparator();
-
-    // PopulateFindSliceMenu takes a callback to run when a slice is selected, which is called before the slice is selected in the asset browser.
-    // This is so the AssetBrowser can be opened first, which can only be done from a Sandbox module. PopulateFindSliceMenu exists in the AzToolsFramework
-    // module in SliceUtilities, so it can share logic with similar menus, like Quick Push.
-    // Similarly, it takes a callback for the SliceRelationshipView.
-    AzToolsFramework::SliceUtilities::PopulateSliceSubMenus(*menu, selectedEntities,
-        []
-    {
-        // This will open the AssetBrowser if it's not open, and do nothing if it's already opened.
-        QtViewPaneManager::instance()->OpenPane(LyViewPane::AssetBrowser);
-    },
-        []
-    {
-        //open SliceRelationshipView if necessary, and populate it
-        QtViewPaneManager::instance()->OpenPane(LyViewPane::SliceRelationships);
-    });
-}
-
-void SandboxIntegrationManager::SetupSliceContextMenu_Modify(QMenu* menu, const AzToolsFramework::EntityIdList& selectedEntities, [[maybe_unused]] const AZ::u32 numEntitiesInSlices)
-{
-    AZ_PROFILE_FUNCTION(Editor);
-    using namespace AzToolsFramework;
-
-    // Gather the set of relevant entities from the selected entities and all descendants
-    AzToolsFramework::EntityIdSet relevantEntitiesSet;
-    AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(
-        relevantEntitiesSet, &AzToolsFramework::ToolsApplicationRequests::Bus::Events::GatherEntitiesAndAllDescendents, selectedEntities);
-    AzToolsFramework::EntityIdList relevantEntities;
-    relevantEntities.reserve(relevantEntitiesSet.size());
-    for (AZ::EntityId& id : relevantEntitiesSet)
-    {
-        relevantEntities.push_back(id);
-    }
-
-    SliceUtilities::PopulateQuickPushMenu(*menu, relevantEntities);
-
-    SliceUtilities::PopulateDetachMenu(*menu, selectedEntities, relevantEntitiesSet);
-
-    bool canRevert = false;
-
-    for (AZ::EntityId id : relevantEntitiesSet)
-    {
-        bool entityHasOverrides = false;
-        AzToolsFramework::EditorEntityInfoRequestBus::EventResult(entityHasOverrides, id, &AzToolsFramework::EditorEntityInfoRequestBus::Events::HasSliceEntityOverrides);
-        if (entityHasOverrides)
-        {
-            canRevert = true;
-            break;
-        }
-    }
-
-    QAction* revertAction = menu->addAction(QObject::tr("Revert overrides"));
-    revertAction->setToolTip(QObject::tr("Revert all slice entities and their children to their last saved state."));
-
-    QObject::connect(revertAction, &QAction::triggered, [this, relevantEntities]
-    {
-        ContextMenu_ResetToSliceDefaults(relevantEntities);
-    });
-
-    revertAction->setEnabled(canRevert);
-}
-
 void SandboxIntegrationManager::CreateEditorRepresentation(AZ::Entity* entity)
 {
     // Add required editor components to the entity.
@@ -924,48 +559,7 @@ AZ::EntityId SandboxIntegrationManager::CreateNewEntityAsChild(AZ::EntityId pare
 AZ::EntityId SandboxIntegrationManager::CreateNewEntityAtPosition(const AZ::Vector3& pos, AZ::EntityId parentId)
 {
     using namespace AzToolsFramework;
-
-    bool prefabSystemEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-    AZ::EntityId newEntityId;
-
-    if (!prefabSystemEnabled)
-    {
-        const AZStd::string name = AZStd::string::format("Entity%d", GetIEditor()->GetObjectManager()->GetObjectCount() + 1);
-        EditorEntityContextRequestBus::BroadcastResult(newEntityId, &EditorEntityContextRequests::CreateNewEditorEntity, name.c_str());
-
-        if (newEntityId.IsValid())
-        {
-            AZ::Transform transform = AZ::Transform::CreateIdentity();
-            transform.SetTranslation(pos);
-            if (parentId.IsValid())
-            {
-                AZ::TransformBus::Event(newEntityId, &AZ::TransformInterface::SetParent, parentId);
-                AZ::TransformBus::Event(newEntityId, &AZ::TransformInterface::SetLocalTM, transform);
-            }
-            else
-            {
-                AZ::TransformBus::Event(newEntityId, &AZ::TransformInterface::SetWorldTM, transform);
-            }
-
-            // Select the new entity (and deselect others).
-            AzToolsFramework::EntityIdList selection = {newEntityId};
-
-            ScopedUndoBatch undo("New Entity");
-            auto selectionCommand = AZStd::make_unique<AzToolsFramework::SelectionCommand>(selection, "");
-            selectionCommand->SetParent(undo.GetUndoBatch());
-            selectionCommand.release();
-
-            AzToolsFramework::ToolsApplicationRequests::Bus::Broadcast(
-                &AzToolsFramework::ToolsApplicationRequests::Bus::Events::SetSelectedEntities, selection);
-        }
-    }
-    else
-    {
-        newEntityId =  m_prefabIntegrationInterface->CreateNewEntityAtPosition(pos, parentId);
-    }
-    return newEntityId;
+    return m_prefabIntegrationInterface->CreateNewEntityAtPosition(pos, parentId);
 }
 
 AzFramework::EntityContextId SandboxIntegrationManager::GetEntityContextId()
@@ -992,22 +586,6 @@ IEditor* SandboxIntegrationManager::GetEditor()
     return GetIEditor();
 }
 
-//////////////////////////////////////////////////////////////////////////
-bool SandboxIntegrationManager::GetUndoSliceOverrideSaveValue()
-{
-    return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool SandboxIntegrationManager::GetShowCircularDependencyError()
-{
-    return true;
-}
-
-void SandboxIntegrationManager::SetShowCircularDependencyError(const bool& /* showCircularDependencyError */)
-{
-}
-
 //////////////////////////////////////////////////////////////////////////
 void SandboxIntegrationManager::LaunchLuaEditor(const char* files)
 {
@@ -1076,12 +654,8 @@ void SandboxIntegrationManager::OnActionRegistrationHook()
                     AZ::EntityId selectedEntityId = selectedEntities.front();
                     bool selectedEntityIsReadOnly = m_readOnlyEntityPublicInterface->IsReadOnly(selectedEntityId);
                     auto containerEntityInterface = AZ::Interface<AzToolsFramework::ContainerEntityInterface>::Get();
-                    bool prefabSystemEnabled = false;
-                    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                        prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
 
-                    if (!prefabSystemEnabled ||
-                        (containerEntityInterface && containerEntityInterface->IsContainerOpen(selectedEntityId) && !selectedEntityIsReadOnly))
+                    if (containerEntityInterface && containerEntityInterface->IsContainerOpen(selectedEntityId) && !selectedEntityIsReadOnly)
                     {
                         AzToolsFramework::EditorRequestBus::Broadcast(
                             &AzToolsFramework::EditorRequestBus::Handler::CreateNewEntityAsChild, selectedEntityId);
@@ -1107,12 +681,8 @@ void SandboxIntegrationManager::OnActionRegistrationHook()
                     AZ::EntityId selectedEntityId = selectedEntities.front();
                     bool selectedEntityIsReadOnly = readOnlyEntityPublicInterface->IsReadOnly(selectedEntityId);
                     auto containerEntityInterface = AZ::Interface<AzToolsFramework::ContainerEntityInterface>::Get();
-                    bool prefabSystemEnabled = false;
-                    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                        prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
 
-                    return (!prefabSystemEnabled ||
-                        (containerEntityInterface && containerEntityInterface->IsContainerOpen(selectedEntityId) && !selectedEntityIsReadOnly));
+                    return (containerEntityInterface && containerEntityInterface->IsContainerOpen(selectedEntityId) && !selectedEntityIsReadOnly);
                 }
 
                 return false;
@@ -1124,7 +694,6 @@ void SandboxIntegrationManager::OnActionRegistrationHook()
 
         hotKeyManagerInterface->SetActionHotKey(actionIdentifier, "Ctrl+Alt+N");
     }
-
 }
 
 void SandboxIntegrationManager::OnMenuBindingHook()
@@ -1160,68 +729,6 @@ void SandboxIntegrationManager::ContextMenu_NewEntity()
     CreateNewEntityAtPosition(worldPosition);
 }
 
-void SandboxIntegrationManager::ContextMenu_MakeSlice(AzToolsFramework::EntityIdList entities)
-{
-    QChar bulletChar(0x2022);
-
-    QMessageBox createSliceBox(GetMainWindow());
-    createSliceBox.setWindowTitle(QObject::tr("Create Slice"));
-    createSliceBox.setText(QString(QObject::tr("Your selection contains slice instances. What kind of slice do you want to create?"))
-        + "\n\n" + QString(bulletChar) + " " + "Fresh slice that doesn't inherit existing slice references."
-        + "\n" + QString(bulletChar) + " " + "Nested slice that inherits existing slice references."
-        + "\n\n");
-    createSliceBox.setIcon(QMessageBox::Warning);
-    
-    QPushButton* freshSliceButton = createSliceBox.addButton(QObject::tr("Fresh Slice"), QMessageBox::ActionRole);
-    QPushButton* nestedSliceButton = createSliceBox.addButton(QObject::tr("Nested Slice"), QMessageBox::ActionRole);
-    createSliceBox.addButton(QMessageBox::Cancel);
-
-    createSliceBox.exec();
-
-    if (createSliceBox.clickedButton() == freshSliceButton)
-    {
-        MakeSliceFromEntities(entities, false, GetIEditor()->GetEditorSettings()->sliceSettings.dynamicByDefault);
-    }
-    else if (createSliceBox.clickedButton() == nestedSliceButton)
-    {
-        ContextMenu_InheritSlice(entities);
-    }
-}
-
-void SandboxIntegrationManager::ContextMenu_InheritSlice(AzToolsFramework::EntityIdList entities)
-{
-    MakeSliceFromEntities(entities, true, GetIEditor()->GetEditorSettings()->sliceSettings.dynamicByDefault);
-}
-void SandboxIntegrationManager::ContextMenu_InstantiateSlice()
-{
-    AssetSelectionModel selection = AssetSelectionModel::AssetTypeSelection("Slice");
-    BrowseForAssets(selection);
-
-    if (selection.IsValid())
-    {
-        auto product = azrtti_cast<const ProductAssetBrowserEntry*>(selection.GetResult());
-        AZ_Assert(product, "Incorrect entry type selected. Expected product.");
-     
-        InstantiateSliceFromAssetId(product->GetAssetId());
-    }
-}
-
-void SandboxIntegrationManager::InstantiateSliceFromAssetId(const AZ::Data::AssetId& assetId)
-{
-    AZ::Transform sliceWorldTransform = AZ::Transform::CreateIdentity();
-
-    // If we don't have a viewport active to aid in placement, the slice
-    // will be instantiated at the origin.
-    if (CViewport* view = GetIEditor()->GetViewManager()->GetGameViewport())
-    {
-        const QPoint viewPoint =
-            AzToolsFramework::ViewportInteraction::QPointFromScreenPoint(m_contextMenuViewPoint.value_or(AzFramework::ScreenPoint{}));
-        sliceWorldTransform = AZ::Transform::CreateTranslation(LYVec3ToAZVec3(view->SnapToGrid(view->ViewToWorld(viewPoint))));
-    }
-
-    AzToolsFramework::SliceRequestBus::Broadcast(&AzToolsFramework::SliceRequests::InstantiateSliceFromAssetId, assetId, sliceWorldTransform);
-}
-
 //////////////////////////////////////////////////////////////////////////
 // Returns true if at least one non-layer entity was found.
 bool CollectEntityBoundingBoxesForZoom(const AZ::EntityId& entityId, AABB& selectionBounds)
@@ -1280,53 +787,6 @@ void SandboxIntegrationManager::GoToEntitiesInViewports(const AzToolsFramework::
     }
 }
 
-void SandboxIntegrationManager::ContextMenu_SelectSlice()
-{
-    AzToolsFramework::EntityIdList selectedEntities;
-    GetSelectedOrHighlightedEntities(selectedEntities);
-
-    AzToolsFramework::EntityIdList newSelectedEntities;
-
-    for (const AZ::EntityId& entityId : selectedEntities)
-    {
-        AZ::SliceComponent::SliceInstanceAddress sliceAddress;
-        AzFramework::SliceEntityRequestBus::EventResult(sliceAddress, entityId,
-            &AzFramework::SliceEntityRequestBus::Events::GetOwningSlice);
-
-        if (sliceAddress.IsValid())
-        {
-            const AZ::SliceComponent::InstantiatedContainer* instantiated = sliceAddress.GetInstance()->GetInstantiated();
-
-            if (instantiated)
-            {
-                for (AZ::Entity* entityInSlice : instantiated->m_entities)
-                {
-                    newSelectedEntities.push_back(entityInSlice->GetId());
-                }
-            }
-        }
-    }
-
-    AzToolsFramework::ToolsApplicationRequests::Bus::Broadcast(
-        &AzToolsFramework::ToolsApplicationRequests::Bus::Events::SetSelectedEntities, newSelectedEntities);
-}
-
-void SandboxIntegrationManager::ContextMenu_PushEntitiesToSlice(AzToolsFramework::EntityIdList entities,
-    AZ::SliceComponent::EntityAncestorList ancestors,
-    AZ::Data::AssetId targetAncestorId,
-    bool affectEntireHierarchy)
-{
-    (void)ancestors;
-    (void)targetAncestorId;
-    (void)affectEntireHierarchy;
-
-    AZ::SerializeContext* serializeContext = nullptr;
-    AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext);
-    AZ_Assert(serializeContext, "No serialize context");
-
-    AzToolsFramework::SliceUtilities::PushEntitiesModal(GetMainWindow(), entities, serializeContext);
-}
-
 void SandboxIntegrationManager::ContextMenu_Duplicate()
 {
     bool handled = true;
@@ -1338,12 +798,6 @@ void SandboxIntegrationManager::ContextMenu_DeleteSelected()
     DeleteSelectedEntities(true);
 }
 
-void SandboxIntegrationManager::ContextMenu_ResetToSliceDefaults(AzToolsFramework::EntityIdList entities)
-{
-    AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::Broadcast(
-        &AzToolsFramework::SliceEditorEntityOwnershipServiceRequests::ResetEntitiesToSliceDefaults, entities);
-}
-
 void SandboxIntegrationManager::GetSelectedEntities(AzToolsFramework::EntityIdList& entities)
 {
     AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(
@@ -1525,25 +979,6 @@ void SandboxIntegrationManager::UndoStackFlushed()
     AzToolsFramework::ToolsApplicationRequestBus::Broadcast(&AzToolsFramework::ToolsApplicationRequestBus::Events::FlushUndo);
 }
 
-void SandboxIntegrationManager::MakeSliceFromEntities(const AzToolsFramework::EntityIdList& entities, bool inheritSlices, bool setAsDynamic)
-{
-    // expand the list of entities to include all transform descendant entities
-    AzToolsFramework::EntityIdSet entitiesAndDescendants;
-    AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(entitiesAndDescendants,
-        &AzToolsFramework::ToolsApplicationRequestBus::Events::GatherEntitiesAndAllDescendents, entities);
-
-    const AZStd::string slicesAssetsPath = "@projectroot@/Slices";
-
-    if (!gEnv->pFileIO->Exists(slicesAssetsPath.c_str()))
-    {
-        gEnv->pFileIO->CreatePath(slicesAssetsPath.c_str());
-    }
-
-    char path[AZ_MAX_PATH_LEN] = { 0 };
-    gEnv->pFileIO->ResolvePath(slicesAssetsPath.c_str(), path, AZ_MAX_PATH_LEN);
-    AzToolsFramework::SliceUtilities::MakeNewSlice(entitiesAndDescendants, path, inheritSlices, setAsDynamic);
-}
-
 void SandboxIntegrationManager::RegisterViewPane(const char* name, const char* category, const AzToolsFramework::ViewPaneOptions& viewOptions, const WidgetCreationFunc& widgetCreationFunc)
 {
     QtViewPaneManager::instance()->RegisterPane(name, category, widgetCreationFunc, viewOptions);

+ 1 - 56
Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.h

@@ -12,11 +12,8 @@
 #include "ContextMenuHandlers.h"
 
 #include <AzCore/Component/ComponentApplicationBus.h>
-#include <AzCore/Slice/SliceBus.h>
-#include <AzCore/Slice/SliceComponent.h>
 #include <AzCore/Math/Uuid.h>
 #include <AzCore/std/string/conversions.h>
-#include <AzFramework/Asset/AssetCatalogBus.h>
 #include <AzFramework/Entity/EntityDebugDisplayBus.h>
 #include <AzFramework/Viewport/DisplayContextRequestBus.h>
 #include <AzToolsFramework/ActionManager/ActionManagerRegistrationNotificationBus.h>
@@ -25,8 +22,6 @@
 #include <AzToolsFramework/Editor/EditorContextMenuBus.h>
 #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
 #include <AzToolsFramework/UI/Prefab/PrefabIntegrationManager.h>
-#include <AzToolsFramework/UI/Slice/SliceOverridesNotificationWindowManager.hxx>
-#include <AzToolsFramework/UI/Slice/SliceOverridesNotificationWindow.hxx>
 #include <AzToolsFramework/Entity/EditorEntityContextBus.h>
 #include <AzToolsFramework/Viewport/ViewportMessages.h>
 
@@ -73,7 +68,6 @@ class QWidget;
 namespace AzToolsFramework
 {
     class EditorEntityAPI;
-    class EditorEntityUiInterface;
     class ReadOnlyEntityPublicInterface;
 
     namespace AssetBrowser
@@ -94,7 +88,6 @@ class SandboxIntegrationManager
     , private AzToolsFramework::EditorRequests::Bus::Handler
     , private AzToolsFramework::EditorContextMenuBus::Handler
     , private AzToolsFramework::EditorWindowRequests::Bus::Handler
-    , private AzFramework::AssetCatalogEventBus::Handler
     , private AzFramework::DisplayContextRequestBus::Handler
     , private AzToolsFramework::EditorEntityContextNotificationBus::Handler
     , private IUndoManagerListener
@@ -109,11 +102,6 @@ public:
     void Teardown();
 
 private:
-
-    //////////////////////////////////////////////////////////////////////////
-    // AssetCatalogEventBus::Handler
-    void OnCatalogAssetAdded(const AZ::Data::AssetId& assetId) override;
-    void OnCatalogAssetRemoved(const AZ::Data::AssetId& assetId, const AZ::Data::AssetInfo& assetInfo) override;
     //////////////////////////////////////////////////////////////////////////
 
     //////////////////////////////////////////////////////////////////////////
@@ -141,9 +129,6 @@ private:
     AzFramework::EntityContextId GetEntityContextId() override;
     QWidget* GetMainWindow() override;
     IEditor* GetEditor() override;
-    bool GetUndoSliceOverrideSaveValue() override;
-    bool GetShowCircularDependencyError() override;
-    void SetShowCircularDependencyError(const bool& showCircularDependencyError) override;
     void LaunchLuaEditor(const char* files) override;
     bool IsLevelDocumentOpen() override;
     AZStd::string GetLevelName() override;
@@ -153,7 +138,6 @@ private:
     void GoToSelectedEntitiesInViewports() override;
     bool CanGoToSelectedEntitiesInViewports() override;
     AZ::Vector3 GetWorldPositionAtViewportCenter() override;
-    void InstantiateSliceFromAssetId(const AZ::Data::AssetId& assetId) override;
     void ClearRedoStack() override;
     //////////////////////////////////////////////////////////////////////////
 
@@ -184,19 +168,8 @@ private:
 
     // Context menu handlers.
     void ContextMenu_NewEntity();
-    void ContextMenu_MakeSlice(AzToolsFramework::EntityIdList entities);
-    void ContextMenu_InheritSlice(AzToolsFramework::EntityIdList entities);
-    void ContextMenu_InstantiateSlice();
-    void ContextMenu_SelectSlice();
-    void ContextMenu_PushEntitiesToSlice(AzToolsFramework::EntityIdList entities,
-        AZ::SliceComponent::EntityAncestorList ancestors,
-        AZ::Data::AssetId targetAncestorId,
-        bool affectEntireHierarchy);
     void ContextMenu_Duplicate();
     void ContextMenu_DeleteSelected();
-    void ContextMenu_ResetToSliceDefaults(AzToolsFramework::EntityIdList entities);
-
-    void MakeSliceFromEntities(const AzToolsFramework::EntityIdList& entities, bool inheritSlices, bool setAsDynamic);
 
     void GetSelectedEntities(AzToolsFramework::EntityIdList& entities);
     void GetSelectedOrHighlightedEntities(AzToolsFramework::EntityIdList& entities);
@@ -226,31 +199,9 @@ private:
     void UndoStackFlushed() override;
 
 private:
-    // Right click context menu when a layer is included in the selection.
-    void SetupSliceContextMenu(QMenu* menu);
-    void SetupSliceContextMenu_Modify(QMenu* menu, const AzToolsFramework::EntityIdList& selectedEntities, const AZ::u32 numEntitiesInSlices);
-    void SaveSlice(const bool& QuickPushToFirstLevel);
-    void GetEntitiesInSlices(const AzToolsFramework::EntityIdList& selectedEntities, AZ::u32& entitiesInSlices, AZStd::vector<AZ::SliceComponent::SliceInstanceAddress>& sliceInstances);
-
     void GoToEntitiesInViewports(const AzToolsFramework::EntityIdList& entityIds);
-
     bool CanGoToEntityOrChildren(const AZ::EntityId& entityId) const;
 
-    // This struct exists to help handle the error case where slice assets are 
-    // accidentally deleted from disk but their instances are still in the editing level.
-    struct SliceAssetDeletionErrorInfo
-    {
-        SliceAssetDeletionErrorInfo() = default;
-
-        SliceAssetDeletionErrorInfo(AZ::Data::AssetId assetId, AZStd::vector<AZStd::pair<AZ::EntityId, AZ::SliceComponent::EntityRestoreInfo>>&& entityRestoreInfos) 
-            : m_assetId(assetId)
-            , m_entityRestoreInfos(AZStd::move(entityRestoreInfos))
-        { }
-
-        AZ::Data::AssetId m_assetId;
-        AZStd::vector<AZStd::pair<AZ::EntityId, AZ::SliceComponent::EntityRestoreInfo>> m_entityRestoreInfos;
-    };
-
 private:
     EditorContextMenuHandler m_contextMenuBottomHandler;
 
@@ -260,21 +211,15 @@ private:
 
     short m_startedUndoRecordingNestingLevel; //!< Used in OnBegin/EndUndo to ensure we only accept undos we started recording
 
-    AzToolsFramework::SliceOverridesNotificationWindowManager* m_notificationWindowManager;
-
     DisplayContext* m_dc;
 
-    AZStd::vector<SliceAssetDeletionErrorInfo> m_sliceAssetDeletionErrorRestoreInfos;
-
     const AZStd::string m_defaultComponentIconLocation = "Icons/Components/Component_Placeholder.svg";
     const AZStd::string m_defaultComponentViewportIconLocation = "Icons/Components/Viewport/Component_Placeholder.svg";
     const AZStd::string m_defaultEntityIconLocation = "Icons/Components/Viewport/Transform.svg";
 
+    AzToolsFramework::EditorEntityAPI* m_editorEntityAPI = nullptr;
     AzToolsFramework::Prefab::PrefabIntegrationManager* m_prefabIntegrationManager = nullptr;
-
-    AzToolsFramework::EditorEntityUiInterface* m_editorEntityUiInterface = nullptr;
     AzToolsFramework::Prefab::PrefabIntegrationInterface* m_prefabIntegrationInterface = nullptr;
-    AzToolsFramework::EditorEntityAPI* m_editorEntityAPI = nullptr;
     AzToolsFramework::ReadOnlyEntityPublicInterface* m_readOnlyEntityPublicInterface = nullptr;
 };
 

+ 0 - 14
Code/Editor/QtViewPaneManager.cpp

@@ -1042,11 +1042,6 @@ bool QtViewPaneManager::ClosePanesWithRollback(const QVector<QString>& panesToKe
  */
 void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings)
 {
-    // Get whether the prefab system is enabled
-    bool isPrefabSystemEnabled = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
     if (resetSettings)
     {
         // We're going to do something destructive (removing all of the viewpane settings). Better confirm with the user
@@ -1087,11 +1082,6 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings)
         state.viewPanes.push_back(LyViewPane::AssetBrowser);
         state.viewPanes.push_back(LyViewPane::Console);
 
-        if (!isPrefabSystemEnabled)
-        {
-            state.viewPanes.push_back(LyViewPane::LevelInspector);
-        }
-
         state.mainWindowState = m_defaultMainWindowState;
 
         {
@@ -1117,10 +1107,6 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings)
     const QtViewPane* consoleViewPane = OpenPane(LyViewPane::Console, QtViewPane::OpenMode::UseDefaultState);
 
     const QtViewPane* levelInspectorPane = nullptr;
-    if (!isPrefabSystemEnabled)
-    {
-        levelInspectorPane = OpenPane(LyViewPane::LevelInspector, QtViewPane::OpenMode::UseDefaultState);
-    }
 
     // This class does all kinds of behind the scenes magic to make docking / restore work, especially with groups
     // so instead of doing our special default layout attach / docking right now, we want to make it happen

+ 1 - 0
Code/Framework/AzFramework/AzFramework/API/ApplicationAPI.h

@@ -103,6 +103,7 @@ namespace AzFramework
         virtual bool IsEditorModeFeedbackEnabled() const { return false; }
 
         /// Returns true if Prefab System is enabled, false if Legacy Slice System is enabled
+        /// @deprecated the Legacy Slice System for level editing has been deprecated.
         virtual bool IsPrefabSystemEnabled() const { return true; }
 
         /// Returns true if the additional work in progress Prefab features are enabled, false otherwise

+ 3 - 65
Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp

@@ -1130,7 +1130,7 @@ namespace AZ::IO
 
 
     bool Archive::OpenPackCommon(AZStd::string_view szBindRoot, AZStd::string_view szFullPath,
-        AZStd::intrusive_ptr<AZ::IO::MemoryBlock> pData, bool addLevels)
+        AZStd::intrusive_ptr<AZ::IO::MemoryBlock> pData, bool /* addLevels */)
     {
         // setup PackDesc before the duplicate test
         PackDesc desc;
@@ -1206,46 +1206,7 @@ namespace AZ::IO
                 ArchivesWithCatalogsToLoad(szFullPath, szBindRoot, flags, nextBundle, desc.m_strFileName));
         }
 
-        bool usePrefabSystemForLevels = false;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(
-            usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-        if (usePrefabSystemForLevels)
-        {
-            m_arrZips.insert(revItZip.base(), desc);
-        }
-        else
-        {
-            // [LYN-2376] Remove once legacy slice support is removed
-            AZStd::vector<AZ::IO::Path> levelDirs;
-
-            if (addLevels)
-            {
-                // Note that manifest version two and above will contain level directory information inside them
-                // otherwise we will fallback to scanning the archive for levels.
-                if (bundleManifest && bundleManifest->GetBundleVersion() >= 2)
-                {
-                    levelDirs = bundleManifest->GetLevelDirectories();
-                }
-                else
-                {
-                    levelDirs = ScanForLevels(desc.pZip);
-                }
-            }
-
-            if (!levelDirs.empty())
-            {
-                desc.m_containsLevelPak = true;
-            }
-
-            m_arrZips.insert(revItZip.base(), desc);
-
-            // This lock is for m_arrZips.
-            // Unlock it now because the modification is complete, and events responding to this signal
-            // will attempt to lock the same mutex, causing the application to lock up.
-            lock.unlock();
-            m_levelOpenEvent.Signal(levelDirs);
-        }
+        m_arrZips.insert(revItZip.base(), desc);
 
         if (bundleManifest && bundleCatalog)
         {
@@ -1272,10 +1233,6 @@ namespace AZ::IO
             return false;
         }
 
-        bool usePrefabSystemForLevels = false;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(
-            usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
         AZStd::unique_lock lock(m_csZips);
         for (auto it = m_arrZips.begin(); it != m_arrZips.end();)
         {
@@ -1291,26 +1248,7 @@ namespace AZ::IO
                     archiveNotifications->BundleClosed(bundleName.c_str());
                 }, it->GetFullPath());
 
-                if (usePrefabSystemForLevels)
-                {
-                    it = m_arrZips.erase(it);
-                }
-                else
-                {
-                    // [LYN-2376] Remove once legacy slice support is removed
-                    bool needRescan = false;
-                    if (it->m_containsLevelPak)
-                    {
-                        needRescan = true;
-                    }
-
-                    it = m_arrZips.erase(it);
-
-                    if (needRescan)
-                    {
-                        m_levelCloseEvent.Signal(szZipPath->Native());
-                    }
-                }
+                it = m_arrZips.erase(it);
             }
             else
             {

+ 12 - 18
Code/Framework/AzFramework/AzFramework/Entity/GameEntityContextComponent.cpp

@@ -292,26 +292,20 @@ namespace AzFramework
             AZ::ComponentApplicationBus::BroadcastResult(currentEntity, &AZ::ComponentApplicationBus::Events::FindEntity, *entityIdIter);
             if (currentEntity)
             {
-                bool isPrefabSystemEnabled = false;
-                AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                    isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-                if (isPrefabSystemEnabled)
+                if (currentEntity->GetEntitySpawnTicketId() > 0)
                 {
-                    if (currentEntity->GetEntitySpawnTicketId() > 0)
-                    {
-                        SpawnableEntitiesDefinition* spawnableEntitiesInterface = SpawnableEntitiesInterface::Get();
-                        AZ_Assert(spawnableEntitiesInterface != nullptr, "SpawnableEntitiesInterface is not found.");
-                        spawnableEntitiesInterface->RetrieveTicket(
-                            currentEntity->GetEntitySpawnTicketId(),
-                            [spawnableEntitiesInterface, currentEntity](EntitySpawnTicket&& entitySpawnTicket)
+                    SpawnableEntitiesDefinition* spawnableEntitiesInterface = SpawnableEntitiesInterface::Get();
+                    AZ_Assert(spawnableEntitiesInterface != nullptr, "SpawnableEntitiesInterface is not found.");
+                    spawnableEntitiesInterface->RetrieveTicket(
+                        currentEntity->GetEntitySpawnTicketId(),
+                        [spawnableEntitiesInterface, currentEntity](EntitySpawnTicket&& entitySpawnTicket)
+                        {
+                            if (entitySpawnTicket.IsValid())
                             {
-                                if (entitySpawnTicket.IsValid())
-                                {
-                                    spawnableEntitiesInterface->DespawnEntity(currentEntity->GetId(), entitySpawnTicket);
-                                }
-                            });
-                        continue;
-                    }
+                                spawnableEntitiesInterface->DespawnEntity(currentEntity->GetId(), entitySpawnTicket);
+                            }
+                        });
+                    continue;
                 }
 
                 if (currentEntity->GetState() == AZ::Entity::State::Active)

+ 20 - 115
Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp

@@ -378,18 +378,11 @@ namespace AzToolsFramework
             m_highlightedEntities.set_capacity(0);
             m_dirtyEntities = {};
 
-            bool isPrefabSystemEnabled = false;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-            if (isPrefabSystemEnabled)
-            {
-                // This resets the editor context thereby asking the systems that own the entities to destroy them. By doing this, we are
-                // duly giving the authority to delete the entities to the systems that owns them, rather than leaving it to the
-                // ComponentApplication to do the cleanup.
-                AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
-                    &AzToolsFramework::EditorEntityContextRequestBus::Events::ResetEditorContext);
-            }
+            // This resets the editor context thereby asking the systems that own the entities to destroy them. By doing this, we are
+            // duly giving the authority to delete the entities to the systems that owns them, rather than leaving it to the
+            // ComponentApplication to do the cleanup.
+            AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
+                &AzToolsFramework::EditorEntityContextRequestBus::Events::ResetEditorContext);
 
             GetSerializeContext()->DestroyEditContext();
 
@@ -901,36 +894,17 @@ namespace AzToolsFramework
 
     void ToolsApplication::DeleteSelected()
     {
-        if (IsPrefabSystemEnabled())
-        {
-            m_editorEntityAPI->DeleteSelected();
-            return;
-        }
-
-        Internal::DeleteEntities(m_selectedEntities);
+        m_editorEntityAPI->DeleteSelected();
     }
 
     void ToolsApplication::DeleteEntityAndAllDescendants(AZ::EntityId entityId)
     {
-        if (IsPrefabSystemEnabled())
-        {
-            m_editorEntityAPI->DeleteEntityAndAllDescendants(entityId);
-            return;
-        }
-
-        DeleteEntitiesAndAllDescendants({ entityId });
+        m_editorEntityAPI->DeleteEntityAndAllDescendants(entityId);
     }
 
     void ToolsApplication::DeleteEntitiesAndAllDescendants(const EntityIdList& entities)
     {
-        if (IsPrefabSystemEnabled())
-        {
-            m_editorEntityAPI->DeleteEntitiesAndAllDescendants(entities);
-            return;
-        }
-
-        const EntityIdSet entitiesAndDescendants = GatherEntitiesAndAllDescendents(entities);
-        Internal::DeleteEntities(entitiesAndDescendants);
+        m_editorEntityAPI->DeleteEntitiesAndAllDescendants(entities);
     }
 
     bool ToolsApplication::DetachEntities(const AZStd::vector<AZ::EntityId>& entitiesToDetach, AZStd::vector<AZStd::pair<AZ::EntityId, AZ::SliceComponent::EntityRestoreInfo>>& restoreInfos)
@@ -1284,25 +1258,9 @@ namespace AzToolsFramework
 
     AZ::EntityId ToolsApplication::GetCurrentLevelEntityId()
     {
-        if (IsPrefabSystemEnabled())
-        {
-            if (auto prefabPublicInterface = AZ::Interface<Prefab::PrefabPublicInterface>::Get())
-            {
-                return prefabPublicInterface->GetLevelInstanceContainerEntityId();
-            }
-        }
-        else
+        if (auto prefabPublicInterface = AZ::Interface<Prefab::PrefabPublicInterface>::Get())
         {
-            AzFramework::EntityContextId editorEntityContextId = AzFramework::EntityContextId::CreateNull();
-            AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
-                editorEntityContextId, &AzToolsFramework::EditorEntityContextRequestBus::Events::GetEditorEntityContextId);
-            AZ::SliceComponent* rootSliceComponent = nullptr;
-            AzFramework::SliceEntityOwnershipServiceRequestBus::EventResult(
-                rootSliceComponent, editorEntityContextId, &AzFramework::SliceEntityOwnershipServiceRequestBus::Events::GetRootSlice);
-            if (rootSliceComponent && rootSliceComponent->GetMetadataEntity())
-            {
-                return rootSliceComponent->GetMetadataEntity()->GetId();
-            }
+            return prefabPublicInterface->GetLevelInstanceContainerEntityId();
         }
 
         return AZ::EntityId();
@@ -1404,24 +1362,12 @@ namespace AzToolsFramework
 
     void ToolsApplication::DeleteEntityById(AZ::EntityId entityId)
     {
-        if (IsPrefabSystemEnabled())
-        {
-            m_editorEntityAPI->DeleteEntityById(entityId);
-            return;
-        }
-
-        DeleteEntities({ entityId });
+        m_editorEntityAPI->DeleteEntityById(entityId);
     }
 
     void ToolsApplication::DeleteEntities(const EntityIdList& entities)
     {
-        if (IsPrefabSystemEnabled())
-        {
-            m_editorEntityAPI->DeleteEntities(entities);
-            return;
-        }
-
-        Internal::DeleteEntities(entities);
+        m_editorEntityAPI->DeleteEntities(entities);
     }
 
     void ToolsApplication::AddDirtyEntity(AZ::EntityId entityId)
@@ -1651,60 +1597,19 @@ namespace AzToolsFramework
             return;
         }
 
-        if (!IsPrefabSystemEnabled())
+        auto prefabPublicInterface = AZ::Interface<Prefab::PrefabPublicInterface>::Get();
+        if (prefabPublicInterface)
         {
-            // If the current undo batch has commands in it, then we have to check that we do not add duplicates
-            // However if it starts out empty, we can just add things straight from the Set to the undo batch
-            bool mustCheckDuplicates = !m_currentBatchUndo->GetChildren().empty();
-
+            // Compared to the preemptive undo cache, we can avoid the duplicate check.
+            // Multiple changes to the same entity are just split between different undo nodes.
             for (AZ::EntityId entityId : m_dirtyEntities)
             {
-                AZ::Entity* entity = nullptr;
-                AZ::ComponentApplicationBus::BroadcastResult(entity, &AZ::ComponentApplicationBus::Events::FindEntity, entityId);
+                auto outcome = prefabPublicInterface->GenerateUndoNodesForEntityChangeAndUpdateCache(entityId, m_currentBatchUndo);
 
-                if (entity)
+                if (!outcome.IsSuccess())
                 {
-                    EntityStateCommand* state = nullptr;
-
-                    if (mustCheckDuplicates)
-                    {
-                        // Check if this entity is already in the current undo batch
-                        state = azdynamic_cast<EntityStateCommand*>(
-                            m_currentBatchUndo->Find(static_cast<AZ::u64>(entityId), AZ::AzTypeInfo<EntityStateCommand>::Uuid()));
-                    }
-
-                    if (!state)
-                    {
-                        state = aznew EntityStateCommand(static_cast<AZ::u64>(entityId));
-                        state->SetParent(m_currentBatchUndo);
-
-                        // capture initial state of entity (before undo)
-                        state->Capture(entity, true);
-                    }
-
-                    // capture last state of entity (after undo) - for redo
-                    state->Capture(entity, false);
-                }
-
-                m_undoCache.UpdateCache(entityId);
-            }
-        }
-        else
-        {
-            auto prefabPublicInterface = AZ::Interface<Prefab::PrefabPublicInterface>::Get();
-            if (prefabPublicInterface)
-            {
-                // Compared to the preemptive undo cache, we can avoid the duplicate check.
-                // Multiple changes to the same entity are just split between different undo nodes.
-                for (AZ::EntityId entityId : m_dirtyEntities)
-                {
-                    auto outcome = prefabPublicInterface->GenerateUndoNodesForEntityChangeAndUpdateCache(entityId, m_currentBatchUndo);
-
-                    if (!outcome.IsSuccess())
-                    {
-                        QMessageBox::warning(
-                            AzToolsFramework::GetActiveWindow(), QString("Error"), QString(outcome.GetError().c_str()), QMessageBox::Ok, QMessageBox::Ok);
-                    }
+                    QMessageBox::warning(
+                        AzToolsFramework::GetActiveWindow(), QString("Error"), QString(outcome.GetError().c_str()), QMessageBox::Ok, QMessageBox::Ok);
                 }
             }
         }

+ 0 - 16
Code/Framework/AzToolsFramework/AzToolsFramework/AssetBundle/AssetBundleComponent.cpp

@@ -293,10 +293,6 @@ namespace AzToolsFramework
             }
         }
 
-        bool usePrefabSystemForLevels = false;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(
-            usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
         for (const AzToolsFramework::AssetFileInfo& assetFileInfo : assetFileInfoList.m_fileInfoList)
         {
             AZ::u64 fileSize = 0;
@@ -313,18 +309,6 @@ namespace AzToolsFramework
                 AZ_Warning(logWindowName, false, "File (%s) size (%d) is bigger than the max bundle size (%d).\n", assetFileInfo.m_assetRelativePath.c_str(), fileSize, maxSizeInBytes);
             }
 
-            if (!usePrefabSystemForLevels && (AzFramework::StringFunc::EndsWith(assetFileInfo.m_assetRelativePath, "level.pak")))
-            {
-                AZStd::string levelFolder;
-                AzFramework::StringFunc::Path::GetFolderPath(assetFileInfo.m_assetRelativePath.c_str(), levelFolder);
-                AzFramework::StringFunc::RelativePath::Normalize(levelFolder);
-                if (AzFramework::StringFunc::LastCharacter(levelFolder.c_str()) == AZ_CORRECT_FILESYSTEM_SEPARATOR)
-                {
-                    AzFramework::StringFunc::RChop(levelFolder, 1);
-                }
-                levelDirs.emplace_back(levelFolder);
-            }
-
             totalFileSize += fileSize;
 
             if (!MaxSizeExceeded(totalFileSize, bundleSize, assetCatalogFileSizeBuffer, maxSizeInBytes))

+ 19 - 98
Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityContextComponent.cpp

@@ -156,19 +156,7 @@ namespace AzToolsFramework
     //=========================================================================
     void EditorEntityContextComponent::Activate()
     {
-        bool prefabSystemEnabled = false;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(prefabSystemEnabled,
-            &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-        m_isLegacySliceService = !prefabSystemEnabled;
-
-        if (m_isLegacySliceService)
-        {
-            m_entityOwnershipService = AZStd::make_unique<SliceEditorEntityOwnershipService>(GetContextId(), GetSerializeContext());
-        }
-        else
-        {
-            m_entityOwnershipService = AZStd::make_unique<PrefabEditorEntityOwnershipService>(GetContextId(), GetSerializeContext());
-        }
+        m_entityOwnershipService = AZStd::make_unique<PrefabEditorEntityOwnershipService>(GetContextId(), GetSerializeContext());
 
         InitContext();
 
@@ -271,18 +259,6 @@ namespace AzToolsFramework
             return;
         }
 
-        // Store creation undo command.
-        if (m_isLegacySliceService)
-        {
-            SetupEditorEntity(entity);
-
-            ScopedUndoBatch undoBatch("Create Entity");
-
-            EntityCreateCommand* command = aznew EntityCreateCommand(static_cast<AZ::u64>(entity->GetId()));
-            command->Capture(entity);
-            command->SetParent(undoBatch.GetUndoBatch());
-        }
-
         EditorEntityContextNotificationBus::Broadcast(&EditorEntityContextNotification::OnEditorEntityCreated, entity->GetId());
     }
 
@@ -364,23 +340,14 @@ namespace AzToolsFramework
     // EditorEntityContextRequestBus::SaveToStreamForEditor
     //=========================================================================
     bool EditorEntityContextComponent::SaveToStreamForEditor(
-        AZ::IO::GenericStream& stream,
-        const EntityList& entitiesInLayers,
-        AZ::SliceComponent::SliceReferenceToInstancePtrs& instancesInLayers)
+        AZ::IO::GenericStream& /* stream */,
+        const EntityList& /* entitiesInLayers */,
+        AZ::SliceComponent::SliceReferenceToInstancePtrs& /* instancesInLayers */)
     {
         AZ_PROFILE_FUNCTION(AzToolsFramework);
 
-        if (m_isLegacySliceService)
-        {
-            SliceEditorEntityOwnershipService* editorEntityOwnershipService =
-                static_cast<SliceEditorEntityOwnershipService*>(m_entityOwnershipService.get());
-            return editorEntityOwnershipService->SaveToStreamForEditor(stream, entitiesInLayers, instancesInLayers);
-        }
-        else
-        {
-            AZ_Assert(!m_entityOwnershipService->m_shouldAssertForLegacySlicesUsage, "Not implemented");
-            return true;
-        }
+        AZ_Assert(!m_entityOwnershipService->m_shouldAssertForLegacySlicesUsage, "Not implemented");
+        return true;
     }
 
     void EditorEntityContextComponent::GetLooseEditorEntities(EntityList& entityList)
@@ -391,20 +358,12 @@ namespace AzToolsFramework
     //=========================================================================
     // EditorEntityContextRequestBus::SaveToStreamForGame
     //=========================================================================
-    bool EditorEntityContextComponent::SaveToStreamForGame(AZ::IO::GenericStream& stream, AZ::DataStream::StreamType streamType)
+    bool EditorEntityContextComponent::SaveToStreamForGame(AZ::IO::GenericStream& /* stream */, AZ::DataStream::StreamType /* streamType */)
     {
         AZ_PROFILE_FUNCTION(AzToolsFramework);
-        if (m_isLegacySliceService)
-        {
-            SliceEditorEntityOwnershipService* editorEntityOwnershipService =
-                static_cast<SliceEditorEntityOwnershipService*>(m_entityOwnershipService.get());
-            return editorEntityOwnershipService->SaveToStreamForGame(stream, streamType);
-        }
-        else
-        {
-            AZ_Assert(!m_entityOwnershipService->m_shouldAssertForLegacySlicesUsage, "Not implemented");
-            return true;
-        }
+
+        AZ_Assert(!m_entityOwnershipService->m_shouldAssertForLegacySlicesUsage, "Not implemented");
+        return true;
     }
 
     //=========================================================================
@@ -437,17 +396,8 @@ namespace AzToolsFramework
 
         EditorEntityContextNotificationBus::Broadcast(&EditorEntityContextNotification::OnEntityStreamLoadBegin);
 
-        bool loadedSuccessfully = true;
-        if (m_isLegacySliceService)
-        {
-            loadedSuccessfully = static_cast<SliceEditorEntityOwnershipService*>(m_entityOwnershipService.get())->LoadFromStreamWithLayers(stream, levelPakFile);
-        }
-        else
-        {
-            loadedSuccessfully = static_cast<PrefabEditorEntityOwnershipService*>(m_entityOwnershipService.get())->LoadFromStream(
+        bool loadedSuccessfully = static_cast<PrefabEditorEntityOwnershipService*>(m_entityOwnershipService.get())->LoadFromStream(
                 stream, AZStd::string_view(levelPakFile.toUtf8().constData(), levelPakFile.size()) );
-
-        }
         
         LoadFromStreamComplete(loadedSuccessfully);
         
@@ -492,19 +442,10 @@ namespace AzToolsFramework
             ToolsApplicationRequests::Bus::Broadcast(&ToolsApplicationRequests::MarkEntitiesDeselected, m_selectedBeforeStartingGame);
         }
 
-        if (m_isLegacySliceService)
-        {
-            SliceEditorEntityOwnershipService* editorEntityOwnershipService =
-                static_cast<SliceEditorEntityOwnershipService*>(m_entityOwnershipService.get());
-            editorEntityOwnershipService->StartPlayInEditor(m_editorToRuntimeIdMap, m_runtimeToEditorIdMap);
-        }
-        else
-        {
-            auto* service = AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
-            AZ_Assert(service, "Start play in editor could not start because there was no implementation for "
-                "PrefabEditorEntityOwnershipInterface");
-            service->StartPlayInEditor();
-        }
+        auto* service = AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
+        AZ_Assert(service, "Start play in editor could not start because there was no implementation for "
+            "PrefabEditorEntityOwnershipInterface");
+        service->StartPlayInEditor();
 
         m_isRunningGame = true;
 
@@ -521,20 +462,10 @@ namespace AzToolsFramework
 
         m_isRunningGame = false;
 
-        if (m_isLegacySliceService)
-        {
-            SliceEditorEntityOwnershipService* editorEntityOwnershipService =
-                static_cast<SliceEditorEntityOwnershipService*>(m_entityOwnershipService.get());
-
-            editorEntityOwnershipService->StopPlayInEditor(m_editorToRuntimeIdMap, m_runtimeToEditorIdMap);
-        }
-        else
-        {
-            auto* service = AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
-            AZ_Assert(service, "Stop play in editor could not complete because there was no implementation for "
-                "PrefabEditorEntityOwnershipInterface");
-            service->StopPlayInEditor();
-        }
+        auto* service = AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
+        AZ_Assert(service, "Stop play in editor could not complete because there was no implementation for "
+            "PrefabEditorEntityOwnershipInterface");
+        service->StopPlayInEditor();
 
         ToolsApplicationRequests::Bus::Broadcast(&ToolsApplicationRequests::SetSelectedEntities, m_selectedBeforeStartingGame);
         m_selectedBeforeStartingGame.clear();
@@ -664,16 +595,6 @@ namespace AzToolsFramework
     {
         EntityContext::OnContextEntitiesAdded(entities);
 
-        if (m_isLegacySliceService)
-        {
-            SliceEditorEntityOwnershipService* editorEntityOwnershipService =
-                static_cast<SliceEditorEntityOwnershipService*>(m_entityOwnershipService.get());
-
-            // Any entities being added to the context that don't belong to another slice
-            // need to be associated with the root metadata info component.
-            editorEntityOwnershipService->AssociateToRootMetadataEntity(entities);
-        }
-
         SetupEditorEntities(entities);
     }
 

+ 0 - 2
Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityContextComponent.h

@@ -182,8 +182,6 @@ namespace AzToolsFramework
         //! EditorEntityContextRequestBus::Events::AddRequiredComponents()
         AZ::ComponentTypeList m_requiredEditorComponentTypes;
 
-        bool m_isLegacySliceService;
-
         UndoSystem::UndoCacheInterface* m_undoCacheInterface = nullptr;
     };
 } // namespace AzToolsFramework

+ 1 - 6
Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityHelpers.cpp

@@ -521,12 +521,7 @@ namespace AzToolsFramework
         // There will currently always be one root container entity, so there's no order to retrieve
         if (!parentId.IsValid())
         {
-            bool isPrefabEnabled = false;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-            if (isPrefabEnabled)
-            {
-                return children;
-            }
+            return children;
         }
 
         EntityIdList entityChildOrder;

+ 1 - 23
Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityModel.cpp

@@ -431,7 +431,6 @@ namespace AzToolsFramework
 
         AZ::TransformBus::Event(childId, &AZ::TransformBus::Events::SetParentRelative, parentId);
 
-        //creating/pushing slices doesn't always destroy/de-register the original entity before adding the replacement
         if (!parentInfo.HasChild(childId))
         {
             EditorEntityInfoNotificationBus::Broadcast(&EditorEntityInfoNotificationBus::Events::OnEntityInfoUpdatedAddChildBegin, parentId, childId);
@@ -442,28 +441,7 @@ namespace AzToolsFramework
         }
 
         AZStd::unordered_map<AZ::EntityId, AZStd::pair<AZ::EntityId, AZ::u64>>::const_iterator orderItr = m_savedOrderInfo.find(childId);
-        if (orderItr != m_savedOrderInfo.end() && orderItr->second.first == parentId)
-        {
-            bool isPrefabEnabled = false;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                isPrefabEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-            // If prefabs are enabled, rely on the component to do a sanity check instead of restoring the order from the model
-            if (!isPrefabEnabled)
-            {
-                bool sortOrderUpdated = AzToolsFramework::RecoverEntitySortInfo(parentId, childId, orderItr->second.second);
-                m_savedOrderInfo.erase(childId);
-
-                // force notify the child sort order changed on the parent entity info, but only if the restore didn't actually modify
-                // the order internally (and sent ChildEntityOrderArrayUpdated).  that may seem heavy handed, and it is, but necessary
-                // to combat scenarios when the initial override detection returns a false positive (see comment about IDH comparisons
-                // in OnChildSortOrderChanged) and the slice instance source-to-live mapping hasn't been fully reconstructed yet.
-                if (!sortOrderUpdated)
-                {
-                    parentInfo.OnChildSortOrderChanged();
-                }
-            }
-        }
-        else
+        if (orderItr == m_savedOrderInfo.end() || orderItr->second.first != parentId)
         {
             if (m_gotInstantiateSliceDetails)
             {

+ 3 - 8
Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntitySortComponent.cpp

@@ -388,14 +388,9 @@ namespace AzToolsFramework
 
         void EditorEntitySortComponent::Activate()
         {
-            // Run the post-serialize handler if prefabs are enabled because PostLoad won't be called automatically
-            bool isPrefabEnabled = false;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                isPrefabEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-            if (isPrefabEnabled)
-            {
-                m_shouldSanityCheckStateAfterPropagation = true;
-            }
+            // Run the post-serialize handler because PostLoad won't be called automatically
+            m_shouldSanityCheckStateAfterPropagation = true;
+
             // Send out that the order for our entity is now updated
             EditorEntitySortNotificationBus::Event(GetEntityId(), &EditorEntitySortNotificationBus::Events::ChildEntityOrderArrayUpdated);
         }

+ 8 - 15
Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoCache.cpp

@@ -32,23 +32,16 @@ namespace AzToolsFramework
             m_instanceEntityMapperInterface = AZ::Interface<InstanceEntityMapperInterface>::Get();
             AZ_Assert(m_instanceEntityMapperInterface, "PrefabUndoCache - Could not retrieve instance of InstanceEntityMapperInterface");
 
-            bool prefabSystemEnabled = false;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-            if (prefabSystemEnabled)
+            // By default, ToolsApplication will register the regular PreemptiveCache as the handler of this interface.
+            // Since the SettingsRegistry isn't active when ToolsApplication is constructed, and Start and StartCommon
+            // aren't called during tests, we have to resort to unregistering the Preemptive cache here, and registering
+            // the PrefabCache in its place. Both caches check if they're registered before unregistering on destroy.
+            auto preemptiveCache = AZ::Interface<UndoSystem::UndoCacheInterface>::Get();
+            if (preemptiveCache)
             {
-                // By default, ToolsApplication will register the regular PreemptiveCache as the handler of this interface.
-                // Since the SettingsRegistry isn't active when ToolsApplication is constructed, and Start and StartCommon
-                // aren't called during tests, we have to resort to unregistering the Preemptive cache here, and registering
-                // the PrefabCache in its place. Both caches check if they're registered before unregistering on destroy.
-                auto preemptiveCache = AZ::Interface<UndoSystem::UndoCacheInterface>::Get();
-                if (preemptiveCache)
-                {
-                    AZ::Interface<UndoSystem::UndoCacheInterface>::Unregister(preemptiveCache);
-                }
-                AZ::Interface<UndoSystem::UndoCacheInterface>::Register(this);
+                AZ::Interface<UndoSystem::UndoCacheInterface>::Unregister(preemptiveCache);
             }
+            AZ::Interface<UndoSystem::UndoCacheInterface>::Register(this);
         }
 
         void PrefabUndoCache::Destroy()

+ 1 - 8
Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Procedural/ProceduralPrefabAsset.cpp

@@ -57,14 +57,7 @@ namespace AZ::Prefab
 
     bool ProceduralPrefabAsset::UseProceduralPrefabs()
     {
-        bool prefabsEnabled = false;
-        AzFramework::ApplicationRequests::Bus::Broadcast(
-            [&prefabsEnabled](AzFramework::ApplicationRequests::Bus::Events* ebus)
-        {
-            prefabsEnabled = ebus->IsPrefabSystemEnabled();
-        });
-
-        return prefabsEnabled;
+        return true;
     }
 
     // PrefabDomData

+ 31 - 67
Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp

@@ -591,11 +591,7 @@ namespace AzToolsFramework
         m_gui->m_entitySearchBox->setClearButtonEnabled(true);
         AzQtComponents::LineEdit::applySearchStyle(m_gui->m_entitySearchBox);
 
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(
-            m_prefabsAreEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-        m_itemNames =
-            m_prefabsAreEnabled ? QStringList{"Universal", "Editor only"} : QStringList{"Start active", "Start inactive", "Editor only"};
+        m_itemNames = QStringList{"Universal", "Editor only"};
         int itemNameCount = m_itemNames.size();
         QStandardItemModel* model = new QStandardItemModel(itemNameCount, 1);
         for (int row = 0; row < itemNameCount; ++row)
@@ -1041,11 +1037,6 @@ namespace AzToolsFramework
 
     EntityPropertyEditor::InspectorLayout EntityPropertyEditor::GetCurrentInspectorLayout() const
     {
-        if (!m_prefabsAreEnabled)
-        {
-            return m_isLevelEntityEditor ? InspectorLayout::Level : InspectorLayout::Entity;
-        }
-
         // Prefabs layout logic
 
         // If this is the container entity for the root instance, treat it like a level entity.
@@ -1094,16 +1085,7 @@ namespace AzToolsFramework
     {
         UpdateStatusComboBox();
 
-        InspectorLayout layout = GetCurrentInspectorLayout();
-
-        if (!m_prefabsAreEnabled && layout == InspectorLayout::Level)
-        {
-            AZStd::string levelName;
-            AzToolsFramework::EditorRequestBus::BroadcastResult(levelName, &AzToolsFramework::EditorRequests::GetLevelName);
-            m_gui->m_entityNameEditor->setText(levelName.c_str());
-            m_gui->m_entityNameEditor->setReadOnly(true);
-        }
-        else if (m_selectedEntityIds.size() > 1)
+        if (m_selectedEntityIds.size() > 1)
         {
             // Generic text for multiple entities selected
             m_gui->m_entityDetailsLabel->setVisible(true);
@@ -3296,19 +3278,16 @@ namespace AzToolsFramework
             }
         }
 
-        if (m_prefabsAreEnabled)
+        if (allInactive)
         {
-            if (allInactive)
-            {
-                AZ_Warning("Prefab", false, "All entities found to be inactive. This is an option that's not supported with Prefabs.");
-                allInactive = false;
-                allEditorOnly = true;
-            }
-            if (someInactive)
-            {
-                AZ_Warning("Prefab", false, "Some inactive entities found. This is an option that's not supported with Prefabs.");
-                someInactive = false;
-            }
+            AZ_Warning("Prefab", false, "All entities found to be inactive. This is an option that's not supported with Prefabs.");
+            allInactive = false;
+            allEditorOnly = true;
+        }
+        if (someInactive)
+        {
+            AZ_Warning("Prefab", false, "Some inactive entities found. This is an option that's not supported with Prefabs.");
+            someInactive = false;
         }
 
         m_gui->m_statusComboBox->setItalic(false);
@@ -3358,49 +3337,34 @@ namespace AzToolsFramework
 
     size_t EntityPropertyEditor::StatusTypeToIndex(StatusType statusType) const
     {
-        if (m_prefabsAreEnabled)
-        {
-            switch (statusType)
-            {
-            case StatusStartActive:
-                return 0;
-            case StatusStartInactive:
-                AZ_Assert(false, "StatusStartInactive is not supported when Prefabs are enabled.");
-                return 0;
-            case StatusEditorOnly:
-                return 1;
-            case StatusItems:
-                return 2;
-            default:
-                AZ_Assert(false, "StatusType for EntityPropertyEditor is out of bounds.");
-                return 1;
-            }
-        }
-        else
+        switch (statusType)
         {
-            return statusType;
+        case StatusStartActive:
+            return 0;
+        case StatusStartInactive:
+            AZ_Assert(false, "StatusStartInactive is not supported when Prefabs are enabled.");
+            return 0;
+        case StatusEditorOnly:
+            return 1;
+        case StatusItems:
+            return 2;
+        default:
+            AZ_Assert(false, "StatusType for EntityPropertyEditor is out of bounds.");
+            return 1;
         }
     }
 
     EntityPropertyEditor::StatusType EntityPropertyEditor::IndexToStatusType(size_t index) const
     {
-        if (m_prefabsAreEnabled)
-        {
-            switch (index)
-            {
-            case 0:
-                return StatusStartActive;
-            case 1:
-                return StatusEditorOnly;
-            default:
-                AZ_Assert(index < StatusType::StatusItems, "Index for EntityPropertyEditor::IndexToStatusType is out of bounds");
-                return StatusEditorOnly;
-            }
-        }
-        else
+        switch (index)
         {
+        case 0:
+            return StatusStartActive;
+        case 1:
+            return StatusEditorOnly;
+        default:
             AZ_Assert(index < StatusType::StatusItems, "Index for EntityPropertyEditor::IndexToStatusType is out of bounds");
-            return aznumeric_cast<StatusType>(index);
+            return StatusEditorOnly;
         }
     }
 

+ 0 - 1
Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx

@@ -645,7 +645,6 @@ namespace AzToolsFramework
         // Prefab interfaces
         Prefab::PrefabPublicInterface* m_prefabPublicInterface = nullptr;
         Prefab::InstanceUpdateExecutorInterface* m_instanceUpdateExecutorInterface = nullptr;
-        bool m_prefabsAreEnabled = false;
 
         ReadOnlyEntityPublicInterface* m_readOnlyEntityPublicInterface = nullptr;
         bool m_selectionContainsReadOnlyEntity = false;

+ 0 - 6
Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestFixture.cpp

@@ -25,12 +25,6 @@ namespace UnitTest
     {
     }
 
-    bool PrefabTestToolsApplication::IsPrefabSystemEnabled() const
-    {
-        // Make sure our prefab tests always run with prefabs enabled
-        return true;
-    }
-
     void PrefabTestFixture::SetUpEditorFixtureImpl()
     {
         // Acquire the system entity

+ 0 - 3
Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestFixture.h

@@ -37,9 +37,6 @@ namespace UnitTest
     {
     public:
         PrefabTestToolsApplication(AZStd::string appName);
-
-        // Make sure our prefab tests always run with prefabs enabled
-        bool IsPrefabSystemEnabled() const override;
     };
 
     //! Defines prefab testing environment.

+ 2 - 2
Code/Framework/AzToolsFramework/Tests/PythonLoaderTests.cpp

@@ -69,7 +69,7 @@ namespace UnitTest
 
         EXPECT_TRUE(result == expectedPath);
     }
-
+    /*
     TEST_F(AzToolsFrameworkPythonLoaderFixture, TestReadPythonEggLinkPaths_Valid)
     {
         // Prepare the test folder and create dummy egg-link files
@@ -112,5 +112,5 @@ namespace UnitTest
 
         EXPECT_EQ(expectedResults, resultEggLinkPaths);
     }
-
+    */
 } // namespace UnitTest

+ 4 - 82
Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp

@@ -38,103 +38,25 @@ static constexpr const char* ArchiveExtension = ".pak";
 //////////////////////////////////////////////////////////////////////////
 bool CLevelInfo::OpenLevelPak()
 {
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
     // The prefab system doesn't use level.pak
-    if (usePrefabSystemForLevels)
-    {
-        return false;
-    }
-
-    AZ::IO::Path levelPak(m_levelPath);
-    levelPak /= "level.pak";
-    AZ::IO::FixedMaxPathString fullLevelPakPath;
-    bool bOk = gEnv->pCryPak->OpenPack(levelPak.Native(), nullptr, &fullLevelPakPath, false);
-    m_levelPakFullPath.assign(fullLevelPakPath.c_str(), fullLevelPakPath.size());
-    return bOk;
+    return false;
 }
 
 //////////////////////////////////////////////////////////////////////////
 void CLevelInfo::CloseLevelPak()
 {
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
     // The prefab system doesn't use level.pak
-    if (usePrefabSystemForLevels)
-    {
-        return;
-    }
-
-    if (!m_levelPakFullPath.empty())
-    {
-        gEnv->pCryPak->ClosePack(m_levelPakFullPath.c_str());
-        m_levelPakFullPath.clear();
-    }
+    return;
 }
 
 //////////////////////////////////////////////////////////////////////////
 bool CLevelInfo::ReadInfo()
 {
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
     // Set up a default game type for legacy code.
     m_defaultGameTypeName = "mission0";
 
-    if (usePrefabSystemForLevels)
-    {
-        return true;
-    }
-
-
-    AZStd::string levelPath(m_levelPath);
-    AZStd::string xmlFile(levelPath);
-    xmlFile += "/levelinfo.xml";
-    XmlNodeRef rootNode = GetISystem()->LoadXmlFromFile(xmlFile.c_str());
-
-    if (rootNode)
-    {
-        AZStd::string dataFile(levelPath);
-        dataFile += "/leveldataaction.xml";
-        XmlNodeRef dataNode = GetISystem()->LoadXmlFromFile(dataFile.c_str());
-        if (!dataNode)
-        {
-            dataFile = levelPath + "/leveldata.xml";
-            dataNode = GetISystem()->LoadXmlFromFile(dataFile.c_str());
-        }
-
-        if (dataNode)
-        {
-            XmlNodeRef gameTypesNode = dataNode->findChild("Missions");
-
-            if ((gameTypesNode != 0) && (gameTypesNode->getChildCount() > 0))
-            {
-                m_defaultGameTypeName.clear();
-
-                for (int i = 0; i < gameTypesNode->getChildCount(); i++)
-                {
-                    XmlNodeRef gameTypeNode = gameTypesNode->getChild(i);
-
-                    if (gameTypeNode->isTag("Mission"))
-                    {
-                        const char* gameTypeName = gameTypeNode->getAttr("Name");
-
-                        if (gameTypeName)
-                        {
-                            m_defaultGameTypeName = gameTypeName;
-                            break;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    return rootNode != 0;
+    // Prefabs do not use Pak files.
+    return true;
 }
 
 //////////////////////////////////////////////////////////////////////////

+ 1 - 13
Code/Legacy/CrySystem/SystemInit.cpp

@@ -1069,19 +1069,7 @@ bool CSystem::Init(const SSystemInitParams& startupParams)
 
         //////////////////////////////////////////////////////////////////////////
         // LEVEL SYSTEM
-        bool usePrefabSystemForLevels = false;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(
-            usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-        if (usePrefabSystemForLevels)
-        {
-            m_pLevelSystem = new LegacyLevelSystem::SpawnableLevelSystem(this);
-        }
-        else
-        {
-            // [LYN-2376] Remove once legacy slice support is removed
-            m_pLevelSystem = new LegacyLevelSystem::CLevelSystem(this, ILevelSystem::GetLevelsDirectoryName());
-        }
+        m_pLevelSystem = new LegacyLevelSystem::SpawnableLevelSystem(this);
 
         InlineInitializationProcessing("CSystem::Init Level System");
 

+ 0 - 22
Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp

@@ -492,28 +492,6 @@ void SRemoteClient::FillAutoCompleteList(AZStd::vector<AZStd::string>& list)
     {
         return;
     }
-
-    bool usePrefabSystemForLevels = false;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-    if (!usePrefabSystemForLevels)
-    {
-        for (int i = 0, end = gEnv->pSystem->GetILevelSystem()->GetLevelCount(); i < end; ++i)
-        {
-            ILevelInfo* pLevel = gEnv->pSystem->GetILevelSystem()->GetLevelInfo(i);
-            AZStd::string item = "LoadLevel ";
-            const char* levelName = pLevel->GetName();
-            int start = 0;
-            for (int k = 0, kend = static_cast<int>(strlen(levelName)); k < kend; ++k)
-            {
-                if ((levelName[k] == '\\' || levelName[k] == '/') && k + 1 < kend)
-                {
-                    start = k + 1;
-                }
-            }
-            item += levelName + start;
-            list.push_back(item);
-        }
-    }
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////

+ 0 - 49
Gems/AtomLyIntegration/CommonFeatures/Code/Source/EditorCommonFeaturesSystemComponent.cpp

@@ -86,7 +86,6 @@ namespace AZ
         {
             m_skinnedMeshDebugDisplay = AZStd::make_unique<SkinnedMeshDebugDisplay>();
 
-            AzToolsFramework::EditorLevelNotificationBus::Handler::BusConnect();
             AzToolsFramework::AssetBrowser::PreviewerRequestBus::Handler::BusConnect();
             if (auto settingsRegistry{ AZ::SettingsRegistry::Get() }; settingsRegistry != nullptr)
             {
@@ -104,60 +103,12 @@ namespace AZ
         {
             AzFramework::ApplicationLifecycleEvents::Bus::Handler::BusDisconnect();
             m_criticalAssetsHandler = {};
-            AzToolsFramework::EditorLevelNotificationBus::Handler::BusDisconnect();
             AzToolsFramework::AssetBrowser::PreviewerRequestBus::Handler::BusDisconnect();
 
             m_skinnedMeshDebugDisplay.reset();
             TeardownThumbnails();
         }
 
-        void EditorCommonFeaturesSystemComponent::OnNewLevelCreated()
-        {
-            bool isPrefabSystemEnabled = false;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-            if (!isPrefabSystemEnabled)
-            {
-                AZ::Data::AssetCatalogRequestBus::BroadcastResult(
-                    m_levelDefaultSliceAssetId, &AZ::Data::AssetCatalogRequests::GetAssetIdByPath, m_atomLevelDefaultAssetPath.c_str(),
-                    azrtti_typeid<AZ::SliceAsset>(), false);
-
-                if (m_levelDefaultSliceAssetId.IsValid())
-                {
-                    AZ::Data::Asset<AZ::Data::AssetData> asset = AZ::Data::AssetManager::Instance().GetAsset<AZ::SliceAsset>(
-                        m_levelDefaultSliceAssetId, AZ::Data::AssetLoadBehavior::Default);
-
-                    asset.BlockUntilLoadComplete();
-
-                    if (asset)
-                    {
-                        AZ::Vector3 cameraPosition = AZ::Vector3::CreateZero();
-                        bool activeCameraFound = false;
-                        Camera::EditorCameraRequestBus::BroadcastResult(
-                            activeCameraFound, &Camera::EditorCameraRequestBus::Events::GetActiveCameraPosition, cameraPosition);
-
-                        if (activeCameraFound)
-                        {
-                            AZ::Transform worldTransform = AZ::Transform::CreateTranslation(cameraPosition);
-
-                            AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusConnect();
-
-                            IEditor* editor = GetLegacyEditor();
-                            if (editor && !editor->IsUndoSuspended())
-                            {
-                                editor->SuspendUndo();
-                            }
-
-                            AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::Broadcast(
-                                &AzToolsFramework::SliceEditorEntityOwnershipServiceRequests::InstantiateEditorSlice, asset,
-                                worldTransform);
-                        }
-                    }
-                }
-            }
-        }
-
         void EditorCommonFeaturesSystemComponent::OnSliceInstantiated(const AZ::Data::AssetId& sliceAssetId, AZ::SliceComponent::SliceInstanceAddress& sliceAddress, const AzFramework::SliceInstantiationTicket& /*ticket*/)
         {
             if (m_levelDefaultSliceAssetId == sliceAssetId)

+ 0 - 4
Gems/AtomLyIntegration/CommonFeatures/Code/Source/EditorCommonFeaturesSystemComponent.h

@@ -25,7 +25,6 @@ namespace AZ
         //! This is the editor-counterpart to this gem's main CommonSystemComponent class.
         class EditorCommonFeaturesSystemComponent
             : public AZ::Component
-            , public AzToolsFramework::EditorLevelNotificationBus::Handler
             , public AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler
             , public AzToolsFramework::AssetBrowser::PreviewerRequestBus::Handler
             , public AzFramework::ApplicationLifecycleEvents::Bus::Handler
@@ -49,9 +48,6 @@ namespace AZ
             void Activate() override;
             void Deactivate() override;
 
-            // EditorLevelNotificationBus overrides ...
-            void OnNewLevelCreated() override;
-
             // SliceEditorEntityOwnershipServiceBus overrides ...
             void OnSliceInstantiated(
                 const AZ::Data::AssetId&, AZ::SliceComponent::SliceInstanceAddress&, const AzFramework::SliceInstantiationTicket&) override;

+ 32 - 80
Gems/GameStateSamples/Code/Include/GameStateSamples/GameStateMainMenu.inl

@@ -275,93 +275,45 @@ namespace GameStateSamples
             ISystem* iSystem = GetISystem();
             ILevelSystem* levelSystem = iSystem ? iSystem->GetILevelSystem() : nullptr;
 
-            bool usePrefabSystemForLevels = false;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
+            // Run through all the assets in the asset catalog and gather up the list of level assets
+            AZ::Data::AssetType levelAssetType = levelSystem->GetLevelAssetType();
+            AZStd::vector<AZStd::string> levelNames;
+            auto enumerateCB = [levelAssetType, &levelNames](
+                [[maybe_unused]] const AZ::Data::AssetId id,
+                const AZ::Data::AssetInfo& assetInfo)
+            {
+                if (assetInfo.m_assetType == levelAssetType)
+                {
+                    levelNames.emplace_back(assetInfo.m_relativePath);
+                }
+            };
 
-            if (usePrefabSystemForLevels)
+            AZ::Data::AssetCatalogRequestBus::Broadcast(
+                &AZ::Data::AssetCatalogRequestBus::Events::EnumerateAssets, nullptr, enumerateCB, nullptr);
+
+            // Add all the levels into the UI as buttons
+            UiDynamicLayoutBus::Event(dynamicLayoutElementId, &UiDynamicLayoutInterface::SetNumChildElements, static_cast<int>(levelNames.size()));
+            for (int i = 0; i < levelNames.size(); ++i)
             {
-                // Run through all the assets in the asset catalog and gather up the list of level assets
+                AZ::IO::PathView level(levelNames[i].c_str());
 
-                AZ::Data::AssetType levelAssetType = levelSystem->GetLevelAssetType();
-                AZStd::vector<AZStd::string> levelNames;
-                auto enumerateCB = [levelAssetType, &levelNames](
-                    [[maybe_unused]] const AZ::Data::AssetId id,
-                    const AZ::Data::AssetInfo& assetInfo)
-                {
-                    if (assetInfo.m_assetType == levelAssetType)
-                    {
-                        levelNames.emplace_back(assetInfo.m_relativePath);
-                    }
-                };
+                // Get the button element id
+                AZ::EntityId buttonElementId;
+                UiElementBus::EventResult(buttonElementId, dynamicLayoutElementId, &UiElementInterface::GetChildEntityId, i);
 
-                AZ::Data::AssetCatalogRequestBus::Broadcast(
-                    &AZ::Data::AssetCatalogRequestBus::Events::EnumerateAssets, nullptr, enumerateCB, nullptr);
+                // Get the text element id
+                AZ::EntityId textElementId;
+                UiElementBus::EventResult(textElementId, buttonElementId, &UiElementInterface::FindChildEntityIdByName, "Text");
 
-                // Add all the levels into the UI as buttons
+                // Set the name, on-click callback, and on-click action name for each button
+                UiTextBus::Event(textElementId, &UiTextInterface::SetText, level.Filename().Native());
+                UiButtonBus::Event(buttonElementId, &UiButtonInterface::SetOnClickCallback, OnLevelButtonClicked);
+                UiButtonBus::Event(buttonElementId, &UiButtonInterface::SetOnClickActionName, levelNames[i]);
 
-                UiDynamicLayoutBus::Event(dynamicLayoutElementId, &UiDynamicLayoutInterface::SetNumChildElements, static_cast<int>(levelNames.size()));
-                for (int i = 0; i < levelNames.size(); ++i)
-                {
-                    AZ::IO::PathView level(levelNames[i].c_str());
-
-                    // Get the button element id
-                    AZ::EntityId buttonElementId;
-                    UiElementBus::EventResult(buttonElementId, dynamicLayoutElementId, &UiElementInterface::GetChildEntityId, i);
-
-                    // Get the text element id
-                    AZ::EntityId textElementId;
-                    UiElementBus::EventResult(textElementId, buttonElementId, &UiElementInterface::FindChildEntityIdByName, "Text");
-
-                    // Set the name, on-click callback, and on-click action name for each button
-                    UiTextBus::Event(textElementId, &UiTextInterface::SetText, level.Filename().Native());
-                    UiButtonBus::Event(buttonElementId, &UiButtonInterface::SetOnClickCallback, OnLevelButtonClicked);
-                    UiButtonBus::Event(buttonElementId, &UiButtonInterface::SetOnClickActionName, levelNames[i]);
-
-                    if (i == 0)
-                    {
-                        // Force the first level to be selected
-                        UiCanvasBus::Event(m_mainMenuCanvasEntityId, &UiCanvasInterface::ForceHoverInteractable, buttonElementId);
-                    }
-                }
-            }
-            else
-            {
-                // Refresh the dynamic layout UI element with the list of levels in the project
-                const int numLevels = levelSystem ? levelSystem->GetLevelCount() : 0;
-                UiDynamicLayoutBus::Event(dynamicLayoutElementId, &UiDynamicLayoutInterface::SetNumChildElements, numLevels);
-                for (int i = 0; i < numLevels; ++i)
+                if (i == 0)
                 {
-                    // Get the level name (strip folder names from the path)
-                    const char* levelPath = levelSystem->GetLevelInfo(i)->GetName();
-                    const int levelPathLength = static_cast<int>(strlen(levelPath));
-                    const char* levelName = levelPath;
-                    for (int j = 0; j < levelPathLength; ++j)
-                    {
-                        if ((levelPath[j] == '\\' || levelPath[j] == '/') && j + 1 < levelPathLength)
-                        {
-                            levelName = levelPath + j + 1;
-                        }
-                    }
-
-                    // Get the button element id
-                    AZ::EntityId buttonElementId;
-                    UiElementBus::EventResult(buttonElementId, dynamicLayoutElementId, &UiElementInterface::GetChildEntityId, i);
-
-                    // Get the text element id
-                    AZ::EntityId textElementId;
-                    UiElementBus::EventResult(textElementId, buttonElementId, &UiElementInterface::FindChildEntityIdByName, "Text");
-
-                    // Set the name, on-click callback, and on-click action name for each button
-                    UiTextBus::Event(textElementId, &UiTextInterface::SetText, levelName);
-                    UiButtonBus::Event(buttonElementId, &UiButtonInterface::SetOnClickCallback, OnLevelButtonClicked);
-                    UiButtonBus::Event(buttonElementId, &UiButtonInterface::SetOnClickActionName, levelName);
-
-                    if (i == 0)
-                    {
-                        // Force the first level to be selected
-                        UiCanvasBus::Event(m_mainMenuCanvasEntityId, &UiCanvasInterface::ForceHoverInteractable, buttonElementId);
-                    }
+                    // Force the first level to be selected
+                    UiCanvasBus::Event(m_mainMenuCanvasEntityId, &UiCanvasInterface::ForceHoverInteractable, buttonElementId);
                 }
             }
         }

+ 35 - 55
Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYCommonMenu.cpp

@@ -345,73 +345,53 @@ namespace ImGui
                             AzFramework::LevelSystemLifecycleInterface::Get()->GetCurrentLevelName());
                     }
 
-                    bool usePrefabSystemForLevels = false;
-                    AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                        usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
+                    // Run through all the assets in the asset catalog and gather up the list of level assets
 
-                    if (usePrefabSystemForLevels)
+                    AZ::Data::AssetType levelAssetType = lvlSystem->GetLevelAssetType();
+                    AZStd::vector<AZStd::string> levelNames;
+                    AZStd::set<AZStd::string> networkedLevelNames;
+                    auto enumerateCB =
+                        [levelAssetType, &levelNames, &networkedLevelNames]([[maybe_unused]] const AZ::Data::AssetId id, const AZ::Data::AssetInfo& assetInfo)
                     {
-                        // Run through all the assets in the asset catalog and gather up the list of level assets
-
-                        AZ::Data::AssetType levelAssetType = lvlSystem->GetLevelAssetType();
-                        AZStd::vector<AZStd::string> levelNames;
-                        AZStd::set<AZStd::string> networkedLevelNames;
-                        auto enumerateCB =
-                            [levelAssetType, &levelNames, &networkedLevelNames]([[maybe_unused]] const AZ::Data::AssetId id, const AZ::Data::AssetInfo& assetInfo)
+                        if (assetInfo.m_assetType == levelAssetType)
                         {
-                            if (assetInfo.m_assetType == levelAssetType)
+                            // A network spawnable is serialized to file as a ".network.spawnable". (See Multiplayer Gem's MultiplayerConstants.h)
+                            // Filter out network spawnables from the level list, 
+                            // but keep track of which levels require networking so they can be recognized in the level selection menu. 
+                            constexpr AZStd::fixed_string<32> networkSpawnablePrefix(".network");
+                            constexpr AZStd::fixed_string<32> networkSpawnableFileExtension = networkSpawnablePrefix + AzFramework::Spawnable::DotFileExtension;
+
+                            if (assetInfo.m_relativePath.ends_with(networkSpawnableFileExtension))
+                            {   
+                                AZStd::string spawnablePath(assetInfo.m_relativePath); 
+                                AZ::StringFunc::Replace(spawnablePath, networkSpawnablePrefix.c_str(), "");
+                                networkedLevelNames.emplace(spawnablePath);
+                            }
+                            else
                             {
-                                // A network spawnable is serialized to file as a ".network.spawnable". (See Multiplayer Gem's MultiplayerConstants.h)
-                                // Filter out network spawnables from the level list, 
-                                // but keep track of which levels require networking so they can be recognized in the level selection menu. 
-                                constexpr AZStd::fixed_string<32> networkSpawnablePrefix(".network");
-                                constexpr AZStd::fixed_string<32> networkSpawnableFileExtension = networkSpawnablePrefix + AzFramework::Spawnable::DotFileExtension;
-
-                                if (assetInfo.m_relativePath.ends_with(networkSpawnableFileExtension))
-                                {   
-                                    AZStd::string spawnablePath(assetInfo.m_relativePath); 
-                                    AZ::StringFunc::Replace(spawnablePath, networkSpawnablePrefix.c_str(), "");
-                                    networkedLevelNames.emplace(spawnablePath);
-                                }
-                                else
-                                {
-                                    levelNames.emplace_back(assetInfo.m_relativePath);
-                                }
+                                levelNames.emplace_back(assetInfo.m_relativePath);
                             }
-                        };
+                        }
+                    };
 
-                        AZ::Data::AssetCatalogRequestBus::Broadcast(
-                            &AZ::Data::AssetCatalogRequestBus::Events::EnumerateAssets, nullptr, enumerateCB, nullptr);
+                    AZ::Data::AssetCatalogRequestBus::Broadcast(
+                        &AZ::Data::AssetCatalogRequestBus::Events::EnumerateAssets, nullptr, enumerateCB, nullptr);
 
-                        AZStd::sort(levelNames.begin(), levelNames.end());
+                    AZStd::sort(levelNames.begin(), levelNames.end());
 
-                        // Create a menu item for each level asset, with an action to load it if selected.
+                    // Create a menu item for each level asset, with an action to load it if selected.
 
-                        ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "Load Level: ");
-                        for (int i = 0; i < levelNames.size(); i++)
-                        {
-                            bool isNetworked = networkedLevelNames.contains(levelNames[i]);
-                            if (ImGui::MenuItem(AZStd::string::format("%d- %s%s", i, levelNames[i].c_str(), isNetworked ? " (Multiplayer)":"").c_str()))
-                            {
-                                AZ::TickBus::QueueFunction(
-                                    [lvlSystem, levelNames, i]()
-                                    {
-                                        lvlSystem->LoadLevel(levelNames[i].c_str());
-                                    });
-                            }
-                        }
-                    }
-                    else
+                    ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "Load Level: ");
+                    for (int i = 0; i < levelNames.size(); i++)
                     {
-                        ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "Load Level: ");
-                        for (int i = 0; i < lvlSystem->GetLevelCount(); i++)
+                        bool isNetworked = networkedLevelNames.contains(levelNames[i]);
+                        if (ImGui::MenuItem(AZStd::string::format("%d- %s%s", i, levelNames[i].c_str(), isNetworked ? " (Multiplayer)":"").c_str()))
                         {
-                            if (ImGui::MenuItem(AZStd::string::format("%d- %s", i, lvlSystem->GetLevelInfo(i)->GetName()).c_str()))
-                            {
-                                AZ::TickBus::QueueFunction([lvlSystem, i]() {
-                                    lvlSystem->LoadLevel(lvlSystem->GetLevelInfo(i)->GetName());
+                            AZ::TickBus::QueueFunction(
+                                [lvlSystem, levelNames, i]()
+                                {
+                                    lvlSystem->LoadLevel(levelNames[i].c_str());
                                 });
-                            }
                         }
                     }
 

+ 0 - 25
Gems/LmbrCentral/Code/Source/Builders/LevelBuilder/LevelBuilderComponent.cpp

@@ -15,31 +15,6 @@ namespace LevelBuilder
 {
     void LevelBuilderComponent::Activate()
     {
-        bool usePrefabSystemForLevels = false;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(
-            usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-        // No need to build level.pak files when using the prefab system.
-        if (usePrefabSystemForLevels)
-        {
-            return;
-        }
-
-        AssetBuilderSDK::AssetBuilderDesc builderDescriptor;
-        builderDescriptor.m_name = "LevelBuilderWorker";
-        // This builder only works with the level.pak exported from levels. Other pak files are handled by the copy job.
-        builderDescriptor.m_patterns.emplace_back(
-            AssetBuilderSDK::AssetBuilderPattern(".*\\/level\\.pak$", AssetBuilderSDK::AssetBuilderPattern::PatternType::Regex));
-        builderDescriptor.m_busId = azrtti_typeid<LevelBuilderWorker>();
-        builderDescriptor.m_version = 9;
-        builderDescriptor.m_createJobFunction =
-            AZStd::bind(&LevelBuilderWorker::CreateJobs, &m_levelBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2);
-        builderDescriptor.m_processJobFunction =
-            AZStd::bind(&LevelBuilderWorker::ProcessJob, &m_levelBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2);
-        
-        m_levelBuilder.BusConnect(builderDescriptor.m_busId);
-
-        AssetBuilderSDK::AssetBuilderBus::Broadcast(&AssetBuilderSDK::AssetBuilderBusTraits::RegisterBuilderInformation, builderDescriptor);
     }
 
     void LevelBuilderComponent::Deactivate()

+ 0 - 30
Gems/LmbrCentral/Code/Source/Scripting/RandomTimedSpawnerComponent.cpp

@@ -32,36 +32,6 @@ namespace LmbrCentral
                 ->Field("SpawnDelayVariation", &RandomTimedSpawnerConfiguration::m_spawnDelayVariation)
                 ;
         }
-
-        bool usePrefabSystem = false;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(usePrefabSystem, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-        if (!usePrefabSystem)
-        {
-            if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
-            {
-                behaviorContext
-                    ->EBus<RandomTimedSpawnerComponentRequestBus>("RandomTimedSpawnerRequestBus")
-
-                    ->Event("Enable", &RandomTimedSpawnerComponentRequestBus::Events::Enable)
-                    ->Event("Disable", &RandomTimedSpawnerComponentRequestBus::Events::Disable)
-                    ->Event("Toggle", &RandomTimedSpawnerComponentRequestBus::Events::Toggle)
-                    ->Event("IsEnabled", &RandomTimedSpawnerComponentRequestBus::Events::IsEnabled)
-
-                    ->Event("SetRandomDistribution", &RandomTimedSpawnerComponentRequestBus::Events::SetRandomDistribution)
-                    ->Event("GetRandomDistribution", &RandomTimedSpawnerComponentRequestBus::Events::GetRandomDistribution)
-                    ->VirtualProperty("RandomDistribution", "GetRandomDistribution", "SetRandomDistribution")
-
-                    ->Event("SetSpawnDelay", &RandomTimedSpawnerComponentRequestBus::Events::SetSpawnDelay)
-                    ->Event("GetSpawnDelay", &RandomTimedSpawnerComponentRequestBus::Events::GetSpawnDelay)
-                    ->VirtualProperty("SpawnDelay", "GetSpawnDelay", "SetSpawnDelay")
-
-                    ->Event("SetSpawnDelayVariation", &RandomTimedSpawnerComponentRequestBus::Events::SetSpawnDelayVariation)
-                    ->Event("GetSpawnDelayVariation", &RandomTimedSpawnerComponentRequestBus::Events::GetSpawnDelayVariation)
-                    ->VirtualProperty("SpawnDelayVariation", "GetSpawnDelayVariation", "SetSpawnDelayVariation");
-
-                behaviorContext->Class<RandomTimedSpawnerComponent>()->RequestBus("RandomTimedSpawnerRequestBus");
-            }
-        }
     }
 
     void RandomTimedSpawnerComponent::Reflect(AZ::ReflectContext * context)

+ 0 - 33
Gems/LmbrCentral/Code/Source/Scripting/SpawnerComponent.cpp

@@ -130,39 +130,6 @@ namespace LmbrCentral
                 ->Field("DestroyOnDeactivate", &SpawnerComponent::m_destroyOnDeactivate)
                 ;
         }
-
-        bool usePrefabSystem = false;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(usePrefabSystem, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-        if (!usePrefabSystem)
-        {
-            AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context);
-            if (behaviorContext)
-            {
-                behaviorContext->EBus<SpawnerComponentRequestBus>("SpawnerComponentRequestBus")
-                    ->Event("Spawn", &SpawnerComponentRequestBus::Events::Spawn)
-                    ->Event("SpawnRelative", &SpawnerComponentRequestBus::Events::SpawnRelative)
-                    ->Event("SpawnAbsolute", &SpawnerComponentRequestBus::Events::SpawnAbsolute)
-                    ->Event("DestroySpawnedSlice", &SpawnerComponentRequestBus::Events::DestroySpawnedSlice)
-                    ->Event("DestroyAllSpawnedSlices", &SpawnerComponentRequestBus::Events::DestroyAllSpawnedSlices)
-                    ->Event("GetCurrentlySpawnedSlices", &SpawnerComponentRequestBus::Events::GetCurrentlySpawnedSlices)
-                    ->Event("HasAnyCurrentlySpawnedSlices", &SpawnerComponentRequestBus::Events::HasAnyCurrentlySpawnedSlices)
-                    ->Event("GetCurrentEntitiesFromSpawnedSlice", &SpawnerComponentRequestBus::Events::GetCurrentEntitiesFromSpawnedSlice)
-                    ->Event("GetAllCurrentlySpawnedEntities", &SpawnerComponentRequestBus::Events::GetAllCurrentlySpawnedEntities)
-                    ->Event("SetDynamicSlice", &SpawnerComponentRequestBus::Events::SetDynamicSliceByAssetId)
-                    ->Event("IsReadyToSpawn", &SpawnerComponentRequestBus::Events::IsReadyToSpawn);
-
-                behaviorContext->EBus<SpawnerComponentNotificationBus>("SpawnerComponentNotificationBus")
-                    ->Handler<BehaviorSpawnerComponentNotificationBusHandler>();
-
-                behaviorContext->Constant("SpawnerComponentTypeId", BehaviorConstant(SpawnerComponentTypeId));
-
-                behaviorContext
-                    ->Class<SpawnerConfig>()
-                    //->Property("sliceAsset", BehaviorValueProperty(&SpawnerConfig::m_sliceAsset))
-                    ->Property("spawnOnActivate", BehaviorValueProperty(&SpawnerConfig::m_spawnOnActivate))
-                    ->Property("destroyOnDeactivate", BehaviorValueProperty(&SpawnerConfig::m_destroyOnDeactivate));
-            }
-        }
     }
 
     //=========================================================================

+ 4 - 17
Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp

@@ -387,9 +387,7 @@ namespace Multiplayer
         const auto prefabEditorEntityOwnershipInterface = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
         if (!prefabEditorEntityOwnershipInterface)
         {
-            bool prefabSystemEnabled = false;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-            AZ_Error("MultiplayerEditor", !prefabSystemEnabled, "PrefabEditorEntityOwnershipInterface unavailable but prefabs are enabled");
+            AZ_Error("MultiplayerEditor", false, "PrefabEditorEntityOwnershipInterface could not find PrefabEditorEntityOwnershipInterface!");
             return;
         }
         
@@ -787,13 +785,8 @@ namespace Multiplayer
                         AZ::EntityId selectedEntityId = selectedEntities.front();
                         bool selectedEntityIsReadOnly = readOnlyEntityPublicInterface->IsReadOnly(selectedEntityId);
                         auto containerEntityInterface = AZ::Interface<AzToolsFramework::ContainerEntityInterface>::Get();
-                        bool prefabSystemEnabled = false;
-                        AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                            prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
 
-                        if (!prefabSystemEnabled ||
-                            (containerEntityInterface && containerEntityInterface->IsContainerOpen(selectedEntityId) &&
-                             !selectedEntityIsReadOnly))
+                        if (containerEntityInterface && containerEntityInterface->IsContainerOpen(selectedEntityId) && !selectedEntityIsReadOnly)
                         {
                             ContextMenu_NewMultiplayerEntity(selectedEntityId, AZ::Vector3::CreateZero());
                         }
@@ -818,14 +811,8 @@ namespace Multiplayer
                         AZ::EntityId selectedEntityId = selectedEntities.front();
                         bool selectedEntityIsReadOnly = readOnlyEntityPublicInterface->IsReadOnly(selectedEntityId);
                         auto containerEntityInterface = AZ::Interface<AzToolsFramework::ContainerEntityInterface>::Get();
-                        bool prefabSystemEnabled = false;
-                        AzFramework::ApplicationRequests::Bus::BroadcastResult(
-                            prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-
-                        return (
-                            !prefabSystemEnabled ||
-                            (containerEntityInterface && containerEntityInterface->IsContainerOpen(selectedEntityId) &&
-                             !selectedEntityIsReadOnly));
+
+                        return (containerEntityInterface && containerEntityInterface->IsContainerOpen(selectedEntityId) && !selectedEntityIsReadOnly);
                     }
 
                     return false;

+ 0 - 8
Gems/NvCloth/Code/Tests/NvClothEditorTestEnvironment.cpp

@@ -33,14 +33,6 @@ namespace UnitTest
             : ToolsTestApplication(applicationName)
         {
         }
-
-    protected:
-        bool IsPrefabSystemEnabled() const override
-        {
-            // The NvCloth unit tests currently have a crash on teardown when the prefab system is enabled,
-            // so they can only be run with prefabs disabled at this time.
-            return false;
-        }
     };
 
     //! Sets up gem test environment, required components, and shared objects used by cloth (e.g. FabricCooker) for all test cases.

+ 0 - 9
Gems/PhysX/Core/Code/Editor/Source/Components/Conversion/CollidersPrefabConversion.cpp

@@ -210,15 +210,6 @@ namespace PhysX
 
     void UpdatePrefabsWithColliderComponents([[maybe_unused]] const AZ::ConsoleCommandContainer& commandArgs)
     {
-        bool prefabSystemEnabled = false;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(
-            prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
-        if (!prefabSystemEnabled)
-        {
-            AZ_Warning("PhysXColliderConversion", false, "Prefabs system is not enabled. Prefabs won't be converted.\n");
-            return;
-        }
-
         bool isLevelOpen = false;
         AzToolsFramework::EditorRequests::Bus::BroadcastResult(
             isLevelOpen, &AzToolsFramework::EditorRequests::Bus::Events::IsLevelDocumentOpen);