Kaynağa Gözat

feat: remove legacy cry object (#17978)

Signed-off-by: Michael Pollind <[email protected]>
Michael Pollind 1 yıl önce
ebeveyn
işleme
acbd298466
58 değiştirilmiş dosya ile 20 ekleme ve 6626 silme
  1. 0 2
      Code/Editor/AnimationContext.cpp
  2. 9 10
      Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp
  3. 0 1
      Code/Editor/CryEdit.cpp
  4. 1 4
      Code/Editor/CryEditDoc.cpp
  5. 0 2
      Code/Editor/EditorToolsApplication.cpp
  6. 0 3
      Code/Editor/EditorViewportWidget.cpp
  7. 0 1
      Code/Editor/EditorViewportWidget.h
  8. 0 14
      Code/Editor/ErrorReport.cpp
  9. 0 16
      Code/Editor/ErrorReport.h
  10. 2 23
      Code/Editor/ErrorReportDialog.cpp
  11. 0 3
      Code/Editor/ErrorReportDialog.h
  12. 2 5
      Code/Editor/ErrorReportTableModel.cpp
  13. 0 1
      Code/Editor/GameEngine.cpp
  14. 0 16
      Code/Editor/GameResourcesExporter.cpp
  15. 0 1
      Code/Editor/GameResourcesExporter.h
  16. 0 9
      Code/Editor/IEditor.h
  17. 1 52
      Code/Editor/IEditorImpl.cpp
  18. 0 10
      Code/Editor/IEditorImpl.h
  19. 0 4
      Code/Editor/Include/HitContext.h
  20. 0 1
      Code/Editor/Include/IDisplayViewport.h
  21. 0 4
      Code/Editor/Include/IErrorReport.h
  22. 0 103
      Code/Editor/Include/IObjectManager.h
  23. 0 5
      Code/Editor/Lib/Tests/IEditorMock.h
  24. 0 1
      Code/Editor/MainWindow.cpp
  25. 0 1961
      Code/Editor/Objects/BaseObject.cpp
  26. 0 648
      Code/Editor/Objects/BaseObject.h
  27. 0 67
      Code/Editor/Objects/ClassDesc.h
  28. 0 1710
      Code/Editor/Objects/EntityObject.cpp
  29. 0 390
      Code/Editor/Objects/EntityObject.h
  30. 0 276
      Code/Editor/Objects/ObjectLoader.cpp
  31. 0 106
      Code/Editor/Objects/ObjectLoader.h
  32. 0 782
      Code/Editor/Objects/ObjectManager.cpp
  33. 0 180
      Code/Editor/Objects/ObjectManager.h
  34. 0 95
      Code/Editor/Objects/ObjectManagerLegacyUndo.cpp
  35. 0 59
      Code/Editor/Objects/ObjectManagerLegacyUndo.h
  36. 0 8
      Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp
  37. 0 1
      Code/Editor/PythonEditorFuncs.cpp
  38. 0 1
      Code/Editor/TrackView/TrackViewAnimNode.cpp
  39. 0 1
      Code/Editor/TrackView/TrackViewAnimNode.h
  40. 1 2
      Code/Editor/TrackView/TrackViewKeyPropertiesDlg.h
  41. 1 2
      Code/Editor/TrackView/TrackViewNodes.cpp
  42. 0 1
      Code/Editor/TrackView/TrackViewSequence.cpp
  43. 0 2
      Code/Editor/TrackView/TrackViewSequenceManager.cpp
  44. 0 3
      Code/Editor/Undo/Undo.cpp
  45. 1 2
      Code/Editor/Util/FileUtil.cpp
  46. 0 3
      Code/Editor/Viewport.cpp
  47. 1 5
      Code/Editor/Viewport.h
  48. 0 1
      Code/Editor/ViewportTitleDlg.cpp
  49. 0 12
      Code/Editor/editor_lib_files.cmake
  50. 0 2
      Code/Framework/AzToolsFramework/AzToolsFramework/API/ComponentEntityObjectBus.h
  51. 0 2
      Gems/LyShine/Code/Editor/Animation/AnimationContext.cpp
  52. 0 2
      Gems/LyShine/Code/Editor/Animation/UiAVSequenceProps.cpp
  53. 1 1
      Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp
  54. 0 1
      Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h
  55. 0 2
      Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp
  56. 0 1
      Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp
  57. 0 5
      Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp
  58. 0 1
      Gems/Maestro/Code/Source/Components/EditorSequenceComponent.cpp

+ 0 - 2
Code/Editor/AnimationContext.cpp

@@ -17,8 +17,6 @@
 // Editor
 #include "TrackView/TrackViewDialog.h"
 #include "ViewManager.h"
-#include "Include/IObjectManager.h"
-#include "Objects/EntityObject.h"
 
 #include <AzCore/Time/ITime.h>
 

+ 9 - 10
Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp

@@ -53,7 +53,6 @@
 
 // Editor
 #include "IEditor.h"
-#include "Include/IObjectManager.h"
 #include "CryEditDoc.h"
 #include "QtViewPaneManager.h"
 
@@ -122,7 +121,7 @@ namespace AzAssetBrowserRequestHandlerPrivate
 
         if (!parentSource)
         {
-            return nullptr; 
+            return nullptr;
         }
         AZ::IO::Path parentName = parentSource->GetName();
         AZ::IO::PathView parentNameWithoutExtension = parentName.Stem();
@@ -184,7 +183,7 @@ namespace AzAssetBrowserRequestHandlerPrivate
                 // here so as to eliminate ties.
                 return a->GetName() < b->GetName();
             });
-        
+
         // since the valid entries are already sorted, just return the first one.
         return validEntries[0];
     }
@@ -294,7 +293,7 @@ namespace AzAssetBrowserRequestHandlerPrivate
                 EntityCompositionRequests::AddComponentsOutcome addComponentsOutcome = AZ::Failure(AZStd::string());
                 EntityCompositionRequestBus::BroadcastResult(
                     addComponentsOutcome, &EntityCompositionRequests::AddComponentsToEntities, entityIds, componentsToAdd);
-                    
+
                 if (!addComponentsOutcome.IsSuccess())
                 {
                     AZ_Error(
@@ -397,7 +396,7 @@ void AzAssetBrowserRequestHandler::CreateSortAction(
         }
     }
 }
-    
+
 
 void AzAssetBrowserRequestHandler::AddSortMenu(
     QMenu* menu,
@@ -420,13 +419,13 @@ void AzAssetBrowserRequestHandler::AddSortMenu(
     }
 
     QMenu* sortMenu = menu->addMenu(QObject::tr("Sort by"));
-    
+
     CreateSortAction(
         sortMenu,
         thumbnailView,
         treeView,
         QObject::tr("Name"), AssetBrowserEntry::AssetEntrySortMode::Name);
-    
+
     CreateSortAction(
         sortMenu,
         thumbnailView,
@@ -654,7 +653,7 @@ void AzAssetBrowserRequestHandler::AddContextMenuActions(QWidget* caller, QMenu*
                 [fullFilePath, thumbnailView, tableView]()
                 {
                     AzAssetBrowserWindow* newAssetBrowser = AzAssetBrowserMultiWindow::OpenNewAssetBrowserWindow();
-                    
+
                     if (thumbnailView)
                     {
                         newAssetBrowser->SetCurrentMode(AssetBrowserMode::ThumbnailView);
@@ -1059,7 +1058,7 @@ void AzAssetBrowserRequestHandler::Drop(QDropEvent* event, AzQtComponents::DragA
     {
         return;
     }
-    
+
     event->setDropAction(Qt::CopyAction);
     event->setAccepted(true);
 
@@ -1108,7 +1107,7 @@ void AzAssetBrowserRequestHandler::AddSourceFileOpeners(
                 // it is not the generic asset handler.
                 continue;
             }
-            
+
             // yes, it is the generic asset handler, so install an opener that sends it to the Asset Editor.
 
             AZ::Data::AssetId assetId = productEntry->GetAssetId();

+ 0 - 1
Code/Editor/CryEdit.cpp

@@ -105,7 +105,6 @@ AZ_POP_DISABLE_WARNING
 
 #include "StartupTraceHandler.h"
 #include "ToolsConfigPage.h"
-#include "Include/IObjectManager.h"
 #include "WaitProgress.h"
 
 #include "ToolBox.h"

+ 1 - 4
Code/Editor/CryEditDoc.cpp

@@ -36,13 +36,13 @@
 #include "Settings.h"
 
 #include "PluginManager.h"
+#include "Util/Variable.h"
 #include "ViewManager.h"
 #include "DisplaySettings.h"
 #include "GameEngine.h"
 
 #include "CryEdit.h"
 #include "Util/PakFile.h"
-#include "Include/IObjectManager.h"
 #include "ErrorReportDialog.h"
 #include "Util/AutoLogTime.h"
 #include "CheckOutDialog.h"
@@ -219,9 +219,6 @@ void CCryEditDoc::DeleteContents()
 
     GetIEditor()->ResetViews();
 
-    // Delete all objects from Object Manager.
-    GetIEditor()->GetObjectManager()->DeleteAllObjects();
-
     // Load scripts data
     SetModifiedFlag(false);
     SetModifiedModules(eModifiedNothing);

+ 0 - 2
Code/Editor/EditorToolsApplication.cpp

@@ -26,8 +26,6 @@
 #include "GameEngine.h"
 #include "PythonEditorFuncs.h"
 #include "TrackView/TrackViewPythonFuncs.h"
-#include "Include/IObjectManager.h"
-#include "Objects/ObjectManager.h"
 
 namespace EditorInternal
 {

+ 0 - 3
Code/Editor/EditorViewportWidget.cpp

@@ -67,11 +67,8 @@
 #include "EditorViewportSettings.h"
 #include "GameEngine.h"
 #include "Include/IDisplayViewport.h"
-#include "Include/IObjectManager.h"
 #include "LayoutWnd.h"
 #include "MainWindow.h"
-#include "Objects/EntityObject.h"
-#include "Objects/ObjectManager.h"
 #include "ProcessInfo.h"
 #include "Util/fastlib.h"
 #include "ViewManager.h"

+ 0 - 1
Code/Editor/EditorViewportWidget.h

@@ -37,7 +37,6 @@
 #endif
 
 // forward declarations.
-class CBaseObject;
 class QMenu;
 class QKeyEvent;
 struct ray_hit;

+ 0 - 14
Code/Editor/ErrorReport.cpp

@@ -67,10 +67,6 @@ QString CErrorRecord::GetErrorText() const
     {
         str += QString("\t ");
     }
-    if (pObject)
-    {
-        str += QString("\t Object=\"") + pObject->GetName() + "\"";
-    }
     return str;
 }
 
@@ -82,7 +78,6 @@ CErrorReport::CErrorReport()
     m_errors.reserve(100);
     m_bImmediateMode = true;
     m_bShowErrors = true;
-    m_pObject = nullptr;
     m_pParticle = nullptr;
 }
 
@@ -117,10 +112,6 @@ void CErrorReport::ReportError(CErrorRecord& err)
     }
     else
     {
-        if (err.pObject == nullptr && m_pObject != nullptr)
-        {
-            err.pObject = m_pObject;
-        }
         m_errors.push_back(err);
     }
     bNoRecurse = false;
@@ -226,11 +217,6 @@ void CErrorReport::SetImmediateMode(bool bEnable)
     }
 }
 
-//////////////////////////////////////////////////////////////////////////
-void CErrorReport::SetCurrentValidatorObject(CBaseObject* pObject)
-{
-    m_pObject = pObject;
-}
 
 //////////////////////////////////////////////////////////////////////////
 void CErrorReport::SetCurrentFile(const QString& file)

+ 0 - 16
Code/Editor/ErrorReport.h

@@ -17,7 +17,6 @@
 // forward declarations.
 class CParticleItem;
 
-#include "Objects/BaseObject.h"
 #include "Include/EditorCoreAPI.h"
 #include "Include/IErrorReport.h"
 #include "ErrorRecorder.h"
@@ -55,25 +54,13 @@ public:
     QString assetScope;
     int count;
     //! Object that caused this error.
-    _smart_ptr<CBaseObject> pObject;
     int flags;
 
-    CErrorRecord(CBaseObject* object, ESeverity _severity, const QString& _error, int _flags = 0, int _count = 0,
-        EValidatorModule _module = VALIDATOR_MODULE_EDITOR)
-        : severity(_severity)
-        , module(_module)
-        , pObject(object)
-        , flags(_flags)
-        , count(_count)
-        , error(_error)
-    {
-    }
 
     CErrorRecord()
     {
         severity = ESEVERITY_WARNING;
         module = VALIDATOR_MODULE_EDITOR;
-        pObject = 0;
         flags = 0;
         count = 0;
     }
@@ -110,8 +97,6 @@ public:
     //! Display dialog with all errors.
     void Display();
 
-    //! Assign current Object to which new reported warnings are assigned.
-    void SetCurrentValidatorObject(CBaseObject* pObject);
     //! Assign current filename.
     void SetCurrentFile(const QString& file);
 
@@ -120,7 +105,6 @@ private:
     std::vector<CErrorRecord> m_errors;
     bool m_bImmediateMode;
     bool m_bShowErrors;
-    _smart_ptr<CBaseObject> m_pObject;
     CParticleItem* m_pParticle;
     QString m_currentFilename;
 };

+ 2 - 23
Code/Editor/ErrorReportDialog.cpp

@@ -358,10 +358,6 @@ void CErrorReportDialog::CopyToClipboard()
         if (pRecord)
         {
             str += pRecord->GetErrorText();
-            if (pRecord->pObject)
-            {
-                str += QString::fromLatin1(" [Object: %1]").arg(pRecord->pObject->GetName());
-            }
             str += QString::fromLatin1("\r\n");
         }
     }
@@ -494,19 +490,8 @@ void CErrorReportDialog::keyPressEvent(QKeyEvent* event)
 //////////////////////////////////////////////////////////////////////////
 void CErrorReportDialog::OnReportItemDblClick(const QModelIndex& index)
 {
-    bool bDone = false;
     const CErrorRecord* pError = index.data(Qt::UserRole).value<const CErrorRecord*>();
-    if (pError && pError->pObject != nullptr)
-    {
-        CViewport* vp = GetIEditor()->GetActiveView();
-        if (vp)
-        {
-            vp->CenterOnSelection();
-        }
-        bDone = true;
-    }
-
-    if (!bDone && pError && GetIEditor()->GetActiveView())
+    if (pError && GetIEditor()->GetActiveView())
     {
         float x, y, z;
         if (GetPositionFromString(pError->error, &x, &y, &z))
@@ -536,13 +521,7 @@ void CErrorReportDialog::OnSortIndicatorChanged(int logicalIndex, Qt::SortOrder
 void CErrorReportDialog::OnReportHyperlink(const QModelIndex& index)
 {
     const CErrorRecord* pError = index.data(Qt::UserRole).value<const CErrorRecord*>();
-    bool bDone = false;
-    if (pError && pError->pObject != nullptr)
-    {
-        bDone = true;
-    }
-
-    if (!bDone && pError && GetIEditor()->GetActiveView())
+    if (pError && GetIEditor()->GetActiveView())
     {
         float x, y, z;
         if (GetPositionFromString(pError->error, &x, &y, &z))

+ 0 - 3
Code/Editor/ErrorReportDialog.h

@@ -11,15 +11,12 @@
 #define CRYINCLUDE_EDITOR_ERRORREPORTDIALOG_H
 #pragma once
 
-// CErrorReportDialog dialog
-
 #if !defined(Q_MOC_RUN)
 #include "ErrorReport.h"
 
 namespace Ui {
     class CErrorReportDialog;
 }
-
 class CErrorReportTableModel;
 
 #include <QWidget>

+ 2 - 5
Code/Editor/ErrorReportTableModel.cpp

@@ -9,6 +9,7 @@
 #include "EditorDefs.h"
 
 #include "ErrorReportTableModel.h"
+#include <QIcon>
 
 // Editor
 #include "ErrorReport.h"
@@ -149,11 +150,7 @@ QVariant CErrorReportTableModel::data(const CErrorRecord& record, int column, in
         case ColumnFile:
             return record.file;
         case ColumnObject:
-            if (record.pObject)
-            {
-                return record.pObject->GetName();
-            }
-            else if (!record.error.isEmpty())
+            if (!record.error.isEmpty())
             {
                 float x, y, z;
                 if (GetPositionFromString(record.error, &x, &y, &z))

+ 0 - 1
Code/Editor/GameEngine.cpp

@@ -43,7 +43,6 @@
 #include "ViewManager.h"
 #include "AnimationContext.h"
 #include "MainWindow.h"
-#include "Include/IObjectManager.h"
 
 // Implementation of System Callback structure.
 struct SSystemUserCallback

+ 0 - 16
Code/Editor/GameResourcesExporter.cpp

@@ -17,7 +17,6 @@
 // Editor
 #include "UsedResources.h"
 #include "GameEngine.h"
-#include "Include/IObjectManager.h"
 #include "WaitProgress.h"
 
 
@@ -55,8 +54,6 @@ void CGameResourcesExporter::GatherAllLoadedResources()
             m_files.push_back(filename);
         }
     }
-
-    GetFilesFromObjects();
 }
 
 //////////////////////////////////////////////////////////////////////////
@@ -122,16 +119,3 @@ void CGameResourcesExporter::Save(const QString& outputDirectory)
     CLogFile::WriteLine("===========================================================================");
     m_files.clear();
 }
-
-//////////////////////////////////////////////////////////////////////////
-//
-// Go through all editor objects and gathers files from thier properties.
-//
-//////////////////////////////////////////////////////////////////////////
-void CGameResourcesExporter::GetFilesFromObjects()
-{
-    CUsedResources rs;
-    GetIEditor()->GetObjectManager()->GatherUsedResources(rs);
-
-    AZStd::copy(rs.files.begin(), rs.files.end(), AZStd::back_inserter(m_files));
-}

+ 0 - 1
Code/Editor/GameResourcesExporter.h

@@ -37,7 +37,6 @@ private:
     //////////////////////////////////////////////////////////////////////////
     // Functions that gather files from editor subsystems.
     //////////////////////////////////////////////////////////////////////////
-    void GetFilesFromObjects();
     void GetFilesFromVarBlock(CVarBlock* pVB);
     void GetFilesFromVariable(IVariable* pVar);
 };

+ 0 - 9
Code/Editor/IEditor.h

@@ -31,7 +31,6 @@ struct QtViewPane;
 class QMainWindow;
 struct QMetaObject;
 
-class CBaseObject;
 class CCryEditDoc;
 class CAnimationContext;
 class CTrackViewSequenceManager;
@@ -456,11 +455,6 @@ struct IEditor
     virtual CGameEngine* GetGameEngine() = 0;
     virtual CDisplaySettings* GetDisplaySettings() = 0;
     //! Create new object
-    virtual CBaseObject* NewObject(const char* typeName, const char* fileName = "", const char* name = "", float x = 0.0f, float y = 0.0f, float z = 0.0f, bool modifyDoc = true) = 0;
-    //! Delete object
-    virtual void DeleteObject(CBaseObject* obj) = 0;
-    //! Get access to object manager.
-    virtual struct IObjectManager* GetObjectManager() = 0;
     virtual CSettingsManager* GetSettingsManager() = 0;
     //! Get Music Manager.
     virtual CMusicManager* GetMusicManager() = 0;
@@ -620,9 +614,6 @@ struct IEditor
     virtual void ReloadTemplates() = 0;
     virtual void ShowStatusText(bool bEnable) = 0;
 
-    // Provides a way to extend the context menu of an object. The function gets called every time the menu is opened.
-    typedef AZStd::function<void(QMenu*, const CBaseObject*)> TContextMenuExtensionFunc;
-    virtual void RegisterObjectContextMenuExtension(TContextMenuExtensionFunc func) = 0;
 
     virtual SSystemGlobalEnvironment* GetEnv() = 0;
     virtual IImageUtil* GetImageUtil() = 0;  // Vladimir@conffx

+ 1 - 52
Code/Editor/IEditorImpl.cpp

@@ -40,6 +40,7 @@
 
 // Editor
 #include "CryEdit.h"
+#include "Plugin.h"
 #include "PluginManager.h"
 #include "ViewManager.h"
 #include "DisplaySettings.h"
@@ -50,9 +51,7 @@
 #include "ToolBox.h"
 #include "MainWindow.h"
 #include "Settings.h"
-#include "Include/IObjectManager.h"
 #include "Include/ISourceControl.h"
-#include "Objects/ObjectManager.h"
 
 #include "EditorFileMonitor.h"
 #include "MainStatusBar.h"
@@ -87,7 +86,6 @@ CEditorImpl::CEditorImpl()
     , m_pFileUtil(nullptr)
     , m_pClassFactory(nullptr)
     , m_pCommandManager(nullptr)
-    , m_pObjectManager(nullptr)
     , m_pPluginManager(nullptr)
     , m_pViewManager(nullptr)
     , m_pUndoManager(nullptr)
@@ -136,7 +134,6 @@ CEditorImpl::CEditorImpl()
     m_pDisplaySettings->LoadRegistry();
     m_pPluginManager = new CPluginManager;
 
-    m_pObjectManager = new CObjectManager;
     m_pViewManager = new CViewManager;
     m_pUndoManager = new CUndoManager;
     m_pToolBoxManager = new CToolBoxManager;
@@ -264,7 +261,6 @@ CEditorImpl::~CEditorImpl()
     SAFE_RELEASE(m_pSourceControl);
 
     SAFE_DELETE(m_pViewManager)
-    SAFE_DELETE(m_pObjectManager) // relies on prefab manager
 
     SAFE_DELETE(m_pPluginManager)
     SAFE_DELETE(m_pAnimationContext) // relies on undo manager
@@ -317,7 +313,6 @@ void CEditorImpl::SetGameEngine(CGameEngine* ge)
     InitializeEditorCommonISystem(m_pSystem);
 
     m_templateRegistry.LoadTemplates("Editor");
-    m_pObjectManager->LoadClassTemplates("Editor");
 
     m_pAnimationContext->Init();
 }
@@ -560,39 +555,6 @@ RefCoordSys CEditorImpl::GetReferenceCoordSys()
     return m_refCoordsSys;
 }
 
-CBaseObject* CEditorImpl::NewObject(const char* typeName, const char* fileName, const char* name, float x, float y, float z, bool modifyDoc)
-{
-    CUndo undo("Create new object");
-
-    IEditor* editor = GetIEditor();
-    if (modifyDoc)
-    {
-        editor->SetModifiedFlag();
-        editor->SetModifiedModule(eModifiedBrushes);
-    }
-    CBaseObject* object = editor->GetObjectManager()->NewObject(typeName, nullptr, fileName, name);
-    if (!object)
-    {
-        return nullptr;
-    }
-
-    object->SetPos(Vec3(x, y, z));
-
-    return object;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEditorImpl::DeleteObject(CBaseObject* obj)
-{
-    SetModifiedFlag();
-    GetIEditor()->SetModifiedModule(eModifiedBrushes);
-    GetObjectManager()->DeleteObject(obj);
-}
-
-IObjectManager* CEditorImpl::GetObjectManager()
-{
-    return m_pObjectManager;
-};
 
 CSettingsManager* CEditorImpl::GetSettingsManager()
 {
@@ -1344,19 +1306,6 @@ void CEditorImpl::CmdPy(IConsoleCmdArgs* pArgs)
     }
 }
 
-void CEditorImpl::OnObjectContextMenuOpened(QMenu* pMenu, const CBaseObject* pObject)
-{
-    for (auto it : m_objectContextMenuExtensions)
-    {
-        it(pMenu, pObject);
-    }
-}
-
-void CEditorImpl::RegisterObjectContextMenuExtension(TContextMenuExtensionFunc func)
-{
-    m_objectContextMenuExtensions.push_back(func);
-}
-
 // Vladimir@Conffx
 SSystemGlobalEnvironment* CEditorImpl::GetEnv()
 {

+ 0 - 10
Code/Editor/IEditorImpl.h

@@ -33,7 +33,6 @@ class QMenu;
 #define GET_PLUGIN_ID_FROM_MENU_ID(ID) (((ID) & 0x000000FF))
 #define GET_UI_ELEMENT_ID_FROM_MENU_ID(ID) ((((ID) & 0x0000FF00) >> 8))
 
-class CObjectManager;
 class CUndoManager;
 class CGameEngine;
 class CErrorsDlg;
@@ -127,9 +126,6 @@ public:
     void EnableUpdate(bool enable) override { m_bUpdates = enable; };
     CGameEngine* GetGameEngine() override { return m_pGameEngine; };
     CDisplaySettings* GetDisplaySettings() override { return m_pDisplaySettings; };
-    CBaseObject* NewObject(const char* typeName, const char* fileName = "", const char* name = "", float x = 0.0f, float y = 0.0f, float z = 0.0f, bool modifyDoc = true) override;
-    void DeleteObject(CBaseObject* obj) override;
-    IObjectManager* GetObjectManager() override;
     // This will return a null pointer if CrySystem is not loaded before
     // Global Sandbox Settings are loaded from the registry before CrySystem
     // At that stage GetSettingsManager will return null and xml node in
@@ -253,9 +249,6 @@ public:
     void ReloadTemplates() override;
     void ShowStatusText(bool bEnable) override;
 
-    void OnObjectContextMenuOpened(QMenu* pMenu, const CBaseObject* pObject);
-    void RegisterObjectContextMenuExtension(TContextMenuExtensionFunc func) override;
-
     SSystemGlobalEnvironment* GetEnv() override;
     IImageUtil* GetImageUtil() override;  // Vladimir@conffx
     SEditorSettings* GetEditorSettings() override;
@@ -283,7 +276,6 @@ protected:
     IFileUtil* m_pFileUtil;
     CClassFactory* m_pClassFactory;
     CEditorCommandManager* m_pCommandManager;
-    CObjectManager* m_pObjectManager;
     CPluginManager* m_pPluginManager;
     CViewManager*   m_pViewManager;
     CUndoManager* m_pUndoManager;
@@ -330,8 +322,6 @@ protected:
     bool m_bExiting;
     static void CmdPy(IConsoleCmdArgs* pArgs);
 
-    std::vector<TContextMenuExtensionFunc> m_objectContextMenuExtensions;
-
     Editor::EditorQtApplication* const m_QtApplication = nullptr;
 
     // This has to be absolute for the namespace since there is also a class called AssetDatabase that causes issues in unity builds

+ 0 - 4
Code/Editor/Include/HitContext.h

@@ -14,7 +14,6 @@
 #define CRYINCLUDE_EDITOR_INCLUDE_HITCONTEXT_H
 #pragma once
 
-class CBaseObject;
 struct IDisplayViewport;
 struct AABB;
 
@@ -97,8 +96,6 @@ struct HitContext
     int manipulatorMode;
     //! distance to the object from src.
     float dist;
-    //! object that have been hit.
-    CBaseObject* object;
     //! For linking tool
     const char* name;
     //! true if this hit was from the object icon
@@ -115,7 +112,6 @@ struct HitContext
         raySrc(0, 0, 0);
         rayDir(0, 0, 0);
         dist = 0;
-        object = 0;
         weakHit = false;
         manipulatorMode = 0;
         nSubObjFlags = 0;

+ 0 - 1
Code/Editor/Include/IDisplayViewport.h

@@ -8,7 +8,6 @@
 
 #pragma once
 
-class CBaseObjectsCache;
 class QPoint;
 struct AABB;
 class CViewport;

+ 0 - 4
Code/Editor/Include/IErrorReport.h

@@ -13,7 +13,6 @@
 
 // forward declarations.
 class CParticleItem;
-class CBaseObject;
 class CErrorRecord;
 class QString;
 
@@ -48,9 +47,6 @@ struct IErrorReport
     //! Display dialog with all errors.
     virtual void Display() = 0;
 
-    //! Assign current Object to which new reported warnings are assigned.
-    virtual void SetCurrentValidatorObject(CBaseObject* pObject) = 0;
-
     //! Assign current filename.
     virtual void SetCurrentFile(const QString& file) = 0;
 };

+ 0 - 103
Code/Editor/Include/IObjectManager.h

@@ -1,103 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-#pragma once
-
-#include <AzCore/PlatformIncl.h>
-#include <AzCore/Math/Guid.h>
-#include <CryCommon/platform.h>
-#include <CryCommon/Cry_Geo.h>
-#include <set>
-
-// forward declarations.
-class CEntityObject;
-class CTrackViewAnimNode;
-class CUsedResources;
-class CObjectClassDesc;
-class CObjectArchive;
-class CViewport;
-struct HitContext;
-enum class ImageRotationDegrees;
-class CBaseObject;
-class XmlNodeRef;
-
-#include "ObjectEvent.h"
-
-//////////////////////////////////////////////////////////////////////////
-typedef std::vector<CBaseObject*> CBaseObjectsArray;
-typedef std::pair< bool(CALLBACK*)(CBaseObject const&, void*), void* > BaseObjectFilterFunctor;
-
-//////////////////////////////////////////////////////////////////////////
-//
-// Interface to access editor objects scene graph.
-//
-//////////////////////////////////////////////////////////////////////////
-struct IObjectManager
-{
-public:
-    virtual ~IObjectManager() = default;
-
-    //! This callback will be called on response to object event.
-    struct EventListener
-    {
-        virtual void OnObjectEvent(CBaseObject*, int) = 0;
-    };
-
-    virtual CBaseObject* NewObject(CObjectClassDesc* cls, CBaseObject* prev = 0, const QString& file = "", const char* newObjectName = nullptr) = 0;
-    virtual CBaseObject* NewObject(const QString& typeName, CBaseObject* prev = 0, const QString& file = "", const char* newObjectName = nullptr) = 0;
-    virtual CBaseObject* NewObject(CObjectArchive& archive, CBaseObject* pUndoObject = 0, bool bMakeNewId = false) = 0;
-
-    virtual void DeleteObject(CBaseObject* obj) = 0;
-    virtual void DeleteAllObjects() = 0;
-
-    //! Get number of objects manager by ObjectManager (not contain sub objects of groups).
-    virtual int GetObjectCount() const = 0;
-
-    //! Get array of objects, managed by manager (not contain sub objects of groups).
-    //! @param layer if 0 get objects for all layers, or layer to get objects from.
-    virtual void GetObjects(CBaseObjectsArray& objects) const = 0;
-
-    //! Send event to all objects.
-    //! Will cause OnEvent handler to be called on all objects.
-    virtual void SendEvent(ObjectEvent event) = 0;
-
-    //! Send event to all objects within given bounding box.
-    //! Will cause OnEvent handler to be called on objects within bounding box.
-    virtual void SendEvent(ObjectEvent event, const AABB& bounds) = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    //! Find object by ID.
-    virtual CBaseObject* FindObject(REFGUID guid) const = 0;
-    //////////////////////////////////////////////////////////////////////////
-    //! Find object by name.
-    virtual CBaseObject* FindObject(const QString& sName) const = 0;
-    //////////////////////////////////////////////////////////////////////////
-    //! Find objects of given type.
-    virtual void FindObjectsOfType(const QMetaObject* pClass, std::vector<CBaseObject*>& result) = 0;
-    virtual void FindObjectsOfType(ObjectType type, std::vector<CBaseObject*>& result) = 0;
-    //////////////////////////////////////////////////////////////////////////
-    //! Find objects which intersect with a given AABB.
-    virtual void FindObjectsInAABB(const AABB& aabb, std::vector<CBaseObject*>& result) const = 0;
-
-    //! Generates uniq name base on type name of object.
-    virtual QString GenerateUniqueObjectName(const QString& typeName) = 0;
-    //! Register object name in object manager, needed for generating uniq names.
-    virtual void RegisterObjectName(const QString& name) = 0;
-
-    //! Find object class by name.
-    virtual CObjectClassDesc* FindClass(const QString& className) = 0;
-
-    virtual void ChangeObjectId(REFGUID oldId, REFGUID newId) = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    //! Invalidate visibily settings of objects.
-    virtual void InvalidateVisibleList() = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    // Gathers all resources used by all objects.
-    virtual void GatherUsedResources(CUsedResources& resources) = 0;
-};

+ 0 - 5
Code/Editor/Lib/Tests/IEditorMock.h

@@ -70,10 +70,6 @@ public:
     MOCK_METHOD0(GetProductVersion, SFileVersion());
     MOCK_METHOD0(GetGameEngine , CGameEngine* ());
     MOCK_METHOD0(GetDisplaySettings, CDisplaySettings*());
-    MOCK_METHOD7(NewObject, CBaseObject* (const char*, const char*, const char*, float, float, float, bool));
-    MOCK_METHOD1(DeleteObject, void(CBaseObject* obj));
-    MOCK_METHOD1(CloneObject, CBaseObject* (CBaseObject* ));
-    MOCK_METHOD0(GetObjectManager, struct IObjectManager* ());
     MOCK_METHOD0(GetSettingsManager, CSettingsManager* ());
     MOCK_METHOD0(GetMusicManager, CMusicManager* ());
     MOCK_METHOD2(GetTerrainElevation, float(float , float ));
@@ -154,7 +150,6 @@ public:
     MOCK_CONST_METHOD0(GetEditorConfigPlatform, ESystemConfigPlatform());
     MOCK_METHOD0(ReloadTemplates, void());
     MOCK_METHOD1(ShowStatusText, void(bool ));
-    MOCK_METHOD1(RegisterObjectContextMenuExtension, void(TContextMenuExtensionFunc ));
     MOCK_METHOD0(GetEnv, SSystemGlobalEnvironment* ());
     MOCK_METHOD0(GetImageUtil, IImageUtil* ());
     MOCK_METHOD0(GetEditorSettings, SEditorSettings* ());

+ 0 - 1
Code/Editor/MainWindow.cpp

@@ -79,7 +79,6 @@
 
 #include "QtViewPaneManager.h"
 #include "ViewPane.h"
-#include "Include/IObjectManager.h"
 #include "Include/Command.h"
 #include "Commands/CommandManager.h"
 #include "SettingsManagerDialog.h"

+ 0 - 1961
Code/Editor/Objects/BaseObject.cpp

@@ -1,1961 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-// Description : CBaseObject implementation.
-
-
-#include "EditorDefs.h"
-
-#include "BaseObject.h"
-
-// Azframework
-#include <AzFramework/Terrain/TerrainDataRequestBus.h>      // for AzFramework::Terrain::TerrainDataRequests
-
-// AzToolsFramework
-#include <AzToolsFramework/API/ComponentEntityObjectBus.h>  // for ComponentEntityObjectRequestBus
-
-// Editor
-#include "Settings.h"
-#include "Viewport.h"
-#include "DisplaySettings.h"
-#include "Undo/Undo.h"
-#include "UsedResources.h"
-#include "Objects/ObjectManager.h"
-#include "ViewManager.h"
-#include "IEditorImpl.h"
-#include "GameEngine.h"
-// To use the Andrew's algorithm in order to make convex hull from the points, this header is needed.
-#include "Util/GeometryUtil.h"
-
-extern CObjectManager* g_pObjectManager;
-
-//////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////
-//! Undo object for CBaseObject.
-class CUndoBaseObject
-    : public IUndoObject
-{
-public:
-    CUndoBaseObject(CBaseObject* pObj);
-
-protected:
-    int GetSize() override { return sizeof(*this);   }
-    QString GetObjectName() override;
-
-    void Undo(bool bUndo) override;
-    void Redo() override;
-
-protected:
-    GUID m_guid;
-    XmlNodeRef m_undo;
-    XmlNodeRef m_redo;
-};
-
-//////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////
-//! Undo object for CBaseObject that only stores its transform, color, area
-class CUndoBaseObjectMinimal
-    : public IUndoObject
-{
-public:
-    CUndoBaseObjectMinimal(CBaseObject* obj, int flags);
-
-protected:
-    int GetSize() override { return sizeof(*this); }
-    QString GetObjectName() override;
-
-    void Undo(bool bUndo) override;
-    void Redo() override;
-
-private:
-    struct StateStruct
-    {
-        Vec3 pos;
-        Quat rotate;
-        Vec3 scale;
-        QColor color;
-        float area;
-    };
-
-    void SetTransformsFromState(CBaseObject* pObject, const StateStruct& state, bool bUndo);
-
-    GUID m_guid;
-    StateStruct m_undoState;
-    StateStruct m_redoState;
-};
-
-//////////////////////////////////////////////////////////////////////////
-//! Undo object for attach/detach changes
-class CUndoAttachBaseObject
-    : public IUndoObject
-{
-public:
-    CUndoAttachBaseObject(CBaseObject* pAttachedObject, bool bKeepPos, bool bAttach)
-        : m_attachedObjectGUID(pAttachedObject->GetId())
-        , m_parentObjectGUID(pAttachedObject->GetParent()->GetId())
-        , m_bKeepPos(bKeepPos)
-        , m_bAttach(bAttach) {}
-
-    void Undo([[maybe_unused]] bool bUndo) override
-    {
-        if (m_bAttach)
-        {
-            Detach();
-        }
-        else
-        {
-            Attach();
-        }
-    }
-
-    void Redo() override
-    {
-        if (m_bAttach)
-        {
-            Attach();
-        }
-        else
-        {
-            Detach();
-        }
-    }
-
-private:
-    void Attach()
-    {
-        CObjectManager* pObjectManager = static_cast<CObjectManager*>(GetIEditor()->GetObjectManager());
-        CBaseObject* pObject = pObjectManager->FindObject(m_attachedObjectGUID);
-        CBaseObject* pParentObject = pObjectManager->FindObject(m_parentObjectGUID);
-
-        if (pObject && pParentObject)
-        {
-            pParentObject->AttachChild(pObject, m_bKeepPos);
-        }
-    }
-
-    void Detach()
-    {
-        CObjectManager* pObjectManager = static_cast<CObjectManager*>(GetIEditor()->GetObjectManager());
-        CBaseObject* pObject = pObjectManager->FindObject(m_attachedObjectGUID);
-
-        if (pObject)
-        {
-            pObject->DetachThis(m_bKeepPos);
-        }
-    }
-
-    int GetSize() override { return sizeof(CUndoAttachBaseObject); }
-
-    GUID m_attachedObjectGUID;
-    GUID m_parentObjectGUID;
-    bool m_bKeepPos;
-    bool m_bAttach;
-};
-
-//////////////////////////////////////////////////////////////////////////
-CUndoBaseObject::CUndoBaseObject(CBaseObject* obj)
-{
-    // Stores the current state of this object.
-    assert(obj != 0);
-    m_guid = obj->GetId();
-
-    m_redo = nullptr;
-    m_undo = XmlHelpers::CreateXmlNode("Undo");
-    CObjectArchive ar(GetIEditor()->GetObjectManager(), m_undo, false);
-    ar.bUndo = true;
-    obj->Serialize(ar);
-}
-
-//////////////////////////////////////////////////////////////////////////
-QString CUndoBaseObject::GetObjectName()
-{
-    if (CBaseObject* obj = GetIEditor()->GetObjectManager()->FindObject(m_guid))
-    {
-        return obj->GetName();
-    }
-    return QString();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CUndoBaseObject::Undo(bool bUndo)
-{
-    CBaseObject* pObject = GetIEditor()->GetObjectManager()->FindObject(m_guid);
-    if (!pObject)
-    {
-        return;
-    }
-
-    GetIEditor()->SuspendUndo();
-
-    if (bUndo)
-    {
-        m_redo = XmlHelpers::CreateXmlNode("Redo");
-        // Save current object state.
-        CObjectArchive ar(GetIEditor()->GetObjectManager(), m_redo, false);
-        ar.bUndo = true;
-        pObject->Serialize(ar);
-    }
-
-    // Undo object state.
-    CObjectArchive ar(GetIEditor()->GetObjectManager(), m_undo, true);
-    ar.bUndo = true;
-    pObject->Serialize(ar);
-
-    GetIEditor()->ResumeUndo();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CUndoBaseObject::Redo()
-{
-    CBaseObject* pObject = GetIEditor()->GetObjectManager()->FindObject(m_guid);
-    if (!pObject)
-    {
-        return;
-    }
-
-    GetIEditor()->SuspendUndo();
-
-    CObjectArchive ar(GetIEditor()->GetObjectManager(), m_redo, true);
-    ar.bUndo = true;
-
-    pObject->Serialize(ar);
-
-    GetIEditor()->ResumeUndo();
-}
-
-//////////////////////////////////////////////////////////////////////////
-CUndoBaseObjectMinimal::CUndoBaseObjectMinimal(CBaseObject* pObj, [[maybe_unused]] int flags)
-{
-    // Stores the current state of this object.
-    assert(pObj != nullptr);
-    m_guid = pObj->GetId();
-
-    ZeroStruct(m_redoState);
-
-    m_undoState.pos = pObj->GetPos();
-    m_undoState.rotate = pObj->GetRotation();
-    m_undoState.scale = pObj->GetScale();
-    m_undoState.color = pObj->GetColor();
-    m_undoState.area = pObj->GetArea();
-}
-
-//////////////////////////////////////////////////////////////////////////
-QString CUndoBaseObjectMinimal::GetObjectName()
-{
-    CBaseObject* pObject = GetIEditor()->GetObjectManager()->FindObject(m_guid);
-    if (!pObject)
-    {
-        return QString();
-    }
-
-    return pObject->GetName();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CUndoBaseObjectMinimal::Undo(bool bUndo)
-{
-    CBaseObject* pObject = GetIEditor()->GetObjectManager()->FindObject(m_guid);
-    if (!pObject)
-    {
-        return;
-    }
-
-    if (bUndo)
-    {
-        m_redoState.pos = pObject->GetPos();
-        m_redoState.scale = pObject->GetScale();
-        m_redoState.rotate = pObject->GetRotation();
-        m_redoState.color = pObject->GetColor();
-        m_redoState.area = pObject->GetArea();
-    }
-
-    SetTransformsFromState(pObject, m_undoState, bUndo);
-
-    pObject->ChangeColor(m_undoState.color);
-    pObject->SetArea(m_undoState.area);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CUndoBaseObjectMinimal::Redo()
-{
-    CBaseObject* pObject = GetIEditor()->GetObjectManager()->FindObject(m_guid);
-    if (!pObject)
-    {
-        return;
-    }
-
-    SetTransformsFromState(pObject, m_redoState, true);
-
-    pObject->ChangeColor(m_redoState.color);
-    pObject->SetArea(m_redoState.area);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CUndoBaseObjectMinimal::SetTransformsFromState(CBaseObject* pObject, const StateStruct& state, bool bUndo)
-{
-    uint32 flags = eObjectUpdateFlags_Undo;
-    if (!bUndo)
-    {
-        flags |= eObjectUpdateFlags_UserInputUndo;
-    }
-
-    pObject->SetPos(state.pos, flags);
-    pObject->SetScale(state.scale, flags);
-    pObject->SetRotation(state.rotate, flags);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectCloneContext::AddClone(CBaseObject* pFromObject, CBaseObject* pToObject)
-{
-    m_objectsMap[pFromObject] = pToObject;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CBaseObject* CObjectCloneContext::FindClone(CBaseObject* pFromObject)
-{
-    CBaseObject* pTarget = stl::find_in_map(m_objectsMap, pFromObject, (CBaseObject*) nullptr);
-    return pTarget;
-}
-
-//////////////////////////////////////////////////////////////////////////
-GUID CObjectCloneContext::ResolveClonedID(REFGUID guid)
-{
-    CBaseObject* pObject = GetIEditor()->GetObjectManager()->FindObject(guid);
-    CBaseObject* pClonedTarget = FindClone(pObject);
-    if (!pClonedTarget)
-    {
-        pClonedTarget = pObject; // If target not cloned, link to original target.
-    }
-    if (pClonedTarget)
-    {
-        return pClonedTarget->GetId();
-    }
-    return GUID_NULL;
-}
-
-//////////////////////////////////////////////////////////////////////////
-// CBaseObject implementation.
-//////////////////////////////////////////////////////////////////////////
-CBaseObject::CBaseObject()
-    : m_pos(0, 0, 0)
-    , m_rotate(IDENTITY)
-    , m_scale(1, 1, 1)
-    , m_guid(GUID_NULL)
-    , m_flags(0)
-    , m_nTextureIcon(0)
-    , m_color(QColor(255, 255, 255))
-    , m_worldTM(IDENTITY)
-    , m_lookat(nullptr)
-    , m_lookatSource(nullptr)
-    , m_flattenArea(0.f)
-    , m_classDesc(nullptr)
-    , m_numRefs(0)
-    , m_parent(nullptr)
-    , m_bInSelectionBox(false)
-    , m_pTransformDelegate(nullptr)
-    , m_bMatrixInWorldSpace(false)
-    , m_bMatrixValid(false)
-    , m_bWorldBoxValid(false)
-    , m_vDrawIconPos(0, 0, 0)
-    , m_nIconFlags(0)
-{
-    m_worldBounds.min.Set(0, 0, 0);
-    m_worldBounds.max.Set(0, 0, 0);
-}
-
-//////////////////////////////////////////////////////////////////////////
-IObjectManager* CBaseObject::GetObjectManager() const
-{
-    return g_pObjectManager;
-};
-
-
-void CBaseObject::SetClassDesc(CObjectClassDesc* classDesc)
-{
-    m_classDesc = classDesc;
-}
-
-//! Initialize Object.
-bool CBaseObject::Init([[maybe_unused]] IEditor* ie, CBaseObject* prev, [[maybe_unused]] const QString& file)
-{
-    SetFlags(m_flags & (~OBJFLAG_DELETED));
-
-    if (prev != nullptr)
-    {
-        SetUniqueName(prev->GetName());
-        SetLocalTM(prev->GetPos(), prev->GetRotation(), prev->GetScale());
-        SetArea(prev->GetArea());
-        SetColor(prev->GetColor());
-
-        // Copy all basic variables.
-        EnableUpdateCallbacks(false);
-        CopyVariableValues(prev);
-        EnableUpdateCallbacks(true);
-        OnSetValues();
-    }
-
-    if (m_classDesc->RenderTextureOnTop())
-    {
-        SetFlags(OBJFLAG_SHOW_ICONONTOP);
-    }
-
-    return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CBaseObject::~CBaseObject()
-{
-    for (Childs::iterator c = m_childs.begin(); c != m_childs.end(); c++)
-    {
-        CBaseObject* child = *c;
-        child->m_parent = nullptr;
-    }
-    m_childs.clear();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::Done()
-{
-    DetachThis();
-
-    // From children
-    DetachAll();
-
-    SetLookAt(nullptr);
-    if (m_lookatSource)
-    {
-        m_lookatSource->SetLookAt(nullptr);
-    }
-    SetFlags(m_flags | OBJFLAG_DELETED);
-
-    NotifyListeners(CBaseObject::ON_DELETE);
-    m_eventListeners.clear();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetName(const QString& name)
-{
-    if (name == m_name)
-    {
-        return;
-    }
-
-    StoreUndo();
-
-    // Notification is expensive and not required if this is during construction.
-    bool notify = (!m_name.isEmpty());
-
-    m_name = name;
-    GetObjectManager()->RegisterObjectName(name);
-    SetModified(false);
-
-    if (notify)
-    {
-        NotifyListeners(ON_RENAME);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetUniqueName(const QString& name)
-{
-    SetName(GetObjectManager()->GenerateUniqueObjectName(name));
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::GenerateUniqueName()
-{
-    if (m_classDesc)
-    {
-        SetUniqueName(m_classDesc->ClassName());
-    }
-    else
-    {
-        SetUniqueName("Object");
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-const QString& CBaseObject::GetName() const
-{
-    return m_name;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CBaseObject::SetPos(const Vec3& pos, int flags)
-{
-    const Vec3 currentPos = GetPos();
-
-    bool equal = false;
-    if (flags & eObjectUpdateFlags_MoveTool) // very sensitive in case of the move tool
-    {
-        equal = IsVectorsEqual(currentPos, pos, 0.0f);
-    }
-    else // less sensitive for others
-    {
-        equal = IsVectorsEqual(currentPos, pos);
-    }
-
-    if (equal)
-    {
-        return false;
-    }
-
-    //////////////////////////////////////////////////////////////////////////
-    // Check if position is bad.
-    if (fabs(pos.x) > AZ::Constants::MaxFloatBeforePrecisionLoss ||
-        fabs(pos.y) > AZ::Constants::MaxFloatBeforePrecisionLoss ||
-        fabs(pos.z) > AZ::Constants::MaxFloatBeforePrecisionLoss ||
-        !_finite(pos.x) || !_finite(pos.y) || !_finite(pos.z))
-    {
-        CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_WARNING,
-            "Object %s, SetPos called with invalid position: (%f,%f,%f)",
-            GetName().toUtf8().data(), pos.x, pos.y, pos.z);
-        return false;
-    }
-
-    OnBeforeAreaChange();
-
-    //////////////////////////////////////////////////////////////////////////
-    const bool bPositionDelegated = m_pTransformDelegate && m_pTransformDelegate->IsPositionDelegated();
-    if (m_pTransformDelegate && (flags & eObjectUpdateFlags_Animated) == 0)
-    {
-        m_pTransformDelegate->SetTransformDelegatePos(pos);
-    }
-
-    //////////////////////////////////////////////////////////////////////////
-    if (!bPositionDelegated && (flags & eObjectUpdateFlags_RestoreUndo) == 0 && (flags & eObjectUpdateFlags_Animated) == 0)
-    {
-        StoreUndo(true, flags);
-    }
-
-    if (!bPositionDelegated)
-    {
-        m_pos = pos;
-    }
-
-    if (!(flags & eObjectUpdateFlags_DoNotInvalidate))
-    {
-        InvalidateTM(flags | eObjectUpdateFlags_PositionChanged);
-    }
-
-    SetModified(true);
-
-    return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CBaseObject::SetRotation(const Quat& rotate, int flags)
-{
-    const Quat currentRotate = GetRotation();
-
-    if (currentRotate.w == rotate.w && currentRotate.v.x == rotate.v.x
-        && currentRotate.v.y == rotate.v.y && currentRotate.v.z == rotate.v.z)
-    {
-        return false;
-    }
-
-    if (flags & eObjectUpdateFlags_ScaleTool)
-    {
-        return false;
-    }
-
-    OnBeforeAreaChange();
-
-    const bool bRotationDelegated = m_pTransformDelegate && m_pTransformDelegate->IsRotationDelegated();
-    if (m_pTransformDelegate && (flags & eObjectUpdateFlags_Animated) == 0)
-    {
-        m_pTransformDelegate->SetTransformDelegateRotation(rotate);
-    }
-
-    if (!bRotationDelegated && (flags & eObjectUpdateFlags_RestoreUndo) == 0 && (flags & eObjectUpdateFlags_Animated) == 0)
-    {
-        StoreUndo(true, flags);
-    }
-
-    if (!bRotationDelegated)
-    {
-        m_rotate = rotate;
-    }
-
-    if (m_bMatrixValid && !(flags & eObjectUpdateFlags_DoNotInvalidate))
-    {
-        InvalidateTM(flags | eObjectUpdateFlags_RotationChanged);
-    }
-
-    SetModified(true);
-
-    return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CBaseObject::SetScale(const Vec3& scale, int flags)
-{
-    if (IsVectorsEqual(GetScale(), scale))
-    {
-        return false;
-    }
-
-    //////////////////////////////////////////////////////////////////////////
-    // Check if scale is bad.
-    if (scale.x < 0.01f || scale.y < 0.01f || scale.z < 0.01f)
-    {
-        CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_WARNING, "Object %s, SetScale called with invalid scale: (%f,%f,%f)", GetName().toUtf8().data(), scale.x, scale.y, scale.z);
-        return false;
-    }
-    //////////////////////////////////////////////////////////////////////////
-
-    OnBeforeAreaChange();
-
-    const bool bScaleDelegated = m_pTransformDelegate && m_pTransformDelegate->IsScaleDelegated();
-    if (m_pTransformDelegate && (flags & eObjectUpdateFlags_Animated) == 0)
-    {
-        m_pTransformDelegate->SetTransformDelegateScale(scale);
-    }
-
-    if (!bScaleDelegated && (flags & eObjectUpdateFlags_RestoreUndo) == 0 && (flags & eObjectUpdateFlags_Animated) == 0)
-    {
-        StoreUndo(true, flags);
-    }
-
-    if (!bScaleDelegated)
-    {
-        m_scale = scale;
-    }
-
-    if (m_bMatrixValid && !(flags & eObjectUpdateFlags_DoNotInvalidate))
-    {
-        InvalidateTM(flags | eObjectUpdateFlags_ScaleChanged);
-    }
-
-    SetModified(true);
-
-    return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-const Vec3 CBaseObject::GetPos() const
-{
-    if (!m_pTransformDelegate)
-    {
-        return m_pos;
-    }
-
-    return m_pTransformDelegate->GetTransformDelegatePos(m_pos);
-}
-
-//////////////////////////////////////////////////////////////////////////
-const Quat CBaseObject::GetRotation() const
-{
-    if (!m_pTransformDelegate)
-    {
-        return m_rotate;
-    }
-
-    return m_pTransformDelegate->GetTransformDelegateRotation(m_rotate);
-}
-
-//////////////////////////////////////////////////////////////////////////
-const Vec3 CBaseObject::GetScale() const
-{
-    if (!m_pTransformDelegate)
-    {
-        return m_scale;
-    }
-
-    return m_pTransformDelegate->GetTransformDelegateScale(m_scale);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::ChangeColor(const QColor& color)
-{
-    if (color == m_color)
-    {
-        return;
-    }
-
-    StoreUndo(true);
-
-    SetColor(color);
-    SetModified(false);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetColor(const QColor& color)
-{
-    m_color = color;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetArea(float area)
-{
-    if (m_flattenArea == area)
-    {
-        return;
-    }
-
-    StoreUndo(true);
-
-    m_flattenArea = area;
-    SetModified(false);
-};
-
-//! Get bounding box of object in world coordinate space.
-void CBaseObject::GetBoundBox(AABB& box)
-{
-    if (!m_bWorldBoxValid)
-    {
-        GetLocalBounds(m_worldBounds);
-        if (!m_worldBounds.IsReset() && !m_worldBounds.IsEmpty())
-        {
-            m_worldBounds.SetTransformedAABB(GetWorldTM(), m_worldBounds);
-            m_bWorldBoxValid = true;
-        }
-    }
-    box = m_worldBounds;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::GetLocalBounds(AABB& box)
-{
-    box.min.Set(0, 0, 0);
-    box.max.Set(0, 0, 0);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetModified(bool)
-{
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::OnEvent(ObjectEvent event)
-{
-    switch (event)
-    {
-    case EVENT_CONFIG_SPEC_CHANGE:
-        UpdateVisibility(!IsHidden());
-        break;
-    }
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetHidden(bool bHidden, bool bAnimated)
-{
-    if (CheckFlags(OBJFLAG_HIDDEN) != bHidden)
-    {
-        if (!bAnimated)
-        {
-            StoreUndo();
-        }
-
-        if (bHidden)
-        {
-            SetFlags(OBJFLAG_HIDDEN);
-        }
-        else
-        {
-            ClearFlags(OBJFLAG_HIDDEN);
-        }
-
-        UpdateVisibility(!IsHidden());
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetFrozen(bool bFrozen)
-{
-    if (CheckFlags(OBJFLAG_FROZEN) != bFrozen)
-    {
-        StoreUndo();
-        if (bFrozen)
-        {
-            SetFlags(OBJFLAG_FROZEN);
-        }
-        else
-        {
-            ClearFlags(OBJFLAG_FROZEN);
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetHighlight(bool bHighlight)
-{
-    if (bHighlight)
-    {
-        SetFlags(OBJFLAG_HIGHLIGHT);
-    }
-    else
-    {
-        ClearFlags(OBJFLAG_HIGHLIGHT);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetSelected(bool bSelect)
-{
-    if (bSelect)
-    {
-        SetFlags(OBJFLAG_SELECTED);
-        NotifyListeners(ON_SELECT);
-
-        //CLogFile::FormatLine( "Selected: %s, ID=%u",(const char*)m_name,m_id );
-    }
-    else
-    {
-        ClearFlags(OBJFLAG_SELECTED);
-        NotifyListeners(ON_UNSELECT);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-//! Returns true if object hidden.
-bool CBaseObject::IsHidden() const
-{
-    return (CheckFlags(OBJFLAG_HIDDEN)) ||
-            (m_classDesc && (gSettings.objectHideMask & GetType()));
-}
-
-//////////////////////////////////////////////////////////////////////////
-//! Returns true if object frozen.
-bool CBaseObject::IsFrozen() const
-{
-    return CheckFlags(OBJFLAG_FROZEN);
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CBaseObject::IsSelectable() const
-{
-    // Not selectable if frozen.
-    return IsFrozen() ? false : true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::Serialize(CObjectArchive& ar)
-{
-    XmlNodeRef xmlNode = ar.node;
-
-    ITransformDelegate* pTransformDelegate = m_pTransformDelegate;
-    m_pTransformDelegate = nullptr;
-
-    if (ar.bLoading)
-    {
-        // Loading.
-        int flags = 0;
-        int oldFlags = m_flags;
-
-        QString name = m_name;
-        QString mtlName;
-
-        Vec3 pos = m_pos;
-        Vec3 scale = m_scale;
-        Quat quat = m_rotate;
-        Ang3 angles(0, 0, 0);
-
-        QColor color = m_color;
-        float flattenArea = m_flattenArea;
-
-        GUID parentId = GUID_NULL;
-        GUID lookatId = GUID_NULL;
-
-        xmlNode->getAttr("Name", name);
-        xmlNode->getAttr("Pos", pos);
-        if (!xmlNode->getAttr("Rotate", quat))
-        {
-            // Backward compatibility.
-            if (xmlNode->getAttr("Angles", angles))
-            {
-                angles = DEG2RAD(angles);
-                //angles.z += gf_PI/2;
-                quat.SetRotationXYZ(angles);
-            }
-        }
-
-        xmlNode->getAttr("Scale", scale);
-        xmlNode->getAttr("ColorRGB", color);
-        xmlNode->getAttr("FlattenArea", flattenArea);
-        xmlNode->getAttr("Flags", flags);
-        xmlNode->getAttr("Parent", parentId);
-        xmlNode->getAttr("LookAt", lookatId);
-        xmlNode->getAttr("Material", mtlName);
-
-        bool bHidden = flags & OBJFLAG_HIDDEN;
-        bool bFrozen = flags & OBJFLAG_FROZEN;
-
-        m_flags = flags;
-        m_flags &= ~OBJFLAG_PERSISTMASK;
-        m_flags |= (oldFlags) & (~OBJFLAG_PERSISTMASK);
-        //SetFlags( flags & OBJFLAG_PERSISTMASK );
-        m_flags &= ~OBJFLAG_SHARED; // clear shared flag
-        m_flags &= ~OBJFLAG_DELETED; // clear deleted flag
-
-        if (ar.bUndo)
-        {
-            DetachThis(false);
-        }
-
-        if (name != m_name)
-        {
-            // This may change object id.
-            SetName(name);
-        }
-
-        //////////////////////////////////////////////////////////////////////////
-        // Check if position is bad.
-        if (fabs(pos.x) > AZ::Constants::MaxFloatBeforePrecisionLoss ||
-            fabs(pos.y) > AZ::Constants::MaxFloatBeforePrecisionLoss ||
-            fabs(pos.z) > AZ::Constants::MaxFloatBeforePrecisionLoss)
-        {
-            // File Not found.
-            CErrorRecord err;
-            err.error = QStringLiteral("Object %1 have invalid position (%2,%3,%4)").arg(GetName()).arg(pos.x).arg(pos.y).arg(pos.z);
-            err.pObject = this;
-            err.severity = CErrorRecord::ESEVERITY_WARNING;
-            GetIEditor()->GetErrorReport()->ReportError(err);
-        }
-        //////////////////////////////////////////////////////////////////////////
-
-        if (!ar.bUndo)
-        {
-            SetLocalTM(pos, quat, scale);
-        }
-        else
-        {
-            SetLocalTM(pos, quat, scale, eObjectUpdateFlags_Undo);
-        }
-
-        SetColor(color);
-        SetArea(flattenArea);
-        SetFrozen(bFrozen);
-        SetHidden(bHidden);
-
-        ar.SetResolveCallback(this, parentId, [this](CBaseObject* parent) { ResolveParent(parent); });
-        ar.SetResolveCallback(this, lookatId, [this](CBaseObject* target) { SetLookAt(target); });
-
-        InvalidateTM(0);
-        SetModified(false);
-
-        //////////////////////////////////////////////////////////////////////////
-    }
-    else
-    {
-        // Saving.
-
-        // This attributed only readed by ObjectManager.
-        xmlNode->setAttr("Type", GetTypeName().toUtf8().data());
-
-        xmlNode->setAttr("Id", m_guid);
-
-        xmlNode->setAttr("Name", GetName().toUtf8().data());
-
-        if (m_parent)
-        {
-            xmlNode->setAttr("Parent", m_parent->GetId());
-        }
-
-        if (m_lookat)
-        {
-            xmlNode->setAttr("LookAt", m_lookat->GetId());
-        }
-
-        if (!IsEquivalent(GetPos(), Vec3(0, 0, 0), 0))
-        {
-            xmlNode->setAttr("Pos", GetPos());
-        }
-
-        xmlNode->setAttr("Rotate", m_rotate);
-
-        if (!IsEquivalent(GetScale(), Vec3(1, 1, 1), 0))
-        {
-            xmlNode->setAttr("Scale", GetScale());
-        }
-
-        xmlNode->setAttr("ColorRGB", GetColor());
-
-        if (GetArea() != 0)
-        {
-            xmlNode->setAttr("FlattenArea", GetArea());
-        }
-
-        int flags = m_flags & OBJFLAG_PERSISTMASK;
-        if (flags != 0)
-        {
-            xmlNode->setAttr("Flags", flags);
-        }
-    }
-
-    // Serialize variables after default entity parameters.
-    CVarObject::Serialize(xmlNode, ar.bLoading);
-
-    m_pTransformDelegate = pTransformDelegate;
-}
-
-//////////////////////////////////////////////////////////////////////////
-XmlNodeRef CBaseObject::Export([[maybe_unused]] const QString& levelPath, XmlNodeRef& xmlNode)
-{
-    XmlNodeRef objNode = xmlNode->newChild("Object");
-
-    objNode->setAttr("Type", GetTypeName().toUtf8().data());
-    objNode->setAttr("Name", GetName().toUtf8().data());
-
-    Vec3 pos, scale;
-    Quat rotate;
-    if (m_parent)
-    {
-        // Export world coordinates.
-        AffineParts ap;
-        ap.SpectralDecompose(GetWorldTM());
-
-        pos = ap.pos;
-        rotate = ap.rot;
-        scale = ap.scale;
-    }
-    else
-    {
-        pos = m_pos;
-        rotate = m_rotate;
-        scale = m_scale;
-    }
-
-    if (!IsEquivalent(pos, Vec3(0, 0, 0), 0))
-    {
-        objNode->setAttr("Pos", pos);
-    }
-
-    if (!rotate.IsIdentity())
-    {
-        objNode->setAttr("Rotate", rotate);
-    }
-
-    if (!IsEquivalent(scale, Vec3(0, 0, 0), 0))
-    {
-        objNode->setAttr("Scale", scale);
-    }
-
-    // Save variables.
-    CVarObject::Serialize(objNode, false);
-
-    return objNode;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CBaseObject* CBaseObject::FindObject(REFGUID id) const
-{
-    return GetObjectManager()->FindObject(id);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::StoreUndo(bool minimal, int flags)
-{
-    // Don't use Sandbox undo for AZ entities, except for the move & scale tools, which rely on it.
-    const bool isGizmoTool = 0 != (flags & (eObjectUpdateFlags_MoveTool | eObjectUpdateFlags_ScaleTool | eObjectUpdateFlags_UserInput));
-    if (!isGizmoTool && 0 != (m_flags & OBJFLAG_DONT_SAVE))
-    {
-        return;
-    }
-
-    if (CUndo::IsRecording())
-    {
-        if (minimal)
-        {
-            CUndo::Record(new CUndoBaseObjectMinimal(this, flags));
-        }
-        else
-        {
-            CUndo::Record(new CUndoBaseObject(this));
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-QString CBaseObject::GetTypeName() const
-{
-    QString className = m_classDesc->ClassName();
-    QString subClassName = strstr(className.toUtf8().data(), "::");
-    if (subClassName.isEmpty())
-    {
-        return className;
-    }
-
-    QString name;
-    name.append(className.midRef(0, className.length() - subClassName.length()));
-    return name;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CBaseObject::IntersectRectBounds(const AABB& bbox)
-{
-    AABB aabb;
-    GetBoundBox(aabb);
-
-    return aabb.IsIntersectBox(bbox);
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CBaseObject::IntersectRayBounds(const Ray& ray)
-{
-    Vec3 tmpPnt;
-    AABB aabb;
-    GetBoundBox(aabb);
-
-    return Intersect::Ray_AABB(ray, aabb, tmpPnt);
-}
-
-//////////////////////////////////////////////////////////////////////////
-namespace
-{
-    using Edge2D = std::pair<Vec2, Vec2>;
-}
-bool IsIncludePointsInConvexHull(Edge2D* pEdgeArray0, int nEdgeArray0Size, Edge2D* pEdgeArray1, int nEdgeArray1Size)
-{
-    if (!pEdgeArray0 || !pEdgeArray1 || nEdgeArray0Size <= 0 || nEdgeArray1Size <= 0)
-    {
-        return false;
-    }
-
-    static const float kPointEdgeMaxInsideDistance(0.05f);
-
-    bool bInside(true);
-    for (int i = 0; i < nEdgeArray0Size; ++i)
-    {
-        const Vec2& v(pEdgeArray0[i].first);
-        bInside = true;
-        for (int k = 0; k < nEdgeArray1Size; ++k)
-        {
-            Vec2 v0 = pEdgeArray1[k].first;
-            Vec2 v1 = pEdgeArray1[k].second;
-            Vec3 direction(v1.x - v0.x, v1.y - v0.y, 0);
-            Vec3 up(0, 0, 1);
-            Vec3 z = up.Cross(direction);
-            Vec2 normal;
-            normal.x = z.x;
-            normal.y = z.y;
-            normal.Normalize();
-            float distance = -normal.Dot(v0);
-            if (normal.Dot(v) + distance > kPointEdgeMaxInsideDistance)
-            {
-                bInside = false;
-                break;
-            }
-        }
-        if (bInside)
-        {
-            break;
-        }
-    }
-    return bInside;
-}
-
-void ModifyConvexEdgeDirection(Edge2D* pEdgeArray, int nEdgeArraySize)
-{
-    if (!pEdgeArray || nEdgeArraySize < 2)
-    {
-        return;
-    }
-    Vec3 v0(pEdgeArray[0].first.x - pEdgeArray[0].second.x, pEdgeArray[0].first.y - pEdgeArray[0].second.y, 0);
-    Vec3 v1(pEdgeArray[1].second.x - pEdgeArray[1].first.x, pEdgeArray[1].second.y - pEdgeArray[1].first.y, 0);
-    Vec3 vCross = v0.Cross(v1);
-    if (vCross.z < 0)
-    {
-        for (int i = 0; i < nEdgeArraySize; ++i)
-        {
-            std::swap(pEdgeArray[i].first, pEdgeArray[i].second);
-        }
-    }
-}
-
-bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box)
-{
-    if (hc.bUseSelectionHelpers)
-    {
-        if (IsSkipSelectionHelper())
-        {
-            return false;
-        }
-    }
-
-    static const int kNumberOfBoundBoxPt(8);
-
-    // transform all 8 vertices into view space.
-    QPoint p[kNumberOfBoundBoxPt] =
-    {
-        hc.view->WorldToView(Vec3(box.min.x, box.min.y, box.min.z)),
-        hc.view->WorldToView(Vec3(box.min.x, box.max.y, box.min.z)),
-        hc.view->WorldToView(Vec3(box.max.x, box.min.y, box.min.z)),
-        hc.view->WorldToView(Vec3(box.max.x, box.max.y, box.min.z)),
-        hc.view->WorldToView(Vec3(box.min.x, box.min.y, box.max.z)),
-        hc.view->WorldToView(Vec3(box.min.x, box.max.y, box.max.z)),
-        hc.view->WorldToView(Vec3(box.max.x, box.min.y, box.max.z)),
-        hc.view->WorldToView(Vec3(box.max.x, box.max.y, box.max.z))
-    };
-
-    QRect objrc;
-    objrc.setLeft(10000);
-    objrc.setTop(10000);
-    objrc.setRight(-10000);
-    objrc.setBottom(-10000);
-
-    // find new min/max values
-    for (int i = 0; i < 8; i++)
-    {
-        objrc.setLeft(min(objrc.left(), p[i].x()));
-        objrc.setRight(max(objrc.right(), p[i].x()));
-        objrc.setTop(min(objrc.top(), p[i].y()));
-        objrc.setBottom(max(objrc.bottom(), p[i].y()));
-    }
-    if (objrc.isEmpty())
-    {
-        // Make objrc at least of size 1.
-        objrc.moveBottomRight(objrc.bottomRight() + QPoint(1, 1));
-    }
-
-    if (hc.rect.contains(objrc.topLeft()) &&
-        hc.rect.contains(objrc.bottomLeft()) &&
-        hc.rect.contains(objrc.topRight()) &&
-        hc.rect.contains(objrc.bottomRight()))
-    {
-        hc.object = this;
-        return true;
-    }
-
-    if (objrc.intersects(hc.rect))
-    {
-        AABB localAABB;
-        GetLocalBounds(localAABB);
-        CBaseObject* pOldObj = hc.object;
-        hc.object = this;
-        if (localAABB.IsEmpty())
-        {
-            return true;
-        }
-
-        const int kMaxSizeOfEdgeList0(4);
-        Edge2D edgelist0[kMaxSizeOfEdgeList0] = {
-            Edge2D(Vec2(static_cast<f32>(hc.rect.left()),  static_cast<f32>(hc.rect.top())),    Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.top()))),
-            Edge2D(Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.top())),    Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.bottom()))),
-            Edge2D(Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.bottom())), Vec2(static_cast<f32>(hc.rect.left()),  static_cast<f32>(hc.rect.bottom()))),
-            Edge2D(Vec2(static_cast<f32>(hc.rect.left()),  static_cast<f32>(hc.rect.bottom())), Vec2(static_cast<f32>(hc.rect.left()),  static_cast<f32>(hc.rect.top())))
-        };
-
-        const int kMaxSizeOfEdgeList1(8);
-        Edge2D edgelist1[kMaxSizeOfEdgeList1];
-        int nEdgeList1Count(kMaxSizeOfEdgeList1);
-
-        const Matrix34& worldTM(GetWorldTM());
-        OBB obb = OBB::CreateOBBfromAABB(Matrix33(worldTM), localAABB);
-        Vec3 ax = obb.m33.GetColumn0() * obb.h.x;
-        Vec3 ay = obb.m33.GetColumn1() * obb.h.y;
-        Vec3 az = obb.m33.GetColumn2() * obb.h.z;
-        QPoint obb_p[kMaxSizeOfEdgeList1] =
-        {
-            hc.view->WorldToView(-ax - ay - az + worldTM.GetTranslation()),
-            hc.view->WorldToView(-ax - ay + az + worldTM.GetTranslation()),
-            hc.view->WorldToView(-ax + ay - az + worldTM.GetTranslation()),
-            hc.view->WorldToView(-ax + ay + az + worldTM.GetTranslation()),
-            hc.view->WorldToView(ax - ay - az + worldTM.GetTranslation()),
-            hc.view->WorldToView(ax - ay + az + worldTM.GetTranslation()),
-            hc.view->WorldToView(ax + ay - az + worldTM.GetTranslation()),
-            hc.view->WorldToView(ax + ay + az + worldTM.GetTranslation())
-        };
-
-        std::vector<Vec3> pointsForRegion1;
-        pointsForRegion1.reserve(kMaxSizeOfEdgeList1);
-        for (int i = 0; i < kMaxSizeOfEdgeList1; ++i)
-        {
-            pointsForRegion1.push_back(Vec3(static_cast<f32>(obb_p[i].x()), static_cast<f32>(obb_p[i].y()), 0.0f));
-        }
-
-        std::vector<Vec3> convexHullForRegion1;
-        ConvexHull2D(convexHullForRegion1, pointsForRegion1);
-        nEdgeList1Count = static_cast<int>(convexHullForRegion1.size());
-        if (nEdgeList1Count < 3 || nEdgeList1Count > kMaxSizeOfEdgeList1)
-        {
-            return true;
-        }
-
-        for (int i = 0; i < nEdgeList1Count; ++i)
-        {
-            int iNextI = (i + 1) % nEdgeList1Count;
-            edgelist1[i] = Edge2D(Vec2(convexHullForRegion1[i].x, convexHullForRegion1[i].y), Vec2(convexHullForRegion1[iNextI].x, convexHullForRegion1[iNextI].y));
-        }
-
-        ModifyConvexEdgeDirection(edgelist0, kMaxSizeOfEdgeList0);
-        ModifyConvexEdgeDirection(edgelist1, nEdgeList1Count);
-
-        bool bInside = IsIncludePointsInConvexHull(edgelist0, kMaxSizeOfEdgeList0, edgelist1, nEdgeList1Count);
-        if (!bInside)
-        {
-            bInside = IsIncludePointsInConvexHull(edgelist1, nEdgeList1Count, edgelist0, kMaxSizeOfEdgeList0);
-        }
-        if (!bInside)
-        {
-            hc.object = pOldObj;
-            return false;
-        }
-
-        return true;
-    }
-
-    return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CBaseObject::HitTestRect(HitContext& hc)
-{
-    AZ_PROFILE_FUNCTION(Editor);
-
-    AABB box;
-
-    if (hc.bUseSelectionHelpers)
-    {
-        if (IsSkipSelectionHelper())
-        {
-            return false;
-        }
-        box.min = GetWorldPos();
-        box.max = box.min;
-    }
-    else
-    {
-        // Retrieve world space bound box.
-        GetBoundBox(box);
-    }
-
-    bool bHit = HitTestRectBounds(hc, box);
-    m_bInSelectionBox = bHit;
-    if (bHit)
-    {
-        hc.object = this;
-    }
-    return bHit;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CBaseObject* CBaseObject::GetChild(size_t const i) const
-{
-    assert(i < m_childs.size());
-    return m_childs[i];
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::AttachChild(CBaseObject* child, bool bKeepPos)
-{
-    Matrix34 childTM;
-    ITransformDelegate* pTransformDelegate;
-    ITransformDelegate* pChildTransformDelegate;
-
-    {
-        CScopedSuspendUndo suspendUndo;
-
-        assert(child);
-        if (!child || child == GetLookAt())
-        {
-            return;
-        }
-
-        child->NotifyListeners(bKeepPos ? ON_PREATTACHEDKEEPXFORM : ON_PREATTACHED);
-
-        pTransformDelegate = m_pTransformDelegate;
-        pChildTransformDelegate = child->m_pTransformDelegate;
-        SetTransformDelegate(nullptr);
-        child->SetTransformDelegate(nullptr);
-
-        if (bKeepPos)
-        {
-            child->InvalidateTM(0);
-            childTM = child->GetWorldTM();
-        }
-
-        // If not already attached to this node.
-        if (child->m_parent == this)
-        {
-            return;
-        }
-
-        // Add to child list first to make sure node not get deleted while reattaching.
-        m_childs.push_back(child);
-        if (child->m_parent)
-        {
-            child->DetachThis(bKeepPos);    // Detach node if attached to other parent.
-        }
-        //////////////////////////////////////////////////////////////////////////
-        child->m_parent = this; // Assign this node as parent to child node.
-    }
-
-    {
-        CScopedSuspendUndo suspendUndo;
-
-        {
-            if (bKeepPos)
-            {
-                child->SetWorldTM(childTM);
-            }
-
-            child->InvalidateTM(0);
-        }
-
-        m_pTransformDelegate = pTransformDelegate;
-        child->m_pTransformDelegate = pChildTransformDelegate;
-
-        child->NotifyListeners(ON_ATTACHED);
-
-        NotifyListeners(ON_CHILDATTACHED);
-    }
-
-    if (CUndo::IsRecording())
-    {
-        CUndo::Record(new CUndoAttachBaseObject(child, bKeepPos, true));
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::DetachAll(bool bKeepPos)
-{
-    while (!m_childs.empty())
-    {
-        CBaseObject* child = *m_childs.begin();
-        child->DetachThis(bKeepPos);
-        NotifyListeners(ON_CHILDDETACHED);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::DetachThis(bool bKeepPos)
-{
-    if (m_parent)
-    {
-        if (CUndo::IsRecording())
-        {
-            CUndo::Record(new CUndoAttachBaseObject(this, bKeepPos, false));
-        }
-
-        Matrix34 worldTM;
-        ITransformDelegate* pTransformDelegate;
-
-        {
-            CScopedSuspendUndo suspendUndo;
-            NotifyListeners(bKeepPos ? ON_PREDETACHEDKEEPXFORM : ON_PREDETACHED);
-
-            pTransformDelegate = m_pTransformDelegate;
-            SetTransformDelegate(nullptr);
-
-            if (bKeepPos)
-            {
-                ITransformDelegate* pParentTransformDelegate = m_parent->m_pTransformDelegate;
-                m_parent->SetTransformDelegate(nullptr);
-                worldTM = GetWorldTM();
-                m_parent->SetTransformDelegate(pParentTransformDelegate);
-            }
-        }
-
-        {
-            CScopedSuspendUndo suspendUndo;
-
-            // Copy parent to temp var, erasing child from parent may delete this node if child referenced only from parent.
-            CBaseObject* parent = m_parent;
-            m_parent = nullptr;
-            parent->RemoveChild(this);
-
-            if (bKeepPos)
-            {
-                // Keep old world space transformation.
-                SetWorldTM(worldTM);
-            }
-
-            SetTransformDelegate(pTransformDelegate);
-
-            NotifyListeners(ON_DETACHED);
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::RemoveChild(CBaseObject* node)
-{
-    Childs::iterator it = std::find(m_childs.begin(), m_childs.end(), node);
-    if (it != m_childs.end())
-    {
-        m_childs.erase(it);
-        NotifyListeners(ON_CHILDDETACHED);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::ResolveParent(CBaseObject* parent)
-{
-    // even though parent is same as m_parent, adding the member to the parent must be done.
-    if (parent)
-    {
-        parent->AddMember(this, false);
-    }
-    else
-    {
-        DetachThis(false);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::CalcLocalTM(Matrix34& tm) const
-{
-    tm.SetIdentity();
-
-    if (m_lookat)
-    {
-        Vec3 pos = GetPos();
-
-        if (m_parent)
-        {
-            // Get our world position.
-            pos = GetParentAttachPointWorldTM().TransformPoint(pos);
-        }
-
-        // Calculate local TM matrix differently.
-        Vec3 lookatPos = m_lookat->GetWorldPos();
-        if (lookatPos == pos) // if target at object pos
-        {
-            tm.SetTranslation(pos);
-        }
-        else
-        {
-            tm = Matrix34(Matrix33::CreateRotationVDir((lookatPos - pos).GetNormalized()), pos);
-        }
-        if (m_parent)
-        {
-            Matrix34 invParentTM = m_parent->GetWorldTM();
-            invParentTM.Invert();
-            tm = invParentTM * tm;
-        }
-    }
-    else
-    {
-        tm = Matrix34::Create(GetScale(), GetRotation(), GetPos());
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-const Matrix34& CBaseObject::GetWorldTM() const
-{
-    if (!m_bMatrixValid)
-    {
-        m_worldTM = GetLocalTM();
-        m_bMatrixValid = true;
-        m_bMatrixInWorldSpace = false;
-        m_bWorldBoxValid = false;
-    }
-    if (!m_bMatrixInWorldSpace)
-    {
-        CBaseObject* parent = GetParent();
-        if (parent)
-        {
-            m_worldTM = GetParentAttachPointWorldTM() * m_worldTM;
-        }
-        m_bMatrixInWorldSpace = true;
-        m_bWorldBoxValid = false;
-    }
-    return m_worldTM;
-}
-
-//////////////////////////////////////////////////////////////////////////
-Matrix34 CBaseObject::GetParentAttachPointWorldTM() const
-{
-    CBaseObject* pParent = GetParent();
-    if (pParent)
-    {
-        return pParent->GetWorldTM();
-    }
-
-    return Matrix34(IDENTITY);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::InvalidateTM([[maybe_unused]] int flags)
-{
-    bool bMatrixWasValid = m_bMatrixValid;
-
-    m_bMatrixInWorldSpace = false;
-    m_bMatrixValid = false;
-    m_bWorldBoxValid = false;
-
-    // If matrix was valid, invalidate all childs.
-    if (bMatrixWasValid)
-    {
-        if (m_lookatSource)
-        {
-            m_lookatSource->InvalidateTM(eObjectUpdateFlags_ParentChanged);
-        }
-
-        // Invalidate matrices off all child objects.
-        for (int i = 0; i < m_childs.size(); i++)
-        {
-            if (m_childs[i] != nullptr && m_childs[i]->m_bMatrixValid)
-            {
-                m_childs[i]->InvalidateTM(eObjectUpdateFlags_ParentChanged);
-            }
-        }
-        NotifyListeners(ON_TRANSFORM);
-
-        // Notify parent that we were modified.
-        if (m_parent)
-        {
-            m_parent->OnChildModified();
-        }
-    }
-
-    if (m_pTransformDelegate)
-    {
-        m_pTransformDelegate->MatrixInvalidated();
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetLocalTM(const Vec3& pos, const Quat& rotate, const Vec3& scale, int flags)
-{
-    const bool b1 = SetPos(pos, flags | eObjectUpdateFlags_DoNotInvalidate);
-    const bool b2 = SetRotation(rotate, flags | eObjectUpdateFlags_DoNotInvalidate);
-    const bool b3 = SetScale(scale, flags | eObjectUpdateFlags_DoNotInvalidate);
-
-    if (b1 || b2 || b3 || flags == eObjectUpdateFlags_Animated)
-    {
-        flags = (b1) ? (flags | eObjectUpdateFlags_PositionChanged) : (flags & (~eObjectUpdateFlags_PositionChanged));
-        flags = (b2) ? (flags | eObjectUpdateFlags_RotationChanged) : (flags & (~eObjectUpdateFlags_RotationChanged));
-        flags = (b3) ? (flags | eObjectUpdateFlags_ScaleChanged) : (flags & (~eObjectUpdateFlags_ScaleChanged));
-        InvalidateTM(flags);
-    }
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetLocalTM(const Matrix34& tm, int flags)
-{
-    if (m_lookat)
-    {
-        bool b1 = SetPos(tm.GetTranslation(), eObjectUpdateFlags_DoNotInvalidate);
-        flags = (b1) ? (flags | eObjectUpdateFlags_PositionChanged) : (flags & (~eObjectUpdateFlags_PositionChanged));
-        InvalidateTM(flags);
-    }
-    else
-    {
-        AffineParts affineParts;
-        affineParts.SpectralDecompose(tm);
-        SetLocalTM(affineParts.pos, affineParts.rot, affineParts.scale, flags);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetWorldPos(const Vec3& pos, int flags)
-{
-    if (GetParent())
-    {
-        Matrix34 invParentTM = GetParentAttachPointWorldTM();
-        invParentTM.Invert();
-        Vec3 posLocal = invParentTM * pos;
-        SetPos(posLocal, flags);
-    }
-    else
-    {
-        SetPos(pos, flags);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetWorldTM(const Matrix34& tm, int flags)
-{
-    if (GetParent())
-    {
-        Matrix34 invParentTM = GetParentAttachPointWorldTM();
-        invParentTM.Invert();
-        Matrix34 localTM = invParentTM * tm;
-        SetLocalTM(localTM, flags);
-    }
-    else
-    {
-        SetLocalTM(tm, flags);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::UpdateVisibility(bool bVisible)
-{
-    if (bVisible == CheckFlags(OBJFLAG_INVISIBLE))
-    {
-        if (IObjectManager* objectManager = GetObjectManager())
-        {
-            objectManager->InvalidateVisibleList();
-        }
-
-        if (!bVisible)
-        {
-            m_flags |= OBJFLAG_INVISIBLE;
-        }
-        else
-        {
-            m_flags &= ~OBJFLAG_INVISIBLE;
-        }
-
-        NotifyListeners(ON_VISIBILITY);
-
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::SetLookAt(CBaseObject* target)
-{
-    if (m_lookat == target)
-    {
-        return;
-    }
-
-    StoreUndo();
-
-    if (m_lookat)
-    {
-        // Unbind current lookat.
-        m_lookat->m_lookatSource = nullptr;
-    }
-    m_lookat = target;
-    if (m_lookat)
-    {
-        m_lookat->m_lookatSource = this;
-    }
-
-    InvalidateTM(0);
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CBaseObject::IsLookAtTarget() const
-{
-    return m_lookatSource != nullptr;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::AddEventListener(EventListener* listener)
-{
-    if (find(m_eventListeners.begin(), m_eventListeners.end(), listener) == m_eventListeners.end())
-    {
-        m_eventListeners.push_back(listener);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::RemoveEventListener(EventListener* listener)
-{
-    std::vector<EventListener*>::iterator listenerFound = find(m_eventListeners.begin(), m_eventListeners.end(), listener);
-    if (listenerFound != m_eventListeners.end())
-    {
-        (*listenerFound) = nullptr;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool IsBaseObjectEventCallbackNULL(CBaseObject::EventListener* listener) { return listener == nullptr; }
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::NotifyListeners(EObjectListenerEvent event)
-{
-    for (auto it = m_eventListeners.begin(); it != m_eventListeners.end(); ++it)
-    {
-        // Call listener callback.
-        if (*it)
-        {
-            (*it)->OnObjectEvent(this, event);
-        }
-    }
-
-    m_eventListeners.erase(remove_if(m_eventListeners.begin(), m_eventListeners.end(), IsBaseObjectEventCallbackNULL), std::end(m_eventListeners));
-}
-//////////////////////////////////////////////////////////////////////////
-bool CBaseObject::ConvertFromObject(CBaseObject* object)
-{
-    SetLocalTM(object->GetLocalTM());
-    SetName(object->GetName());
-    SetColor(object->GetColor());
-    m_flattenArea = object->m_flattenArea;
-    if (object->GetParent())
-    {
-        object->GetParent()->AttachChild(this);
-    }
-    return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CBaseObject::IsPotentiallyVisible() const
-{
-    if (CheckFlags(OBJFLAG_HIDDEN))
-    {
-        return false;
-    }
-    if (gSettings.objectHideMask & GetType())
-    {
-        return false;
-    }
-    return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-//! Analyze errors for this object.
-void CBaseObject::Validate(IErrorReport* report)
-{
-    // Checks for invalid values in base object.
-
-    //////////////////////////////////////////////////////////////////////////
-    // Check if position is bad.
-    const Vec3 pos = GetPos();
-
-    if (fabs(pos.x) > AZ::Constants::MaxFloatBeforePrecisionLoss ||
-        fabs(pos.y) > AZ::Constants::MaxFloatBeforePrecisionLoss ||
-        fabs(pos.z) > AZ::Constants::MaxFloatBeforePrecisionLoss)
-    {
-        // File Not found.
-        CErrorRecord err;
-        err.error = QStringLiteral("Object %1 have invalid position (%2,%3,%4)").arg(GetName()).arg(pos.x).arg(pos.y).arg(pos.z);
-        err.pObject = this;
-        report->ReportError(err);
-    }
-    //////////////////////////////////////////////////////////////////////////
-
-    float minScale = 0.01f;
-    float maxScale = 1000.0f;
-    //////////////////////////////////////////////////////////////////////////
-    // Check if position is bad.
-    if (m_scale.x < minScale || m_scale.x > maxScale ||
-        m_scale.y < minScale || m_scale.y > maxScale ||
-        m_scale.z < minScale || m_scale.z > maxScale)
-    {
-        // File Not found.
-        CErrorRecord err;
-        err.error = QStringLiteral("Object %1 have invalid scale (%2,%3,%4)").arg(GetName()).arg(m_scale.x).arg(m_scale.y).arg(m_scale.z);
-        err.pObject = this;
-        report->ReportError(err);
-    }
-    //////////////////////////////////////////////////////////////////////////
-};
-
-//////////////////////////////////////////////////////////////////////////
-void CBaseObject::GatherUsedResources(CUsedResources& resources)
-{
-    if (GetVarBlock())
-    {
-        GetVarBlock()->GatherUsedResources(resources);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CBaseObject::IsSimilarObject(CBaseObject* pObject)
-{
-    if (pObject->GetClassDesc() == GetClassDesc() && pObject->metaObject() == metaObject())
-    {
-        return true;
-    }
-    return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-EScaleWarningLevel CBaseObject::GetScaleWarningLevel() const
-{
-    EScaleWarningLevel scaleWarningLevel = eScaleWarningLevel_None;
-
-    const float kScaleThreshold = 0.001f;
-
-    if (fabs(m_scale.x - 1.0f) > kScaleThreshold
-        || fabs(m_scale.y - 1.0f) > kScaleThreshold
-        || fabs(m_scale.z - 1.0f) > kScaleThreshold)
-    {
-        if (fabs(m_scale.x - m_scale.y) < kScaleThreshold
-            && fabs(m_scale.y - m_scale.z) < kScaleThreshold)
-        {
-            scaleWarningLevel = eScaleWarningLevel_Rescaled;
-        }
-        else
-        {
-            scaleWarningLevel = eScaleWarningLevel_RescaledNonUniform;
-        }
-    }
-
-    return scaleWarningLevel;
-}
-
-//////////////////////////////////////////////////////////////////////////
-ERotationWarningLevel CBaseObject::GetRotationWarningLevel() const
-{
-    ERotationWarningLevel rotationWarningLevel = eRotationWarningLevel_None;
-
-    const float kRotationThreshold = 0.01f;
-
-    Ang3 eulerRotation = Ang3(GetRotation());
-
-    if (fabs(eulerRotation.x) > kRotationThreshold
-        || fabs(eulerRotation.y) > kRotationThreshold
-        || fabs(eulerRotation.z) > kRotationThreshold)
-    {
-        const float xRotationMod = fabs(fmod(eulerRotation.x, gf_PI / 2.0f));
-        const float yRotationMod = fabs(fmod(eulerRotation.y, gf_PI / 2.0f));
-        const float zRotationMod = fabs(fmod(eulerRotation.z, gf_PI / 2.0f));
-
-        if ((xRotationMod < kRotationThreshold || xRotationMod > (gf_PI / 2.0f - kRotationThreshold))
-            && (yRotationMod < kRotationThreshold || yRotationMod > (gf_PI / 2.0f - kRotationThreshold))
-            && (zRotationMod < kRotationThreshold || zRotationMod > (gf_PI / 2.0f - kRotationThreshold)))
-        {
-            rotationWarningLevel = eRotationWarningLevel_Rotated;
-        }
-        else
-        {
-            rotationWarningLevel = eRotationWarningLevel_RotatedNonRectangular;
-        }
-    }
-
-    return rotationWarningLevel;
-}
-
-bool CBaseObject::IsSkipSelectionHelper() const
-{
-    return false;
-}
-
-bool CBaseObject::CanBeHightlighted() const
-{
-    return true;
-}
-
-Matrix33 CBaseObject::GetWorldRotTM() const
-{
-    if (GetParent())
-    {
-        return GetParent()->GetWorldRotTM() * Matrix33(GetRotation());
-    }
-    return Matrix33(GetRotation());
-}
-
-Matrix33 CBaseObject::GetWorldScaleTM() const
-{
-    if (GetParent())
-    {
-        return GetParent()->GetWorldScaleTM() * Matrix33::CreateScale(GetScale());
-    }
-    return Matrix33::CreateScale(GetScale());
-}
-
-void CBaseObject::SetTransformDelegate(ITransformDelegate* pTransformDelegate)
-{
-    m_pTransformDelegate = pTransformDelegate;
-    InvalidateTM(0);
-}
-
-void CBaseObject::AddMember(CBaseObject* pMember, bool bKeepPos /*=true */)
-{
-    AttachChild(pMember, bKeepPos);
-}
-
-void CBaseObject::OnBeforeAreaChange()
-{
-    AABB aabb;
-    GetBoundBox(aabb);
-    GetIEditor()->GetGameEngine()->OnAreaModified(aabb);
-}
-
-#include <Objects/moc_BaseObject.cpp>

+ 0 - 648
Code/Editor/Objects/BaseObject.h

@@ -1,648 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-// Description : Definition of basic Editor object.
-
-
-#ifndef CRYINCLUDE_EDITOR_OBJECTS_BASEOBJECT_H
-#define CRYINCLUDE_EDITOR_OBJECTS_BASEOBJECT_H
-#pragma once
-
-
-#if !defined(Q_MOC_RUN)
-#include "Include/HitContext.h"
-#include "ClassDesc.h"
-#include "ObjectLoader.h"
-#include "Util/Variable.h"
-
-#include "AzCore/Math/Guid.h"
-
-#include "SandboxAPI.h"
-#include <Cry_Color.h>
-#include <Cry_Geo.h>
-#include <AzCore/std/containers/vector.h>
-#endif
-
-//////////////////////////////////////////////////////////////////////////
-// forward declarations.
-class CUndoBaseObject;
-class CObjectManager;
-class CObjectArchive;
-struct SRayHitInfo;
-class CPopupMenuItem;
-class QMenu;
-
-//////////////////////////////////////////////////////////////////////////
-typedef _smart_ptr<CBaseObject> CBaseObjectPtr;
-typedef std::vector<CBaseObjectPtr> TBaseObjects;
-
-//////////////////////////////////////////////////////////////////////////
-/*!
-This class used for object references remapping during cloning operation.
-*/
-class CObjectCloneContext
-{
-public:
-    //! Add cloned object.
-    SANDBOX_API void AddClone(CBaseObject* pFromObject, CBaseObject* pToObject);
-
-    //! Find cloned object for given object.
-    SANDBOX_API CBaseObject* FindClone(CBaseObject* pFromObject);
-
-    // Find id of the cloned object.
-    GUID ResolveClonedID(REFGUID guid);
-
-private:
-    typedef std::map<CBaseObject*, CBaseObject*> ObjectsMap;
-    ObjectsMap m_objectsMap;
-};
-
-//////////////////////////////////////////////////////////////////////////
-enum EObjectChangedOpType
-{
-    eOCOT_Empty = 0,
-    eOCOT_Modify,
-    eOCOT_ModifyTransform,
-    eOCOT_ModifyTransformInLibOnly,
-    eOCOT_Add,
-    eOCOT_Delete,
-    eOCOT_Count
-};
-
-struct SObjectChangedContext
-{
-    GUID m_modifiedObjectGlobalId; //! The object id globaly unique and used in ObjectManager
-    EObjectChangedOpType m_operation; //! What was the operation on the modified object
-    Matrix34 m_localTM; //! If we are in modify transform case this is the local TM info
-
-    SObjectChangedContext(EObjectChangedOpType optype)
-        : m_modifiedObjectGlobalId(GUID_NULL)
-        , m_operation(optype) { m_localTM.SetIdentity(); }
-    SObjectChangedContext()
-        : m_modifiedObjectGlobalId(GUID_NULL)
-        , m_operation(eOCOT_Empty) { m_localTM.SetIdentity(); }
-};
-
-//////////////////////////////////////////////////////////////////////////
-enum ObjectFlags
-{
-    OBJFLAG_SELECTED    = 0x0001,   //!< Object is selected. (Do not set this flag explicitly).
-    OBJFLAG_HIDDEN      = 0x0002,   //!< Object is hidden.
-    OBJFLAG_FROZEN      = 0x0004,   //!< Object is frozen (Visible but cannot be selected)
-    OBJFLAG_FLATTEN     = 0x0008,   //!< Flatten area around object.
-    OBJFLAG_SHARED      = 0x0010,   //!< This object is shared between missions.
-
-    OBJFLAG_KEEP_HEIGHT = 0x0040,   //!< This object should try to preserve height when snapping to flat objects.
-
-    OBJFLAG_NO_HITTEST  = 0x0080,   //!< This object will be not a target of ray hit test for deep selection mode.
-    OBJFLAG_IS_PARTICLE = 0x0100,
-    // object is in editing mode.
-    OBJFLAG_EDITING     = 0x01000,
-    OBJFLAG_ATTACHING   = 0x02000,  //!< Object in attaching to group mode.
-    OBJFLAG_DELETED     = 0x04000,  //!< This object is deleted.
-    OBJFLAG_HIGHLIGHT   = 0x08000,  //!< Object is highlighted (When mouse over).
-    OBJFLAG_INVISIBLE       = 0x10000,  //!< This object is invisible.
-    OBJFLAG_SUBOBJ_EDITING = 0x20000,   //!< This object is in the sub object editing mode.
-
-    OBJFLAG_SHOW_ICONONTOP = 0x100000,  //!< Icon will be drawn on top of the object.
-    OBJFLAG_HIDE_HELPERS = 0x200000,    //!< Helpers will be hidden.
-    OBJFLAG_DONT_SAVE   = 0x400000, //!< Object will not be saved with editor xml data.
-
-    OBJFLAG_PERSISTMASK = OBJFLAG_HIDDEN | OBJFLAG_FROZEN | OBJFLAG_FLATTEN,
-};
-
-#define ERF_GET_WRITABLE(flags) (flags)
-
-//////////////////////////////////////////////////////////////////////////
-//! Return values from CBaseObject::MouseCreateCallback method.
-enum MouseCreateResult
-{
-    MOUSECREATE_CONTINUE = 0,   //!< Continue placing this object.
-    MOUSECREATE_ABORT,              //!< Abort creation of this object.
-    MOUSECREATE_OK,                     //!< Accept this object.
-};
-
-// Flags used for object interaction
-enum EObjectUpdateFlags
-{
-    eObjectUpdateFlags_UserInput                = 0x00001,
-    eObjectUpdateFlags_PositionChanged  = 0x00002,
-    eObjectUpdateFlags_RotationChanged  = 0x00004,
-    eObjectUpdateFlags_ScaleChanged         = 0x00008,
-    eObjectUpdateFlags_DoNotInvalidate  = 0x00100, // Do not cause InvalidateTM call.
-    eObjectUpdateFlags_ParentChanged        = 0x00200, // When parent transformation change.
-    eObjectUpdateFlags_Undo                         = 0x00400, // When doing undo operation.
-    eObjectUpdateFlags_RestoreUndo          = 0x00800, // When doing RestoreUndo operation (This is different from normal undo).
-    eObjectUpdateFlags_Animated                 = 0x01000, // When doing animation.
-    eObjectUpdateFlags_MoveTool                 = 0x02000, // Transformation changed by the move tool
-    eObjectUpdateFlags_ScaleTool                = 0x04000, // Transformation changed by the scale tool
-    eObjectUpdateFlags_UserInputUndo        = 0x20000, // Undo operation related to user input rather than actual Undo
-};
-
-#define OBJECT_TEXTURE_ICON_SIZEX 32
-#define OBJECT_TEXTURE_ICON_SIZEY 32
-#define OBJECT_TEXTURE_ICON_SCALE 10.0f
-
-enum EScaleWarningLevel
-{
-    eScaleWarningLevel_None,
-    eScaleWarningLevel_Rescaled,
-    eScaleWarningLevel_RescaledNonUniform,
-};
-
-enum ERotationWarningLevel
-{
-    eRotationWarningLevel_None = 0,
-    eRotationWarningLevel_Rotated,
-    eRotationWarningLevel_RotatedNonRectangular,
-};
-
-// Used for external control of object position without changing the object's real position (e.g. TrackView)
-class ITransformDelegate
-{
-public:
-    // Called when matrix got invalidatd
-    virtual void MatrixInvalidated() = 0;
-
-    // Returns current delegated transforms, base transform is passed for delegates
-    // that need it, e.g. for overriding only X
-    virtual Vec3 GetTransformDelegatePos(const Vec3& basePos) const = 0;
-    virtual Quat GetTransformDelegateRotation(const Quat& baseRotation) const = 0;
-    virtual Vec3 GetTransformDelegateScale(const Vec3& baseScale) const = 0;
-
-    // Sets the delegate transform.
-    virtual void SetTransformDelegatePos(const Vec3& position) = 0;
-    virtual void SetTransformDelegateRotation(const Quat& rotation) = 0;
-    virtual void SetTransformDelegateScale(const Vec3& scale) = 0;
-
-    // If those return true the base object uses its own transform instead
-    virtual bool IsPositionDelegated() const = 0;
-    virtual bool IsRotationDelegated() const = 0;
-    virtual bool IsScaleDelegated() const = 0;
-};
-
-/*!
- *  CBaseObject is the base class for all objects which can be placed in map.
- *  Every object belongs to class specified by ClassDesc.
- *  Specific object classes must override this class, to provide specific functionality.
- *  Objects are reference counted and only destroyed when last reference to object
- *  is destroyed.
- *
- */
-class SANDBOX_API CBaseObject
-    : public CVarObject
-{
-    Q_OBJECT
-public:
-    //! Events sent by object to EventListeners
-    enum EObjectListenerEvent
-    {
-        ON_DELETE = 0,// Sent after object was deleted from object manager.
-        ON_ADD,       // Sent after object was added to object manager.
-        ON_SELECT,      // Sent when objects becomes selected.
-        ON_UNSELECT,    // Sent when objects unselected.
-        ON_TRANSFORM, // Sent when object transformed.
-        ON_VISIBILITY, // Sent when object visibility changes.
-        ON_RENAME,      // Sent when object changes name.
-        ON_CHILDATTACHED, // Sent when object gets a child attached.
-        ON_PREDELETE, // Sent before an object is processed to be deleted from the object manager.
-        ON_CHILDDETACHED, // Sent when the object gets a child detached.
-        ON_DETACHFROMPARENT, // Sent when the object detaches from a parent.
-        ON_PREATTACHED, // Sent when this object is about to get attached and is already in relative space
-        ON_PREATTACHEDKEEPXFORM, // Sent when this object is about to get attached and needs to stay in place
-        ON_ATTACHED, // Sent when this object got attached
-        ON_PREDETACHED, // Sent when this object is about to get detached and is already in relative space
-        ON_PREDETACHEDKEEPXFORM, // Sent when this object is about to get detached and needs to stay in place
-        ON_DETACHED, // Sent when this object got detached
-        ON_PREFAB_CHANGED, // Sent when prefab representation has been changed
-    };
-
-    //! This callback will be called if object is deleted.
-    struct EventListener
-    {
-        virtual void OnObjectEvent(CBaseObject*, int) = 0;
-    };
-
-    //! Childs structure.
-    typedef std::vector<_smart_ptr<CBaseObject> > Childs;
-
-    //! Retrieve class description of this object.
-    CObjectClassDesc*   GetClassDesc() const { return m_classDesc; };
-
-    static bool IsEnabled() { return true; }
-
-    /** Check if both object are of same class.
-    */
-    virtual ObjectType GetType() const
-    {
-        return m_classDesc->GetObjectType();
-    };
-    QString GetTypeName() const;
-
-    //////////////////////////////////////////////////////////////////////////
-    // Flags.
-    //////////////////////////////////////////////////////////////////////////
-    void SetFlags(int flags) { m_flags |= flags; };
-    void ClearFlags(int flags) { m_flags &= ~flags; };
-    bool CheckFlags(int flags) const { return (m_flags & flags) != 0; };
-
-    //////////////////////////////////////////////////////////////////////////
-    // Hidden ID
-    //////////////////////////////////////////////////////////////////////////
-    static const uint64 s_invalidHiddenID = 0;
-
-    //! Returns true if object hidden.
-    bool IsHidden() const;
-    //! Returns true if object frozen.
-    virtual bool IsFrozen() const;
-    //! Returns true if object is shared between missions.
-    bool IsShared() const { return CheckFlags(OBJFLAG_SHARED); }
-
-    //! Returns true if object is selected.
-    virtual bool IsSelected() const { return CheckFlags(OBJFLAG_SELECTED); }
-    //! Returns true if object can be selected.
-    virtual bool IsSelectable() const;
-
-    // Return texture icon.
-    int GetTextureIcon() const { return m_nTextureIcon; }
-    void SetTextureIcon(int nTexIcon) { m_nTextureIcon = nTexIcon; }
-
-    //! Set object hidden status.
-    virtual void SetHidden(bool bHidden, bool bAnimated = false);
-    //! Set object frozen status.
-    virtual void SetFrozen(bool bFrozen);
-    //! Set object selected status.
-    virtual void SetSelected(bool bSelect);
-    //! Set object highlighted (Note: not selected)
-    virtual void SetHighlight(bool bHighlight);
-    //! Check if object is highlighted.
-    bool IsHighlighted() const { return CheckFlags(OBJFLAG_HIGHLIGHT); }
-    //! Check if the object is isolated when the editor is in Isolation Mode
-    virtual bool IsIsolated() const { return false; }
-
-    // Tooltip is rendered in CObjectMode, when you hover the object
-    virtual QString GetTooltip() const { return QString(); }
-
-    //////////////////////////////////////////////////////////////////////////
-    // Object Id.
-    //////////////////////////////////////////////////////////////////////////
-    //! Get unique object id.
-    //! Every object will have its own unique id assigned.
-    REFGUID GetId() const { return m_guid; };
-
-    //////////////////////////////////////////////////////////////////////////
-    // Name.
-    //////////////////////////////////////////////////////////////////////////
-    //! Get name of object.
-    const QString& GetName() const;
-
-    //! Change name of object.
-    virtual void SetName(const QString& name);
-    //! Set object name and make sure it is unique.
-    void SetUniqueName(const QString& name);
-    //! Generate unique object name based on a base name (e.g. class name)
-    virtual void GenerateUniqueName();
-
-    //////////////////////////////////////////////////////////////////////////
-    // Geometry.
-    //////////////////////////////////////////////////////////////////////////
-    //! Set object position.
-    virtual bool SetPos(const Vec3& pos, int flags = 0);
-
-    //! Set object rotation angles.
-    virtual bool SetRotation(const Quat& rotate, int flags = 0);
-
-    //! Set object scale.
-    virtual bool SetScale(const Vec3& scale, int flags = 0);
-
-    //! Get object position.
-    const Vec3 GetPos() const;
-
-    //! Get object local rotation quaternion.
-    const Quat GetRotation() const;
-
-    //! Get object scale.
-    const Vec3 GetScale() const;
-
-    //! Set flatten area.
-    void SetArea(float area);
-    float GetArea() const { return m_flattenArea; };
-
-    //! Assign display color to the object.
-    virtual void    ChangeColor(const QColor& color);
-    //! Get object color.
-    QColor GetColor() const { return m_color; };
-
-    // Set current transform delegate. Pass nullptr to unset.
-    virtual void SetTransformDelegate(ITransformDelegate* pTransformDelegate);
-    ITransformDelegate* GetTransformDelegate() const { return m_pTransformDelegate; }
-
-    //////////////////////////////////////////////////////////////////////////
-    // CHILDS
-    //////////////////////////////////////////////////////////////////////////
-
-    //! Return true if have attached childs.
-    size_t GetChildCount() const { return m_childs.size(); }
-
-    //! Get child by index.
-    CBaseObject* GetChild(size_t const i) const;
-    //! Return parent node if exist.
-    CBaseObject* GetParent() const { return m_parent; };
-    //! Attach new child node.
-    //! @param bKeepPos if true Child node will keep its world space position.
-    virtual void AttachChild(CBaseObject* child, bool bKeepPos = true);
-    //! Attach new child node when the object is not a sort of a group object like AttachChild()
-    //! but if the object is a group object, the group object should be set to all children objects recursively.
-    //! and if the object is a prefab object, the prefab object should be loaded from the prefabitem.
-    //! @param bKeepPos if true Child node will keep its world space position.
-    virtual void AddMember(CBaseObject* pMember, bool bKeepPos = true);
-    //! Detach all childs of this node.
-    virtual void DetachAll(bool bKeepPos = true);
-    // Detach this node from parent.
-    virtual void DetachThis(bool bKeepPos = true);
-
-    //////////////////////////////////////////////////////////////////////////
-    // MATRIX
-    //////////////////////////////////////////////////////////////////////////
-    //! Get objects' local transformation matrix.
-    Matrix34 GetLocalTM() const { Matrix34 tm; CalcLocalTM(tm); return tm; };
-
-    //! Get objects' world-space transformation matrix.
-    const Matrix34& GetWorldTM() const;
-
-    // Gets matrix of parent attachment point
-    virtual Matrix34 GetParentAttachPointWorldTM() const;
-
-    //! Set position in world space.
-    virtual void SetWorldPos(const Vec3& pos, int flags = 0);
-
-    //! Get position in world space.
-    Vec3 GetWorldPos() const { return GetWorldTM().GetTranslation(); };
-
-    //! Set xform of object given in world space.
-    virtual void SetWorldTM(const Matrix34& tm, int flags = 0);
-
-    //! Set object xform.
-    virtual void SetLocalTM(const Matrix34& tm, int flags = 0);
-
-    // Set object xform.
-    virtual void SetLocalTM(const Vec3& pos, const Quat& rotate, const Vec3& scale, int flags = 0);
-
-    //////////////////////////////////////////////////////////////////////////
-    // Interface to be implemented in plugins.
-    //////////////////////////////////////////////////////////////////////////
-
-    //! Perform intersection testing of this object.
-    //! Return true if was hit.
-    virtual bool HitTest([[maybe_unused]] HitContext& hc) { return false; };
-
-    //! Perform intersection testing of this object with rectangle.
-    //! Return true if was hit.
-    virtual bool HitTestRect(HitContext& hc);
-
-    //! Get bounding box of object in world coordinate space.
-    virtual void GetBoundBox(AABB& box);
-
-    //! Get bounding box of object in local object space.
-    virtual void GetLocalBounds(AABB& box);
-
-    //! Called after some parameter been modified.
-    virtual void SetModified(bool boModifiedTransformOnly);
-
-    //! Called when visibility of this object changes.
-    //! Derived class may override this to respond to new visibility setting.
-    virtual void UpdateVisibility(bool bVisible);
-
-    //! Serialize object to/from xml.
-    //! @param xmlNode XML node to load/save serialized data to.
-    //! @param bLoading true if loading data from xml.
-    //! @param bUndo true if loading or saving data for Undo/Redo purposes.
-    virtual void Serialize(CObjectArchive& ar);
-
-    // Post load called after all objects where completely loaded.
-    virtual void PostLoad([[maybe_unused]] CObjectArchive& ar) {};
-
-    //! Export object to xml.
-    //! Return created object node in xml.
-    virtual XmlNodeRef Export(const QString& levelPath, XmlNodeRef& xmlNode);
-
-    //! Handle events received by object.
-    //! Override in derived classes, to handle specific events.
-    virtual void OnEvent(ObjectEvent event);
-
-    //////////////////////////////////////////////////////////////////////////
-    // LookAt Target.
-    //////////////////////////////////////////////////////////////////////////
-    virtual void SetLookAt(CBaseObject* target);
-    CBaseObject* GetLookAt() const { return m_lookat; };
-    //! Returns true if this object is a look-at target.
-    bool IsLookAtTarget() const;
-
-    IObjectManager* GetObjectManager() const;
-
-    //! Store undo information for this object.
-    void StoreUndo(bool minimal = false, int flags = 0);
-
-    //! Add event listener callback.
-    void AddEventListener(EventListener* listener);
-    //! Remove event listener callback.
-    void RemoveEventListener(EventListener* listener);
-
-    //////////////////////////////////////////////////////////////////////////
-    //! Analyze errors for this object.
-    virtual void Validate(IErrorReport* report);
-
-    //////////////////////////////////////////////////////////////////////////
-    //! Gather resources of this object.
-    virtual void GatherUsedResources(CUsedResources& resources);
-
-    //////////////////////////////////////////////////////////////////////////
-    //! Check if specified object is very similar to this one.
-    virtual bool IsSimilarObject(CBaseObject* pObject);
-
-    //! In This function variables of the object must be initialized.
-    virtual void InitVariables() {};
-
-    bool CanBeHightlighted() const;
-    bool IsSkipSelectionHelper() const;
-
-    // Invalidates cached transformation matrix.
-    // nWhyFlags - Flags that indicate the reason for matrix invalidation.
-    virtual void InvalidateTM(int nWhyFlags);
-
-protected:
-    friend class CObjectManager;
-
-    //! Ctor is protected to restrict direct usage.
-    CBaseObject();
-    //! Dtor is protected to restrict direct usage.
-    virtual ~CBaseObject();
-
-    //! Initialize Object.
-    //! If previous object specified it must be of exactly same class as this object.
-    //! All data is copied from previous object.
-    //! Optional file parameter specify initial object or script for this object.
-    virtual bool Init(IEditor* ie, CBaseObject* prev, const QString& file);
-
-    //! Must be implemented by derived class to create game related objects.
-    virtual bool CreateGameObject() { return true; };
-
-    /** Called when object is about to be deleted.
-        All Game resources should be freed in this function.
-    */
-    virtual void Done();
-
-    //! Call this to delete an object.
-    virtual void DeleteThis() = 0;
-
-    //! Called when object need to be converted from different object.
-    virtual bool ConvertFromObject(CBaseObject* object);
-
-    //! Called when local transformation matrix is calculated.
-    void CalcLocalTM(Matrix34& tm) const;
-
-    //! Called when child position changed.
-    virtual void OnChildModified() {};
-
-    //! Remove child from our childs list.
-    virtual void RemoveChild(CBaseObject* node);
-
-    //! Resolve parent from callback.
-    void ResolveParent(CBaseObject* object);
-    void SetColor(const QColor& color);
-
-    // Do basic intersection tests
-    virtual bool IntersectRectBounds(const AABB& bbox);
-    virtual bool IntersectRayBounds(const Ray& ray);
-
-    // Do hit testing on specified bounding box.
-    // Function can be used by derived classes.
-    bool HitTestRectBounds(HitContext& hc, const AABB& box);
-
-    // Do helper hit testing taking child objects into account (e.g. opened prefab)
-    virtual bool HitHelperTestForChildObjects([[maybe_unused]] HitContext& hc) { return false; }
-
-    CBaseObject* FindObject(REFGUID id) const;
-
-    //! Notify all listeners about event.
-    void NotifyListeners(EObjectListenerEvent event);
-
-    //! Only used by ObjectManager.
-    bool IsPotentiallyVisible() const;
-
-    const Vec3& GetTextureIconDrawPos(){ return m_vDrawIconPos; };
-    int GetTextureIconFlags(){ return m_nIconFlags; };
-
-    Matrix33 GetWorldRotTM() const;
-    Matrix33 GetWorldScaleTM() const;
-
-    AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-    //! World space object's position.
-    Vec3 m_pos;
-    //! Object's Rotation angles.
-    Quat m_rotate;
-    //! Object's scale value.
-    Vec3 m_scale;
-    AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-
-private:
-    friend class CUndoBaseObject;
-    friend class CObjectArchive;
-
-    //! Set class description for this object,
-    //! Only called once after creation by ObjectManager.
-    void SetClassDesc(CObjectClassDesc* classDesc);
-
-    EScaleWarningLevel GetScaleWarningLevel() const;
-    ERotationWarningLevel GetRotationWarningLevel() const;
-
-    bool IsInSelectionBox() const { return m_bInSelectionBox; }
-
-    void SetId(REFGUID guid) { m_guid = guid; }
-
-    // Before translating, rotating or scaling, we ask our subclasses for whether
-    // they want us to notify CGameEngine of the upcoming change of our AABB.
-    virtual bool ShouldNotifyOfUpcomingAABBChanges() const { return false; }
-
-    // Notifies the CGameEngine about an upcoming change of our AABB.
-    void OnBeforeAreaChange();
-
-    //////////////////////////////////////////////////////////////////////////
-    // PRIVATE FIELDS
-    //////////////////////////////////////////////////////////////////////////
-private:
-    AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-    //Default ObjType
-    ObjectType m_objType;
-
-    //! Unique object Id.
-    GUID m_guid;
-
-    //! Flags of this object.
-    int m_flags;
-
-    //! Id of the texture icon for this object.
-    int m_nTextureIcon;
-
-    //! Display color.
-    QColor m_color;
-
-    //! World transformation matrix of this object.
-    mutable Matrix34 m_worldTM;
-
-    //////////////////////////////////////////////////////////////////////////
-    //! Look At target entity.
-    _smart_ptr<CBaseObject> m_lookat;
-    //! If we are lookat target. this is pointer to source.
-    CBaseObject* m_lookatSource;
-
-    //////////////////////////////////////////////////////////////////////////
-    //! Area radius around object, where terrain is flatten and static objects removed.
-    float m_flattenArea;
-    //! Object's name.
-    QString m_name;
-    //! Class description for this object.
-    CObjectClassDesc*   m_classDesc;
-
-    //! Number of reference to this object.
-    //! When reference count reach zero, object will delete itself.
-    int m_numRefs;
-
-    int m_nIconFlags;
-
-    //////////////////////////////////////////////////////////////////////////
-    //! Child animation nodes.
-    Childs m_childs;
-    //! Pointer to parent node.
-    mutable CBaseObject* m_parent;
-
-    AABB m_worldBounds;
-
-    // The transform delegate
-    ITransformDelegate* m_pTransformDelegate;
-
-    //////////////////////////////////////////////////////////////////////////
-    // Listeners.
-    std::vector<EventListener*> m_eventListeners;
-
-    //////////////////////////////////////////////////////////////////////////
-    // Flags and bit masks.
-    //////////////////////////////////////////////////////////////////////////
-    mutable uint32 m_bMatrixInWorldSpace : 1;
-    mutable uint32 m_bMatrixValid : 1;
-    mutable uint32 m_bWorldBoxValid : 1;
-    uint32 m_bInSelectionBox : 1;
-
-    Vec3 m_vDrawIconPos;
-    AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-};
-
-Q_DECLARE_METATYPE(CBaseObject*)
-
-#endif // CRYINCLUDE_EDITOR_OBJECTS_BASEOBJECT_H

+ 0 - 67
Code/Editor/Objects/ClassDesc.h

@@ -1,67 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-// Description : Class description of CBaseObject
-
-
-#ifndef CRYINCLUDE_EDITOR_OBJECTS_CLASSDESC_H
-#define CRYINCLUDE_EDITOR_OBJECTS_CLASSDESC_H
-#pragma once
-
-#include "Plugin.h"
-#include "Include/ObjectEvent.h"
-#include <QString>
-
-class CXmlArchive;
-
-AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
-//! Virtual base class description of CBaseObject.
-//! Override this class to create specific Class descriptions for every base object class.
-//! Type name is specified like this:
-//! Category\Type ex: "TagPoint\Respawn"
-class SANDBOX_API CObjectClassDesc
-    : public IClassDesc
-{
-AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
-public:
-    CObjectClassDesc()
-    {
-        m_nTextureIcon = 0;
-    }
-
-    //! Release class description.
-    virtual ObjectType GetObjectType() = 0;
-    virtual QObject* CreateQObject() const { return nullptr; }
-    //! If this function return not empty string,object of this class must be created with file.
-    //! Return root path where to look for files this object supports.
-    //! Also wild card for files can be specified, ex: Objects\*.cgf
-    virtual QString GetFileSpec()
-    {
-        return "";
-    }
-
-    virtual ESystemClassID SystemClassID() { return ESYSTEM_CLASS_OBJECT; };
-    virtual void ShowAbout() {};
-    virtual bool CanExitNow() { return true; }
-    virtual void Serialize([[maybe_unused]] CXmlArchive& ar) {};
-    //! Ex. Object with creation order 200 will be created after any object with order 100.
-    virtual int GameCreationOrder() { return 100; };
-    virtual QString GetTextureIcon() { return QString(); };
-    virtual bool RenderTextureOnTop() const { return false; }
-
-    virtual QString GetToolClassName() { return "EditTool.ObjectCreate"; }
-
-    QString MenuSuggestion() { return{}; }
-    QString Tooltip() { return{}; }
-    QString Description() { return{}; }
-
-private:
-    int m_nTextureIcon;
-};
-#endif // CRYINCLUDE_EDITOR_OBJECTS_CLASSDESC_H

+ 0 - 1710
Code/Editor/Objects/EntityObject.cpp

@@ -1,1710 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-// Description : StaticObject implementation.
-
-
-#include "EditorDefs.h"
-
-#include "EntityObject.h"
-
-// AzToolsFramework
-#include <AzToolsFramework/API/ComponentEntityObjectBus.h>
-
-// Editor
-#include "Settings.h"
-#include "Viewport.h"
-#include "Include/IObjectManager.h"
-#include "Objects/ObjectManager.h"
-#include "ViewManager.h"
-#include "AnimationContext.h"
-#include "HitContext.h"
-
-static constexpr int VIEW_DISTANCE_MULTIPLIER_MAX = 100;
-
-namespace
-{
-    CEntityObject* s_pPropertyPanelEntityObject = nullptr;
-};
-
-//////////////////////////////////////////////////////////////////////////
-CEntityObject::CEntityObject()
-{
-    m_bLoadFailed = false;
-
-    m_box.min.Set(0, 0, 0);
-    m_box.max.Set(0, 0, 0);
-
-    m_proximityRadius = 0;
-    m_innerRadius = 0;
-    m_outerRadius = 0;
-    m_boxSizeX = 1;
-    m_boxSizeY = 1;
-    m_boxSizeZ = 1;
-    m_bProjectInAllDirs = false;
-    m_bProjectorHasTexture = false;
-
-    m_bDisplayBBox = true;
-    m_bBBoxSelection = false;
-    m_bDisplaySolidBBox = false;
-    m_bDisplayAbsoluteRadius = false;
-    m_bIconOnTop = false;
-    m_bDisplayArrow = false;
-    m_entityId = 0;
-    m_bVisible = true;
-    m_bCalcPhysics = true;
-    m_bLight = false;
-    m_bAreaLight = false;
-    m_fAreaWidth = 1;
-    m_fAreaHeight = 1;
-    m_fAreaLightSize = 0.05f;
-    m_bBoxProjectedCM = false;
-    m_fBoxWidth = 1;
-    m_fBoxHeight = 1;
-    m_fBoxLength = 1;
-
-    m_bEnableReload = true;
-
-    m_lightColor = Vec3(1, 1, 1);
-
-    SetColor(QColor(255, 255, 0));
-
-    // Init Variables.
-    mv_castShadow = true;
-    mv_outdoor          =   false;
-    mv_recvWind = false;
-    mv_renderNearest = false;
-    mv_noDecals = false;
-
-    mv_createdThroughPool = false;
-
-    mv_obstructionMultiplier = 1.f;
-    mv_obstructionMultiplier.SetLimits(0.f, 1.f, 0.01f);
-
-    mv_hiddenInGame = false;
-    mv_ratioLOD = 100;
-    mv_viewDistanceMultiplier = 1.0f;
-    mv_ratioLOD.SetLimits(0, 255);
-    mv_viewDistanceMultiplier.SetLimits(0.0f, VIEW_DISTANCE_MULTIPLIER_MAX);
-
-    m_physicsState = nullptr;
-
-    m_attachmentType = eAT_Pivot;
-
-    // cache all the variable callbacks, must match order of enum defined in header
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaHeightChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaLightChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaLightSizeChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaWidthChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxHeightChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxLengthChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxProjectionChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxSizeXChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxSizeYChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxSizeZChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxWidthChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnColorChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnInnerRadiusChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnOuterRadiusChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnProjectInAllDirsChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnProjectorFOVChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnProjectorTextureChange(var); });
-    m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnRadiusChange(var); });
-}
-
-CEntityObject::~CEntityObject()
-{
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::InitVariables()
-{
-    mv_castShadow.SetFlags(mv_castShadow.GetFlags() | IVariable::UI_INVISIBLE);
-
-    AddVariable(mv_outdoor, "OutdoorOnly", tr("Outdoor Only"));
-    AddVariable(mv_castShadow, "CastShadow", tr("Cast Shadow"));
-
-    AddVariable(mv_ratioLOD, "LodRatio");
-    AddVariable(mv_viewDistanceMultiplier, "ViewDistanceMultiplier");
-    AddVariable(mv_hiddenInGame, "HiddenInGame");
-    AddVariable(mv_recvWind, "RecvWind", tr("Receive Wind"));
-
-    // [artemk]: Add RenderNearest entity param because of animator request.
-    // This will cause that slot zero is rendered with ENTITY_SLOT_RENDER_NEAREST flag raised.
-    AddVariable(mv_renderNearest, "RenderNearest");
-    mv_renderNearest.SetDescription("Used to eliminate z-buffer artifacts when rendering from first person view");
-    AddVariable(mv_noDecals, "NoStaticDecals");
-
-    AddVariable(mv_createdThroughPool, "CreatedThroughPool", tr("Created Through Pool"));
-
-    AddVariable(mv_obstructionMultiplier, "ObstructionMultiplier", tr("Obstruction Multiplier"));
-}
-
-//////////////////////////////////////////////////////////////////////////&
-void CEntityObject::Done()
-{
-    DeleteEntity();
-
-    ReleaseEventTargets();
-    RemoveAllEntityLinks();
-
-    CBaseObject::Done();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::FreeGameData()
-{
-    DeleteEntity();
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CEntityObject::Init(IEditor* pEditor, CBaseObject* pPrev, const QString& file)
-{
-    CBaseObject::Init(pEditor, pPrev, file);
-
-    if (pPrev)
-    {
-        CEntityObject* pPreviousEntity = ( CEntityObject* )pPrev;
-
-        // Clone Properties.
-        if (pPreviousEntity->m_pProperties)
-        {
-            m_pProperties = CloneProperties(pPreviousEntity->m_pProperties);
-        }
-        if (pPreviousEntity->m_pProperties2)
-        {
-            m_pProperties2 = CloneProperties(pPreviousEntity->m_pProperties2);
-        }
-
-        mv_createdThroughPool = pPreviousEntity->mv_createdThroughPool;
-    }
-    else if (!file.isEmpty())
-    {
-        SetUniqueName(file);
-        m_entityClass = file;
-    }
-
-    ResetCallbacks();
-
-    return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::SetTransformDelegate(ITransformDelegate* pTransformDelegate)
-{
-    CBaseObject::SetTransformDelegate(pTransformDelegate);
-
-    if (this == s_pPropertyPanelEntityObject)
-    {
-        return;
-    }
-
-    ForceVariableUpdate();
-    ResetCallbacks();
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CEntityObject::ConvertFromObject(CBaseObject* object)
-{
-    CBaseObject::ConvertFromObject(object);
-
-    if (qobject_cast<CEntityObject*>(object))
-    {
-        CEntityObject* pObject = ( CEntityObject* )object;
-
-        mv_outdoor = pObject->mv_outdoor;
-        mv_ratioLOD = pObject->mv_ratioLOD;
-        mv_viewDistanceMultiplier = pObject->mv_viewDistanceMultiplier;
-        mv_hiddenInGame = pObject->mv_hiddenInGame;
-        mv_recvWind = pObject->mv_recvWind;
-        mv_renderNearest = pObject->mv_renderNearest;
-        mv_noDecals = pObject->mv_noDecals;
-
-        mv_createdThroughPool = pObject->mv_createdThroughPool;
-
-        mv_obstructionMultiplier = pObject->mv_obstructionMultiplier;
-        return true;
-    }
-
-    return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::GetLocalBounds(AABB& box)
-{
-    box = m_box;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CEntityObject::HitTest(HitContext& hc)
-{
-    if (!hc.b2DViewport)
-    {
-        // Test 3D viewport.
-    }
-
-    //////////////////////////////////////////////////////////////////////////
-    if ((m_bDisplayBBox && gSettings.viewports.bShowTriggerBounds) || hc.b2DViewport || (m_bDisplayBBox && m_bBBoxSelection))
-    {
-        float hitEpsilon = hc.view->GetScreenScaleFactor(GetWorldPos()) * 0.01f;
-        float hitDist;
-
-        float fScale = GetScale().x;
-        AABB boxScaled;
-        boxScaled.min = m_box.min * fScale;
-        boxScaled.max = m_box.max * fScale;
-
-        Matrix34 invertWTM = GetWorldTM();
-        invertWTM.Invert();
-
-        Vec3 xformedRaySrc = invertWTM.TransformPoint(hc.raySrc);
-        Vec3 xformedRayDir = invertWTM.TransformVector(hc.rayDir);
-        xformedRayDir.Normalize();
-
-        {
-            Vec3 intPnt;
-            if (m_bBBoxSelection)
-            {
-                // Check intersection with bbox.
-                if (Intersect::Ray_AABB(xformedRaySrc, xformedRayDir, boxScaled, intPnt))
-                {
-                    hc.dist = xformedRaySrc.GetDistance(intPnt);
-                    hc.object = this;
-                    return true;
-                }
-            }
-            else
-            {
-                // Check intersection with bbox edges.
-                if (Intersect::Ray_AABBEdge(xformedRaySrc, xformedRayDir, boxScaled, hitEpsilon, hitDist, intPnt))
-                {
-                    hc.dist = xformedRaySrc.GetDistance(intPnt);
-                    hc.object = this;
-                    return true;
-                }
-            }
-        }
-    }
-
-    return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CEntityObject::HitTestRect(HitContext& hc)
-{
-    bool bResult = CBaseObject::HitTestRect(hc);
-
-    if (bResult)
-    {
-        hc.object = this;
-    }
-
-    return bResult;
-}
-
-//////////////////////////////////////////////////////////////////////////
-IVariable* CEntityObject::FindVariableInSubBlock(CVarBlockPtr& properties, IVariable* pSubBlockVar, const char* pVarName)
-{
-    IVariable* pVar = pSubBlockVar ? pSubBlockVar->FindVariable(pVarName) : properties->FindVariable(pVarName);
-    return pVar;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::AdjustLightProperties(CVarBlockPtr& properties, const char* pSubBlock)
-{
-    IVariable* pSubBlockVar = pSubBlock ? properties->FindVariable(pSubBlock) : nullptr;
-
-    if (IVariable* pRadius = FindVariableInSubBlock(properties, pSubBlockVar, "Radius"))
-    {
-        // The value of 0.01 was found through asking Crysis 2 designer
-        // team.
-        pRadius->SetLimits(0.01f, 100.0f, 0.0f, true, false);
-    }
-
-    if (IVariable* pBoxSizeX = FindVariableInSubBlock(properties, pSubBlockVar, "BoxSizeX"))
-    {
-        pBoxSizeX->SetLimits(0.01f, 100.0f, 0.0f, true, false);
-    }
-
-    if (IVariable* pBoxSizeY = FindVariableInSubBlock(properties, pSubBlockVar, "BoxSizeY"))
-    {
-        pBoxSizeY->SetLimits(0.01f, 100.0f, 0.0f, true, false);
-    }
-
-    if (IVariable* pBoxSizeZ = FindVariableInSubBlock(properties, pSubBlockVar, "BoxSizeZ"))
-    {
-        pBoxSizeZ->SetLimits(0.01f, 100.0f, 0.0f, true, false);
-    }
-
-    if (IVariable* pProjectorFov = FindVariableInSubBlock(properties, pSubBlockVar, "fProjectorFov"))
-    {
-        pProjectorFov->SetLimits(0.01f, 180.0f, 0.0f, true, true);
-    }
-
-    if (IVariable* pPlaneWidth = FindVariableInSubBlock(properties, pSubBlockVar, "fPlaneWidth"))
-    {
-        pPlaneWidth->SetLimits(0.01f, 10.0f, 0.0f, true, false);
-        pPlaneWidth->SetHumanName("SourceWidth");
-    }
-
-    if (IVariable* pPlaneHeight = FindVariableInSubBlock(properties, pSubBlockVar, "fPlaneHeight"))
-    {
-        pPlaneHeight->SetLimits(0.01f, 10.0f, 0.0f, true, false);
-        pPlaneHeight->SetHumanName("SourceDiameter");
-    }
-
-    // For backwards compatibility with old lights (avoids changing settings in Lua which will break loading compatibility).
-    // Todo: Change the Lua property names on the next big light refactor.
-    if (IVariable* pAreaLight = FindVariableInSubBlock(properties, pSubBlockVar, "bAreaLight"))
-    {
-        pAreaLight->SetHumanName("PlanarLight");
-    }
-
-    if (IVariable* pCastShadowVarLegacy = FindVariableInSubBlock(properties, pSubBlockVar, "bCastShadow"))
-    {
-        pCastShadowVarLegacy->SetFlags(pCastShadowVarLegacy->GetFlags() | IVariable::UI_INVISIBLE);
-        const QString zeroPrefix("0");
-        if (!pCastShadowVarLegacy->GetDisplayValue().startsWith(zeroPrefix))
-        {
-            pCastShadowVarLegacy->SetDisplayValue(zeroPrefix);
-        }
-    }
-
-    if (IVariable* pFade = FindVariableInSubBlock(properties, pSubBlockVar, "vFadeDimensionsLeft"))
-    {
-        pFade->SetFlags(pFade->GetFlags() | IVariable::UI_INVISIBLE);
-    }
-
-    if (IVariable* pFade = FindVariableInSubBlock(properties, pSubBlockVar, "vFadeDimensionsRight"))
-    {
-        pFade->SetFlags(pFade->GetFlags() | IVariable::UI_INVISIBLE);
-    }
-
-    if (IVariable* pFade = FindVariableInSubBlock(properties, pSubBlockVar, "vFadeDimensionsNear"))
-    {
-        pFade->SetFlags(pFade->GetFlags() | IVariable::UI_INVISIBLE);
-    }
-
-    if (IVariable* pFade = FindVariableInSubBlock(properties, pSubBlockVar, "vFadeDimensionsFar"))
-    {
-        pFade->SetFlags(pFade->GetFlags() | IVariable::UI_INVISIBLE);
-    }
-
-    if (IVariable* pFade = FindVariableInSubBlock(properties, pSubBlockVar, "vFadeDimensionsTop"))
-    {
-        pFade->SetFlags(pFade->GetFlags() | IVariable::UI_INVISIBLE);
-    }
-
-    if (IVariable* pFade = FindVariableInSubBlock(properties, pSubBlockVar, "vFadeDimensionsBottom"))
-    {
-        pFade->SetFlags(pFade->GetFlags() | IVariable::UI_INVISIBLE);
-    }
-
-    if (IVariable* pSortPriority = FindVariableInSubBlock(properties, pSubBlockVar, "SortPriority"))
-    {
-        pSortPriority->SetLimits(0, 255, 1, true, true);
-    }
-
-    if (IVariable* pAttenFalloffMax = FindVariableInSubBlock(properties, pSubBlockVar, "fAttenuationFalloffMax"))
-    {
-        pAttenFalloffMax->SetLimits(0.0f, 1.0f, 1.0f / 255.0f, true, true);
-    }
-
-    if (IVariable* pVer = FindVariableInSubBlock(properties, pSubBlockVar, "_nVersion"))
-    {
-        int version = -1;
-        pVer->Get(version);
-        if (version == -1)
-        {
-            version++;
-            pVer->Set(version);
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::SetName(const QString& name)
-{
-    if (name == GetName())
-    {
-        return;
-    }
-
-    const QString oldName = GetName();
-
-    CBaseObject::SetName(name);
-
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::SetSelected(bool bSelect)
-{
-    CBaseObject::SetSelected(bSelect);
-
-    if (bSelect)
-    {
-        UpdateLightProperty();
-    }
-
-}
-
-template <typename T>
-struct IVariableType {};
-template <>
-struct IVariableType<bool>
-{
-    enum
-    {
-        value = IVariable::BOOL
-    };
-};
-template <>
-struct IVariableType<int>
-{
-    enum
-    {
-        value = IVariable::INT
-    };
-};
-template <>
-struct IVariableType<float>
-{
-    enum
-    {
-        value = IVariable::FLOAT
-    };
-};
-template <>
-struct IVariableType<QString>
-{
-    enum
-    {
-        value = IVariable::STRING
-    };
-};
-template <>
-struct IVariableType<Vec3>
-{
-    enum
-    {
-        value = IVariable::VECTOR
-    };
-};
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::Serialize(CObjectArchive& ar)
-{
-    CBaseObject::Serialize(ar);
-    XmlNodeRef xmlNode = ar.node;
-    if (ar.bLoading)
-    {
-        // Load
-        QString entityClass = m_entityClass;
-        m_bLoadFailed = false;
-
-        xmlNode->getAttr("EntityClass", entityClass);
-        m_physicsState = xmlNode->findChild("PhysicsState");
-
-        Vec3 angles;
-        // Backward compatibility, with FarCry levels.
-        if (xmlNode->getAttr("Angles", angles))
-        {
-            angles = DEG2RAD(angles);
-            angles.z += gf_PI / 2;
-            Quat quat;
-            quat.SetRotationXYZ(Ang3(angles));
-            SetRotation(quat);
-        }
-
-        // Load Event Targets.
-        ReleaseEventTargets();
-        XmlNodeRef eventTargets = xmlNode->findChild("EventTargets");
-        if (eventTargets)
-        {
-            for (int i = 0; i < eventTargets->getChildCount(); i++)
-            {
-                XmlNodeRef eventTarget = eventTargets->getChild(i);
-                CEntityEventTarget et;
-                et.target = nullptr;
-                GUID targetId = GUID_NULL;
-                eventTarget->getAttr("TargetId", targetId);
-                eventTarget->getAttr("Event", et.event);
-                eventTarget->getAttr("SourceEvent", et.sourceEvent);
-                m_eventTargets.emplace_back(AZStd::move(et));
-                if (targetId != GUID_NULL)
-                {
-                    ar.SetResolveCallback(
-                        this, targetId,
-                        [this,i](CBaseObject* object) { ResolveEventTarget(object, i); });
-                }
-            }
-        }
-
-        XmlNodeRef propsNode = xmlNode->findChild("Properties");
-        XmlNodeRef props2Node = xmlNode->findChild("Properties2");
-
-        QString attachmentType;
-        xmlNode->getAttr("AttachmentType", attachmentType);
-
-        if (attachmentType == "CharacterBone")
-        {
-            m_attachmentType = eAT_CharacterBone;
-        }
-        else
-        {
-            m_attachmentType = eAT_Pivot;
-        }
-
-        xmlNode->getAttr("AttachmentTarget", m_attachmentTarget);
-
-        if (ar.bUndo)
-        {
-            RemoveAllEntityLinks();
-            PostLoad(ar);
-        }
-    }
-    else
-    {
-        if (m_attachmentType != eAT_Pivot)
-        {
-            if (m_attachmentType == eAT_CharacterBone)
-            {
-                xmlNode->setAttr("AttachmentType", "CharacterBone");
-            }
-
-            xmlNode->setAttr("AttachmentTarget", m_attachmentTarget.toUtf8().data());
-        }
-
-        // Saving.
-        if (!m_entityClass.isEmpty())
-        {
-            xmlNode->setAttr("EntityClass", m_entityClass.toUtf8().data());
-        }
-
-        if (m_physicsState)
-        {
-            xmlNode->addChild(m_physicsState);
-        }
-
-        //! Save properties.
-        if (m_pProperties)
-        {
-            XmlNodeRef propsNode = xmlNode->newChild("Properties");
-            m_pProperties->Serialize(propsNode, ar.bLoading);
-        }
-
-        //! Save properties.
-        if (m_pProperties2)
-        {
-            XmlNodeRef propsNode = xmlNode->newChild("Properties2");
-            m_pProperties2->Serialize(propsNode, ar.bLoading);
-        }
-
-        // Save Event Targets.
-        if (!m_eventTargets.empty())
-        {
-            XmlNodeRef eventTargets = xmlNode->newChild("EventTargets");
-            for (int i = 0; i < m_eventTargets.size(); i++)
-            {
-                CEntityEventTarget& et = m_eventTargets[i];
-                GUID targetId = GUID_NULL;
-                if (et.target != nullptr)
-                {
-                    targetId = et.target->GetId();
-                }
-
-                XmlNodeRef eventTarget = eventTargets->newChild("EventTarget");
-                eventTarget->setAttr("TargetId", targetId);
-                eventTarget->setAttr("Event", et.event.toUtf8().data());
-                eventTarget->setAttr("SourceEvent", et.sourceEvent.toUtf8().data());
-            }
-        }
-
-        // Save Entity Links.
-        SaveLink(xmlNode);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::PostLoad(CObjectArchive& ar)
-{
-    //////////////////////////////////////////////////////////////////////////
-    // Load Links.
-    XmlNodeRef linksNode = ar.node->findChild("EntityLinks");
-    LoadLink(linksNode, &ar);
-}
-
-//////////////////////////////////////////////////////////////////////////
-XmlNodeRef CEntityObject::Export([[maybe_unused]] const QString& levelPath, XmlNodeRef& xmlExportNode)
-{
-    if (m_bLoadFailed)
-    {
-        return nullptr;
-    }
-
-    // Do not export entity with bad id.
-    if (!m_entityId)
-    {
-        return XmlHelpers::CreateXmlNode("Temp");
-    }
-
-    // Export entities to entities.ini
-    XmlNodeRef objNode = xmlExportNode->newChild("Entity");
-
-    objNode->setAttr("Name", GetName().toUtf8().data());
-
-    Vec3 pos = GetPos(), scale = GetScale();
-    Quat rotate = GetRotation();
-
-    if (GetParent())
-    {
-        if (qobject_cast<CEntityObject*>(GetParent()))
-        {
-            // Store parent entity id.
-            CEntityObject* parentEntity = ( CEntityObject* )GetParent();
-            if (parentEntity)
-            {
-                objNode->setAttr("ParentId", parentEntity->GetEntityId());
-                if (m_attachmentType != eAT_Pivot)
-                {
-                    if (m_attachmentType == eAT_CharacterBone)
-                    {
-                        objNode->setAttr("AttachmentType", "CharacterBone");
-                    }
-
-                    objNode->setAttr("AttachmentTarget", m_attachmentTarget.toUtf8().data());
-                }
-            }
-        }
-        else
-        {
-            // Export world coordinates.
-            AffineParts ap;
-            ap.SpectralDecompose(GetWorldTM());
-            pos = ap.pos;
-            rotate = ap.rot;
-            scale = ap.scale;
-        }
-    }
-
-    if (!IsEquivalent(pos, Vec3(0, 0, 0), 0))
-    {
-        objNode->setAttr("Pos", pos);
-    }
-
-    if (!rotate.IsIdentity())
-    {
-        objNode->setAttr("Rotate", rotate);
-    }
-
-    if (!IsEquivalent(scale, Vec3(1, 1, 1), 0))
-    {
-        objNode->setAttr("Scale", scale);
-    }
-
-    objNode->setTag("Entity");
-    objNode->setAttr("EntityClass", m_entityClass.toUtf8().data());
-    objNode->setAttr("EntityId", m_entityId);
-
-    if (mv_ratioLOD != 100)
-    {
-        objNode->setAttr("LodRatio", ( int )mv_ratioLOD);
-    }
-
-    if (fabs(mv_viewDistanceMultiplier - 1.f) > FLT_EPSILON)
-    {
-        objNode->setAttr("ViewDistanceMultiplier", mv_viewDistanceMultiplier);
-    }
-
-    if (mv_recvWind)
-    {
-        objNode->setAttr("RecvWind", true);
-    }
-
-    if (mv_noDecals)
-    {
-        objNode->setAttr("NoDecals", true);
-    }
-
-    if (mv_outdoor)
-    {
-        objNode->setAttr("OutdoorOnly", true);
-    }
-
-    if (mv_hiddenInGame)
-    {
-        objNode->setAttr("HiddenInGame", true);
-    }
-
-    if (mv_createdThroughPool)
-    {
-        objNode->setAttr("CreatedThroughPool", true);
-    }
-
-    if (mv_obstructionMultiplier != 1.f)
-    {
-        objNode->setAttr("ObstructionMultiplier", (float)mv_obstructionMultiplier);
-    }
-
-    if (m_physicsState)
-    {
-        objNode->addChild(m_physicsState);
-    }
-
-    // Export Event Targets.
-    if (!m_eventTargets.empty())
-    {
-        XmlNodeRef eventTargets = objNode->newChild("EventTargets");
-        for (int i = 0; i < m_eventTargets.size(); i++)
-        {
-            CEntityEventTarget& et = m_eventTargets[i];
-
-            int entityId = 0;
-            if (et.target)
-            {
-                if (qobject_cast<CEntityObject*>(et.target))
-                {
-                    entityId = (( CEntityObject* )et.target)->GetEntityId();
-                }
-            }
-
-            XmlNodeRef eventTarget = eventTargets->newChild("EventTarget");
-            eventTarget->setAttr("Target", entityId);
-            eventTarget->setAttr("Event", et.event.toUtf8().data());
-            eventTarget->setAttr("SourceEvent", et.sourceEvent.toUtf8().data());
-        }
-    }
-
-    // Save Entity Links.
-    if (!m_links.empty())
-    {
-        XmlNodeRef linksNode = objNode->newChild("EntityLinks");
-        for (size_t i = 0, num = m_links.size(); i < num; i++)
-        {
-            if (m_links[i].target)
-            {
-                XmlNodeRef linkNode = linksNode->newChild("Link");
-                linkNode->setAttr("TargetId", m_links[i].target->GetEntityId());
-                linkNode->setAttr("Name", m_links[i].name.toUtf8().data());
-            }
-        }
-    }
-
-    //! Export properties.
-    if (m_pProperties)
-    {
-        XmlNodeRef propsNode = objNode->newChild("Properties");
-        m_pProperties->Serialize(propsNode, false);
-    }
-    //! Export properties.
-    if (m_pProperties2)
-    {
-        XmlNodeRef propsNode = objNode->newChild("Properties2");
-        m_pProperties2->Serialize(propsNode, false);
-    }
-
-    return objNode;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnEvent(ObjectEvent event)
-{
-    CBaseObject::OnEvent(event);
-
-    switch (event)
-    {
-    case EVENT_RELOAD_ENTITY:
-        GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(this);
-        break;
-
-    case EVENT_RELOAD_GEOM:
-        GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(this);
-        break;
-
-    case EVENT_FREE_GAME_DATA:
-        FreeGameData();
-        break;
-
-    case EVENT_CONFIG_SPEC_CHANGE:
-    {
-        break;
-    }
-    default:
-        break;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::UpdateVisibility(bool bVisible)
-{
-    CBaseObject::UpdateVisibility(bVisible);
-
-    bool bVisibleWithSpec = bVisible;
-    if (bVisibleWithSpec != static_cast<bool>(m_bVisible))
-    {
-        m_bVisible = bVisibleWithSpec;
-    }
-
-    size_t const numChildren = GetChildCount();
-    for (size_t i = 0; i < numChildren; ++i)
-    {
-        CBaseObject* const pChildObject = GetChild(i);
-        pChildObject->SetHidden(!m_bVisible);
-
-        if (qobject_cast<CEntityObject*>(pChildObject))
-        {
-            pChildObject->UpdateVisibility(m_bVisible);
-        }
-    }
-};
-
-//////////////////////////////////////////////////////////////////////////
-IVariable* CEntityObject::GetLightVariable(const char* name0) const
-{
-    if (m_pProperties2)
-    {
-        IVariable* pLightProperties = m_pProperties2->FindVariable("LightProperties_Base");
-
-        if (pLightProperties)
-        {
-            for (int i = 0; i < pLightProperties->GetNumVariables(); ++i)
-            {
-                IVariable* pChild = pLightProperties->GetVariable(i);
-
-                if (pChild == nullptr)
-                {
-                    continue;
-                }
-
-                QString name(pChild->GetName());
-                if (name == name0)
-                {
-                    return pChild;
-                }
-            }
-        }
-    }
-
-    return m_pProperties ? m_pProperties->FindVariable(name0) : nullptr;
-}
-
-//////////////////////////////////////////////////////////////////////////
-QString CEntityObject::GetLightAnimation() const
-{
-    IVariable* pStyleGroup = GetLightVariable("Style");
-    if (pStyleGroup)
-    {
-        for (int i = 0; i < pStyleGroup->GetNumVariables(); ++i)
-        {
-            IVariable* pChild = pStyleGroup->GetVariable(i);
-
-            if (pChild == nullptr)
-            {
-                continue;
-            }
-
-            QString name(pChild->GetName());
-            if (name == "lightanimation_LightAnimation")
-            {
-                QString lightAnimationName;
-                pChild->Get(lightAnimationName);
-                return lightAnimationName;
-            }
-        }
-    }
-
-    return "";
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::ResolveEventTarget(CBaseObject* object, unsigned int index)
-{
-    // Find target id.
-    assert(index < m_eventTargets.size());
-    if (object)
-    {
-        object->AddEventListener(this);
-    }
-    m_eventTargets[index].target = object;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::RemoveAllEntityLinks()
-{
-    while (!m_links.empty())
-    {
-        RemoveEntityLink(static_cast<int>(m_links.size() - 1));
-    }
-    m_links.clear();
-    SetModified(false);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::ReleaseEventTargets()
-{
-    while (!m_eventTargets.empty())
-    {
-        RemoveEventTarget(static_cast<int>(m_eventTargets.size() - 1), false);
-    }
-    m_eventTargets.clear();
-    SetModified(false);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::LoadLink(XmlNodeRef xmlNode, CObjectArchive* pArchive)
-{
-    RemoveAllEntityLinks();
-
-    if (!xmlNode)
-    {
-        return;
-    }
-
-    QString name;
-    GUID targetId;
-
-    for (int i = 0; i < xmlNode->getChildCount(); i++)
-    {
-        XmlNodeRef linkNode = xmlNode->getChild(i);
-        linkNode->getAttr("Name", name);
-
-        if (linkNode->getAttr("TargetId", targetId))
-        {
-            int version = 0;
-            linkNode->getAttr("Version", version);
-
-            GUID newTargetId = pArchive ? pArchive->ResolveID(targetId) : targetId;
-
-            // Backwards compatibility with old bone attachment system
-            const char kOldBoneLinkPrefix = '@';
-            if (version == 0 && !name.isEmpty() && name[0] == kOldBoneLinkPrefix)
-            {
-                CBaseObject* pObject = FindObject(newTargetId);
-                if (qobject_cast<CEntityObject*>(pObject))
-                {
-                    CEntityObject* pTargetEntity = static_cast<CEntityObject*>(pObject);
-
-                    Quat relRot(IDENTITY);
-                    linkNode->getAttr("RelRot", relRot);
-                    Vec3 relPos(IDENTITY);
-                    linkNode->getAttr("RelPos", relPos);
-
-                    SetAttachType(eAT_CharacterBone);
-                    SetAttachTarget(name.mid(1).toUtf8().data());
-                    pTargetEntity->AttachChild(this);
-
-                    SetPos(relPos);
-                    SetRotation(relRot);
-                }
-            }
-            else
-            {
-                AddEntityLink(name, newTargetId);
-            }
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::SaveLink(XmlNodeRef xmlNode)
-{
-    if (m_links.empty())
-    {
-        return;
-    }
-
-    XmlNodeRef linksNode = xmlNode->newChild("EntityLinks");
-    for (size_t i = 0, num = m_links.size(); i < num; i++)
-    {
-        XmlNodeRef linkNode = linksNode->newChild("Link");
-        linkNode->setAttr("TargetId", m_links[i].targetId);
-        linkNode->setAttr("Name", m_links[i].name.toUtf8().data());
-        linkNode->setAttr("Version", 1);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnObjectEvent(CBaseObject* target, int event)
-{
-    // When event target is deleted.
-    if (event == CBaseObject::ON_DELETE)
-    {
-        // Find this target in events list and remove.
-        int numTargets = static_cast<int>(m_eventTargets.size());
-        for (int i = 0; i < numTargets; i++)
-        {
-            if (m_eventTargets[i].target == target)
-            {
-                RemoveEventTarget(i);
-                numTargets = static_cast<int>(m_eventTargets.size());
-                i--;
-            }
-        }
-    }
-    else if (event == CBaseObject::ON_PREDELETE)
-    {
-        int numTargets = static_cast<int>(m_links.size());
-        for (int i = 0; i < numTargets; i++)
-        {
-            if (m_links[i].target == target)
-            {
-                RemoveEntityLink(i);
-                numTargets = static_cast<int>(m_eventTargets.size());
-                i--;
-            }
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-int CEntityObject::AddEventTarget(CBaseObject* target, const QString& event, const QString& sourceEvent, [[maybe_unused]] bool bUpdateScript)
-{
-    StoreUndo();
-    CEntityEventTarget et;
-    et.target = target;
-    et.event = event;
-    et.sourceEvent = sourceEvent;
-
-    // Assign event target.
-    if (et.target)
-    {
-        et.target->AddEventListener(this);
-    }
-
-    m_eventTargets.push_back(et);
-
-    SetModified(false);
-    return static_cast<int>(m_eventTargets.size() - 1);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::RemoveEventTarget(int index, [[maybe_unused]] bool bUpdateScript)
-{
-    if (index >= 0 && index < m_eventTargets.size())
-    {
-        StoreUndo();
-
-        if (m_eventTargets[index].target)
-        {
-            m_eventTargets[index].target->RemoveEventListener(this);
-        }
-        m_eventTargets.erase(m_eventTargets.begin() + index);
-
-        SetModified(false);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-int CEntityObject::AddEntityLink(const QString& name, GUID targetEntityId)
-{
-    CEntityObject* target = nullptr;
-    if (targetEntityId != GUID_NULL)
-    {
-        CBaseObject* pObject = FindObject(targetEntityId);
-        if (qobject_cast<CEntityObject*>(pObject))
-        {
-            target = ( CEntityObject* )pObject;
-
-            // Legacy entities and AZ entities shouldn't be linked.
-            if (target->GetType() == OBJTYPE_AZENTITY || GetType() == OBJTYPE_AZENTITY)
-            {
-                return -1;
-            }
-        }
-    }
-
-    StoreUndo();
-
-    CEntityLink lnk;
-    lnk.targetId = targetEntityId;
-    lnk.target = target;
-    lnk.name = name;
-    m_links.push_back(lnk);
-
-    SetModified(false);
-
-    return static_cast<int>(m_links.size() - 1);
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CEntityObject::EntityLinkExists(const QString& name, GUID targetEntityId)
-{
-    for (size_t i = 0, num = m_links.size(); i < num; ++i)
-    {
-        if (m_links[i].targetId == targetEntityId && name.compare(m_links[i].name, Qt::CaseInsensitive) == 0)
-        {
-            return true;
-        }
-    }
-    return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::RemoveEntityLink(int index)
-{
-    if (index >= 0 && index < m_links.size())
-    {
-        CEntityLink& link = m_links[index];
-        StoreUndo();
-
-        if (link.target)
-        {
-            link.target->RemoveEventListener(this);
-            link.target->EntityUnlinked(link.name, GetId());
-        }
-        m_links.erase(m_links.begin() + index);
-
-        SetModified(false);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::RenameEntityLink(int index, const QString& newName)
-{
-    if (index >= 0 && index < m_links.size())
-    {
-        StoreUndo();
-
-        m_links[index].name = newName;
-
-        SetModified(false);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnRadiusChange(IVariable* var)
-{
-    var->Get(m_proximityRadius);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnInnerRadiusChange(IVariable* var)
-{
-    var->Get(m_innerRadius);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnOuterRadiusChange(IVariable* var)
-{
-    var->Get(m_outerRadius);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnBoxSizeXChange(IVariable* var)
-{
-    var->Get(m_boxSizeX);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnBoxSizeYChange(IVariable* var)
-{
-    var->Get(m_boxSizeY);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnBoxSizeZChange(IVariable* var)
-{
-    var->Get(m_boxSizeZ);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnProjectorFOVChange(IVariable* var)
-{
-    var->Get(m_projectorFOV);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnProjectInAllDirsChange(IVariable* var)
-{
-    int value;
-    var->Get(value);
-    m_bProjectInAllDirs = value;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnProjectorTextureChange(IVariable* var)
-{
-    QString texture;
-    var->Get(texture);
-    m_bProjectorHasTexture = !texture.isEmpty();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnAreaLightChange(IVariable* var)
-{
-    int value;
-    var->Get(value);
-    m_bAreaLight = value;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnAreaWidthChange(IVariable* var)
-{
-    var->Get(m_fAreaWidth);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnAreaHeightChange(IVariable* var)
-{
-    var->Get(m_fAreaHeight);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnAreaLightSizeChange(IVariable* var)
-{
-    var->Get(m_fAreaLightSize);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnColorChange(IVariable* var)
-{
-    var->Get(m_lightColor);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnBoxProjectionChange(IVariable* var)
-{
-    int value;
-    var->Get(value);
-    m_bBoxProjectedCM = value;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnBoxWidthChange(IVariable* var)
-{
-    var->Get(m_fBoxWidth);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnBoxHeightChange(IVariable* var)
-{
-    var->Get(m_fBoxHeight);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnBoxLengthChange(IVariable* var)
-{
-    var->Get(m_fBoxLength);
-}
-
-//////////////////////////////////////////////////////////////////////////
-CVarBlock* CEntityObject::CloneProperties(CVarBlock* srcProperties)
-{
-    assert(srcProperties);
-    return srcProperties->Clone(true);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::OnLoadFailed()
-{
-    m_bLoadFailed = true;
-
-    CErrorRecord err;
-    err.error = tr("Entity %1 Failed to Spawn (Script: %2)").arg(GetName(), m_entityClass);
-    err.pObject = this;
-    GetIEditor()->GetErrorReport()->ReportError(err);
-}
-
-//////////////////////////////////////////////////////////////////////////
-//! Analyze errors for this object.
-void CEntityObject::Validate(IErrorReport* report)
-{
-    CBaseObject::Validate(report);
-
-    if (!m_entityClass.isEmpty())
-    {
-        CErrorRecord err;
-        err.error = tr("Entity %1 Failed to Spawn (Script: %2)").arg(GetName(), m_entityClass);
-        err.pObject = this;
-        report->ReportError(err);
-        return;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::GatherUsedResources(CUsedResources& resources)
-{
-    CBaseObject::GatherUsedResources(resources);
-    if (m_pProperties)
-    {
-        m_pProperties->GatherUsedResources(resources);
-    }
-    if (m_pProperties2)
-    {
-        m_pProperties2->GatherUsedResources(resources);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CEntityObject::IsSimilarObject(CBaseObject* pObject)
-{
-    if (pObject->GetClassDesc() == GetClassDesc() && pObject->metaObject() == metaObject())
-    {
-        CEntityObject* pEntity = ( CEntityObject* )pObject;
-        if (m_entityClass == pEntity->m_entityClass &&
-            m_proximityRadius == pEntity->m_proximityRadius &&
-            m_innerRadius == pEntity->m_innerRadius &&
-            m_outerRadius == pEntity->m_outerRadius)
-        {
-            return true;
-        }
-    }
-    return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::PreInitLightProperty()
-{
-    if (!IsLight() || !m_pProperties)
-    {
-        return;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::UpdateLightProperty()
-{
-    if (!IsLight() || !m_pProperties)
-    {
-        return;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::ForceVariableUpdate()
-{
-    if (m_pProperties)
-    {
-        m_pProperties->OnSetValues();
-    }
-    if (m_pProperties2)
-    {
-        m_pProperties2->OnSetValues();
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::ResetCallbacks()
-{
-    ClearCallbacks();
-
-    CVarBlock* pProperties = m_pProperties;
-    CVarBlock* pProperties2 = m_pProperties2;
-
-    if (pProperties)
-    {
-        m_callbacks.reserve(6);
-
-        //@FIXME Hack to display radii of properties.
-        // wires properties from param block, to this entity internal variables.
-        IVariable* var = nullptr;
-        var = pProperties->FindVariable("Radius", false);
-        if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-        {
-            var->Get(m_proximityRadius);
-            SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnRadiusChange]);
-        }
-        else
-        {
-            var = pProperties->FindVariable("radius", false);
-            if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-            {
-                var->Get(m_proximityRadius);
-                SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnRadiusChange]);
-            }
-        }
-
-        var = pProperties->FindVariable("InnerRadius", false);
-        if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-        {
-            var->Get(m_innerRadius);
-            SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnInnerRadiusChange]);
-        }
-        var = pProperties->FindVariable("OuterRadius", false);
-        if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-        {
-            var->Get(m_outerRadius);
-            SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnOuterRadiusChange]);
-        }
-
-        var = pProperties->FindVariable("BoxSizeX", false);
-        if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-        {
-            var->Get(m_boxSizeX);
-            SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnBoxSizeXChange]);
-        }
-        var = pProperties->FindVariable("BoxSizeY", false);
-        if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-        {
-            var->Get(m_boxSizeY);
-            SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnBoxSizeYChange]);
-        }
-        var = pProperties->FindVariable("BoxSizeZ", false);
-        if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-        {
-            var->Get(m_boxSizeZ);
-            SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnBoxSizeZChange]);
-        }
-
-        var = pProperties->FindVariable("fAttenuationBulbSize");
-        if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-        {
-            var->Get(m_fAreaLightSize);
-            SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnAreaLightSizeChange]);
-        }
-
-        IVariable* pProjector = pProperties->FindVariable("Projector");
-        if (pProjector)
-        {
-            var = pProjector->FindVariable("fProjectorFov");
-            if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-            {
-                var->Get(m_projectorFOV);
-                SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnProjectorFOVChange]);
-            }
-            var = pProjector->FindVariable("bProjectInAllDirs");
-            if (var && var->GetType() == IVariable::BOOL)
-            {
-                int value;
-                var->Get(value);
-                m_bProjectInAllDirs = value;
-                SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnProjectInAllDirsChange]);
-            }
-            var = pProjector->FindVariable("texture_Texture");
-            if (var && var->GetType() == IVariable::STRING)
-            {
-                QString projectorTexture;
-                var->Get(projectorTexture);
-                m_bProjectorHasTexture = !projectorTexture.isEmpty();
-                SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnProjectorTextureChange]);
-            }
-        }
-
-        IVariable* pColorGroup = pProperties->FindVariable("Color", false);
-        if (pColorGroup)
-        {
-            const int nChildCount = pColorGroup->GetNumVariables();
-            for (int i = 0; i < nChildCount; ++i)
-            {
-                IVariable* pChild = pColorGroup->GetVariable(i);
-                if (!pChild)
-                {
-                    continue;
-                }
-
-                QString name(pChild->GetName());
-                if (name == "clrDiffuse")
-                {
-                    pChild->Get(m_lightColor);
-                    SetVariableCallback(pChild, &m_onSetCallbacksCache[VariableCallbackIndex::OnColorChange]);
-                    break;
-                }
-            }
-        }
-
-        IVariable* pType = pProperties->FindVariable("Shape");
-        if (pType)
-        {
-            var = pType->FindVariable("bAreaLight");
-            if (var && var->GetType() == IVariable::BOOL)
-            {
-                int value;
-                var->Get(value);
-                m_bAreaLight = value;
-                SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnAreaLightChange]);
-            }
-            var = pType->FindVariable("fPlaneWidth");
-            if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-            {
-                var->Get(m_fAreaWidth);
-                SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnAreaWidthChange]);
-            }
-            var = pType->FindVariable("fPlaneHeight");
-            if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-            {
-                var->Get(m_fAreaHeight);
-                SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnAreaHeightChange]);
-            }
-        }
-
-        IVariable* pProjection = pProperties->FindVariable("Projection");
-        if (pProjection)
-        {
-            var = pProjection->FindVariable("bBoxProject");
-            if (var && var->GetType() == IVariable::BOOL)
-            {
-                int value;
-                var->Get(value);
-                m_bBoxProjectedCM = value;
-                SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnBoxProjectionChange]);
-            }
-            var = pProjection->FindVariable("fBoxWidth");
-            if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-            {
-                var->Get(m_fBoxWidth);
-                SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnBoxWidthChange]);
-            }
-            var = pProjection->FindVariable("fBoxHeight");
-            if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-            {
-                var->Get(m_fBoxHeight);
-                SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnBoxHeightChange]);
-            }
-            var = pProjection->FindVariable("fBoxLength");
-            if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
-            {
-                var->Get(m_fBoxLength);
-                SetVariableCallback(var, &m_onSetCallbacksCache[VariableCallbackIndex::OnBoxLengthChange]);
-            }
-        }
-
-        // Each property must have callback to our OnPropertyChange.
-        pProperties->AddOnSetCallback(&m_onSetCallbacksCache[VariableCallbackIndex::OnPropertyChange]);
-    }
-
-    if (pProperties2)
-    {
-        pProperties2->AddOnSetCallback(&m_onSetCallbacksCache[VariableCallbackIndex::OnPropertyChange]);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::SetVariableCallback(IVariable* pVar, IVariable::OnSetCallback* func)
-{
-    pVar->AddOnSetCallback(func);
-    m_callbacks.push_back(std::make_pair(pVar, func));
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CEntityObject::ClearCallbacks()
-{
-    if (m_pProperties)
-    {
-        m_pProperties->RemoveOnSetCallback(&m_onSetCallbacksCache[VariableCallbackIndex::OnPropertyChange]);
-    }
-
-    if (m_pProperties2)
-    {
-        m_pProperties2->RemoveOnSetCallback(&m_onSetCallbacksCache[VariableCallbackIndex::OnPropertyChange]);
-    }
-
-    for (auto iter = m_callbacks.begin(); iter != m_callbacks.end(); ++iter)
-    {
-        iter->first->RemoveOnSetCallback(iter->second);
-    }
-
-    m_callbacks.clear();
-}
-
-template <typename T>
-T CEntityObject::GetEntityProperty(const char* pName, T defaultvalue) const
-{
-    CVarBlock* pProperties = GetProperties2();
-    IVariable* pVariable = nullptr;
-    if (pProperties)
-    {
-        pVariable = pProperties->FindVariable(pName);
-    }
-
-    if (!pVariable)
-    {
-        pProperties = GetProperties();
-        if (pProperties)
-        {
-            pVariable = pProperties->FindVariable(pName);
-        }
-
-        if (!pVariable)
-        {
-            return defaultvalue;
-        }
-    }
-
-    if (pVariable->GetType() != IVariableType<T>::value)
-    {
-        return defaultvalue;
-    }
-
-    T value;
-    pVariable->Get(value);
-    return value;
-}
-
-template <typename T>
-void CEntityObject::SetEntityProperty(const char* pName, T value)
-{
-    CVarBlock* pProperties = GetProperties2();
-    IVariable* pVariable = nullptr;
-    if (pProperties)
-    {
-        pVariable = pProperties->FindVariable(pName);
-    }
-
-    if (!pVariable)
-    {
-        pProperties = GetProperties();
-        if (pProperties)
-        {
-            pVariable = pProperties->FindVariable(pName);
-        }
-
-        if (!pVariable)
-        {
-            throw std::runtime_error((QString("\"") + pName + "\" is an invalid property.").toUtf8().data());
-        }
-    }
-
-    if (pVariable->GetType() != IVariableType<T>::value)
-    {
-        throw std::logic_error("Data type is invalid.");
-    }
-    pVariable->Set(value);
-}
-
-bool CEntityObject::GetEntityPropertyBool(const char* name) const
-{
-    return GetEntityProperty<bool>(name, false);
-}
-
-int CEntityObject::GetEntityPropertyInteger(const char* name) const
-{
-    return GetEntityProperty<int>(name, 0);
-}
-
-float CEntityObject::GetEntityPropertyFloat(const char* name) const
-{
-    return GetEntityProperty<float>(name, 0.0f);
-}
-
-QString CEntityObject::GetEntityPropertyString(const char* name) const
-{
-    return GetEntityProperty<QString>(name, "");
-}
-
-void CEntityObject::SetEntityPropertyBool(const char* name, bool value)
-{
-    SetEntityProperty<bool>(name, value);
-}
-
-void CEntityObject::SetEntityPropertyInteger(const char* name, int value)
-{
-    SetEntityProperty<int>(name, value);
-}
-
-void CEntityObject::SetEntityPropertyFloat(const char* name, float value)
-{
-    SetEntityProperty<float>(name, value);
-}
-
-void CEntityObject::SetEntityPropertyString(const char* name, const QString& value)
-{
-    SetEntityProperty<QString>(name, value);
-}
-
-#include <Objects/moc_EntityObject.cpp>

+ 0 - 390
Code/Editor/Objects/EntityObject.h

@@ -1,390 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-#ifndef CRYINCLUDE_EDITOR_OBJECTS_ENTITYOBJECT_H
-#define CRYINCLUDE_EDITOR_OBJECTS_ENTITYOBJECT_H
-#pragma once
-
-
-#if !defined(Q_MOC_RUN)
-#include "BaseObject.h"
-
-#include "IMovieSystem.h"
-
-#include <QObject>
-#endif
-
-class CEntityObject;
-class QMenu;
-
-/*!
- *  CEntityEventTarget is an Entity event target and type.
- */
-struct CEntityEventTarget
-{
-    CBaseObject* target; //! Target object.
-    QString event;
-    QString sourceEvent;
-};
-
-//////////////////////////////////////////////////////////////////////////
-// Named link from entity to entity.
-//////////////////////////////////////////////////////////////////////////
-struct CEntityLink
-{
-    GUID targetId;   // Target entity id.
-    CEntityObject* target; // Target entity.
-    QString name;    // Name of the link.
-};
-
-struct IPickEntitesOwner
-{
-    virtual void AddEntity(CBaseObject* pEntity) = 0;
-    virtual CBaseObject* GetEntity(int nIdx) = 0;
-    virtual int GetEntityCount() = 0;
-    virtual void RemoveEntity(int nIdx) = 0;
-};
-
-AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
-AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-/*!
- *  CEntity is an static object on terrain.
- *
- */
-class CRYEDIT_API CEntityObject
-    : public CBaseObject
-    , public CBaseObject::EventListener
-{
-AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
-    Q_OBJECT
-public:
-    ~CEntityObject();
-
-    //////////////////////////////////////////////////////////////////////////
-    // Overrides from CBaseObject.
-    //////////////////////////////////////////////////////////////////////////
-
-    bool Init(IEditor* ie, CBaseObject* prev, const QString& file) override;
-    void InitVariables() override;
-    void Done() override;
-
-
-    bool GetEntityPropertyBool(const char* name) const;
-    int GetEntityPropertyInteger(const char* name) const;
-    float GetEntityPropertyFloat(const char* name) const;
-    QString GetEntityPropertyString(const char* name) const;
-    void SetEntityPropertyBool(const char* name, bool value);
-    void SetEntityPropertyInteger(const char* name, int value);
-    void SetEntityPropertyFloat(const char* name, float value);
-    void SetEntityPropertyString(const char* name, const QString& value);
-
-    void SetName(const QString& name) override;
-    void SetSelected(bool bSelect) override;
-
-    void GetLocalBounds(AABB& box) override;
-
-    bool HitTest(HitContext& hc) override;
-    bool HitTestRect(HitContext& hc) override;
-    void UpdateVisibility(bool bVisible) override;
-    bool ConvertFromObject(CBaseObject* object) override;
-
-    using CBaseObject::Serialize;
-    void Serialize(CObjectArchive& ar) override;
-    void PostLoad(CObjectArchive& ar) override;
-
-    XmlNodeRef Export(const QString& levelPath, XmlNodeRef& xmlNode) override;
-
-    //////////////////////////////////////////////////////////////////////////
-    void OnEvent(ObjectEvent event) override;
-
-    void SetTransformDelegate(ITransformDelegate* pTransformDelegate) override;
-
-    // Set attach flags and target
-    enum EAttachmentType
-    {
-        eAT_Pivot,
-        eAT_CharacterBone,
-    };
-
-    void SetAttachType(const EAttachmentType attachmentType) { m_attachmentType = attachmentType; }
-    void SetAttachTarget(const char* target) { m_attachmentTarget = target; }
-    EAttachmentType GetAttachType() const { return m_attachmentType; }
-    QString GetAttachTarget() const { return m_attachmentTarget; }
-
-    void GatherUsedResources(CUsedResources& resources) override;
-    bool IsSimilarObject(CBaseObject* pObject) override;
-
-    bool IsIsolated() const override { return false; }
-
-    //////////////////////////////////////////////////////////////////////////
-    // END CBaseObject
-    //////////////////////////////////////////////////////////////////////////
-
-    //////////////////////////////////////////////////////////////////////////
-    // CEntity interface.
-    //////////////////////////////////////////////////////////////////////////
-    virtual void DeleteEntity() {}
-
-    QString GetEntityClass() const { return m_entityClass; };
-    int GetEntityId() const { return m_entityId; };
-
-    //////////////////////////////////////////////////////////////////////////
-    //! Return number of event targets of Script.
-    int     GetEventTargetCount() const { return static_cast<int>(m_eventTargets.size()); };
-    CEntityEventTarget& GetEventTarget(int index) { return m_eventTargets[index]; };
-    //! Add new event target, returns index of created event target.
-    //! Event targets are Always entities.
-    int AddEventTarget(CBaseObject* target, const QString& event, const QString& sourceEvent, bool bUpdateScript = true);
-    //! Remove existing event target by index.
-    void RemoveEventTarget(int index, bool bUpdateScript = true);
-    //////////////////////////////////////////////////////////////////////////
-
-    //////////////////////////////////////////////////////////////////////////
-    // Entity Links.
-    //////////////////////////////////////////////////////////////////////////
-    //! Return number of event targets of Script.
-    int     GetEntityLinkCount() const { return static_cast<int>(m_links.size()); };
-    CEntityLink& GetEntityLink(int index) { return m_links[index]; };
-    virtual int AddEntityLink(const QString& name, GUID targetEntityId);
-    virtual bool EntityLinkExists(const QString& name, GUID targetEntityId);
-    void RenameEntityLink(int index, const QString& newName);
-    void RemoveEntityLink(int index);
-    void RemoveAllEntityLinks();
-    virtual void EntityLinked([[maybe_unused]] const QString& name, [[maybe_unused]] GUID targetEntityId){}
-    virtual void EntityUnlinked([[maybe_unused]] const QString& name, [[maybe_unused]] GUID targetEntityId) {}
-    void LoadLink(XmlNodeRef xmlNode, CObjectArchive* pArchive = nullptr);
-    void SaveLink(XmlNodeRef xmlNode);
-    //////////////////////////////////////////////////////////////////////////
-    //////////////////////////////////////////////////////////////////////////
-
-    float GetRatioLod() const { return static_cast<float>(mv_ratioLOD); };
-    float GetViewDistanceMultiplier() const { return mv_viewDistanceMultiplier; }
-
-    CVarBlock* GetProperties() const { return m_pProperties; };
-    CVarBlock* GetProperties2() const { return m_pProperties2; };
-
-    bool IsLight()  const   {   return m_bLight;        }
-
-    void Validate(IErrorReport* report) override;
-
-
-    // Get the name of the light animation node assigned to this, if any.
-    QString GetLightAnimation() const;
-
-    IVariable* GetLightVariable(const char* name) const;
-
-    void PreInitLightProperty();
-    void UpdateLightProperty();
-
-    void EnableReload(bool bEnable)
-    {
-        m_bEnableReload = bEnable;
-    }
-
-protected:
-    template <typename T>
-    void SetEntityProperty(const char* name, T value);
-    template <typename T>
-    T GetEntityProperty(const char* name, T defaultvalue) const;
-
-    //! Draw default object items.
-    void OnLoadFailed();
-
-    CVarBlock* CloneProperties(CVarBlock* srcProperties);
-
-    //////////////////////////////////////////////////////////////////////////
-    void OnObjectEvent(CBaseObject* target, int event) override;
-    void ResolveEventTarget(CBaseObject* object, unsigned int index);
-    void ReleaseEventTargets();
-
-public:
-    CEntityObject();
-
-    static const GUID& GetClassID()
-    {
-        // {C80F8AEA-90EF-471f-82C7-D14FA80B9203}
-        static const GUID guid = {
-            0xc80f8aea, 0x90ef, 0x471f, { 0x82, 0xc7, 0xd1, 0x4f, 0xa8, 0xb, 0x92, 0x3 }
-        };
-        return guid;
-    }
-
-protected:
-    void DeleteThis() override { delete this; };
-
-    //////////////////////////////////////////////////////////////////////////
-    // Radius callbacks.
-    //////////////////////////////////////////////////////////////////////////
-    void OnRadiusChange(IVariable* var);
-    void OnInnerRadiusChange(IVariable* var);
-    void OnOuterRadiusChange(IVariable* var);
-    void OnBoxSizeXChange(IVariable* var);
-    void OnBoxSizeYChange(IVariable* var);
-    void OnBoxSizeZChange(IVariable* var);
-    void OnProjectorFOVChange(IVariable* var);
-    void OnProjectorTextureChange(IVariable* var);
-    void OnProjectInAllDirsChange(IVariable* var);
-    //////////////////////////////////////////////////////////////////////////
-    // Area light callbacks.
-    //////////////////////////////////////////////////////////////////////////
-    void OnAreaLightChange(IVariable* var);
-    void OnAreaWidthChange(IVariable* var);
-    void OnAreaHeightChange(IVariable* var);
-    void OnAreaFOVChange(IVariable* var);
-    void OnAreaLightSizeChange(IVariable* var);
-    void OnColorChange(IVariable* var);
-    //////////////////////////////////////////////////////////////////////////
-    // Box projection callbacks.
-    //////////////////////////////////////////////////////////////////////////
-    void OnBoxProjectionChange(IVariable* var);
-    void OnBoxWidthChange(IVariable* var);
-    void OnBoxHeightChange(IVariable* var);
-    void OnBoxLengthChange(IVariable* var);
-    //////////////////////////////////////////////////////////////////////////
-
-    void FreeGameData();
-
-    void AdjustLightProperties(CVarBlockPtr& properties, const char* pSubBlock);
-    IVariable* FindVariableInSubBlock(CVarBlockPtr& properties, IVariable* pSubBlockVar, const char* pVarName);
-
-    unsigned int m_bLoadFailed : 1;
-    unsigned int m_bCalcPhysics : 1;
-    unsigned int m_bDisplayBBox : 1;
-    unsigned int m_bDisplaySolidBBox : 1;
-    unsigned int m_bDisplayAbsoluteRadius : 1;
-    unsigned int m_bDisplayArrow : 1;
-    unsigned int m_bIconOnTop : 1;
-    unsigned int m_bVisible : 1;
-    unsigned int m_bLight : 1;
-    unsigned int m_bAreaLight : 1;
-    unsigned int m_bProjectorHasTexture : 1;
-    unsigned int m_bProjectInAllDirs : 1;
-    unsigned int m_bBoxProjectedCM : 1;
-    unsigned int m_bBBoxSelection : 1;
-
-    AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-    Vec3  m_lightColor;
-
-    //! Entity class.
-    QString m_entityClass;
-    //! Id of spawned entity.
-    int m_entityId;
-
-    // Used for light entities
-    float m_projectorFOV;
-
-    AABB m_box;
-
-    //////////////////////////////////////////////////////////////////////////
-    // Main entity parameters.
-    //////////////////////////////////////////////////////////////////////////
-    CVariable<bool> mv_outdoor;
-    CVariable<bool> mv_castShadow; // Legacy, required for backwards compatibility
-    CVariable<int> mv_ratioLOD;
-    CVariable<float> mv_viewDistanceMultiplier;
-    CVariable<bool> mv_hiddenInGame; // Entity is hidden in game (on start).
-    CVariable<bool> mv_recvWind;
-    CVariable<bool> mv_renderNearest;
-    CVariable<bool> mv_noDecals;
-    CVariable<bool> mv_createdThroughPool;
-    CVariable<float> mv_obstructionMultiplier;
-
-    //////////////////////////////////////////////////////////////////////////
-    // Temp variables (Not serializable) just to display radii from properties.
-    //////////////////////////////////////////////////////////////////////////
-    // Used for proximity entities.
-    float m_proximityRadius;
-    float m_innerRadius;
-    float m_outerRadius;
-    // Used for probes
-    float m_boxSizeX;
-    float m_boxSizeY;
-    float m_boxSizeZ;
-    // Used for area lights
-    float m_fAreaWidth;
-    float m_fAreaHeight;
-    float m_fAreaLightSize;
-    // Used for box projected cubemaps
-    float m_fBoxWidth;
-    float m_fBoxHeight;
-    float m_fBoxLength;
-    //////////////////////////////////////////////////////////////////////////
-
-    //////////////////////////////////////////////////////////////////////////
-    // Event Targets.
-    //////////////////////////////////////////////////////////////////////////
-    //! Array of event targets of this Entity.
-    typedef std::vector<CEntityEventTarget> EventTargets;
-    EventTargets m_eventTargets;
-
-    //////////////////////////////////////////////////////////////////////////
-    // Links
-    typedef std::vector<CEntityLink> Links;
-    Links m_links;
-
-    //! Entity properties variables.
-    CVarBlockPtr m_pProperties;
-
-    //! Per instance entity properties variables
-    CVarBlockPtr m_pProperties2;
-
-    // Physics state, as a string.
-    XmlNodeRef m_physicsState;
-    AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-
-    EAttachmentType m_attachmentType;
-
-    bool m_bEnableReload;
-
-    QString m_attachmentTarget;
-
-private:
-    struct VariableCallbackIndex
-    {
-        enum : unsigned char
-        {
-            OnAreaHeightChange = 0,
-            OnAreaLightChange,
-            OnAreaLightSizeChange,
-            OnAreaWidthChange,
-            OnBoxHeightChange,
-            OnBoxLengthChange,
-            OnBoxProjectionChange,
-            OnBoxSizeXChange,
-            OnBoxSizeYChange,
-            OnBoxSizeZChange,
-            OnBoxWidthChange,
-            OnColorChange,
-            OnInnerRadiusChange,
-            OnOuterRadiusChange,
-            OnProjectInAllDirsChange,
-            OnProjectorFOVChange,
-            OnProjectorTextureChange,
-            OnPropertyChange,
-            OnRadiusChange,
-
-            // must be at the end
-            Count,
-        };
-    };
-
-    void ResetCallbacks();
-    void SetVariableCallback(IVariable* pVar, IVariable::OnSetCallback* func);
-    void ClearCallbacks();
-
-    void ForceVariableUpdate();
-
-    AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-    std::vector< std::pair<IVariable*, IVariable::OnSetCallback*> > m_callbacks;
-    AZStd::fixed_vector< IVariable::OnSetCallback, VariableCallbackIndex::Count > m_onSetCallbacksCache;
-    AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-};
-
-#endif // CRYINCLUDE_EDITOR_OBJECTS_ENTITYOBJECT_H

+ 0 - 276
Code/Editor/Objects/ObjectLoader.cpp

@@ -1,276 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-#include "EditorDefs.h"
-
-#include "ObjectLoader.h"
-
-// Editor
-#include "Util/PakFile.h"
-#include "WaitProgress.h"
-#include "Include/IObjectManager.h"
-
-
-//////////////////////////////////////////////////////////////////////////
-// CObjectArchive Implementation.
-//////////////////////////////////////////////////////////////////////////
-CObjectArchive::CObjectArchive(IObjectManager* objMan, XmlNodeRef xmlRoot, bool loading)
-{
-    m_objectManager = objMan;
-    bLoading = loading;
-    bUndo = false;
-    m_nFlags = 0;
-    node = xmlRoot;
-    m_pCurrentErrorReport = GetIEditor()->GetErrorReport();
-    m_bNeedResolveObjects = false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CObjectArchive::~CObjectArchive()
-{
-    // Always make sure objects are resolved when loading from archive.
-    if (bLoading && m_bNeedResolveObjects)
-    {
-        ResolveObjects();
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectArchive::SetResolveCallback(CBaseObject* fromObject, REFGUID objectId, ResolveObjRefFunctor1 func)
-{
-    if (objectId == GUID_NULL)
-    {
-        func(0);
-        return;
-    }
-
-    GUID guid(objectId);
-
-    CBaseObject* pObject = m_objectManager->FindObject(guid);
-    if (pObject && !(m_nFlags & eObjectLoader_MakeNewIDs))
-    {
-        // Object is already resolved. immediately call callback.
-        func(pObject);
-    }
-    else
-    {
-        Callback cb;
-        cb.fromObject = fromObject;
-        cb.func1 = func;
-        m_resolveCallbacks.insert(Callbacks::value_type(guid, cb));
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-GUID CObjectArchive::ResolveID(REFGUID id)
-{
-    return stl::find_in_map(m_IdRemap, id, id);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectArchive::ResolveObjects()
-{
-    int i;
-
-    if (!bLoading)
-    {
-        return;
-    }
-
-    {
-        CWaitProgress wait("Loading Objects", false);
-        wait.Start();
-
-        GetIEditor()->SuspendUndo();
-        //////////////////////////////////////////////////////////////////////////
-        // Serialize All Objects from XML.
-        //////////////////////////////////////////////////////////////////////////
-        int numObj = static_cast<int>(m_loadedObjects.size());
-        for (i = 0; i < numObj; i++)
-        {
-            wait.Step((i * 100) / numObj);
-
-            SLoadedObjectInfo& obj = m_loadedObjects[i];
-            m_pCurrentErrorReport->SetCurrentValidatorObject(obj.pObject);
-            node = obj.xmlNode;
-
-            obj.pObject->Serialize(*this);
-
-            m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
-
-            // Objects can be added to the list here (from Groups).
-            numObj = static_cast<int>(m_loadedObjects.size());
-        }
-        m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
-        //////////////////////////////////////////////////////////////////////////
-        GetIEditor()->ResumeUndo();
-    }
-
-    // Sort objects by sort order.
-    std::sort(m_loadedObjects.begin(), m_loadedObjects.end());
-
-    // Then rearrange to parent-first, if same sort order.
-    for (i = 0; i < m_loadedObjects.size(); i++)
-    {
-        if (m_loadedObjects[i].pObject->GetParent())
-        {
-            // Find later in array.
-            for (int j = i + 1; j < m_loadedObjects.size() && m_loadedObjects[j].nSortOrder == m_loadedObjects[i].nSortOrder; j++)
-            {
-                if (m_loadedObjects[j].pObject == m_loadedObjects[i].pObject->GetParent())
-                {
-                    // Swap the objects.
-                    std::swap(m_loadedObjects[i], m_loadedObjects[j]);
-                    i--;
-                    break;
-                }
-            }
-        }
-    }
-
-    //////////////////////////////////////////////////////////////////////////
-    // Resolve objects GUIDs
-    //////////////////////////////////////////////////////////////////////////
-    for (Callbacks::iterator it = m_resolveCallbacks.begin(); it != m_resolveCallbacks.end(); it++)
-    {
-        Callback& cb = it->second;
-        GUID objectId = ResolveID(it->first);
-        CBaseObject* object = m_objectManager->FindObject(objectId);
-        if (!object)
-        {
-            QString from;
-            if (cb.fromObject)
-            {
-                from = cb.fromObject->GetName();
-            }
-            // Cannot resolve this object id.
-            CErrorRecord err;
-            err.error = QObject::tr("Unresolved ObjectID: %1, Referenced from Object %1").arg(GuidUtil::ToString(objectId)).arg(from);
-            err.severity = CErrorRecord::ESEVERITY_ERROR;
-            err.flags = CErrorRecord::FLAG_OBJECTID;
-            err.pObject = cb.fromObject;
-            GetIEditor()->GetErrorReport()->ReportError(err);
-
-            //Warning( "Cannot resolve ObjectID: %s\r\nObject with this ID was not present in loaded file.\r\nFor instance Trigger referencing another object which is not loaded in Level.",GuidUtil::ToString(objectId) );
-            continue;
-        }
-        m_pCurrentErrorReport->SetCurrentValidatorObject(object);
-        // Call callback with this object.
-        if (cb.func1)
-        {
-            (cb.func1)(object);
-        }
-    }
-    m_resolveCallbacks.clear();
-    //////////////////////////////////////////////////////////////////////////
-
-    {
-        CWaitProgress wait("Creating Objects", false);
-        wait.Start();
-        //////////////////////////////////////////////////////////////////////////
-        // Serialize All Objects from XML.
-        //////////////////////////////////////////////////////////////////////////
-        int numObj = static_cast<int>(m_loadedObjects.size());
-        for (i = 0; i < numObj; i++)
-        {
-            wait.Step((i * 100) / numObj);
-
-            SLoadedObjectInfo& obj = m_loadedObjects[i];
-            m_pCurrentErrorReport->SetCurrentValidatorObject(obj.pObject);
-
-            obj.pObject->CreateGameObject();
-
-            // unset the current validator object because the wait Step 
-            // might generate unrelated errors
-            m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
-        }
-        m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
-        //////////////////////////////////////////////////////////////////////////
-    }
-
-    //////////////////////////////////////////////////////////////////////////
-    // Call PostLoad on all these objects.
-    //////////////////////////////////////////////////////////////////////////
-    {
-        int numObj = static_cast<int>(m_loadedObjects.size());
-        for (i = 0; i < numObj; i++)
-        {
-            SLoadedObjectInfo& obj = m_loadedObjects[i];
-            m_pCurrentErrorReport->SetCurrentValidatorObject(obj.pObject);
-            node = obj.xmlNode;
-            obj.pObject->PostLoad(*this);
-        }
-    }
-
-    m_bNeedResolveObjects = false;
-    m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectArchive::SaveObject(CBaseObject* pObject)
-{
-    if (pObject->CheckFlags(OBJFLAG_DONT_SAVE))
-    {
-        return;
-    }
-
-    if (m_savedObjects.find(pObject) == m_savedObjects.end())
-    {
-        m_savedObjects.insert(pObject);
-        // If this object was not saved before.
-        XmlNodeRef objNode = node->newChild("Object");
-        XmlNodeRef prevRoot = node;
-        node = objNode;
-
-        pObject->Serialize(*this);
-        node = prevRoot;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-CBaseObject* CObjectArchive::LoadObject(const XmlNodeRef& objNode, CBaseObject* pPrevObject)
-{
-    XmlNodeRef prevNode = node;
-    node = objNode;
-    CBaseObject* pObject;
-    bool bMakeNewID = (m_nFlags & eObjectLoader_MakeNewIDs) ? true : false;
-
-    pObject = m_objectManager->NewObject(*this, pPrevObject, bMakeNewID);
-    if (pObject)
-    {
-        SLoadedObjectInfo obj;
-        obj.nSortOrder = pObject->GetClassDesc()->GameCreationOrder();
-        obj.pObject = pObject;
-        obj.newGuid = pObject->GetId();
-        obj.xmlNode = node;
-        m_loadedObjects.push_back(obj);
-        m_bNeedResolveObjects = true;
-    }
-    node = prevNode;
-    return pObject;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectArchive::MakeNewIds(bool bEnable)
-{
-    if (bEnable)
-    {
-        m_nFlags |= eObjectLoader_MakeNewIDs;
-    }
-    else
-    {
-        m_nFlags &= ~(eObjectLoader_MakeNewIDs);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectArchive::RemapID(REFGUID oldId, REFGUID newId)
-{
-    m_IdRemap[oldId] = newId;
-}

+ 0 - 106
Code/Editor/Objects/ObjectLoader.h

@@ -1,106 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-#pragma once
-
-
-#include "Util/GuidUtil.h"
-#include "ErrorReport.h"
-#include <AzCore/std/containers/set.h>
-
-#include <CryCommon/IXml.h>
-
-class CErrorRecord;
-struct IObjectManager;
-
-typedef std::map<GUID, GUID, guid_less_predicate> TGUIDRemap;
-
-AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
-/** CObjectLoader used to load Bas Object and resolve ObjectId references while loading.
-*/
-class SANDBOX_API CObjectArchive
-{
-public:
-AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
-
-    AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-    XmlNodeRef node; //!< Current archive node.
-    AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-
-    bool bLoading;
-    bool bUndo;
-
-    CObjectArchive(IObjectManager* objMan, XmlNodeRef xmlRoot, bool loading);
-    ~CObjectArchive();
-
-    //! Resolve callback with only one parameter of CBaseObject.
-    typedef AZStd::function<void(CBaseObject*)> ResolveObjRefFunctor1;
-
-    // Return object ID remapped after loading.
-    GUID ResolveID(REFGUID id);
-
-    //! Set object resolve callback, it will be called once object with specified Id is loaded.
-    void SetResolveCallback(CBaseObject* fromObject, REFGUID objectId, ResolveObjRefFunctor1 func);
-    //! Resolve all object ids and call callbacks on resolved objects.
-    void ResolveObjects();
-
-    // Save object to archive.
-    void SaveObject(CBaseObject* pObject);
-
-    //! Load one object from archive.
-    CBaseObject* LoadObject(const XmlNodeRef& objNode, CBaseObject* pPrevObject = nullptr);
-
-    //! If true new loaded objects will be assigned new GUIDs.
-    void MakeNewIds(bool bEnable);
-
-    //! Remap object ids.
-    void RemapID(REFGUID oldId, REFGUID newId);
-
-private:
-    struct SLoadedObjectInfo
-    {
-        int nSortOrder;
-        _smart_ptr<CBaseObject> pObject;
-        XmlNodeRef xmlNode;
-        GUID newGuid;
-        bool operator <(const SLoadedObjectInfo& oi) const { return nSortOrder < oi.nSortOrder;   }
-    };
-
-    IObjectManager* m_objectManager;
-    struct Callback
-    {
-        ResolveObjRefFunctor1 func1;
-        _smart_ptr<CBaseObject> fromObject;
-        Callback() { func1 = 0; }
-    };
-    typedef std::multimap<GUID, Callback, guid_less_predicate> Callbacks;
-    AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-    Callbacks m_resolveCallbacks;
-
-    // Set of all saved objects to this archive.
-    typedef AZStd::set<_smart_ptr<CBaseObject> > ObjectsSet;
-    ObjectsSet m_savedObjects;
-
-    //typedef std::multimap<int,_smart_ptr<CBaseObject> > OrderedObjects;
-    //OrderedObjects m_orderedObjects;
-    std::vector<SLoadedObjectInfo> m_loadedObjects;
-
-    // Loaded objects IDs, used for remapping of GUIDs.
-    TGUIDRemap m_IdRemap;
-
-    enum EObjectLoaderFlags
-    {
-        eObjectLoader_MakeNewIDs = 0x0001,      // If true new loaded objects will be assigned new GUIDs.
-    };
-    int m_nFlags;
-    IErrorReport* m_pCurrentErrorReport;
-
-    bool m_bNeedResolveObjects;
-
-    AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-};

+ 0 - 782
Code/Editor/Objects/ObjectManager.cpp

@@ -1,782 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-#include "EditorDefs.h"
-
-#include "ObjectManager.h"
-
-// Qt
-#include <QMessageBox>
-
-// Editor
-#include "Settings.h"
-#include "DisplaySettings.h"
-#include "EntityObject.h"
-#include "Viewport.h"
-#include "GameEngine.h"
-#include "WaitProgress.h"
-#include "Util/Image.h"
-#include "ObjectManagerLegacyUndo.h"
-#include "Include/HitContext.h"
-
-#include <AzCore/Console/Console.h>
-#include <AzCore/RTTI/BehaviorContext.h>
-#include <AzToolsFramework/Viewport/ViewportMessages.h>
-#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
-
-AZ_CVAR_EXTERNED(bool, ed_visibility_logTiming);
-
-/*!
- *  Class Description used for object templates.
- *  This description filled from Xml template files.
- */
-class CXMLObjectClassDesc
-    : public CObjectClassDesc
-{
-public:
-    CObjectClassDesc*   superType;
-    QString type;
-    QString category;
-    QString fileSpec;
-    GUID guid;
-
-public:
-    virtual ~CXMLObjectClassDesc() = default;
-    REFGUID ClassID() override
-    {
-        return guid;
-    }
-    ObjectType GetObjectType() override { return superType->GetObjectType(); };
-    QString ClassName() override { return type; };
-    QString Category() override { return category; };
-    QObject* CreateQObject() const override { return superType->CreateQObject(); }
-    QString GetTextureIcon() override { return superType->GetTextureIcon(); };
-    QString GetFileSpec() override
-    {
-        if (!fileSpec.isEmpty())
-        {
-            return fileSpec;
-        }
-        else
-        {
-            return superType->GetFileSpec();
-        }
-    };
-    int GameCreationOrder() override { return superType->GameCreationOrder(); };
-};
-
-//////////////////////////////////////////////////////////////////////////
-// CObjectManager implementation.
-//////////////////////////////////////////////////////////////////////////
-CObjectManager* g_pObjectManager = nullptr;
-
-//////////////////////////////////////////////////////////////////////////
-CObjectManager::CObjectManager()
-    : m_bExiting(false)
-    , m_isUpdateVisibilityList(false)
-    , m_currentHideCount(CBaseObject::s_invalidHiddenID)
-{
-    g_pObjectManager = this;
-
-    m_objectsByName.reserve(1024);
-}
-
-//////////////////////////////////////////////////////////////////////////
-CObjectManager::~CObjectManager()
-{
-    m_bExiting = true;
-    DeleteAllObjects();
-}
-
-//////////////////////////////////////////////////////////////////////////
-CBaseObject* CObjectManager::NewObject(CObjectClassDesc* cls, CBaseObject* prev, const QString& file, const char* newObjectName)
-{
-    // Suspend undo operations when initializing object.
-    GetIEditor()->SuspendUndo();
-
-    CBaseObjectPtr obj;
-    {
-        obj = qobject_cast<CBaseObject*>(cls->CreateQObject());
-        obj->SetClassDesc(cls);
-        obj->InitVariables();
-        obj->m_guid = AZ::Uuid::CreateRandom();    // generate uniq GUID for this object.
-
-        GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(obj);
-        if (obj->Init(GetIEditor(), prev, file))
-        {
-            if ((newObjectName)&&(newObjectName[0]))
-            {
-                obj->SetName(newObjectName);
-            }
-            else
-            {
-                if (obj->GetName().isEmpty())
-                {
-                    obj->GenerateUniqueName();
-                }
-            }
-
-            // Create game object itself.
-            obj->CreateGameObject();
-
-            if (!AddObject(obj))
-            {
-                obj = nullptr;
-            }
-        }
-        else
-        {
-            obj = nullptr;
-        }
-        GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
-    }
-
-    GetIEditor()->ResumeUndo();
-
-    if (obj != nullptr && GetIEditor()->IsUndoRecording())
-    {
-        // AZ entity creations are handled through the AZ undo system.
-        if (obj->GetType() != OBJTYPE_AZENTITY)
-        {
-            GetIEditor()->RecordUndo(new CUndoBaseObjectNew(obj));
-        }
-    }
-
-    return obj;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CBaseObject* CObjectManager::NewObject(CObjectArchive& ar, CBaseObject* pUndoObject, bool bMakeNewId)
-{
-    XmlNodeRef objNode = ar.node;
-
-    // Load all objects from XML.
-    QString typeName;
-    GUID id = GUID_NULL;
-
-    if (!objNode->getAttr("Type", typeName))
-    {
-        return nullptr;
-    }
-
-    if (!objNode->getAttr("Id", id))
-    {
-        // Make new ID for object that doesn't have if.
-        id = AZ::Uuid::CreateRandom();
-    }
-
-    if (bMakeNewId)
-    {
-        // Make new guid for this object.
-        GUID newId = AZ::Uuid::CreateRandom();
-        ar.RemapID(id, newId);  // Mark this id remapped.
-        id = newId;
-    }
-
-    CBaseObjectPtr pObject;
-    if (pUndoObject)
-    {
-        // if undoing restore object pointer.
-        pObject = pUndoObject;
-    }
-    else
-    {
-        // New object creation.
-
-        // Suspend undo operations when initializing object.
-        CUndoSuspend undoSuspender;
-
-        QString entityClass;
-        if (objNode->getAttr("EntityClass", entityClass))
-        {
-            typeName = typeName + "::" + entityClass;
-        }
-
-        CObjectClassDesc* cls = FindClass(typeName);
-        if (!cls)
-        {
-            CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_ERROR, "RuntimeClass %s not registered", typeName.toUtf8().data());
-            return nullptr;
-        }
-
-        pObject = qobject_cast<CBaseObject*>(cls->CreateQObject());
-        assert(pObject);
-        pObject->SetClassDesc(cls);
-        pObject->m_guid = id;
-
-        pObject->InitVariables();
-
-        QString objName;
-        objNode->getAttr("Name", objName);
-        pObject->m_name = objName;
-
-        CBaseObject* obj = FindObject(pObject->GetId());
-        if (obj)
-        {
-            // If id is taken.
-            QString error;
-            error = QObject::tr("[Error] Object %1 already exists in the Object Manager and has been deleted as it is a duplicate of object %2").arg(pObject->m_name, obj->GetName());
-            CLogFile::WriteLine(error.toUtf8().data());
-
-            if (!GetIEditor()->IsInTestMode() && !GetIEditor()->IsInLevelLoadTestMode())
-            {
-                CErrorRecord errorRecord;
-                errorRecord.pObject = obj;
-                errorRecord.count = 1;
-                errorRecord.severity = CErrorRecord::ESEVERITY_ERROR;
-                errorRecord.error = error;
-                errorRecord.description = "Possible duplicate objects being loaded, potential fix is to remove duplicate objects from level files.";
-                GetIEditor()->GetErrorReport()->ReportError(errorRecord);
-            }
-
-            return nullptr;
-            //CoCreateGuid( &pObject->m_guid ); // generate uniq GUID for this object.
-        }
-    }
-
-    GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(pObject);
-    if (!pObject->Init(GetIEditor(), nullptr, ""))
-    {
-        GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
-        return nullptr;
-    }
-
-    if (!AddObject(pObject))
-    {
-        GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
-        return nullptr;
-    }
-
-    //pObject->Serialize( ar );
-
-    GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
-
-    if (pObject != nullptr && pUndoObject == nullptr)
-    {
-        // If new object with no undo, record it.
-        if (CUndo::IsRecording())
-        {
-            GetIEditor()->RecordUndo(new CUndoBaseObjectNew(pObject));
-        }
-    }
-
-    return pObject;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CBaseObject* CObjectManager::NewObject(const QString& typeName, CBaseObject* prev, const QString& file, const char* newObjectName)
-{
-    // [9/22/2009 evgeny] If it is "Entity", figure out if a CEntity subclass is actually needed
-    QString fullName = typeName + "::" + file;
-    CObjectClassDesc* cls = FindClass(fullName);
-    if (!cls)
-    {
-        cls = FindClass(typeName);
-    }
-
-    if (!cls)
-    {
-        GetIEditor()->GetSystem()->GetILog()->Log("Warning: RuntimeClass %s (as well as %s) not registered", typeName.toUtf8().data(), fullName.toUtf8().data());
-        return nullptr;
-    }
-    CBaseObject* pObject = NewObject(cls, prev, file, newObjectName);
-    return pObject;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void    CObjectManager::DeleteObject(CBaseObject* obj)
-{
-    AZ_PROFILE_FUNCTION(Editor);
-
-    if (!obj)
-    {
-        return;
-    }
-
-    // If object already deleted.
-    if (obj->CheckFlags(OBJFLAG_DELETED))
-    {
-        return;
-    }
-
-    obj->NotifyListeners(CBaseObject::ON_PREDELETE);
-
-    // Must be after object DetachAll to support restoring Parent/Child relations.
-    // AZ entity deletions are handled through the AZ undo system.
-    if (CUndo::IsRecording() && obj->GetType() != OBJTYPE_AZENTITY)
-    {
-        // Store undo for all child objects.
-        for (int i = 0; i < obj->GetChildCount(); i++)
-        {
-            obj->GetChild(i)->StoreUndo();
-        }
-        CUndo::Record(new CUndoBaseObjectDelete(obj));
-    }
-
-    AABB objAAB;
-    obj->GetBoundBox(objAAB);
-    GetIEditor()->GetGameEngine()->OnAreaModified(objAAB);
-
-    obj->Done();
-
-    RemoveObject(obj);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::DeleteAllObjects()
-{
-    AZ_PROFILE_FUNCTION(Editor);
-
-    InvalidateVisibleList();
-
-    TBaseObjects objectsHolder;
-    GetAllObjects(objectsHolder);
-
-    // Clear map. Need to do this before deleting objects in case someone tries to get object list during shutdown.
-    m_objects.clear();
-    m_objectsByName.clear();
-
-    for (int i = 0; i < objectsHolder.size(); i++)
-    {
-        objectsHolder[i]->Done();
-    }
-
-    //! Delete object instances.
-    objectsHolder.clear();
-
-    // Clear name map.
-    m_nameNumbersMap.clear();
-
-    m_animatedAttachedEntities.clear();
-}
-
-//////////////////////////////////////////////////////////////////////////
-CBaseObject* CObjectManager::FindObject(REFGUID guid) const
-{
-    CBaseObject* result = stl::find_in_map(m_objects, guid, (CBaseObject*)nullptr);
-    return result;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CBaseObject* CObjectManager::FindObject(const QString& sName) const
-{
-    const AZ::Crc32 crc(sName.toUtf8().data(), sName.toUtf8().count(), true);
-
-    auto iter = m_objectsByName.find(crc);
-    if (iter != m_objectsByName.end())
-    {
-        return iter->second;
-    }
-
-    return nullptr;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::FindObjectsOfType(ObjectType type, std::vector<CBaseObject*>& result)
-{
-    result.clear();
-
-    CBaseObjectsArray objects;
-    GetObjects(objects);
-
-    for (size_t i = 0, n = objects.size(); i < n; ++i)
-    {
-        if (objects[i]->GetType() == type)
-        {
-            result.push_back(objects[i]);
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::FindObjectsOfType(const QMetaObject* pClass, std::vector<CBaseObject*>& result)
-{
-    result.clear();
-
-    CBaseObjectsArray objects;
-    GetObjects(objects);
-
-    for (size_t i = 0, n = objects.size(); i < n; ++i)
-    {
-        CBaseObject* pObject = objects[i];
-        if (pObject->metaObject() == pClass)
-        {
-            result.push_back(pObject);
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::FindObjectsInAABB(const AABB& aabb, std::vector<CBaseObject*>& result) const
-{
-    result.clear();
-
-    CBaseObjectsArray objects;
-    GetObjects(objects);
-
-    for (size_t i = 0, n = objects.size(); i < n; ++i)
-    {
-        CBaseObject* pObject = objects[i];
-        AABB aabbObj;
-        pObject->GetBoundBox(aabbObj);
-        if (aabb.IsIntersectBox(aabbObj))
-        {
-            result.push_back(pObject);
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CObjectManager::AddObject(CBaseObject* obj)
-{
-    CBaseObjectPtr p = stl::find_in_map(m_objects, obj->GetId(), nullptr);
-    if (p)
-    {
-        CErrorRecord err;
-        err.error = QObject::tr("New Object %1 has Duplicate GUID %2, New Object Ignored").arg(obj->GetName()).arg(GuidUtil::ToString(obj->GetId()));
-        err.severity = CErrorRecord::ESEVERITY_ERROR;
-        err.pObject = obj;
-        err.flags = CErrorRecord::FLAG_OBJECTID;
-        GetIEditor()->GetErrorReport()->ReportError(err);
-
-        return false;
-    }
-    m_objects[obj->GetId()] = obj;
-
-    // Handle adding object to type-specific containers if needed
-    {
-        if (CEntityObject* entityObj = qobject_cast<CEntityObject*>(obj))
-        {
-            CEntityObject::EAttachmentType attachType = entityObj->GetAttachType();
-            if (attachType == CEntityObject::EAttachmentType::eAT_CharacterBone)
-            {
-                m_animatedAttachedEntities.insert(entityObj);
-            }
-        }
-    }
-
-    const AZ::Crc32 nameCrc(obj->GetName().toUtf8().data(), obj->GetName().toUtf8().count(), true);
-    m_objectsByName[nameCrc] = obj;
-
-    RegisterObjectName(obj->GetName());
-    InvalidateVisibleList();
-    return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::RemoveObject(CBaseObject* obj)
-{
-    assert(obj != 0);
-
-    InvalidateVisibleList();
-
-    // Handle removing object from type-specific containers if needed
-    {
-        if (CEntityObject* entityObj = qobject_cast<CEntityObject*>(obj))
-        {
-            m_animatedAttachedEntities.erase(entityObj);
-        }
-    }
-
-    m_objectsByName.erase(AZ::Crc32(obj->GetName().toUtf8().data(), obj->GetName().toUtf8().count(), true));
-
-    // Need to erase this last since it is a smart pointer and can end up deleting the object if it is the last reference to it being kept
-    m_objects.erase(obj->GetId());
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::GetAllObjects(TBaseObjects& objects) const
-{
-    objects.clear();
-    objects.reserve(m_objects.size());
-    for (Objects::const_iterator it = m_objects.begin(); it != m_objects.end(); ++it)
-    {
-        objects.push_back(it->second);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::ChangeObjectId(REFGUID oldGuid, REFGUID newGuid)
-{
-    Objects::iterator it = m_objects.find(oldGuid);
-    if (it != m_objects.end())
-    {
-        CBaseObjectPtr pRemappedObject = (*it).second;
-        pRemappedObject->SetId(newGuid);
-        m_objects.erase(it);
-        m_objects.insert(AZStd::make_pair(newGuid, pRemappedObject));
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-int CObjectManager::GetObjectCount() const
-{
-    return static_cast<int>(m_objects.size());
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::GetObjects(CBaseObjectsArray& objects) const
-{
-    objects.clear();
-    objects.reserve(m_objects.size());
-    for (Objects::const_iterator it = m_objects.begin(); it != m_objects.end(); ++it)
-    {
-        objects.push_back(it->second);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::SendEvent(ObjectEvent event)
-{
-    for (Objects::iterator it = m_objects.begin(); it != m_objects.end(); ++it)
-    {
-        CBaseObject* obj = it->second;
-        obj->OnEvent(event);
-    }
-
-    if (event == EVENT_RELOAD_ENTITY)
-    {
-        GetIEditor()->Notify(eNotify_OnReloadTrackView);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::SendEvent(ObjectEvent event, const AABB& bounds)
-{
-    AABB box;
-    for (Objects::iterator it = m_objects.begin(); it != m_objects.end(); ++it)
-    {
-        CBaseObject* obj = it->second;
-        obj->GetBoundBox(box);
-        if (bounds.IsIntersectBox(box))
-        {
-            obj->OnEvent(event);
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////
-bool CObjectManager::IsObjectDeletionAllowed(CBaseObject* pObject)
-{
-    if (!pObject)
-    {
-        return false;
-    }
-
-    return true;
-};
-
-//////////////////////////////////////////////////////////////////////////
-uint16 FindPossibleObjectNameNumber(std::set<uint16>& numberSet)
-{
-    const int LIMIT = 65535;
-    size_t nSetSize = numberSet.size();
-    for (uint16 i = 1; i < LIMIT; ++i)
-    {
-        uint16 candidateNumber = (i + nSetSize) % LIMIT;
-        if (numberSet.find(candidateNumber) == numberSet.end())
-        {
-            numberSet.insert(candidateNumber);
-            return candidateNumber;
-        }
-    }
-    return 0;
-}
-
-void CObjectManager::RegisterObjectName(const QString& name)
-{
-    // Remove all numbers from the end of typename.
-    QString typeName = name;
-    int nameLen = typeName.length();
-    int len = nameLen;
-    while (len > 0 && typeName[len - 1].isDigit())
-    {
-        len--;
-    }
-
-    typeName = typeName.left(len);
-
-    uint16 num = 1;
-    if (len < nameLen)
-    {
-        num = (uint16)atoi((const char*)name.toUtf8().data() + len) + 0;
-    }
-
-    NameNumbersMap::iterator iNameNumber = m_nameNumbersMap.find(typeName);
-    if (iNameNumber == m_nameNumbersMap.end())
-    {
-        std::set<uint16> numberSet;
-        numberSet.insert(num);
-        m_nameNumbersMap[typeName] = numberSet;
-    }
-    else
-    {
-        std::set<uint16>& numberSet = iNameNumber->second;
-        numberSet.insert(num);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-QString CObjectManager::GenerateUniqueObjectName(const QString& theTypeName)
-{
-    QString typeName = theTypeName;
-    const int subIndex = theTypeName.indexOf("::");
-    if (subIndex != -1 && subIndex > typeName.length() - 2)
-    {
-        typeName.remove(0, subIndex + 2);
-    }
-
-    // Remove all numbers from the end of typename.
-    int len = typeName.length();
-    while (len > 0 && typeName[len - 1].isDigit())
-    {
-        len--;
-    }
-
-    typeName = typeName.left(len);
-
-    NameNumbersMap::iterator ii = m_nameNumbersMap.find(typeName);
-    uint16 lastNumber = 1;
-    if (ii != m_nameNumbersMap.end())
-    {
-        lastNumber = FindPossibleObjectNameNumber(ii->second);
-    }
-    else
-    {
-        std::set<uint16> numberSet;
-        numberSet.insert(lastNumber);
-        m_nameNumbersMap[typeName] = numberSet;
-    }
-
-    QString str = QStringLiteral("%1%2").arg(typeName).arg(lastNumber);
-
-    return str;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CObjectClassDesc* CObjectManager::FindClass(const QString& className)
-{
-    IClassDesc* cls = CClassFactory::Instance()->FindClass(className.toUtf8().data());
-    if (cls != nullptr && cls->SystemClassID() == ESYSTEM_CLASS_OBJECT)
-    {
-        return (CObjectClassDesc*)cls;
-    }
-    return nullptr;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::RegisterClassTemplate(const XmlNodeRef& templ)
-{
-    QString typeName = templ->getTag();
-    QString superTypeName;
-    if (!templ->getAttr("SuperType", superTypeName))
-    {
-        return;
-    }
-
-    CObjectClassDesc* superType = FindClass(superTypeName);
-    if (!superType)
-    {
-        return;
-    }
-
-    QString category, fileSpec, initialName;
-    templ->getAttr("Category", category);
-    templ->getAttr("File", fileSpec);
-    templ->getAttr("Name", initialName);
-
-    CXMLObjectClassDesc* classDesc = new CXMLObjectClassDesc;
-    classDesc->superType = superType;
-    classDesc->type = typeName;
-    classDesc->category = category;
-    classDesc->fileSpec = fileSpec;
-    classDesc->guid = AZ::Uuid::CreateRandom();
-
-    CClassFactory::Instance()->RegisterClass(classDesc);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::LoadClassTemplates(const QString& path)
-{
-    QString dir = Path::AddPathSlash(path);
-
-    IFileUtil::FileArray files;
-    CFileUtil::ScanDirectory(dir, "*.xml", files, false);
-
-    for (int k = 0; k < files.size(); k++)
-    {
-        // Construct the full filepath of the current file
-        XmlNodeRef node = XmlHelpers::LoadXmlFromFile((dir + files[k].filename).toUtf8().data());
-        if (node != nullptr && node->isTag("ObjectTemplates"))
-        {
-            QString name;
-            for (int i = 0; i < node->getChildCount(); i++)
-            {
-                RegisterClassTemplate(node->getChild(i));
-            }
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::InvalidateVisibleList()
-{
-    if (m_isUpdateVisibilityList)
-    {
-        return;
-    }
-    ++m_visibilitySerialNumber;
-    m_visibleObjects.clear();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::UpdateVisibilityList()
-{
-    m_isUpdateVisibilityList = true;
-    m_visibleObjects.clear();
-
-    bool isInIsolationMode = false;
-    AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
-        isInIsolationMode, &AzToolsFramework::ToolsApplicationRequestBus::Events::IsEditorInIsolationMode);
-
-    for (Objects::iterator it = m_objects.begin(); it != m_objects.end(); ++it)
-    {
-        CBaseObject* obj = it->second;
-        bool visible = obj->IsPotentiallyVisible();
-
-        // entities not isolated in Isolation Mode will be invisible
-        bool isObjectIsolated = obj->IsIsolated();
-        visible = visible && (!isInIsolationMode || isObjectIsolated);
-        obj->UpdateVisibility(visible);
-
-        // when the new viewport interaction model is enabled we always want to add objects
-        // in the view (frustum) to the visible objects list so we can draw feedback for
-        // entities being hidden in the viewport when selected in the  entity outliner
-        // (EditorVisibleEntityDataCache must be populated even if entities are 'hidden')
-        m_visibleObjects.push_back(obj);
-    }
-
-    m_isUpdateVisibilityList = false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CObjectManager::GatherUsedResources(CUsedResources& resources)
-{
-    CBaseObjectsArray objects;
-    GetIEditor()->GetObjectManager()->GetObjects(objects);
-
-    for (int i = 0; i < objects.size(); i++)
-    {
-        CBaseObject* pObject = objects[i];
-        pObject->GatherUsedResources(resources);
-    }
-}
-

+ 0 - 180
Code/Editor/Objects/ObjectManager.h

@@ -1,180 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-// Description : ObjectManager definition.
-#pragma once
-
-#include "IObjectManager.h"
-#include "BaseObject.h"
-
-#include <AzCore/std/containers/map.h>
-#include <AzCore/std/smart_ptr/unique_ptr.h>
-#include <AzCore/EBus/EBus.h>
-#include <AzCore/Component/Component.h>
-#include <Include/SandboxAPI.h>
-
-// forward declarations.
-class CEntityObject;
-class CObjectArchive;
-class CObjectClassDesc;
-class CWaitProgress;
-
-enum class ImageRotationDegrees;
-
-/*!
- *  CObjectManager is a singleton object that
- *  manages global set of objects in level.
- */
-class CObjectManager
-    : public IObjectManager
-{
-public:
-    //! Selection functor callback.
-    //! Callback function must return a boolean value.
-    //! Return true if selection should proceed, or false to abort object selection.
-    CObjectManager();
-    ~CObjectManager();
-
-    CBaseObject* NewObject(CObjectClassDesc* cls, CBaseObject* prev = 0, const QString& file = "", const char* newObjectName = nullptr) override;
-    CBaseObject* NewObject(const QString& typeName, CBaseObject* prev = 0, const QString& file = "", const char* newEntityName = nullptr) override;
-
-    void DeleteObject(CBaseObject* obj) override;
-    void DeleteAllObjects() override;
-
-    //! Get number of objects manager by ObjectManager (not contain sub objects of groups).
-    int GetObjectCount() const override;
-
-    //! Get array of objects, managed by manager (not contain sub objects of groups).
-    //! @param layer if 0 get objects for all layers, or layer to get objects from.
-    void GetObjects(CBaseObjectsArray& objects) const override;
-
-    //! Send event to all objects.
-    //! Will cause OnEvent handler to be called on all objects.
-    void SendEvent(ObjectEvent event) override;
-
-    //! Send event to all objects within given bounding box.
-    //! Will cause OnEvent handler to be called on objects within bounding box.
-    void SendEvent(ObjectEvent event, const AABB& bounds) override;
-
-    //////////////////////////////////////////////////////////////////////////
-    //! Find object by ID.
-    CBaseObject* FindObject(REFGUID guid) const override;
-    //////////////////////////////////////////////////////////////////////////
-    //! Find object by name.
-    CBaseObject* FindObject(const QString& sName) const override;
-    //////////////////////////////////////////////////////////////////////////
-    //! Find objects of given type.
-    void FindObjectsOfType(const QMetaObject* pClass, std::vector<CBaseObject*>& result) override;
-    void FindObjectsOfType(ObjectType type, std::vector<CBaseObject*>& result) override;
-    //////////////////////////////////////////////////////////////////////////
-    //! Find objects which intersect with a given AABB.
-    void FindObjectsInAABB(const AABB& aabb, std::vector<CBaseObject*>& result) const override;
-
-    bool IsObjectDeletionAllowed(CBaseObject* pObject);
-
-    //! Generates uniq name base on type name of object.
-    QString GenerateUniqueObjectName(const QString& typeName) override;
-    //! Register object name in object manager, needed for generating uniq names.
-    void RegisterObjectName(const QString& name) override;
-
-    //! Register XML template of runtime class.
-    void RegisterClassTemplate(const XmlNodeRef& templ);
-    //! Load class templates for specified directory,
-    void LoadClassTemplates(const QString& path);
-
-    //! Registers the ObjectManager's console variables.
-    void RegisterCVars();
-
-    //! Find object class by name.
-    CObjectClassDesc* FindClass(const QString& className) override;
-
-    bool AddObject(CBaseObject* obj);
-    void RemoveObject(CBaseObject* obj);
-    void ChangeObjectId(REFGUID oldId, REFGUID newId) override;
-
-    //////////////////////////////////////////////////////////////////////////
-    //! Invalidate visibily settings of objects.
-    void InvalidateVisibleList() override;
-
-    //////////////////////////////////////////////////////////////////////////
-    // Gathers all resources used by all objects.
-    void GatherUsedResources(CUsedResources& resources) override;
-
-private:
-    friend CObjectArchive;
-    friend class CBaseObject;
-    /** Creates and serialize object from xml node.
-    @param objectNode Xml node to serialize object info from.
-    @param pUndoObject Pointer to deleted object for undo.
-    */
-    CBaseObject* NewObject(CObjectArchive& archive, CBaseObject* pUndoObject, bool bMakeNewId) override;
-
-    //! Update visibility of all objects.
-    void UpdateVisibilityList();
-    //! Get array of all objects in manager.
-    void GetAllObjects(TBaseObjects& objects) const;
-
-    void UnselectCurrent();
-    void SelectCurrent();
-    void SetObjectSelected(CBaseObject* pObject, bool bSelect);
-
-private:
-    typedef AZStd::map<GUID, CBaseObjectPtr, guid_less_predicate> Objects;
-    Objects m_objects;
-    typedef AZStd::unordered_map<AZ::u32, CBaseObjectPtr> ObjectsByNameCrc;
-    ObjectsByNameCrc m_objectsByName;
-
-    //! Array of currently visible objects.
-    TBaseObjects m_visibleObjects;
-
-    // this number changes whenever visibility is invalidated.  Viewports can use it to keep track of whether they need to recompute object
-    // visibility.
-    unsigned int m_visibilitySerialNumber = 1;
-    unsigned int m_lastComputedVisibility = 0; // when the object manager itself last updated visibility (since it also has a cache)
-    int m_lastHideMask = 0;
-
-    // True while performing a select or deselect operation on more than one object.
-    // Prevents individual undo/redo commands for every object, allowing bulk undo/redo
-    bool m_processingBulkSelect = false;
-
-    //////////////////////////////////////////////////////////////////////////
-
-    //////////////////////////////////////////////////////////////////////////
-    // Numbering for names.
-    //////////////////////////////////////////////////////////////////////////
-    typedef std::map<QString, std::set<uint16>, stl::less_stricmp<QString> > NameNumbersMap;
-    NameNumbersMap m_nameNumbersMap;
-
-    bool m_bExiting;
-
-    std::unordered_set<CEntityObject*> m_animatedAttachedEntities;
-
-    bool m_isUpdateVisibilityList;
-
-    uint64 m_currentHideCount;
-};
-
-namespace AzToolsFramework
-{
-    //! A component to reflect scriptable commands for the Editor
-    class ObjectManagerFuncsHandler
-        : public AZ::Component
-    {
-    public:
-        AZ_COMPONENT(ObjectManagerFuncsHandler, "{D79B69EE-A2CC-43C0-AA5C-47DCFCCBC955}")
-
-        SANDBOX_API static void Reflect(AZ::ReflectContext* context);
-
-        // AZ::Component ...
-        void Activate() override {}
-        void Deactivate() override {}
-    };
-
-} // namespace AzToolsFramework
-

+ 0 - 95
Code/Editor/Objects/ObjectManagerLegacyUndo.cpp

@@ -1,95 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-#include "EditorDefs.h"
-
-#include "ObjectManagerLegacyUndo.h"
-
-// AzToolsFramework
-#include <AzToolsFramework/API/ComponentEntityObjectBus.h>
-
-// Editor
-#include "Include/IObjectManager.h"
-#include "Objects/BaseObject.h"
-#include "Objects/ObjectLoader.h"
-
-//////////////////////////////////////////////////////////////////////////
-// CUndoBaseObjectNew implementation.
-//////////////////////////////////////////////////////////////////////////
-
-CUndoBaseObjectNew::CUndoBaseObjectNew(CBaseObject* object)
-{
-    m_object = object;
-}
-
-void CUndoBaseObjectNew::Undo(bool bUndo)
-{
-    if (bUndo)
-    {
-        m_redo = XmlHelpers::CreateXmlNode("Redo");
-        // Save current object state.
-        CObjectArchive ar(GetIEditor()->GetObjectManager(), m_redo, false);
-        ar.bUndo = true;
-        m_object->Serialize(ar);
-    }
-
-    // Delete this object.
-    GetIEditor()->DeleteObject(m_object);
-}
-
-void CUndoBaseObjectNew::Redo()
-{
-    if (!m_redo)
-    {
-        return;
-    }
-
-    IObjectManager* objectManager = GetIEditor()->GetObjectManager();
-    {
-        CObjectArchive ar(objectManager, m_redo, true);
-        ar.bUndo = true;
-        ar.MakeNewIds(false);
-        ar.LoadObject(m_redo, m_object);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-// CUndoBaseObjectDelete implementation.
-//////////////////////////////////////////////////////////////////////////
-
-CUndoBaseObjectDelete::CUndoBaseObjectDelete(CBaseObject* object)
-{
-    AZ_Assert(object, "Object does not exist");
-    object->SetTransformDelegate(nullptr);
-    m_object = object;
-
-    // Save current object state.
-    m_undo = XmlHelpers::CreateXmlNode("Undo");
-    CObjectArchive ar(GetIEditor()->GetObjectManager(), m_undo, false);
-    ar.bUndo = true;
-    m_bSelected = m_object->IsSelected();
-    m_object->Serialize(ar);
-}
-
-void CUndoBaseObjectDelete::Undo([[maybe_unused]] bool bUndo)
-{
-    IObjectManager* objectManager = GetIEditor()->GetObjectManager();
-    {
-        CObjectArchive ar(objectManager, m_undo, true);
-        ar.bUndo = true;
-        ar.MakeNewIds(false);
-        ar.LoadObject(m_undo, m_object);
-        m_object->ClearFlags(OBJFLAG_SELECTED);
-    }
-}
-
-void CUndoBaseObjectDelete::Redo()
-{
-    // Delete this object.
-    GetIEditor()->DeleteObject(m_object);
-}

+ 0 - 59
Code/Editor/Objects/ObjectManagerLegacyUndo.h

@@ -1,59 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-#pragma once
-
-#include "Undo/IUndoObject.h"
-
-#include <AzToolsFramework/API/ToolsApplicationAPI.h>
-
-#include "Objects/BaseObject.h"
-
-//////////////////////////////////////////////////////////////////////////
-//! Undo New Object
-class CUndoBaseObjectNew
-    : public IUndoObject
-{
-public:
-    CUndoBaseObjectNew(CBaseObject* object);
-
-protected:
-    int GetSize() override { return sizeof(*this); } // Return size of xml state.
-    QString GetObjectName() override { return m_object->GetName(); }
-
-    void Undo(bool bUndo) override;
-    void Redo() override;
-
-private:
-    CBaseObjectPtr m_object;
-    TGUIDRemap m_remapping;
-    XmlNodeRef m_redo;
-};
-
-//////////////////////////////////////////////////////////////////////////
-//! Undo Delete Object
-class CUndoBaseObjectDelete
-    : public IUndoObject
-{
-public:
-    CUndoBaseObjectDelete(CBaseObject* object);
-
-protected:
-    int GetSize() override { return sizeof(*this); } // Return size of xml state.
-    QString GetObjectName() override { return m_object->GetName(); }
-
-    void Undo(bool bUndo) override;
-    void Redo() override;
-
-private:
-    CBaseObjectPtr m_object;
-    XmlNodeRef m_undo;
-    TGUIDRemap m_remapping;
-    bool m_bSelected;
-};

+ 0 - 8
Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp

@@ -76,7 +76,6 @@
 #include <Editor/EditorViewportSettings.h>
 #include <Editor/EditorViewportCamera.h>
 #include <Editor/Util/PathUtil.h>
-#include <Editor/Objects/EntityObject.h>
 #include "CryEdit.h"
 #include "Undo/Undo.h"
 
@@ -86,8 +85,6 @@
 #include <QHBoxLayout>
 #include "MainWindow.h"
 
-#include "Include/IObjectManager.h"
-
 #include <AzCore/std/algorithm.h>
 
 #ifdef CreateDirectory
@@ -492,11 +489,6 @@ void SandboxIntegrationManager::OnPrepareForContextReset()
     // Deselect everything.
     AzToolsFramework::ToolsApplicationRequests::Bus::Broadcast(
         &AzToolsFramework::ToolsApplicationRequests::Bus::Events::SetSelectedEntities, AzToolsFramework::EntityIdList());
-
-    std::vector<CBaseObject*> objects;
-    objects.reserve(128);
-    IObjectManager* objectManager = GetIEditor()->GetObjectManager();
-    objectManager->FindObjectsOfType(OBJTYPE_AZENTITY, objects);
 }
 
 void SandboxIntegrationManager::OnActionRegistrationHook()

+ 0 - 1
Code/Editor/PythonEditorFuncs.cpp

@@ -29,7 +29,6 @@
 #include "GameEngine.h"
 #include "ViewManager.h"
 #include "GenericSelectItemDialog.h"
-#include "Objects/BaseObject.h"
 #include "Commands/CommandManager.h"
 
 AZ_CVAR_EXTERNED(bool, ed_previewGameInFullscreen_once);

+ 0 - 1
Code/Editor/TrackView/TrackViewAnimNode.cpp

@@ -35,7 +35,6 @@
 #include "CommentNodeAnimator.h"
 #include "DirectorNodeAnimator.h"
 #include "ViewManager.h"
-#include "Include/IObjectManager.h"
 #include "TrackView/TrackViewDialog.h"
 #include "TrackView/TrackViewSequence.h"
 #include "TrackView/TrackViewUndo.h"

+ 0 - 1
Code/Editor/TrackView/TrackViewAnimNode.h

@@ -16,7 +16,6 @@
 #include <AzToolsFramework/Entity/EditorEntityContextBus.h>
 #include <AzCore/Component/TransformBus.h>
 
-#include "Objects/BaseObject.h"
 #include "TrackViewNode.h"
 #include "TrackViewTrack.h"
 

+ 1 - 2
Code/Editor/TrackView/TrackViewKeyPropertiesDlg.h

@@ -11,8 +11,6 @@
 #define CRYINCLUDE_EDITOR_TRACKVIEW_TRACKVIEWKEYPROPERTIESDLG_H
 #pragma once
 
-#pragma once
-
 #if !defined(Q_MOC_RUN)
 #include "TrackViewSequence.h"
 #include "TrackViewNode.h"
@@ -21,6 +19,7 @@
 
 #include <QScopedPointer>
 #include <QDockWidget>
+#include "Util/Variable.h"
 #endif
 
 namespace Ui {

+ 1 - 2
Code/Editor/TrackView/TrackViewNodes.cpp

@@ -45,7 +45,6 @@
 // Editor
 #include "TrackView/TVEventsDialog.h"
 #include "TrackView/TrackViewDialog.h"
-#include "Objects/ObjectManager.h"
 #include "Util/AutoDirectoryRestoreFileDialog.h"
 #include "TrackViewFBXImportPreviewDialog.h"
 #include "AnimationContext.h"
@@ -172,7 +171,7 @@ protected:
             if (allValidReparenting && !nodes.isEmpty())
             {
                 // By default here the drop action is a CopyAction. That is what we want in case
-                // some other random control accepts this drop (and then does nothing with the data). 
+                // some other random control accepts this drop (and then does nothing with the data).
                 // If that happens we will not receive any notifications. If the Action default was MoveAction,
                 // the dragged items in the tree would be deleted out from under us causing a crash.
                 // Since we are here, we know this drop is on the same control so we can

+ 0 - 1
Code/Editor/TrackView/TrackViewSequence.cpp

@@ -31,7 +31,6 @@
 #include "Clipboard.h"
 #include "TrackViewSequenceManager.h"
 #include "TrackViewNodeFactories.h"
-#include "Include/IObjectManager.h"
 
 
 //////////////////////////////////////////////////////////////////////////

+ 0 - 2
Code/Editor/TrackView/TrackViewSequenceManager.cpp

@@ -22,8 +22,6 @@
 // Editor
 #include "AnimationContext.h"
 #include "GameEngine.h"
-#include "Include/IObjectManager.h"
-#include "Objects/ObjectManager.h"
 
 
 ////////////////////////////////////////////////////////////////////////////

+ 0 - 3
Code/Editor/Undo/Undo.cpp

@@ -13,7 +13,6 @@
 
 #include "Settings.h"
 #include "IUndoManagerListener.h"
-#include "Objects/ObjectManager.h"
 #include <Include/ILogFile.h>
 #include <list>
 
@@ -342,7 +341,6 @@ void CUndoManager::Redo(int numSteps)
     {
         GetIEditor()->UpdateViews(eUpdateObjects);
     }
-    GetIEditor()->GetObjectManager()->InvalidateVisibleList();
 
     m_bRedoing = true;
     EndUndoTransaction();
@@ -404,7 +402,6 @@ void CUndoManager::Undo(int numSteps)
     {
         GetIEditor()->UpdateViews(eUpdateObjects);
     }
-    GetIEditor()->GetObjectManager()->InvalidateVisibleList();
 
     m_bUndoing = true;
     EndUndoTransaction();

+ 1 - 2
Code/Editor/Util/FileUtil.cpp

@@ -40,14 +40,13 @@
 #include <AzToolsFramework/Thumbnails/SourceControlThumbnailBus.h>
 
 // Editor
+#include "QtUtilWin.h"
 #include "Settings.h"
 #include "MainWindow.h"
 #include "CheckOutDialog.h"
 #include "ISourceControl.h"
 #include "Dialogs/Generic/UserOptions.h"
-#include "Include/IObjectManager.h"
 #include "UsedResources.h"
-#include "Objects/BaseObject.h"
 #include "StringHelpers.h"
 #include "AutoDirectoryRestoreFileDialog.h"
 #include "EditorPreferencesDialog.h"

+ 0 - 3
Code/Editor/Viewport.cpp

@@ -26,7 +26,6 @@
 #include "Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.h"
 #include "ViewManager.h"
 #include "Include/HitContext.h"
-#include "Objects/ObjectManager.h"
 #include "Util/3DConnexionDriver.h"
 #include "PluginManager.h"
 #include "GameEngine.h"
@@ -173,7 +172,6 @@ QtViewport::QtViewport(QWidget* parent)
     }
     m_screenTM.SetIdentity();
 
-    m_pMouseOverObject = nullptr;
 
     m_bAdvancedSelectMode = false;
 
@@ -313,7 +311,6 @@ void QtViewport::OnDeactivate()
 //////////////////////////////////////////////////////////////////////////
 void QtViewport::ResetContent()
 {
-    m_pMouseOverObject = nullptr;
 }
 
 //////////////////////////////////////////////////////////////////////////

+ 1 - 5
Code/Editor/Viewport.h

@@ -18,9 +18,8 @@
 #include "IPostRenderer.h"
 #include "Include/IDisplayViewport.h"
 #include "Include/SandboxAPI.h"
-
-#include <QMenu>
 #include <QPointer>
+#include <QMenu>
 
 #if defined(Q_OS_WIN)
 #include <QtWinExtras/qwinfunctions.h>
@@ -36,11 +35,9 @@ namespace AzQtComponents
 }
 
 // forward declarations.
-class CBaseObject;
 class CCryEditDoc;
 class CLayoutViewPane;
 class CViewManager;
-class CBaseObjectsCache;
 struct HitContext;
 class CImageEx;
 class QMenu;
@@ -563,7 +560,6 @@ protected:
     QCursor m_hCurrCursor;
 
     //! Mouse is over this object.
-    CBaseObject* m_pMouseOverObject;
     QString m_cursorStr;
     QString m_cursorSupplementaryStr;
 

+ 0 - 1
Code/Editor/ViewportTitleDlg.cpp

@@ -26,7 +26,6 @@
 #include "DisplaySettings.h"
 #include "EditorViewportSettings.h"
 #include "GameEngine.h"
-#include "Include/IObjectManager.h"
 #include "MainWindow.h"
 #include "MathConversion.h"
 #include "Settings.h"

+ 0 - 12
Code/Editor/editor_lib_files.cmake

@@ -265,14 +265,11 @@ set(FILES
     Include/IEditorClassFactory.h
     Include/ILogFile.h
     Include/IKeyTimeSet.h
-    Include/IObjectManager.h
     Include/IPlugin.h
     Include/IPreferencesPage.h
     Include/ISourceControl.h
     Include/ObjectEvent.h
     Util/AffineParts.cpp
-    Objects/BaseObject.cpp
-    Objects/BaseObject.h
     AnimationContext.cpp
     AnimationContext.h
     AzAssetBrowser/AzAssetBrowserRequestHandler.cpp
@@ -406,15 +403,6 @@ set(FILES
     LevelIndependentFileMan.h
     LogFileImpl.cpp
     LogFileImpl.h
-    Objects/ClassDesc.h
-    Objects/ObjectLoader.cpp
-    Objects/ObjectLoader.h
-    Objects/ObjectManager.cpp
-    Objects/ObjectManager.h
-    Objects/ObjectManagerLegacyUndo.cpp
-    Objects/ObjectManagerLegacyUndo.h
-    Objects/EntityObject.cpp
-    Objects/EntityObject.h
     PythonEditorFuncs.cpp
     PythonEditorFuncs.h
     QtUI/WaitCursor.h

+ 0 - 2
Code/Framework/AzToolsFramework/AzToolsFramework/API/ComponentEntityObjectBus.h

@@ -13,8 +13,6 @@
 #include <AzCore/Component/ComponentBus.h>
 #include <AzToolsFramework/ToolsComponents/EditorSelectionAccentSystemComponent.h>
 
-class CEntityObject;
-
 namespace AzToolsFramework
 {
     /**

+ 0 - 2
Gems/LyShine/Code/Editor/Animation/AnimationContext.cpp

@@ -15,8 +15,6 @@
 #include <LyShine/Animation/IUiAnimation.h>
 #include "GameEngine.h"
 
-#include "Objects/EntityObject.h"
-
 #include "Animation/UiAnimViewSequence.h"
 #include "Animation/UiAnimViewDialog.h"
 #include "Animation/UiAnimViewUndo.h"

+ 0 - 2
Gems/LyShine/Code/Editor/Animation/UiAVSequenceProps.cpp

@@ -14,8 +14,6 @@
 #include "UiAnimViewSequence.h"
 #include "Animation/AnimationContext.h"
 
-#include "Objects/BaseObject.h"
-
 #include "QtUtilWin.h"
 #include <Editor/Animation/ui_UiAVSequenceProps.h>
 #include <QMessageBox>

+ 1 - 1
Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp

@@ -16,7 +16,7 @@
 #include "UiAnimViewNodeFactories.h"
 #include "AnimationContext.h"
 #include "UiAnimViewSequenceManager.h"
-#include "Objects/EntityObject.h"
+#include "Util/EditorUtils.h"
 #include "ViewManager.h"
 #include "Clipboard.h"
 

+ 0 - 1
Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h

@@ -15,7 +15,6 @@
 #include <AzCore/Serialization/SerializeContext.h>
 
 class CUiAnimViewAnimNode;
-class CEntityObject;
 class QWidget;
 
 namespace AZ

+ 0 - 2
Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp

@@ -34,8 +34,6 @@
 #include <AzQtComponents/Components/StyledDockWidget.h>
 #include <AzQtComponents/Components/Widgets/ToolBar.h>
 
-#include "Objects/EntityObject.h"
-
 #include "PluginManager.h"
 #include "Util/3DConnexionDriver.h"
 #include "UiAnimViewNewSequenceDialog.h"

+ 0 - 1
Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp

@@ -20,7 +20,6 @@
 
 #include <LyShine/Animation/IUiAnimation.h>
 
-#include "Objects/EntityObject.h"
 #include "ViewManager.h"
 #include <Editor/Util/fastlib.h>
 

+ 0 - 5
Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp

@@ -16,9 +16,6 @@
 #include "UiAnimViewNodeFactories.h"
 #include "UiAnimViewSequence.h"
 #include "AnimationContext.h"
-#if UI_ANIMATION_REMOVED
-#include "Objects/EntityObject.h"
-#endif
 #include "Clipboard.h"
 
 #include "UiEditorAnimationBus.h"
@@ -489,8 +486,6 @@ void CUiAnimViewSequence::SelectSelectedNodesInViewport()
 
     CUiAnimViewAnimNodeBundle selectedNodes = GetSelectedAnimNodes();
 
-    std::vector<CBaseObject*> entitiesToBeSelected;
-
 #if UI_ANIMATION_REMOVED // lights
     const unsigned int numSelectedNodes = selectedNodes.GetCount();
 

+ 0 - 1
Gems/Maestro/Code/Source/Components/EditorSequenceComponent.cpp

@@ -8,7 +8,6 @@
 #include "EditorSequenceComponent.h"
 #include "EditorSequenceAgentComponent.h"
 
-#include "Objects/EntityObject.h"
 #include "TrackView/TrackViewSequenceManager.h"
 #include <Maestro/Types/AnimValueType.h>
 #include <Maestro/Types/SequenceType.h>