Преглед на файлове

Merge branch 'development' into cmake/SPEC-2513_w4018

Signed-off-by: Esteban Papp <[email protected]>

# Conflicts:
#	Gems/EMotionFX/Code/EMotionFX/Source/Actor.cpp
Esteban Papp преди 4 години
родител
ревизия
2d1ed48fea
променени са 100 файла, в които са добавени 1177 реда и са изтрити 6821 реда
  1. 1 0
      .gitignore
  2. 5 0
      AutomatedTesting/Gem/PythonTests/AWS/CMakeLists.txt
  3. 1 0
      AutomatedTesting/Gem/PythonTests/atom_renderer/atom_hydra_scripts/hydra_GPUTest_AtomFeatureIntegrationBenchmark.py
  4. 19 0
      AutomatedTesting/Gem/PythonTests/atom_renderer/atom_utils/benchmark_utils.py
  5. 2 0
      AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py
  6. 2 2
      AutomatedTesting/Gem/PythonTests/scripting/ScriptCanvasComponent_OnEntityActivatedDeactivated_PrintMessage.py
  7. 10 9
      AutomatedTesting/Gem/PythonTests/smoke/CMakeLists.txt
  8. 44 0
      AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_CPULoadLevel_Works.py
  9. 43 0
      AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_GPULoadLevel_Works.py
  10. 0 105
      AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_LoadLevel_Works.py
  11. 1 1
      CMakeLists.txt
  12. 2 1
      Code/Editor/2DViewport.cpp
  13. 1 1
      Code/Editor/AboutDialog.cpp
  14. 7 17
      Code/Editor/AnimationContext.cpp
  15. 1 0
      Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp
  16. 11 11
      Code/Editor/BaseLibrary.cpp
  17. 10 10
      Code/Editor/BaseLibraryItem.cpp
  18. 21 21
      Code/Editor/BaseLibraryManager.cpp
  19. 1 1
      Code/Editor/CheckOutDialog.h
  20. 6 6
      Code/Editor/ConfigGroup.cpp
  21. 2 2
      Code/Editor/ConfigGroup.h
  22. 5 5
      Code/Editor/ControlMRU.cpp
  23. 1 1
      Code/Editor/CrtDebug.cpp
  24. 39 123
      Code/Editor/CryEdit.cpp
  25. 12 12
      Code/Editor/CryEdit.h
  26. 35 33
      Code/Editor/CryEditDoc.cpp
  27. 5 5
      Code/Editor/CryEditDoc.h
  28. 1 1
      Code/Editor/CryEditPy.cpp
  29. 1 1
      Code/Editor/CustomAspectRatioDlg.cpp
  30. 4 4
      Code/Editor/CustomResolutionDlg.cpp
  31. 2 2
      Code/Editor/CustomizeKeyboardDialog.cpp
  32. 3 4
      Code/Editor/EditorDefs.h
  33. 1 1
      Code/Editor/EditorFileMonitor.cpp
  34. 1 1
      Code/Editor/EditorFileMonitor.h
  35. 23 23
      Code/Editor/EditorPanelUtils.cpp
  36. 1 1
      Code/Editor/EditorPreferencesDialog.cpp
  37. 18 2
      Code/Editor/EditorPreferencesPageFiles.cpp
  38. 7 0
      Code/Editor/EditorPreferencesPageFiles.h
  39. 218 507
      Code/Editor/EditorViewportWidget.cpp
  40. 187 390
      Code/Editor/EditorViewportWidget.h
  41. 2 2
      Code/Editor/ErrorReport.cpp
  42. 8 8
      Code/Editor/ErrorReportDialog.cpp
  43. 1 1
      Code/Editor/ErrorReportTableModel.cpp
  44. 0 7
      Code/Editor/Export/ExportManager.cpp
  45. 16 25
      Code/Editor/GameEngine.cpp
  46. 2 2
      Code/Editor/GameExporter.cpp
  47. 1 1
      Code/Editor/GenericSelectItemDialog.cpp
  48. 2 2
      Code/Editor/IEditor.h
  49. 14 14
      Code/Editor/IEditorImpl.cpp
  50. 4 4
      Code/Editor/IEditorImpl.h
  51. 5 5
      Code/Editor/IconManager.cpp
  52. 1 1
      Code/Editor/LayoutConfigDialog.cpp
  53. 2 2
      Code/Editor/LayoutWnd.cpp
  54. 2 2
      Code/Editor/Lib/Tests/test_EditorUtils.cpp
  55. 1 1
      Code/Editor/Lib/Tests/test_Main.cpp
  56. 30 30
      Code/Editor/Objects/BaseObject.cpp
  57. 8 8
      Code/Editor/Objects/BaseObject.h
  58. 25 25
      Code/Editor/Objects/EntityObject.cpp
  59. 1 1
      Code/Editor/Objects/EntityObject.h
  60. 1 1
      Code/Editor/Objects/Gizmo.h
  61. 1 1
      Code/Editor/Objects/GizmoManager.cpp
  62. 3 3
      Code/Editor/Objects/LineGizmo.cpp
  63. 7 7
      Code/Editor/Objects/ObjectLoader.cpp
  64. 1 1
      Code/Editor/Objects/ObjectLoader.h
  65. 52 51
      Code/Editor/Objects/ObjectManager.cpp
  66. 1 1
      Code/Editor/Objects/SelectionGroup.cpp
  67. 1 1
      Code/Editor/Objects/TrackGizmo.cpp
  68. 24 0
      Code/Editor/Platform/Mac/editor_mac.cmake
  69. 1 1
      Code/Editor/Platform/Mac/gui_info.plist
  70. 75 0
      Code/Editor/Platform/Mac/main_dummy.cpp
  71. 4 4
      Code/Editor/Platform/Windows/Util/Mailer_Windows.cpp
  72. 2 1
      Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp
  73. 1 1
      Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentPaletteWindow.cpp
  74. 8 8
      Code/Editor/Plugins/EditorCommon/DockTitleBarWidget.cpp
  75. 1 1
      Code/Editor/Plugins/FFMPEGPlugin/main.cpp
  76. 1 1
      Code/Editor/Plugins/PerforcePlugin/PerforceSourceControl.cpp
  77. 2 2
      Code/Editor/Plugins/ProjectSettingsTool/PlatformSettings_Android.cpp
  78. 1 1
      Code/Editor/Plugins/ProjectSettingsTool/Validators.cpp
  79. 0 4142
      Code/Editor/RenderViewport.cpp
  80. 0 649
      Code/Editor/RenderViewport.h
  81. 8 0
      Code/Editor/Settings.cpp
  82. 8 0
      Code/Editor/Settings.h
  83. 3 11
      Code/Editor/TrackView/CommentNodeAnimator.cpp
  84. 10 2
      Code/Editor/TrackView/SequenceBatchRenderDialog.cpp
  85. 1 1
      Code/Editor/TrackView/TrackViewAnimNode.cpp
  86. 19 2
      Code/Editor/UndoViewRotation.cpp
  87. 2 0
      Code/Editor/UndoViewRotation.h
  88. 0 202
      Code/Editor/Util/IndexedFiles.cpp
  89. 0 176
      Code/Editor/Util/IndexedFiles.h
  90. 2 17
      Code/Editor/ViewManager.cpp
  91. 0 18
      Code/Editor/ViewPane.cpp
  92. 0 1
      Code/Editor/Viewport.cpp
  93. 10 4
      Code/Editor/Viewport.h
  94. 25 7
      Code/Editor/ViewportTitleDlg.cpp
  95. 0 1
      Code/Editor/ViewportTitleDlg.h
  96. 0 4
      Code/Editor/editor_lib_files.cmake
  97. 16 0
      Code/Framework/AzCore/AzCore/Math/MatrixUtils.cpp
  98. 4 0
      Code/Framework/AzCore/AzCore/Math/MatrixUtils.h
  99. 3 4
      Code/Framework/AzCore/AzCore/Memory/AllocationRecords.h
  100. 0 50
      Code/Framework/AzCore/AzCore/Script/ScriptProperty.cpp

+ 1 - 0
.gitignore

@@ -25,3 +25,4 @@ TestResults/**
 *.swatches
 *.swatches
 /imgui.ini
 /imgui.ini
 /scripts/project_manager/logs/
 /scripts/project_manager/logs/
+/AutomatedTesting/Gem/PythonTests/scripting/TestResults

+ 5 - 0
AutomatedTesting/Gem/PythonTests/AWS/CMakeLists.txt

@@ -12,6 +12,11 @@
 ################################################################################
 ################################################################################
 
 
 if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
 if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
+    # Only enable AWS automated tests on Windows
+    if(NOT "${PAL_PLATFORM_NAME}" STREQUAL "Windows")
+        return()
+    endif()
+
     # Enable after installing NodeJS and CDK on jenkins Windows AMI.
     # Enable after installing NodeJS and CDK on jenkins Windows AMI.
     ly_add_pytest(
     ly_add_pytest(
         NAME AutomatedTesting::AWSTests
         NAME AutomatedTesting::AWSTests

+ 1 - 0
AutomatedTesting/Gem/PythonTests/atom_renderer/atom_hydra_scripts/hydra_GPUTest_AtomFeatureIntegrationBenchmark.py

@@ -93,6 +93,7 @@ def run():
     general.idle_wait_frames(100)
     general.idle_wait_frames(100)
     for i in range(1, 101):
     for i in range(1, 101):
         benchmarker.capture_pass_timestamp(i)
         benchmarker.capture_pass_timestamp(i)
+        benchmarker.capture_cpu_frame_time(i)
     general.exit_game_mode()
     general.exit_game_mode()
     helper.wait_for_condition(function=lambda: not general.is_in_game_mode(), timeout_in_seconds=2.0)
     helper.wait_for_condition(function=lambda: not general.is_in_game_mode(), timeout_in_seconds=2.0)
     general.log("Capturing complete.")
     general.log("Capturing complete.")

+ 19 - 0
AutomatedTesting/Gem/PythonTests/atom_renderer/atom_utils/benchmark_utils.py

@@ -61,6 +61,25 @@ class BenchmarkHelper(object):
             general.log('Failed to capture pass timestamps.')
             general.log('Failed to capture pass timestamps.')
         return self.capturedData
         return self.capturedData
 
 
+    def capture_cpu_frame_time(self, frame_number):
+        """
+        Capture CPU frame times and block further execution until it has been written to the disk.
+        """
+        self.handler = azlmbr.atom.ProfilingCaptureNotificationBusHandler()
+        self.handler.connect()
+        self.handler.add_callback('OnCaptureCpuFrameTimeFinished', self.on_data_captured)
+
+        self.done = False
+        self.capturedData = False
+        success = azlmbr.atom.ProfilingCaptureRequestBus(
+            azlmbr.bus.Broadcast, "CaptureCpuFrameTime", f'{self.output_path}/cpu_frame{frame_number}_time.json')
+        if success:
+            self.wait_until_data()
+            general.log('CPU frame time captured.')
+        else:
+            general.log('Failed to capture CPU frame time.')
+        return self.capturedData
+
     def on_data_captured(self, parameters):
     def on_data_captured(self, parameters):
         # the parameters come in as a tuple
         # the parameters come in as a tuple
         if parameters[0]:
         if parameters[0]:

+ 2 - 0
AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py

@@ -99,6 +99,7 @@ class TestPerformanceBenchmarkSuite(object):
         expected_lines = [
         expected_lines = [
             "Benchmark metadata captured.",
             "Benchmark metadata captured.",
             "Pass timestamps captured.",
             "Pass timestamps captured.",
+            "CPU frame time captured.",
             "Capturing complete.",
             "Capturing complete.",
             "Captured data successfully."
             "Captured data successfully."
         ]
         ]
@@ -106,6 +107,7 @@ class TestPerformanceBenchmarkSuite(object):
         unexpected_lines = [
         unexpected_lines = [
             "Failed to capture data.",
             "Failed to capture data.",
             "Failed to capture pass timestamps.",
             "Failed to capture pass timestamps.",
+            "Failed to capture CPU frame time.",
             "Failed to capture benchmark metadata."
             "Failed to capture benchmark metadata."
         ]
         ]
 
 

+ 2 - 2
AutomatedTesting/Gem/PythonTests/scripting/ScriptCanvasComponent_OnEntityActivatedDeactivated_PrintMessage.py

@@ -93,11 +93,11 @@ def ScriptCanvasComponent_OnEntityActivatedDeactivated_PrintMessage():
             if entity_dict["name"] == "Controller":
             if entity_dict["name"] == "Controller":
                 sc_component.get_property_tree()
                 sc_component.get_property_tree()
                 sc_component.set_component_property_value(
                 sc_component.set_component_property_value(
-                    "Properties|Variable Fields|Variables|[0]|Name,Value|Datum|Datum|EntityToActivate",
+                    "Properties|Variables|EntityToActivate|Datum|Datum|value|EntityToActivate",
                     entity_to_activate.id,
                     entity_to_activate.id,
                 )
                 )
                 sc_component.set_component_property_value(
                 sc_component.set_component_property_value(
-                    "Properties|Variable Fields|Variables|[1]|Name,Value|Datum|Datum|EntityToDeactivate",
+                    "Properties|Variables|EntityToDeactivate|Datum|Datum|value|EntityToDeactivate",
                     entity_to_deactivate.id,
                     entity_to_deactivate.id,
                 )
                 )
             return entity
             return entity

+ 10 - 9
AutomatedTesting/Gem/PythonTests/smoke/CMakeLists.txt

@@ -11,7 +11,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
     if (PAL_TRAIT_BUILD_SERIALIZECONTEXTTOOLS)
     if (PAL_TRAIT_BUILD_SERIALIZECONTEXTTOOLS)
         list(APPEND additional_dependencies AZ::SerializeContextTools) # test_CLITool_SerializeContextTools depends on it
         list(APPEND additional_dependencies AZ::SerializeContextTools) # test_CLITool_SerializeContextTools depends on it
     endif()
     endif()
-    list(APPEND additional_dependencies AZ::AssetBundlerBatch) # test_CLITool_AssetBundlerBatch_Works depends on it
 
 
     ly_add_pytest(
     ly_add_pytest(
         NAME AutomatedTesting::SmokeTest
         NAME AutomatedTesting::SmokeTest
@@ -26,26 +25,27 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
             Legacy::Editor
             Legacy::Editor
             AutomatedTesting.GameLauncher
             AutomatedTesting.GameLauncher
             AutomatedTesting.Assets
             AutomatedTesting.Assets
-            ${aditional_dependencies}
+            AZ::AzTestRunner
+            AZ::AssetBundlerBatch
+            ${additional_dependencies}
         COMPONENT
         COMPONENT
             Smoke
             Smoke
     )
     )
 
 
     ly_add_pytest(
     ly_add_pytest(
-        NAME AutomatedTesting::SandboxTest
-        TEST_SUITE sandbox
+        NAME AutomatedTesting::LoadLevelGPU
+        TEST_SUITE smoke
         TEST_SERIAL
         TEST_SERIAL
-        PATH ${CMAKE_CURRENT_LIST_DIR}
-        PYTEST_MARKS "SUITE_sandbox"
-        TIMEOUT 1500
+        TEST_REQUIRES gpu
+        PATH ${CMAKE_CURRENT_LIST_DIR}/test_RemoteConsole_GPULoadLevel_Works.py
+        TIMEOUT 100
         RUNTIME_DEPENDENCIES
         RUNTIME_DEPENDENCIES
             AZ::AssetProcessor
             AZ::AssetProcessor
             AZ::PythonBindingsExample
             AZ::PythonBindingsExample
-            Legacy::Editor
             AutomatedTesting.GameLauncher
             AutomatedTesting.GameLauncher
             AutomatedTesting.Assets
             AutomatedTesting.Assets
         COMPONENT
         COMPONENT
-            Sandbox
+            Smoke
     )
     )
 
 
     ly_add_pytest(
     ly_add_pytest(
@@ -74,4 +74,5 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
             AutomatedTesting.GameLauncher
             AutomatedTesting.GameLauncher
             AutomatedTesting.Assets
             AutomatedTesting.Assets
     )
     )
+
 endif()
 endif()

+ 44 - 0
AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_CPULoadLevel_Works.py

@@ -0,0 +1,44 @@
+"""
+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
+
+
+UI Apps: AutomatedTesting.GameLauncher
+Launch AutomatedTesting.GameLauncher with Simple level
+Test should run in both gpu and non gpu
+"""
+
+import pytest
+import psutil
+
+import ly_test_tools.environment.waiter as waiter
+import editor_python_test_tools.hydra_test_utils as editor_test_utils
+from ly_remote_console.remote_console_commands import RemoteConsole as RemoteConsole
+from ly_remote_console.remote_console_commands import (
+    send_command_and_expect_response as send_command_and_expect_response,
+)
+
+
[email protected]("launcher_platform", ["windows"])
[email protected]("project", ["AutomatedTesting"])
[email protected]("level", ["Simple"])
[email protected]_smoke
+class TestRemoteConsoleLoadLevelWorks(object):
+    @pytest.fixture
+    def remote_console_instance(self, request):
+        console = RemoteConsole()
+
+        def teardown():
+            if console.connected:
+                console.stop()
+
+        request.addfinalizer(teardown)
+
+        return console
+
+    def test_RemoteConsole_LoadLevel_Works(self, launcher, level, remote_console_instance, launcher_platform):
+        expected_lines = ['Level system is loading "Simple"']
+
+        editor_test_utils.launch_and_validate_results_launcher(launcher, level, remote_console_instance, expected_lines, null_renderer=True)

+ 43 - 0
AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_GPULoadLevel_Works.py

@@ -0,0 +1,43 @@
+"""
+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
+
+
+UI Apps: AutomatedTesting.GameLauncher
+Launch AutomatedTesting.GameLauncher with Simple level
+Test should run in both gpu and non gpu
+"""
+
+import pytest
+import psutil
+
+import ly_test_tools.environment.waiter as waiter
+import editor_python_test_tools.hydra_test_utils as editor_test_utils
+from ly_remote_console.remote_console_commands import RemoteConsole as RemoteConsole
+from ly_remote_console.remote_console_commands import (
+    send_command_and_expect_response as send_command_and_expect_response,
+)
+
+
[email protected]("launcher_platform", ["windows"])
[email protected]("project", ["AutomatedTesting"])
[email protected]("level", ["Simple"])
+class TestRemoteConsoleLoadLevelWorks(object):
+    @pytest.fixture
+    def remote_console_instance(self, request):
+        console = RemoteConsole()
+
+        def teardown():
+            if console.connected:
+                console.stop()
+
+        request.addfinalizer(teardown)
+
+        return console
+
+    def test_RemoteConsole_LoadLevel_Works(self, launcher, level, remote_console_instance, launcher_platform):
+        expected_lines = ['Level system is loading "Simple"']
+
+        editor_test_utils.launch_and_validate_results_launcher(launcher, level, remote_console_instance, expected_lines, null_renderer=False)

+ 0 - 105
AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_LoadLevel_Works.py

@@ -1,105 +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
-
-
-UI Apps: AutomatedTesting.GameLauncher
-Launch AutomatedTesting.GameLauncher with Simple level
-Test should run in both gpu and non gpu
-"""
-
-import pytest
-import psutil
-
-# Bail on the test if ly_test_tools doesn't exist.
-pytest.importorskip("ly_test_tools")
-import ly_test_tools.environment.waiter as waiter
-from ly_remote_console.remote_console_commands import RemoteConsole as RemoteConsole
-from ly_remote_console.remote_console_commands import (
-    send_command_and_expect_response as send_command_and_expect_response,
-)
-
-
[email protected]("launcher_platform", ["windows"])
[email protected]("project", ["AutomatedTesting"])
[email protected]("level", ["Simple"])
[email protected]_sandbox
-class TestRemoteConsoleLoadLevelWorks(object):
-    @pytest.fixture
-    def remote_console_instance(self, request):
-        console = RemoteConsole()
-
-        def teardown():
-            if console.connected:
-                console.stop()
-
-        request.addfinalizer(teardown)
-
-        return console
-
-    def test_RemoteConsole_LoadLevel_Works(self, launcher, level, remote_console_instance, launcher_platform):
-        expected_lines = ['Level system is loading "Simple"']
-
-        self.launch_and_validate_results_launcher(launcher, level, remote_console_instance, expected_lines)
-
-    def launch_and_validate_results_launcher(
-        self,
-        launcher,
-        level,
-        remote_console_instance,
-        expected_lines,
-        null_renderer=False,
-        port_listener_timeout=120,
-        log_monitor_timeout=300,
-        remote_console_port=4600,
-    ):
-        """
-        Runs the launcher with the specified level, and monitors Game.log for expected lines.
-        :param launcher: Configured launcher object to run test against.
-        :param level: The level to load in the launcher.
-        :param remote_console_instance: Configured Remote Console object.
-        :param expected_lines: Expected lines to search log for.
-        :oaram null_renderer: Specifies the test does not require the renderer. Defaults to True.
-        :param port_listener_timeout: Timeout for verifying successful connection to Remote Console.
-        :param log_monitor_timeout: Timeout for monitoring for lines in Game.log
-        :param remote_console_port: The port used to communicate with the Remote Console.
-        """
-
-        def _check_for_listening_port(port):
-            """
-            Checks to see if the connection to the designated port was established.
-            :param port: Port to listen to.
-            :return: True if port is listening.
-            """
-            port_listening = False
-            for conn in psutil.net_connections():
-                if "port={}".format(port) in str(conn):
-                    port_listening = True
-            return port_listening
-
-        if null_renderer:
-            launcher.args.extend(["-NullRenderer"])
-
-        # Start the Launcher
-        with launcher.start():
-
-            # Ensure Remote Console can be reached
-            waiter.wait_for(
-                lambda: _check_for_listening_port(remote_console_port),
-                port_listener_timeout,
-                exc=AssertionError("Port {} not listening.".format(remote_console_port)),
-            )
-            remote_console_instance.start(timeout=30)
-
-            # Load the specified level in the launcher
-            send_command_and_expect_response(
-                remote_console_instance, f"loadlevel {level}", "LEVEL_LOAD_END", timeout=30
-            )
-
-            # Monitor the console for expected lines
-            for line in expected_lines:
-                assert remote_console_instance.expect_log_line(
-                    line, log_monitor_timeout
-                ), f"Expected line not found: {line}"

+ 1 - 1
CMakeLists.txt

@@ -28,8 +28,8 @@ include(cmake/FileUtil.cmake)
 include(cmake/PAL.cmake)
 include(cmake/PAL.cmake)
 include(cmake/PALTools.cmake)
 include(cmake/PALTools.cmake)
 include(cmake/RuntimeDependencies.cmake)
 include(cmake/RuntimeDependencies.cmake)
-include(cmake/Install.cmake)
 include(cmake/Configurations.cmake) # Requires to be after PAL so we get platform variable definitions
 include(cmake/Configurations.cmake) # Requires to be after PAL so we get platform variable definitions
+include(cmake/Install.cmake)
 include(cmake/Dependencies.cmake)
 include(cmake/Dependencies.cmake)
 include(cmake/Deployment.cmake)
 include(cmake/Deployment.cmake)
 include(cmake/3rdParty.cmake)
 include(cmake/3rdParty.cmake)

+ 2 - 1
Code/Editor/2DViewport.cpp

@@ -952,7 +952,8 @@ void Q2DViewport::DrawViewerMarker(DisplayContext& dc)
     dc.SetColor(QColor(0, 0, 255)); // blue
     dc.SetColor(QColor(0, 0, 255)); // blue
     dc.DrawWireBox(-dim * noScale, dim * noScale);
     dc.DrawWireBox(-dim * noScale, dim * noScale);
 
 
-    float fov = GetIEditor()->GetSystem()->GetViewCamera().GetFov();
+    constexpr float DefaultFov = 60.f;
+    float fov = DefaultFov;
 
 
     Vec3 q[4];
     Vec3 q[4];
     float dist = 30;
     float dist = 30;

+ 1 - 1
Code/Editor/AboutDialog.cpp

@@ -25,7 +25,7 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
 #include <ui_AboutDialog.h>
 #include <ui_AboutDialog.h>
 AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
 AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
 
 
-CAboutDialog::CAboutDialog(QString versionText, QString richTextCopyrightNotice, QWidget* pParent /*=NULL*/)
+CAboutDialog::CAboutDialog(QString versionText, QString richTextCopyrightNotice, QWidget* pParent /*=nullptr*/)
     : QDialog(pParent)
     : QDialog(pParent)
     , m_ui(new Ui::CAboutDialog)
     , m_ui(new Ui::CAboutDialog)
 {
 {

+ 7 - 17
Code/Editor/AnimationContext.cpp

@@ -16,7 +16,6 @@
 
 
 // Editor
 // Editor
 #include "TrackView/TrackViewDialog.h"
 #include "TrackView/TrackViewDialog.h"
-#include "RenderViewport.h"
 #include "ViewManager.h"
 #include "ViewManager.h"
 #include "Objects/SelectionGroup.h"
 #include "Objects/SelectionGroup.h"
 #include "Include/IObjectManager.h"
 #include "Include/IObjectManager.h"
@@ -29,7 +28,7 @@ class CMovieCallback
     : public IMovieCallback
     : public IMovieCallback
 {
 {
 protected:
 protected:
-    virtual void OnMovieCallback(ECallbackReason reason, [[maybe_unused]] IAnimNode* pNode)
+    void OnMovieCallback(ECallbackReason reason, [[maybe_unused]] IAnimNode* pNode) override
     {
     {
         switch (reason)
         switch (reason)
         {
         {
@@ -49,7 +48,7 @@ protected:
         }
         }
     }
     }
 
 
-    void OnSetCamera(const SCameraParams& Params)
+    void OnSetCamera(const SCameraParams& Params) override
     {
     {
         // Only switch camera when in Play mode.
         // Only switch camera when in Play mode.
         GUID camObjId = GUID_NULL;
         GUID camObjId = GUID_NULL;
@@ -61,15 +60,6 @@ protected:
             {
             {
                 camObjId = pEditorEntity->GetId();
                 camObjId = pEditorEntity->GetId();
             }
             }
-
-            CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
-            if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(pViewport))
-            {
-                if (!rvp->IsSequenceCamera())
-                {
-                    return;
-                }
-            }
         }
         }
 
 
         // Switch camera in active rendering view.
         // Switch camera in active rendering view.
@@ -79,14 +69,14 @@ protected:
         }
         }
     };
     };
 
 
-    bool IsSequenceCamUsed() const
+    bool IsSequenceCamUsed() const override
     {
     {
         if (gEnv->IsEditorGameMode() == true)
         if (gEnv->IsEditorGameMode() == true)
         {
         {
             return true;
             return true;
         }
         }
 
 
-        if (GetIEditor()->GetViewManager() == NULL)
+        if (GetIEditor()->GetViewManager() == nullptr)
         {
         {
             return false;
             return false;
         }
         }
@@ -113,7 +103,7 @@ public:
     CAnimationContextPostRender(CAnimationContext* pAC)
     CAnimationContextPostRender(CAnimationContext* pAC)
         : m_pAC(pAC){}
         : m_pAC(pAC){}
 
 
-    void OnPostRender() const { assert(m_pAC); m_pAC->OnPostRender(); }
+    void OnPostRender() const override { assert(m_pAC); m_pAC->OnPostRender(); }
 
 
 protected:
 protected:
     CAnimationContext* m_pAC;
     CAnimationContext* m_pAC;
@@ -231,7 +221,7 @@ void CAnimationContext::SetSequence(CTrackViewSequence* sequence, bool force, bo
         m_pSequence->UnBindFromEditorObjects();
         m_pSequence->UnBindFromEditorObjects();
     }
     }
     m_pSequence = sequence;
     m_pSequence = sequence;
-    
+
     // Notify a new sequence was just selected.
     // Notify a new sequence was just selected.
     Maestro::EditorSequenceNotificationBus::Broadcast(&Maestro::EditorSequenceNotificationBus::Events::OnSequenceSelected, m_pSequence ? m_pSequence->GetSequenceComponentEntityId() : AZ::EntityId());
     Maestro::EditorSequenceNotificationBus::Broadcast(&Maestro::EditorSequenceNotificationBus::Events::OnSequenceSelected, m_pSequence ? m_pSequence->GetSequenceComponentEntityId() : AZ::EntityId());
 
 
@@ -347,7 +337,7 @@ void CAnimationContext::OnSequenceActivated(AZ::EntityId entityId)
                     {
                     {
                         // Hang onto this because SetSequence() will reset it.
                         // Hang onto this because SetSequence() will reset it.
                         float lastTime = m_mostRecentSequenceTime;
                         float lastTime = m_mostRecentSequenceTime;
-                        
+
                         SetSequence(sequence, false, false);
                         SetSequence(sequence, false, false);
 
 
                         // Restore the current time.
                         // Restore the current time.

+ 1 - 0
Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp

@@ -82,6 +82,7 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent)
 
 
     m_ui->m_assetBrowserTableViewWidget->setVisible(false);
     m_ui->m_assetBrowserTableViewWidget->setVisible(false);
     m_ui->m_toggleDisplayViewBtn->setVisible(false);
     m_ui->m_toggleDisplayViewBtn->setVisible(false);
+    m_ui->m_searchWidget->SetFilterInputInterval(AZStd::chrono::milliseconds(250));
     if (ed_useNewAssetBrowserTableView)
     if (ed_useNewAssetBrowserTableView)
     {
     {
         m_ui->m_toggleDisplayViewBtn->setVisible(true);
         m_ui->m_toggleDisplayViewBtn->setVisible(true);

+ 11 - 11
Code/Editor/BaseLibrary.cpp

@@ -24,10 +24,10 @@ class CUndoBaseLibrary
     : public IUndoObject
     : public IUndoObject
 {
 {
 public:
 public:
-    CUndoBaseLibrary(CBaseLibrary* pLib, const QString& description, const QString& selectedItem = 0)
+    CUndoBaseLibrary(CBaseLibrary* pLib, const QString& description, const QString& selectedItem = QString())
         : m_pLib(pLib)
         : m_pLib(pLib)
         , m_description(description)
         , m_description(description)
-        , m_redo(0)
+        , m_redo(nullptr)
         , m_selectedItem(selectedItem)
         , m_selectedItem(selectedItem)
     {
     {
         assert(m_pLib);
         assert(m_pLib);
@@ -36,16 +36,16 @@ public:
         m_pLib->Serialize(m_undo, false);
         m_pLib->Serialize(m_undo, false);
     }
     }
 
 
-    virtual QString GetEditorObjectName()
+    QString GetEditorObjectName() override
     {
     {
         return m_selectedItem;
         return m_selectedItem;
     }
     }
 
 
 protected:
 protected:
-    virtual int GetSize() { return sizeof(CUndoBaseLibrary); }
-    virtual QString GetDescription() { return m_description; };
+    int GetSize() override { return sizeof(CUndoBaseLibrary); }
+    QString GetDescription() override { return m_description; };
 
 
-    virtual void Undo(bool bUndo)
+    void Undo(bool bUndo) override
     {
     {
         if (bUndo)
         if (bUndo)
         {
         {
@@ -57,7 +57,7 @@ protected:
         GetIEditor()->Notify(eNotify_OnDataBaseUpdate);
         GetIEditor()->Notify(eNotify_OnDataBaseUpdate);
     }
     }
 
 
-    virtual void Redo()
+    void Redo() override
     {
     {
         m_pLib->Serialize(m_redo, true);
         m_pLib->Serialize(m_redo, true);
         m_pLib->SetModified();
         m_pLib->SetModified();
@@ -107,7 +107,7 @@ void CBaseLibrary::RemoveAllItems()
         // Unregister item in case it was registered.  It is ok if it wasn't.  This is still safe to call.
         // Unregister item in case it was registered.  It is ok if it wasn't.  This is still safe to call.
         m_pManager->UnregisterItem(m_items[i]);
         m_pManager->UnregisterItem(m_items[i]);
         // Clear library item.
         // Clear library item.
-        m_items[i]->m_library = NULL;
+        m_items[i]->m_library = nullptr;
     }
     }
     m_items.clear();
     m_items.clear();
     Release();
     Release();
@@ -216,7 +216,7 @@ IDataBaseItem* CBaseLibrary::FindItem(const QString& name)
             return m_items[i];
             return m_items[i];
         }
         }
     }
     }
-    return NULL;
+    return nullptr;
 }
 }
 
 
 bool CBaseLibrary::AddLibraryToSourceControl(const QString& fullPathName) const
 bool CBaseLibrary::AddLibraryToSourceControl(const QString& fullPathName) const
@@ -233,8 +233,8 @@ bool CBaseLibrary::AddLibraryToSourceControl(const QString& fullPathName) const
 
 
 bool CBaseLibrary::SaveLibrary(const char* name, bool saveEmptyLibrary)
 bool CBaseLibrary::SaveLibrary(const char* name, bool saveEmptyLibrary)
 {
 {
-    assert(name != NULL);
-    if (name == NULL)
+    assert(name != nullptr);
+    if (name == nullptr)
     {
     {
         CryFatalError("The library you are attempting to save has no name specified.");
         CryFatalError("The library you are attempting to save has no name specified.");
         return false;
         return false;

+ 10 - 10
Code/Editor/BaseLibraryItem.cpp

@@ -16,7 +16,7 @@
 
 
 #include <AzCore/Math/Uuid.h>
 #include <AzCore/Math/Uuid.h>
 
 
-//undo object for multi-changes inside library item. such as set all variables to default values. 
+//undo object for multi-changes inside library item. such as set all variables to default values.
 //For example: change particle emitter shape will lead to multiple variable changes
 //For example: change particle emitter shape will lead to multiple variable changes
 class CUndoBaseLibraryItem
 class CUndoBaseLibraryItem
     : public IUndoObject
     : public IUndoObject
@@ -54,24 +54,24 @@ public:
     }
     }
 
 
 protected:
 protected:
-    virtual int GetSize() 
-    { 
+    int GetSize() override
+    {
         return m_size;
         return m_size;
     }
     }
 
 
     QString GetDescription() override
     QString GetDescription() override
-    { 
-        return m_description; 
+    {
+        return m_description;
     }
     }
 
 
-    virtual void Undo(bool bUndo)
+    void Undo(bool bUndo) override
     {
     {
         //find the libItem
         //find the libItem
         IDataBaseItem *libItem = m_libMgr->FindItemByName(m_itemPath);
         IDataBaseItem *libItem = m_libMgr->FindItemByName(m_itemPath);
         if (libItem == nullptr)
         if (libItem == nullptr)
         {
         {
             //the undo stack is not reliable any more..
             //the undo stack is not reliable any more..
-            assert(false);  
+            assert(false);
             return;
             return;
         }
         }
 
 
@@ -95,7 +95,7 @@ protected:
         libItem->Serialize(m_undoCtx);
         libItem->Serialize(m_undoCtx);
     }
     }
 
 
-    virtual void Redo()
+    void Redo() override
     {
     {
         //find the libItem
         //find the libItem
         IDataBaseItem *libItem = m_libMgr->FindItemByName(m_itemPath);
         IDataBaseItem *libItem = m_libMgr->FindItemByName(m_itemPath);
@@ -124,7 +124,7 @@ private:
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 CBaseLibraryItem::CBaseLibraryItem()
 CBaseLibraryItem::CBaseLibraryItem()
 {
 {
-    m_library = 0;
+    m_library = nullptr;
     GenerateId();
     GenerateId();
     m_bModified = false;
     m_bModified = false;
 }
 }
@@ -266,7 +266,7 @@ void CBaseLibraryItem::SetLibrary(CBaseLibrary* pLibrary)
 void CBaseLibraryItem::SetModified(bool bModified)
 void CBaseLibraryItem::SetModified(bool bModified)
 {
 {
     m_bModified = bModified;
     m_bModified = bModified;
-    if (m_bModified && m_library != NULL)
+    if (m_bModified && m_library != nullptr)
     {
     {
         m_library->SetModified(bModified);
         m_library->SetModified(bModified);
     }
     }

+ 21 - 21
Code/Editor/BaseLibraryManager.cpp

@@ -26,7 +26,7 @@ class CUndoBaseLibraryManager
     : public IUndoObject
     : public IUndoObject
 {
 {
 public:
 public:
-    CUndoBaseLibraryManager(CBaseLibraryManager* pMngr, const QString& description, const QString& modifiedManager = 0)
+    CUndoBaseLibraryManager(CBaseLibraryManager* pMngr, const QString& description, const QString& modifiedManager = nullptr)
         : m_pMngr(pMngr)
         : m_pMngr(pMngr)
         , m_description(description)
         , m_description(description)
         , m_editorObject(modifiedManager)
         , m_editorObject(modifiedManager)
@@ -35,16 +35,16 @@ public:
         SerializeTo(m_undos);
         SerializeTo(m_undos);
     }
     }
 
 
-    virtual QString GetEditorObjectName()
+    QString GetEditorObjectName() override
     {
     {
         return m_editorObject;
         return m_editorObject;
     }
     }
 
 
 protected:
 protected:
-    virtual int GetSize() { return sizeof(CUndoBaseLibraryManager); }
-    virtual QString GetDescription() { return m_description; };
+    int GetSize() override { return sizeof(CUndoBaseLibraryManager); }
+    QString GetDescription() override { return m_description; };
 
 
-    virtual void Undo(bool bUndo)
+    void Undo(bool bUndo) override
     {
     {
         if (bUndo)
         if (bUndo)
         {
         {
@@ -55,7 +55,7 @@ protected:
         GetIEditor()->Notify(eNotify_OnDataBaseUpdate);
         GetIEditor()->Notify(eNotify_OnDataBaseUpdate);
     }
     }
 
 
-    virtual void Redo()
+    void Redo() override
     {
     {
         m_pMngr->ClearAll();
         m_pMngr->ClearAll();
         UnserializeFrom(m_redos);
         UnserializeFrom(m_redos);
@@ -84,7 +84,7 @@ private:
         for (int i = 0; i < m_pMngr->GetLibraryCount(); i++)
         for (int i = 0; i < m_pMngr->GetLibraryCount(); i++)
         {
         {
             IDataBaseLibrary* library = m_pMngr->GetLibrary(i);
             IDataBaseLibrary* library = m_pMngr->GetLibrary(i);
-            
+
             const char* tag = library->IsLevelLibrary() ? LEVEL_LIBRARY_TAG : LIBRARY_TAG;
             const char* tag = library->IsLevelLibrary() ? LEVEL_LIBRARY_TAG : LIBRARY_TAG;
             XmlNodeRef node = GetIEditor()->GetSystem()->CreateXmlNode(tag);
             XmlNodeRef node = GetIEditor()->GetSystem()->CreateXmlNode(tag);
             QString file = library->GetFilename().isEmpty() ? library->GetFilename() : library->GetName();
             QString file = library->GetFilename().isEmpty() ? library->GetFilename() : library->GetName();
@@ -203,7 +203,7 @@ int CBaseLibraryManager::FindLibraryIndex(const QString& library)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 IDataBaseItem* CBaseLibraryManager::FindItem(REFGUID guid) const
 IDataBaseItem* CBaseLibraryManager::FindItem(REFGUID guid) const
 {
 {
-    CBaseLibraryItem* pMtl = stl::find_in_map(m_itemsGuidMap, guid, (CBaseLibraryItem*)0);
+    CBaseLibraryItem* pMtl = stl::find_in_map(m_itemsGuidMap, guid, nullptr);
     return pMtl;
     return pMtl;
 }
 }
 
 
@@ -226,7 +226,7 @@ void CBaseLibraryManager::SplitFullItemName(const QString& fullItemName, QString
 IDataBaseItem* CBaseLibraryManager::FindItemByName(const QString& fullItemName)
 IDataBaseItem* CBaseLibraryManager::FindItemByName(const QString& fullItemName)
 {
 {
     AZStd::lock_guard<AZStd::mutex> lock(m_itemsNameMapMutex);
     AZStd::lock_guard<AZStd::mutex> lock(m_itemsNameMapMutex);
-    return stl::find_in_map(m_itemsNameMap, fullItemName, 0);
+    return stl::find_in_map(m_itemsNameMap, fullItemName, nullptr);
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -398,7 +398,7 @@ void CBaseLibraryManager::DeleteLibrary(const QString& library, bool forceDelete
                     UnregisterItem((CBaseLibraryItem*)pLibrary->GetItem(j));
                     UnregisterItem((CBaseLibraryItem*)pLibrary->GetItem(j));
                 }
                 }
                 pLibrary->RemoveAllItems();
                 pLibrary->RemoveAllItems();
-                
+
                 if (pLibrary->IsLevelLibrary())
                 if (pLibrary->IsLevelLibrary())
                 {
                 {
                     m_pLevelLibrary = nullptr;
                     m_pLevelLibrary = nullptr;
@@ -420,7 +420,7 @@ IDataBaseLibrary* CBaseLibraryManager::GetLibrary(int index) const
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 IDataBaseLibrary* CBaseLibraryManager::GetLevelLibrary() const
 IDataBaseLibrary* CBaseLibraryManager::GetLevelLibrary() const
 {
 {
-    IDataBaseLibrary* pLevelLib = NULL;
+    IDataBaseLibrary* pLevelLib = nullptr;
 
 
     for (int i = 0; i < GetLibraryCount(); i++)
     for (int i = 0; i < GetLibraryCount(); i++)
     {
     {
@@ -531,9 +531,9 @@ QString CBaseLibraryManager::MakeUniqueItemName(const QString& srcName, const QS
 
 
     // search for strings in the database that might have a similar name (ignore case)
     // search for strings in the database that might have a similar name (ignore case)
     IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
     IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
-    for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != NULL; pItem = pEnum->GetNext())
+    for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
     {
     {
-        //Check if the item is in the target library first. 
+        //Check if the item is in the target library first.
         IDataBaseLibrary* itemLibrary = pItem->GetLibrary();
         IDataBaseLibrary* itemLibrary = pItem->GetLibrary();
         QString itemLibraryName;
         QString itemLibraryName;
         if (itemLibrary)
         if (itemLibrary)
@@ -590,7 +590,7 @@ QString CBaseLibraryManager::MakeUniqueItemName(const QString& srcName, const QS
 void CBaseLibraryManager::Validate()
 void CBaseLibraryManager::Validate()
 {
 {
     IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
     IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
-    for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != NULL; pItem = pEnum->GetNext())
+    for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
     {
     {
         pItem->Validate();
         pItem->Validate();
     }
     }
@@ -617,7 +617,7 @@ void CBaseLibraryManager::RegisterItem(CBaseLibraryItem* pItem, REFGUID newGuid)
         {
         {
             return;
             return;
         }
         }
-        CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, newGuid, (CBaseLibraryItem*)0);
+        CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, newGuid, nullptr);
         if (!pOldItem)
         if (!pOldItem)
         {
         {
             pItem->m_guid = newGuid;
             pItem->m_guid = newGuid;
@@ -677,7 +677,7 @@ void CBaseLibraryManager::RegisterItem(CBaseLibraryItem* pItem)
         {
         {
             return;
             return;
         }
         }
-        CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, pItem->GetGUID(), (CBaseLibraryItem*)0);
+        CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, pItem->GetGUID(), nullptr);
         if (!pOldItem)
         if (!pOldItem)
         {
         {
             m_itemsGuidMap[pItem->GetGUID()] = pItem;
             m_itemsGuidMap[pItem->GetGUID()] = pItem;
@@ -789,7 +789,7 @@ QString CBaseLibraryManager::MakeFullItemName(IDataBaseLibrary* pLibrary, const
 void CBaseLibraryManager::GatherUsedResources(CUsedResources& resources)
 void CBaseLibraryManager::GatherUsedResources(CUsedResources& resources)
 {
 {
     IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
     IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
-    for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != NULL; pItem = pEnum->GetNext())
+    for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
     {
     {
         pItem->GatherUsedResources(resources);
         pItem->GatherUsedResources(resources);
     }
     }
@@ -815,15 +815,15 @@ void CBaseLibraryManager::OnEditorNotifyEvent(EEditorNotifyEvent event)
     switch (event)
     switch (event)
     {
     {
     case eNotify_OnBeginNewScene:
     case eNotify_OnBeginNewScene:
-        SetSelectedItem(0);
+        SetSelectedItem(nullptr);
         ClearAll();
         ClearAll();
         break;
         break;
     case eNotify_OnBeginSceneOpen:
     case eNotify_OnBeginSceneOpen:
-        SetSelectedItem(0);
+        SetSelectedItem(nullptr);
         ClearAll();
         ClearAll();
         break;
         break;
     case eNotify_OnCloseScene:
     case eNotify_OnCloseScene:
-        SetSelectedItem(0);
+        SetSelectedItem(nullptr);
         ClearAll();
         ClearAll();
         break;
         break;
     }
     }
@@ -913,7 +913,7 @@ void CBaseLibraryManager::ChangeLibraryOrder(IDataBaseLibrary* lib, unsigned int
     {
     {
         return;
         return;
     }
     }
-    
+
     for (int i = 0; i < m_libs.size(); i++)
     for (int i = 0; i < m_libs.size(); i++)
     {
     {
         if (lib == m_libs[i])
         if (lib == m_libs[i])

+ 1 - 1
Code/Editor/CheckOutDialog.h

@@ -34,7 +34,7 @@ public:
         CANCEL = QDialog::Rejected
         CANCEL = QDialog::Rejected
     };
     };
 
 
-    CCheckOutDialog(const QString& file, QWidget* pParent = NULL);   // standard constructor
+    CCheckOutDialog(const QString& file, QWidget* pParent = nullptr);   // standard constructor
     virtual ~CCheckOutDialog();
     virtual ~CCheckOutDialog();
 
 
     // Dialog Data
     // Dialog Data

+ 6 - 6
Code/Editor/ConfigGroup.cpp

@@ -48,7 +48,7 @@ namespace Config
             }
             }
         }
         }
 
 
-        return NULL;
+        return nullptr;
     }
     }
 
 
     const IConfigVar* CConfigGroup::GetVar(const char* szName) const
     const IConfigVar* CConfigGroup::GetVar(const char* szName) const
@@ -63,7 +63,7 @@ namespace Config
             }
             }
         }
         }
 
 
-        return NULL;
+        return nullptr;
     }
     }
 
 
     IConfigVar* CConfigGroup::GetVar(uint index)
     IConfigVar* CConfigGroup::GetVar(uint index)
@@ -73,7 +73,7 @@ namespace Config
             return m_vars[index];
             return m_vars[index];
         }
         }
 
 
-        return NULL;
+        return nullptr;
     }
     }
 
 
     const IConfigVar* CConfigGroup::GetVar(uint index) const
     const IConfigVar* CConfigGroup::GetVar(uint index) const
@@ -83,7 +83,7 @@ namespace Config
             return m_vars[index];
             return m_vars[index];
         }
         }
 
 
-        return NULL;
+        return nullptr;
     }
     }
 
 
     void CConfigGroup::SaveToXML(XmlNodeRef node)
     void CConfigGroup::SaveToXML(XmlNodeRef node)
@@ -127,7 +127,7 @@ namespace Config
 
 
                     case IConfigVar::eType_STRING:
                     case IConfigVar::eType_STRING:
                     {
                     {
-                        string currentValue = 0;
+                        string currentValue = nullptr;
                         var->Get(&currentValue);
                         var->Get(&currentValue);
                         node->setAttr(szName, currentValue);
                         node->setAttr(szName, currentValue);
                         break;
                         break;
@@ -186,7 +186,7 @@ namespace Config
 
 
                 case IConfigVar::eType_STRING:
                 case IConfigVar::eType_STRING:
                 {
                 {
-                    string currentValue = 0;
+                    string currentValue = nullptr;
                     var->GetDefault(&currentValue);
                     var->GetDefault(&currentValue);
                     QString readValue(currentValue.c_str());
                     QString readValue(currentValue.c_str());
                     if (node->getAttr(szName, readValue))
                     if (node->getAttr(szName, readValue))

+ 2 - 2
Code/Editor/ConfigGroup.h

@@ -37,11 +37,11 @@ namespace Config
             , m_description(szDescription)
             , m_description(szDescription)
             , m_type(varType)
             , m_type(varType)
             , m_flags(flags)
             , m_flags(flags)
-            , m_ptr(NULL)
+            , m_ptr(nullptr)
         {};
         {};
 
 
         virtual ~IConfigVar() = default;
         virtual ~IConfigVar() = default;
-        
+
         ILINE EType GetType() const
         ILINE EType GetType() const
         {
         {
             return m_type;
             return m_type;

+ 5 - 5
Code/Editor/ControlMRU.cpp

@@ -28,7 +28,7 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
 
 
     CString* pArrNames = pRecentFileList->m_arrNames;
     CString* pArrNames = pRecentFileList->m_arrNames;
 
 
-    assert(pArrNames != NULL);
+    assert(pArrNames != nullptr);
     if (!pArrNames)
     if (!pArrNames)
     {
     {
         return;
         return;
@@ -52,7 +52,7 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
     if (m_pParent->IsCustomizeMode())
     if (m_pParent->IsCustomizeMode())
     {
     {
         m_dwHideFlags = 0;
         m_dwHideFlags = 0;
-        SetEnabled(TRUE);
+        SetEnabled(true);
         return;
         return;
     }
     }
 
 
@@ -61,7 +61,7 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
         SetCaption(CString(MAKEINTRESOURCE(IDS_NORECENTFILE_CAPTION)));
         SetCaption(CString(MAKEINTRESOURCE(IDS_NORECENTFILE_CAPTION)));
         SetDescription("No recently opened files");
         SetDescription("No recently opened files");
         m_dwHideFlags = 0;
         m_dwHideFlags = 0;
-        SetEnabled(FALSE);
+        SetEnabled(false);
 
 
         return;
         return;
     }
     }
@@ -105,7 +105,7 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
 
 
         int nId = iMRU + GetFirstMruID();
         int nId = iMRU + GetFirstMruID();
 
 
-        CXTPControl* pControl = m_pControls->Add(xtpControlButton, nId, _T(""), m_nIndex + iLastValidMRU + 1, TRUE);
+        CXTPControl* pControl = m_pControls->Add(xtpControlButton, nId, _T(""), m_nIndex + iLastValidMRU + 1, true);
         assert(pControl);
         assert(pControl);
 
 
         pControl->SetCaption(CXTPControlWindowList::ConstructCaption(strName, iLastValidMRU + 1));
         pControl->SetCaption(CXTPControlWindowList::ConstructCaption(strName, iLastValidMRU + 1));
@@ -130,6 +130,6 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
         SetCaption(CString(MAKEINTRESOURCE(IDS_NORECENTFILE_CAPTION)));
         SetCaption(CString(MAKEINTRESOURCE(IDS_NORECENTFILE_CAPTION)));
         SetDescription("No recently opened files");
         SetDescription("No recently opened files");
         m_dwHideFlags = 0;
         m_dwHideFlags = 0;
-        SetEnabled(FALSE);
+        SetEnabled(false);
     }
     }
 }
 }

+ 1 - 1
Code/Editor/CrtDebug.cpp

@@ -62,7 +62,7 @@ int crtAllocHook(int nAllocType, void* pvData,
 {
 {
     if (nBlockUse == _CRT_BLOCK)
     if (nBlockUse == _CRT_BLOCK)
     {
     {
-        return(TRUE);
+        return TRUE;
     }
     }
 
 
     static int total_cnt = 0;
     static int total_cnt = 0;

+ 39 - 123
Code/Editor/CryEdit.cpp

@@ -127,7 +127,6 @@ AZ_POP_DISABLE_WARNING
 
 
 #include "Util/AutoDirectoryRestoreFileDialog.h"
 #include "Util/AutoDirectoryRestoreFileDialog.h"
 #include "Util/EditorAutoLevelLoadTest.h"
 #include "Util/EditorAutoLevelLoadTest.h"
-#include "Util/IndexedFiles.h"
 #include "AboutDialog.h"
 #include "AboutDialog.h"
 #include <AzToolsFramework/PythonTerminal/ScriptHelpDialog.h>
 #include <AzToolsFramework/PythonTerminal/ScriptHelpDialog.h>
 
 
@@ -267,13 +266,13 @@ CCrySingleDocTemplate* CCryDocManager::SetDefaultTemplate(CCrySingleDocTemplate*
 // Copied from MFC to get rid of the silly ugly unoverridable doc-type pick dialog
 // Copied from MFC to get rid of the silly ugly unoverridable doc-type pick dialog
 void CCryDocManager::OnFileNew()
 void CCryDocManager::OnFileNew()
 {
 {
-    assert(m_pDefTemplate != NULL);
+    assert(m_pDefTemplate != nullptr);
 
 
-    m_pDefTemplate->OpenDocumentFile(NULL);
+    m_pDefTemplate->OpenDocumentFile(nullptr);
     // if returns NULL, the user has already been alerted
     // if returns NULL, the user has already been alerted
 }
 }
-BOOL CCryDocManager::DoPromptFileName(QString& fileName, [[maybe_unused]] UINT nIDSTitle,
-    [[maybe_unused]] DWORD lFlags, BOOL bOpenFileDialog, [[maybe_unused]] CDocTemplate* pTemplate)
+bool CCryDocManager::DoPromptFileName(QString& fileName, [[maybe_unused]] UINT nIDSTitle,
+    [[maybe_unused]] DWORD lFlags, bool bOpenFileDialog, [[maybe_unused]] CDocTemplate* pTemplate)
 {
 {
     CLevelFileDialog levelFileDialog(bOpenFileDialog);
     CLevelFileDialog levelFileDialog(bOpenFileDialog);
     levelFileDialog.show();
     levelFileDialog.show();
@@ -287,15 +286,15 @@ BOOL CCryDocManager::DoPromptFileName(QString& fileName, [[maybe_unused]] UINT n
 
 
     return false;
     return false;
 }
 }
-CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToMRU)
+CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, bool bAddToMRU)
 {
 {
-    assert(lpszFileName != NULL);
+    assert(lpszFileName != nullptr);
 
 
     // find the highest confidence
     // find the highest confidence
     auto pos = m_templateList.begin();
     auto pos = m_templateList.begin();
     CCrySingleDocTemplate::Confidence bestMatch = CCrySingleDocTemplate::noAttempt;
     CCrySingleDocTemplate::Confidence bestMatch = CCrySingleDocTemplate::noAttempt;
-    CCrySingleDocTemplate* pBestTemplate = NULL;
-    CCryEditDoc* pOpenDocument = NULL;
+    CCrySingleDocTemplate* pBestTemplate = nullptr;
+    CCryEditDoc* pOpenDocument = nullptr;
 
 
     if (lpszFileName[0] == '\"')
     if (lpszFileName[0] == '\"')
     {
     {
@@ -312,7 +311,7 @@ CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToM
         auto pTemplate = *(pos++);
         auto pTemplate = *(pos++);
 
 
         CCrySingleDocTemplate::Confidence match;
         CCrySingleDocTemplate::Confidence match;
-        assert(pOpenDocument == NULL);
+        assert(pOpenDocument == nullptr);
         match = pTemplate->MatchDocType(szPath.toUtf8().data(), pOpenDocument);
         match = pTemplate->MatchDocType(szPath.toUtf8().data(), pOpenDocument);
         if (match > bestMatch)
         if (match > bestMatch)
         {
         {
@@ -325,18 +324,18 @@ CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToM
         }
         }
     }
     }
 
 
-    if (pOpenDocument != NULL)
+    if (pOpenDocument != nullptr)
     {
     {
         return pOpenDocument;
         return pOpenDocument;
     }
     }
 
 
-    if (pBestTemplate == NULL)
+    if (pBestTemplate == nullptr)
     {
     {
         QMessageBox::critical(AzToolsFramework::GetActiveWindow(), QString(), QObject::tr("Failed to open document."));
         QMessageBox::critical(AzToolsFramework::GetActiveWindow(), QString(), QObject::tr("Failed to open document."));
-        return NULL;
+        return nullptr;
     }
     }
 
 
-    return pBestTemplate->OpenDocumentFile(szPath.toUtf8().data(), bAddToMRU, FALSE);
+    return pBestTemplate->OpenDocumentFile(szPath.toUtf8().data(), bAddToMRU, false);
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////
@@ -461,7 +460,7 @@ void CCryEditApp::RegisterActionHandlers()
     ON_COMMAND(ID_FILE_SAVE_LEVEL, OnFileSave)
     ON_COMMAND(ID_FILE_SAVE_LEVEL, OnFileSave)
     ON_COMMAND(ID_FILE_EXPORTOCCLUSIONMESH, OnFileExportOcclusionMesh)
     ON_COMMAND(ID_FILE_EXPORTOCCLUSIONMESH, OnFileExportOcclusionMesh)
 
 
-    // Project Manager 
+    // Project Manager
     ON_COMMAND(ID_FILE_PROJECT_MANAGER_SETTINGS, OnOpenProjectManagerSettings)
     ON_COMMAND(ID_FILE_PROJECT_MANAGER_SETTINGS, OnOpenProjectManagerSettings)
     ON_COMMAND(ID_FILE_PROJECT_MANAGER_NEW, OnOpenProjectManagerNew)
     ON_COMMAND(ID_FILE_PROJECT_MANAGER_NEW, OnOpenProjectManagerNew)
     ON_COMMAND(ID_FILE_PROJECT_MANAGER_OPEN, OnOpenProjectManager)
     ON_COMMAND(ID_FILE_PROJECT_MANAGER_OPEN, OnOpenProjectManager)
@@ -654,7 +653,7 @@ struct SharedData
 //
 //
 //      This function uses a technique similar to that described in KB
 //      This function uses a technique similar to that described in KB
 //      article Q141752 to locate the previous instance of the application. .
 //      article Q141752 to locate the previous instance of the application. .
-BOOL CCryEditApp::FirstInstance(bool bForceNewInstance)
+bool CCryEditApp::FirstInstance(bool bForceNewInstance)
 {
 {
     QSystemSemaphore sem(QString(O3DEApplicationName) + "_sem", 1);
     QSystemSemaphore sem(QString(O3DEApplicationName) + "_sem", 1);
     sem.acquire();
     sem.acquire();
@@ -802,12 +801,12 @@ void CCryEditApp::InitDirectory()
 // Needed to work with custom memory manager.
 // Needed to work with custom memory manager.
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 
 
-CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible /*= true*/)
+CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, bool bMakeVisible /*= true*/)
 {
 {
     return OpenDocumentFile(lpszPathName, true, bMakeVisible);
     return OpenDocumentFile(lpszPathName, true, bMakeVisible);
 }
 }
 
 
-CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bAddToMRU, [[maybe_unused]] BOOL bMakeVisible)
+CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, bool bAddToMRU, [[maybe_unused]] bool bMakeVisible)
 {
 {
     CCryEditDoc* pCurDoc = GetIEditor()->GetDocument();
     CCryEditDoc* pCurDoc = GetIEditor()->GetDocument();
 
 
@@ -848,8 +847,8 @@ CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL
 
 
 CCrySingleDocTemplate::Confidence CCrySingleDocTemplate::MatchDocType(LPCTSTR lpszPathName, CCryEditDoc*& rpDocMatch)
 CCrySingleDocTemplate::Confidence CCrySingleDocTemplate::MatchDocType(LPCTSTR lpszPathName, CCryEditDoc*& rpDocMatch)
 {
 {
-    assert(lpszPathName != NULL);
-    rpDocMatch = NULL;
+    assert(lpszPathName != nullptr);
+    rpDocMatch = nullptr;
 
 
     // go through all documents
     // go through all documents
     CCryEditDoc* pDoc = GetIEditor()->GetDocument();
     CCryEditDoc* pDoc = GetIEditor()->GetDocument();
@@ -1056,7 +1055,7 @@ AZ::Outcome<void, AZStd::string> CCryEditApp::InitGameSystem(HWND hwndForInputSy
 }
 }
 
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-BOOL CCryEditApp::CheckIfAlreadyRunning()
+bool CCryEditApp::CheckIfAlreadyRunning()
 {
 {
     bool bForceNewInstance = false;
     bool bForceNewInstance = false;
 
 
@@ -1300,7 +1299,7 @@ void CCryEditApp::InitLevel(const CEditCommandLineInfo& cmdInfo)
 }
 }
 
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-BOOL CCryEditApp::InitConsole()
+bool CCryEditApp::InitConsole()
 {
 {
     // Execute command from cmdline -exec_line if applicable
     // Execute command from cmdline -exec_line if applicable
     if (!m_execLineCmd.isEmpty())
     if (!m_execLineCmd.isEmpty())
@@ -1432,7 +1431,7 @@ struct CCryEditApp::PythonOutputHandler
         AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusConnect();
         AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusConnect();
     }
     }
 
 
-    virtual ~PythonOutputHandler()
+    ~PythonOutputHandler() override
     {
     {
         AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusDisconnect();
         AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusDisconnect();
     }
     }
@@ -1464,7 +1463,7 @@ struct PythonTestOutputHandler final
     : public CCryEditApp::PythonOutputHandler
     : public CCryEditApp::PythonOutputHandler
 {
 {
     PythonTestOutputHandler() = default;
     PythonTestOutputHandler() = default;
-    virtual ~PythonTestOutputHandler() = default;
+    ~PythonTestOutputHandler() override = default;
 
 
     void OnTraceMessage(AZStd::string_view message) override
     void OnTraceMessage(AZStd::string_view message) override
     {
     {
@@ -1590,7 +1589,7 @@ void CCryEditApp::RunInitPythonScript(CEditCommandLineInfo& cmdInfo)
 
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 // CCryEditApp initialization
 // CCryEditApp initialization
-BOOL CCryEditApp::InitInstance()
+bool CCryEditApp::InitInstance()
 {
 {
     QElapsedTimer startupTimer;
     QElapsedTimer startupTimer;
     startupTimer.start();
     startupTimer.start();
@@ -1617,7 +1616,7 @@ BOOL CCryEditApp::InitInstance()
     {
     {
         CAboutDialog aboutDlg(FormatVersion(m_pEditor->GetFileVersion()), FormatRichTextCopyrightNotice());
         CAboutDialog aboutDlg(FormatVersion(m_pEditor->GetFileVersion()), FormatRichTextCopyrightNotice());
         aboutDlg.exec();
         aboutDlg.exec();
-        return FALSE;
+        return false;
     }
     }
 
 
     // Reflect property control classes to the serialize context...
     // Reflect property control classes to the serialize context...
@@ -1627,9 +1626,6 @@ BOOL CCryEditApp::InitInstance()
     ReflectedVarInit::setupReflection(serializeContext);
     ReflectedVarInit::setupReflection(serializeContext);
     RegisterReflectedVarHandlers();
     RegisterReflectedVarHandlers();
 
 
-
-    QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
-
     CreateSplashScreen();
     CreateSplashScreen();
 
 
     // Register the application's document templates. Document templates
     // Register the application's document templates. Document templates
@@ -1715,18 +1711,6 @@ BOOL CCryEditApp::InitInstance()
 
 
     if (IsInRegularEditorMode())
     if (IsInRegularEditorMode())
     {
     {
-        CIndexedFiles::Create();
-
-        if (gEnv->pConsole->GetCVar("ed_indexfiles")->GetIVal())
-        {
-            Log("Started game resource files indexing...");
-            CIndexedFiles::StartFileIndexing();
-        }
-        else
-        {
-            Log("Game resource files indexing is disabled.");
-        }
-
         // QuickAccessBar creation should be before m_pMainWnd->SetFocus(),
         // QuickAccessBar creation should be before m_pMainWnd->SetFocus(),
         // since it receives the focus at creation time. It brakes MainFrame key accelerators.
         // since it receives the focus at creation time. It brakes MainFrame key accelerators.
         m_pQuickAccessBar = new CQuickAccessBar;
         m_pQuickAccessBar = new CQuickAccessBar;
@@ -1772,7 +1756,7 @@ BOOL CCryEditApp::InitInstance()
         }
         }
     }
     }
 
 
-    SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), 0);
+    SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), nullptr);
     if (!GetIEditor()->IsInMatEditMode())
     if (!GetIEditor()->IsInMatEditMode())
     {
     {
         m_pEditor->InitFinished();
         m_pEditor->InitFinished();
@@ -1857,8 +1841,8 @@ void CCryEditApp::RegisterEventLoopHook(IEventLoopHook* pHook)
 
 
 void CCryEditApp::UnregisterEventLoopHook(IEventLoopHook* pHookToRemove)
 void CCryEditApp::UnregisterEventLoopHook(IEventLoopHook* pHookToRemove)
 {
 {
-    IEventLoopHook* pPrevious = 0;
-    for (IEventLoopHook* pHook = m_pEventLoopHook; pHook != 0; pHook = pHook->pNextHook)
+    IEventLoopHook* pPrevious = nullptr;
+    for (IEventLoopHook* pHook = m_pEventLoopHook; pHook != nullptr; pHook = pHook->pNextHook)
     {
     {
         if (pHook == pHookToRemove)
         if (pHook == pHookToRemove)
         {
         {
@@ -1871,7 +1855,7 @@ void CCryEditApp::UnregisterEventLoopHook(IEventLoopHook* pHookToRemove)
                 m_pEventLoopHook = pHookToRemove->pNextHook;
                 m_pEventLoopHook = pHookToRemove->pNextHook;
             }
             }
 
 
-            pHookToRemove->pNextHook = 0;
+            pHookToRemove->pNextHook = nullptr;
             return;
             return;
         }
         }
     }
     }
@@ -1894,7 +1878,7 @@ void CCryEditApp::LoadFile(QString fileName)
 
 
     if (MainWindow::instance() || m_pConsoleDialog)
     if (MainWindow::instance() || m_pConsoleDialog)
     {
     {
-        SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName());
+        SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName());
     }
     }
 
 
     GetIEditor()->SetModifiedFlag(false);
     GetIEditor()->SetModifiedFlag(false);
@@ -1935,7 +1919,7 @@ void CCryEditApp::EnableAccelerator([[maybe_unused]] bool bEnable)
         CMainFrame *mainFrame = (CMainFrame*)m_pMainWnd;
         CMainFrame *mainFrame = (CMainFrame*)m_pMainWnd;
         if (mainFrame->m_hAccelTable)
         if (mainFrame->m_hAccelTable)
             DestroyAcceleratorTable( mainFrame->m_hAccelTable );
             DestroyAcceleratorTable( mainFrame->m_hAccelTable );
-        mainFrame->m_hAccelTable = NULL;
+        mainFrame->m_hAccelTable = nullptr;
         mainFrame->LoadAccelTable( MAKEINTRESOURCE(IDR_GAMEACCELERATOR) );
         mainFrame->LoadAccelTable( MAKEINTRESOURCE(IDR_GAMEACCELERATOR) );
         CLogFile::WriteLine( "Disable Accelerators" );
         CLogFile::WriteLine( "Disable Accelerators" );
     }
     }
@@ -2163,12 +2147,6 @@ int CCryEditApp::ExitInstance(int exitCode)
         }
         }
     }
     }
 
 
-    if (IsInRegularEditorMode())
-    {
-        CIndexedFiles::AbortFileIndexing();
-        CIndexedFiles::Destroy();
-    }
-
     if (GetIEditor() && !GetIEditor()->IsInMatEditMode())
     if (GetIEditor() && !GetIEditor()->IsInMatEditMode())
     {
     {
         //Nobody seems to know in what case that kind of exit can happen so instrumented to see if it happens at all
         //Nobody seems to know in what case that kind of exit can happen so instrumented to see if it happens at all
@@ -2278,7 +2256,7 @@ void CCryEditApp::EnableIdleProcessing()
     AZ_Assert(m_disableIdleProcessingCounter >= 0, "m_disableIdleProcessingCounter must be nonnegative");
     AZ_Assert(m_disableIdleProcessingCounter >= 0, "m_disableIdleProcessingCounter must be nonnegative");
 }
 }
 
 
-BOOL CCryEditApp::OnIdle([[maybe_unused]] LONG lCount)
+bool CCryEditApp::OnIdle([[maybe_unused]] LONG lCount)
 {
 {
     if (0 == m_disableIdleProcessingCounter)
     if (0 == m_disableIdleProcessingCounter)
     {
     {
@@ -2286,7 +2264,7 @@ BOOL CCryEditApp::OnIdle([[maybe_unused]] LONG lCount)
     }
     }
     else
     else
     {
     {
-        return 0;
+        return false;
     }
     }
 }
 }
 
 
@@ -3161,7 +3139,7 @@ void CCryEditApp::OnCreateLevel()
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
 bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
 {
 {
-    BOOL bIsDocModified = GetIEditor()->GetDocument()->IsModified();
+    bool bIsDocModified = GetIEditor()->GetDocument()->IsModified();
     if (GetIEditor()->GetDocument()->IsDocumentReady() && bIsDocModified)
     if (GetIEditor()->GetDocument()->IsDocumentReady() && bIsDocModified)
     {
     {
         QString str = QObject::tr("Level %1 has been changed. Save Level?").arg(GetIEditor()->GetGameEngine()->GetLevelName());
         QString str = QObject::tr("Level %1 has been changed. Save Level?").arg(GetIEditor()->GetGameEngine()->GetLevelName());
@@ -3249,11 +3227,11 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
 
 
 #ifdef WIN32
 #ifdef WIN32
         FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
         FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-            NULL,
+            nullptr,
             dw,
             dw,
             MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
             MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
             windowsErrorMessage.data(),
             windowsErrorMessage.data(),
-            windowsErrorMessage.length(), NULL);
+            windowsErrorMessage.length(), nullptr);
         _getcwd(cwd.data(), cwd.length());
         _getcwd(cwd.data(), cwd.length());
 #else
 #else
         windowsErrorMessage = strerror(dw);
         windowsErrorMessage = strerror(dw);
@@ -3663,24 +3641,12 @@ void CCryEditApp::OnToolsPreferences()
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void CCryEditApp::OnSwitchToDefaultCamera()
 void CCryEditApp::OnSwitchToDefaultCamera()
 {
 {
-    CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
-    if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
-    {
-        rvp->SetDefaultCamera();
-    }
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void CCryEditApp::OnUpdateSwitchToDefaultCamera(QAction* action)
 void CCryEditApp::OnUpdateSwitchToDefaultCamera(QAction* action)
 {
 {
     Q_ASSERT(action->isCheckable());
     Q_ASSERT(action->isCheckable());
-    CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
-    if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(pViewport))
-    {
-        action->setEnabled(true);
-        action->setChecked(rvp->IsDefaultCamera());
-    }
-    else
     {
     {
         action->setEnabled(false);
         action->setEnabled(false);
     }
     }
@@ -3689,39 +3655,12 @@ void CCryEditApp::OnUpdateSwitchToDefaultCamera(QAction* action)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void CCryEditApp::OnSwitchToSequenceCamera()
 void CCryEditApp::OnSwitchToSequenceCamera()
 {
 {
-    CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
-    if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
-    {
-        rvp->SetSequenceCamera();
-    }
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void CCryEditApp::OnUpdateSwitchToSequenceCamera(QAction* action)
 void CCryEditApp::OnUpdateSwitchToSequenceCamera(QAction* action)
 {
 {
     Q_ASSERT(action->isCheckable());
     Q_ASSERT(action->isCheckable());
-
-    CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
-
-    if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(pViewport))
-    {
-        bool enableAction = false;
-
-        // only enable if we're editing a sequence in Track View and have cameras in the level
-        if (GetIEditor()->GetAnimation()->GetSequence())
-        {
-
-            AZ::EBusAggregateResults<AZ::EntityId> componentCameras;
-            Camera::CameraBus::BroadcastResult(componentCameras, &Camera::CameraRequests::GetCameras);
-
-            const int numCameras = componentCameras.values.size();
-            enableAction = (numCameras > 0);
-        }
-
-        action->setEnabled(enableAction);
-        action->setChecked(rvp->IsSequenceCamera());
-    }
-    else
     {
     {
         action->setEnabled(false);
         action->setEnabled(false);
     }
     }
@@ -3730,31 +3669,12 @@ void CCryEditApp::OnUpdateSwitchToSequenceCamera(QAction* action)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void CCryEditApp::OnSwitchToSelectedcamera()
 void CCryEditApp::OnSwitchToSelectedcamera()
 {
 {
-    CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
-    if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
-    {
-        rvp->SetSelectedCamera();
-    }
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void CCryEditApp::OnUpdateSwitchToSelectedCamera(QAction* action)
 void CCryEditApp::OnUpdateSwitchToSelectedCamera(QAction* action)
 {
 {
     Q_ASSERT(action->isCheckable());
     Q_ASSERT(action->isCheckable());
-    AzToolsFramework::EntityIdList selectedEntityList;
-    AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
-    AZ::EBusAggregateResults<AZ::EntityId> cameras;
-    Camera::CameraBus::BroadcastResult(cameras, &Camera::CameraRequests::GetCameras);
-    bool isCameraComponentSelected = selectedEntityList.size() > 0 ? AZStd::find(cameras.values.begin(), cameras.values.end(), *selectedEntityList.begin()) != cameras.values.end() : false;
-
-    CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
-    CRenderViewport* rvp = viewport_cast<CRenderViewport*>(pViewport);
-    if (isCameraComponentSelected && rvp)
-    {
-        action->setEnabled(true);
-        action->setChecked(rvp->IsSelectedCamera());
-    }
-    else
     {
     {
         action->setEnabled(false);
         action->setEnabled(false);
     }
     }
@@ -3763,11 +3683,7 @@ void CCryEditApp::OnUpdateSwitchToSelectedCamera(QAction* action)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void CCryEditApp::OnSwitchcameraNext()
 void CCryEditApp::OnSwitchcameraNext()
 {
 {
-    CViewport* vp = GetIEditor()->GetActiveView();
-    if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
-    {
-        rvp->CycleCamera();
-    }
+
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -3840,7 +3756,7 @@ bool CCryEditApp::IsInRegularEditorMode()
 
 
 void CCryEditApp::OnOpenQuickAccessBar()
 void CCryEditApp::OnOpenQuickAccessBar()
 {
 {
-    if (m_pQuickAccessBar == NULL)
+    if (m_pQuickAccessBar == nullptr)
     {
     {
         return;
         return;
     }
     }
@@ -4188,7 +4104,7 @@ extern "C" int AZ_DLL_EXPORT CryEditMain(int argc, char* argv[])
 
 
         int exitCode = 0;
         int exitCode = 0;
 
 
-        BOOL didCryEditStart = CCryEditApp::instance()->InitInstance();
+        bool didCryEditStart = CCryEditApp::instance()->InitInstance();
         AZ_Error("Editor", didCryEditStart, "O3DE Editor did not initialize correctly, and will close."
         AZ_Error("Editor", didCryEditStart, "O3DE Editor did not initialize correctly, and will close."
             "\nThis could be because of incorrectly configured components, or missing required gems."
             "\nThis could be because of incorrectly configured components, or missing required gems."
             "\nSee other errors for more details.");
             "\nSee other errors for more details.");

+ 12 - 12
Code/Editor/CryEdit.h

@@ -135,16 +135,16 @@ public:
     virtual void AddToRecentFileList(const QString& lpszPathName);
     virtual void AddToRecentFileList(const QString& lpszPathName);
     ECreateLevelResult CreateLevel(const QString& levelName, QString& fullyQualifiedLevelName);
     ECreateLevelResult CreateLevel(const QString& levelName, QString& fullyQualifiedLevelName);
     static void InitDirectory();
     static void InitDirectory();
-    BOOL FirstInstance(bool bForceNewInstance = false);
+    bool FirstInstance(bool bForceNewInstance = false);
     void InitFromCommandLine(CEditCommandLineInfo& cmdInfo);
     void InitFromCommandLine(CEditCommandLineInfo& cmdInfo);
-    BOOL CheckIfAlreadyRunning();
+    bool CheckIfAlreadyRunning();
     //! @return successful outcome if initialization succeeded. or failed outcome with error message.
     //! @return successful outcome if initialization succeeded. or failed outcome with error message.
     AZ::Outcome<void, AZStd::string> InitGameSystem(HWND hwndForInputSystem);
     AZ::Outcome<void, AZStd::string> InitGameSystem(HWND hwndForInputSystem);
     void CreateSplashScreen();
     void CreateSplashScreen();
     void InitPlugins();
     void InitPlugins();
     bool InitGame();
     bool InitGame();
 
 
-    BOOL InitConsole();
+    bool InitConsole();
     int IdleProcessing(bool bBackground);
     int IdleProcessing(bool bBackground);
     bool IsWindowInForeground();
     bool IsWindowInForeground();
     void RunInitPythonScript(CEditCommandLineInfo& cmdInfo);
     void RunInitPythonScript(CEditCommandLineInfo& cmdInfo);
@@ -171,9 +171,9 @@ public:
     // Overrides
     // Overrides
     // ClassWizard generated virtual function overrides
     // ClassWizard generated virtual function overrides
 public:
 public:
-    virtual BOOL InitInstance();
+    virtual bool InitInstance();
     virtual int ExitInstance(int exitCode = 0);
     virtual int ExitInstance(int exitCode = 0);
-    virtual BOOL OnIdle(LONG lCount);
+    virtual bool OnIdle(LONG lCount);
     virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszFileName);
     virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszFileName);
 
 
     CCryDocManager* GetDocManager() { return m_pDocManager; }
     CCryDocManager* GetDocManager() { return m_pDocManager; }
@@ -347,7 +347,7 @@ private:
 // Disable warning for dll export since this member won't be used outside this class
 // Disable warning for dll export since this member won't be used outside this class
 AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
 AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
     AZ::IO::FileDescriptorRedirector m_stdoutRedirection = AZ::IO::FileDescriptorRedirector(1); // < 1 for STDOUT
     AZ::IO::FileDescriptorRedirector m_stdoutRedirection = AZ::IO::FileDescriptorRedirector(1); // < 1 for STDOUT
-AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING 
+AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
 
 
 private:
 private:
     static inline constexpr const char* DefaultLevelTemplateName = "Prefabs/Default_Level.prefab";
     static inline constexpr const char* DefaultLevelTemplateName = "Prefabs/Default_Level.prefab";
@@ -420,7 +420,7 @@ public:
 };
 };
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
-class CCrySingleDocTemplate 
+class CCrySingleDocTemplate
     : public QObject
     : public QObject
 {
 {
 private:
 private:
@@ -448,8 +448,8 @@ public:
     ~CCrySingleDocTemplate() {};
     ~CCrySingleDocTemplate() {};
     // avoid creating another CMainFrame
     // avoid creating another CMainFrame
     // close other type docs before opening any things
     // close other type docs before opening any things
-    virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, BOOL bAddToMRU, BOOL bMakeVisible);
-    virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible = TRUE);
+    virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, bool bAddToMRU, bool bMakeVisible);
+    virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, bool bMakeVisible = true);
     virtual Confidence MatchDocType(LPCTSTR lpszPathName, CCryEditDoc*& rpDocMatch);
     virtual Confidence MatchDocType(LPCTSTR lpszPathName, CCryEditDoc*& rpDocMatch);
 
 
 private:
 private:
@@ -465,9 +465,9 @@ public:
     CCrySingleDocTemplate* SetDefaultTemplate(CCrySingleDocTemplate* pNew);
     CCrySingleDocTemplate* SetDefaultTemplate(CCrySingleDocTemplate* pNew);
     // Copied from MFC to get rid of the silly ugly unoverridable doc-type pick dialog
     // Copied from MFC to get rid of the silly ugly unoverridable doc-type pick dialog
     virtual void OnFileNew();
     virtual void OnFileNew();
-    virtual BOOL DoPromptFileName(QString& fileName, UINT nIDSTitle,
-        DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate);
-    virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToMRU);
+    virtual bool DoPromptFileName(QString& fileName, UINT nIDSTitle,
+        DWORD lFlags, bool bOpenFileDialog, CDocTemplate* pTemplate);
+    virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszFileName, bool bAddToMRU);
 
 
     QVector<CCrySingleDocTemplate*> m_templateList;
     QVector<CCrySingleDocTemplate*> m_templateList;
 };
 };

+ 35 - 33
Code/Editor/CryEditDoc.cpp

@@ -19,6 +19,7 @@
 #include <AzCore/Asset/AssetManager.h>
 #include <AzCore/Asset/AssetManager.h>
 #include <AzCore/Interface/Interface.h>
 #include <AzCore/Interface/Interface.h>
 #include <AzCore/Utils/Utils.h>
 #include <AzCore/Utils/Utils.h>
+#include <MathConversion.h>
 
 
 // AzFramework
 // AzFramework
 #include <AzFramework/Archive/IArchive.h>
 #include <AzFramework/Archive/IArchive.h>
@@ -53,6 +54,7 @@
 #include "MainWindow.h"
 #include "MainWindow.h"
 #include "LevelFileDialog.h"
 #include "LevelFileDialog.h"
 #include "StatObjBus.h"
 #include "StatObjBus.h"
+#include "Undo/Undo.h"
 
 
 #include <Atom/RPI.Public/ViewportContext.h>
 #include <Atom/RPI.Public/ViewportContext.h>
 #include <Atom/RPI.Public/ViewportContextBus.h>
 #include <Atom/RPI.Public/ViewportContextBus.h>
@@ -95,7 +97,7 @@ namespace Internal
 {
 {
     bool SaveLevel()
     bool SaveLevel()
     {
     {
-        if (!GetIEditor()->GetDocument()->DoSave(GetIEditor()->GetDocument()->GetActivePathName(), TRUE))
+        if (!GetIEditor()->GetDocument()->DoSave(GetIEditor()->GetDocument()->GetActivePathName(), true))
         {
         {
             return false;
             return false;
         }
         }
@@ -261,7 +263,7 @@ void CCryEditDoc::DeleteContents()
     GetIEditor()->GetObjectManager()->DeleteAllObjects();
     GetIEditor()->GetObjectManager()->DeleteAllObjects();
 
 
     // Load scripts data
     // Load scripts data
-    SetModifiedFlag(FALSE);
+    SetModifiedFlag(false);
     SetModifiedModules(eModifiedNothing);
     SetModifiedModules(eModifiedNothing);
     // Clear error reports if open.
     // Clear error reports if open.
     CErrorReportDialog::Clear();
     CErrorReportDialog::Clear();
@@ -303,7 +305,7 @@ void CCryEditDoc::Save(TDocMultiArchive& arrXmlAr)
     {
     {
         CAutoDocNotReady autoDocNotReady;
         CAutoDocNotReady autoDocNotReady;
 
 
-        if (arrXmlAr[DMAS_GENERAL] != NULL)
+        if (arrXmlAr[DMAS_GENERAL] != nullptr)
         {
         {
             (*arrXmlAr[DMAS_GENERAL]).root = XmlHelpers::CreateXmlNode("Level");
             (*arrXmlAr[DMAS_GENERAL]).root = XmlHelpers::CreateXmlNode("Level");
             (*arrXmlAr[DMAS_GENERAL]).root->setAttr("WaterColor", m_waterColor);
             (*arrXmlAr[DMAS_GENERAL]).root->setAttr("WaterColor", m_waterColor);
@@ -481,7 +483,7 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
 
 
                     if (!pObj)
                     if (!pObj)
                     {
                     {
-                        pObj = GetIEditor()->GetObjectManager()->NewObject("SequenceObject", 0, fullname);
+                        pObj = GetIEditor()->GetObjectManager()->NewObject("SequenceObject", nullptr, fullname);
                     }
                     }
                 }
                 }
             }
             }
@@ -665,7 +667,7 @@ int CCryEditDoc::GetModifiedModule()
     return m_modifiedModuleFlags;
     return m_modifiedModuleFlags;
 }
 }
 
 
-BOOL CCryEditDoc::CanCloseFrame()
+bool CCryEditDoc::CanCloseFrame()
 {
 {
     // Ask the base class to ask for saving, which also includes the save
     // Ask the base class to ask for saving, which also includes the save
     // status of the plugins. Additionaly we query if all the plugins can exit
     // status of the plugins. Additionaly we query if all the plugins can exit
@@ -674,21 +676,21 @@ BOOL CCryEditDoc::CanCloseFrame()
     // are not serialized in the project file
     // are not serialized in the project file
     if (!SaveModified())
     if (!SaveModified())
     {
     {
-        return FALSE;
+        return false;
     }
     }
 
 
     if (!GetIEditor()->GetPluginManager()->CanAllPluginsExitNow())
     if (!GetIEditor()->GetPluginManager()->CanAllPluginsExitNow())
     {
     {
-        return FALSE;
+        return false;
     }
     }
 
 
     // If there is an export in process, exiting will corrupt it
     // If there is an export in process, exiting will corrupt it
     if (CGameExporter::GetCurrentExporter() != nullptr)
     if (CGameExporter::GetCurrentExporter() != nullptr)
     {
     {
-        return FALSE;
+        return false;
     }
     }
 
 
-    return TRUE;
+    return true;
 }
 }
 
 
 bool CCryEditDoc::SaveModified()
 bool CCryEditDoc::SaveModified()
@@ -733,7 +735,7 @@ bool CCryEditDoc::OnOpenDocument(const QString& lpszPathName)
     TOpenDocContext context;
     TOpenDocContext context;
     if (!BeforeOpenDocument(lpszPathName, context))
     if (!BeforeOpenDocument(lpszPathName, context))
     {
     {
-        return FALSE;
+        return false;
     }
     }
     return DoOpenDocument(context);
     return DoOpenDocument(context);
 }
 }
@@ -776,7 +778,7 @@ bool CCryEditDoc::BeforeOpenDocument(const QString& lpszPathName, TOpenDocContex
         context.absoluteLevelPath = absolutePath;
         context.absoluteLevelPath = absolutePath;
         context.absoluteSlicePath = "";
         context.absoluteSlicePath = "";
     }
     }
-    return TRUE;
+    return true;
 }
 }
 
 
 bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
 bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
@@ -813,7 +815,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
         if (!LoadXmlArchiveArray(arrXmlAr, levelFilePath, levelFolderAbsolutePath))
         if (!LoadXmlArchiveArray(arrXmlAr, levelFilePath, levelFolderAbsolutePath))
         {
         {
             m_bLoadFailed = true;
             m_bLoadFailed = true;
-            return FALSE;
+            return false;
         }
         }
     }
     }
     if (!LoadLevel(arrXmlAr, context.absoluteLevelPath))
     if (!LoadLevel(arrXmlAr, context.absoluteLevelPath))
@@ -825,7 +827,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
 
 
     if (m_bLoadFailed)
     if (m_bLoadFailed)
     {
     {
-        return FALSE;
+        return false;
     }
     }
 
 
     // Load AZ entities for the editor.
     // Load AZ entities for the editor.
@@ -846,7 +848,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
 
 
     if (m_bLoadFailed)
     if (m_bLoadFailed)
     {
     {
-        return FALSE;
+        return false;
     }
     }
 
 
     StartStreamingLoad();
     StartStreamingLoad();
@@ -863,7 +865,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
     // level.
     // level.
     SetLevelExported(true);
     SetLevelExported(true);
 
 
-    return TRUE;
+    return true;
 }
 }
 
 
 bool CCryEditDoc::OnNewDocument()
 bool CCryEditDoc::OnNewDocument()
@@ -959,7 +961,7 @@ bool CCryEditDoc::BeforeSaveDocument(const QString& lpszPathName, TSaveDocContex
     bool bSaved(true);
     bool bSaved(true);
 
 
     context.bSaved = bSaved;
     context.bSaved = bSaved;
-    return TRUE;
+    return true;
 }
 }
 
 
 bool CCryEditDoc::HasLayerNameConflicts() const
 bool CCryEditDoc::HasLayerNameConflicts() const
@@ -1044,7 +1046,7 @@ bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName
     else
     else
     {
     {
         CLogFile::WriteLine("$3Document successfully saved");
         CLogFile::WriteLine("$3Document successfully saved");
-        SetModifiedFlag(FALSE);
+        SetModifiedFlag(false);
         SetModifiedModules(eModifiedNothing);
         SetModifiedModules(eModifiedNothing);
         MainWindow::instance()->ResetAutoSaveTimers();
         MainWindow::instance()->ResetAutoSaveTimers();
     }
     }
@@ -1596,7 +1598,7 @@ bool CCryEditDoc::LoadLevel(TDocMultiArchive& arrXmlAr, const QString& absoluteC
     // Set level path directly *after* DeleteContents(), since that will unload the previous level and clear the level path.
     // Set level path directly *after* DeleteContents(), since that will unload the previous level and clear the level path.
     GetIEditor()->GetGameEngine()->SetLevelPath(folderPath);
     GetIEditor()->GetGameEngine()->SetLevelPath(folderPath);
 
 
-    SetModifiedFlag(TRUE);  // dirty during de-serialize
+    SetModifiedFlag(true);  // dirty during de-serialize
     SetModifiedModules(eModifiedAll);
     SetModifiedModules(eModifiedAll);
     Load(arrXmlAr, absoluteCryFilePath);
     Load(arrXmlAr, absoluteCryFilePath);
 
 
@@ -1606,7 +1608,7 @@ bool CCryEditDoc::LoadLevel(TDocMultiArchive& arrXmlAr, const QString& absoluteC
     {
     {
         pIPak->GetResourceList(AZ::IO::IArchive::RFOM_NextLevel)->Clear();
         pIPak->GetResourceList(AZ::IO::IArchive::RFOM_NextLevel)->Clear();
     }
     }
-    SetModifiedFlag(FALSE); // start off with unmodified
+    SetModifiedFlag(false); // start off with unmodified
     SetModifiedModules(eModifiedNothing);
     SetModifiedModules(eModifiedNothing);
     SetDocumentReady(true);
     SetDocumentReady(true);
     GetIEditor()->Notify(eNotify_OnEndLoad);
     GetIEditor()->Notify(eNotify_OnEndLoad);
@@ -1982,7 +1984,7 @@ void CCryEditDoc::OnStartLevelResourceList()
     gEnv->pCryPak->GetResourceList(AZ::IO::IArchive::RFOM_Level)->Clear();
     gEnv->pCryPak->GetResourceList(AZ::IO::IArchive::RFOM_Level)->Clear();
 }
 }
 
 
-BOOL CCryEditDoc::DoFileSave()
+bool CCryEditDoc::DoFileSave()
 {
 {
     if (GetEditMode() == CCryEditDoc::DocumentEditingMode::LevelEdit)
     if (GetEditMode() == CCryEditDoc::DocumentEditingMode::LevelEdit)
     {
     {
@@ -2000,15 +2002,15 @@ BOOL CCryEditDoc::DoFileSave()
                     QString newLevelPath = filename.left(filename.lastIndexOf('/') + 1);
                     QString newLevelPath = filename.left(filename.lastIndexOf('/') + 1);
                     GetIEditor()->GetDocument()->SetPathName(filename);
                     GetIEditor()->GetDocument()->SetPathName(filename);
                     GetIEditor()->GetGameEngine()->SetLevelPath(newLevelPath);
                     GetIEditor()->GetGameEngine()->SetLevelPath(newLevelPath);
-                    return TRUE;
+                    return true;
                 }
                 }
             }
             }
-            return FALSE;
+            return false;
         }
         }
     }
     }
     if (!IsDocumentReady())
     if (!IsDocumentReady())
     {
     {
-        return FALSE;
+        return false;
     }
     }
 
 
     return Internal::SaveLevel();
     return Internal::SaveLevel();
@@ -2063,7 +2065,7 @@ void CCryEditDoc::InitEmptyLevel(int /*resolution*/, int /*unitSize*/, bool /*bU
     GetISystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_LOAD_END, 0, 0);
     GetISystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_LOAD_END, 0, 0);
 
 
     GetIEditor()->Notify(eNotify_OnEndNewScene);
     GetIEditor()->Notify(eNotify_OnEndNewScene);
-    SetModifiedFlag(FALSE);
+    SetModifiedFlag(false);
     SetLevelExported(false);
     SetLevelExported(false);
     SetModifiedModules(eModifiedNothing);
     SetModifiedModules(eModifiedNothing);
 
 
@@ -2077,13 +2079,13 @@ void CCryEditDoc::CreateDefaultLevelAssets([[maybe_unused]] int resolution, [[ma
 
 
 void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
 void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
 {
 {
-    if (pVar == NULL)
+    if (pVar == nullptr)
     {
     {
         return;
         return;
     }
     }
 
 
     XmlNodeRef node = GetEnvironmentTemplate();
     XmlNodeRef node = GetEnvironmentTemplate();
-    if (node == NULL)
+    if (node == nullptr)
     {
     {
         return;
         return;
     }
     }
@@ -2101,7 +2103,7 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
 
 
     XmlNodeRef groupNode = node->getChild(nGroup);
     XmlNodeRef groupNode = node->getChild(nGroup);
 
 
-    if (groupNode == NULL)
+    if (groupNode == nullptr)
     {
     {
         return;
         return;
     }
     }
@@ -2112,7 +2114,7 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
     }
     }
 
 
     XmlNodeRef childNode = groupNode->getChild(nChild);
     XmlNodeRef childNode = groupNode->getChild(nChild);
-    if (childNode == NULL)
+    if (childNode == nullptr)
     {
     {
         return;
         return;
     }
     }
@@ -2139,7 +2141,7 @@ QString CCryEditDoc::GetCryIndexPath(const LPCTSTR levelFilePath) const
     return Path::AddPathSlash(levelPath + levelName + "_editor");
     return Path::AddPathSlash(levelPath + levelName + "_editor");
 }
 }
 
 
-BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath)
+bool CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath)
 {
 {
     auto pIPak = GetIEditor()->GetSystem()->GetIPak();
     auto pIPak = GetIEditor()->GetSystem()->GetIPak();
 
 
@@ -2148,7 +2150,7 @@ BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString&
         CXmlArchive* pXmlAr = new CXmlArchive();
         CXmlArchive* pXmlAr = new CXmlArchive();
         if (!pXmlAr)
         if (!pXmlAr)
         {
         {
-            return FALSE;
+            return false;
         }
         }
 
 
         CXmlArchive& xmlAr = *pXmlAr;
         CXmlArchive& xmlAr = *pXmlAr;
@@ -2159,7 +2161,7 @@ BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString&
         bool openLevelPakFileSuccess = pIPak->OpenPack(levelPath.toUtf8().data(), absoluteLevelPath.toUtf8().data());
         bool openLevelPakFileSuccess = pIPak->OpenPack(levelPath.toUtf8().data(), absoluteLevelPath.toUtf8().data());
         if (!openLevelPakFileSuccess)
         if (!openLevelPakFileSuccess)
         {
         {
-            return FALSE;
+            return false;
         }
         }
 
 
         CPakFile pakFile;
         CPakFile pakFile;
@@ -2167,13 +2169,13 @@ BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString&
         pIPak->ClosePack(absoluteLevelPath.toUtf8().data());
         pIPak->ClosePack(absoluteLevelPath.toUtf8().data());
         if (!loadFromPakSuccess)
         if (!loadFromPakSuccess)
         {
         {
-            return FALSE;
+            return false;
         }
         }
 
 
         FillXmlArArray(arrXmlAr, &xmlAr);
         FillXmlArArray(arrXmlAr, &xmlAr);
     }
     }
 
 
-    return TRUE;
+    return true;
 }
 }
 
 
 void CCryEditDoc::ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr)
 void CCryEditDoc::ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr)

+ 5 - 5
Code/Editor/CryEditDoc.h

@@ -26,7 +26,7 @@ struct ICVar;
 
 
 // Filename of the temporary file used for the hold / fetch operation
 // Filename of the temporary file used for the hold / fetch operation
 // conform to the "$tmp[0-9]_" naming convention
 // conform to the "$tmp[0-9]_" naming convention
-#define HOLD_FETCH_FILE "$tmp_hold" 
+#define HOLD_FETCH_FILE "$tmp_hold"
 
 
 class CCryEditDoc
 class CCryEditDoc
     : public QObject
     : public QObject
@@ -36,7 +36,7 @@ class CCryEditDoc
     Q_PROPERTY(bool modified READ IsModified WRITE SetModifiedFlag);
     Q_PROPERTY(bool modified READ IsModified WRITE SetModifiedFlag);
     Q_PROPERTY(QString pathName READ GetLevelPathName WRITE SetPathName);
     Q_PROPERTY(QString pathName READ GetLevelPathName WRITE SetPathName);
     Q_PROPERTY(QString title READ GetTitle WRITE SetTitle);
     Q_PROPERTY(QString title READ GetTitle WRITE SetTitle);
- 
+
 public: // Create from serialization only
 public: // Create from serialization only
     enum DocumentEditingMode
     enum DocumentEditingMode
     {
     {
@@ -82,7 +82,7 @@ public: // Create from serialization only
 
 
     bool DoSave(const QString& pathName, bool replace);
     bool DoSave(const QString& pathName, bool replace);
     SANDBOX_API bool Save();
     SANDBOX_API bool Save();
-    virtual BOOL DoFileSave();
+    virtual bool DoFileSave();
     bool SaveModified();
     bool SaveModified();
 
 
     virtual bool BackupBeforeSave(bool bForce = false);
     virtual bool BackupBeforeSave(bool bForce = false);
@@ -102,7 +102,7 @@ public: // Create from serialization only
     bool IsLevelExported() const;
     bool IsLevelExported() const;
     void SetLevelExported(bool boExported = true);
     void SetLevelExported(bool boExported = true);
 
 
-    BOOL CanCloseFrame();
+    bool CanCloseFrame();
 
 
     enum class FetchPolicy
     enum class FetchPolicy
     {
     {
@@ -144,7 +144,7 @@ protected:
     };
     };
     bool BeforeOpenDocument(const QString& lpszPathName, TOpenDocContext& context);
     bool BeforeOpenDocument(const QString& lpszPathName, TOpenDocContext& context);
     bool DoOpenDocument(TOpenDocContext& context);
     bool DoOpenDocument(TOpenDocContext& context);
-    virtual BOOL LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath);
+    virtual bool LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath);
     virtual void ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr);
     virtual void ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr);
 
 
     virtual void Load(TDocMultiArchive& arrXmlAr, const QString& szFilename);
     virtual void Load(TDocMultiArchive& arrXmlAr, const QString& szFilename);

+ 1 - 1
Code/Editor/CryEditPy.cpp

@@ -359,7 +359,7 @@ namespace
             {
             {
                 AZ::TickBus::Handler::BusConnect();
                 AZ::TickBus::Handler::BusConnect();
             }
             }
-            ~Ticker()
+            ~Ticker() override
             {
             {
                 AZ::TickBus::Handler::BusDisconnect();
                 AZ::TickBus::Handler::BusDisconnect();
             }
             }

+ 1 - 1
Code/Editor/CustomAspectRatioDlg.cpp

@@ -22,7 +22,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
 #define MIN_ASPECT 1
 #define MIN_ASPECT 1
 #define MAX_ASPECT 16384
 #define MAX_ASPECT 16384
 
 
-CCustomAspectRatioDlg::CCustomAspectRatioDlg(int x, int y, QWidget* pParent /*=NULL*/)
+CCustomAspectRatioDlg::CCustomAspectRatioDlg(int x, int y, QWidget* pParent /*=nullptr*/)
     : QDialog(pParent)
     : QDialog(pParent)
     , m_xDefault(x)
     , m_xDefault(x)
     , m_yDefault(y)
     , m_yDefault(y)

+ 4 - 4
Code/Editor/CustomResolutionDlg.cpp

@@ -25,7 +25,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
 #define MIN_RES 64
 #define MIN_RES 64
 #define MAX_RES 8192
 #define MAX_RES 8192
 
 
-CCustomResolutionDlg::CCustomResolutionDlg(int w, int h, QWidget* pParent /*=NULL*/)
+CCustomResolutionDlg::CCustomResolutionDlg(int w, int h, QWidget* pParent /*=nullptr*/)
     : QDialog(pParent)
     : QDialog(pParent)
     , m_wDefault(w)
     , m_wDefault(w)
     , m_hDefault(h)
     , m_hDefault(h)
@@ -50,12 +50,12 @@ void CCustomResolutionDlg::OnInitDialog()
     m_ui->m_height->setValue(m_hDefault);
     m_ui->m_height->setValue(m_hDefault);
 
 
     QString maxDimensionString;
     QString maxDimensionString;
-    QTextStream(&maxDimensionString) 
-        << "Maximum Dimension: " << MAX_RES << Qt::endl 
+    QTextStream(&maxDimensionString)
+        << "Maximum Dimension: " << MAX_RES << Qt::endl
         << Qt::endl
         << Qt::endl
         << "Note: Dimensions over 8K may be" << Qt::endl
         << "Note: Dimensions over 8K may be" << Qt::endl
         << "unstable depending on hardware.";
         << "unstable depending on hardware.";
-    
+
     m_ui->m_maxDimension->setText(maxDimensionString);
     m_ui->m_maxDimension->setText(maxDimensionString);
 }
 }
 
 

+ 2 - 2
Code/Editor/CustomizeKeyboardDialog.cpp

@@ -87,7 +87,7 @@ public:
         : QAbstractListModel(parent)
         : QAbstractListModel(parent)
     {
     {
     }
     }
-    virtual ~MenuActionsModel() {}
+    ~MenuActionsModel() override {}
 
 
     int rowCount([[maybe_unused]] const QModelIndex& parent = QModelIndex()) const override
     int rowCount([[maybe_unused]] const QModelIndex& parent = QModelIndex()) const override
     {
     {
@@ -134,7 +134,7 @@ public:
         , m_action(nullptr)
         , m_action(nullptr)
     {
     {
     }
     }
-    virtual ~ActionShortcutsModel() {}
+    ~ActionShortcutsModel() override {}
 
 
     int rowCount([[maybe_unused]] const QModelIndex& parent = QModelIndex()) const override
     int rowCount([[maybe_unused]] const QModelIndex& parent = QModelIndex()) const override
     {
     {

+ 3 - 4
Code/Editor/EditorDefs.h

@@ -37,7 +37,6 @@
 #pragma warning (disable : 4786) // identifier was truncated to 'number' characters in the debug information.
 #pragma warning (disable : 4786) // identifier was truncated to 'number' characters in the debug information.
 #pragma warning (disable : 4244) // conversion from 'long' to 'float', possible loss of data
 #pragma warning (disable : 4244) // conversion from 'long' to 'float', possible loss of data
 #pragma warning (disable : 4018) // signed/unsigned mismatch
 #pragma warning (disable : 4018) // signed/unsigned mismatch
-#pragma warning (disable : 4800) // BOOL bool conversion
 
 
 // Disable warning when a function returns a value inside an __asm block
 // Disable warning when a function returns a value inside an __asm block
 #pragma warning (disable : 4035)
 #pragma warning (disable : 4035)
@@ -85,17 +84,17 @@
 #endif
 #endif
 
 
 #ifndef SAFE_DELETE
 #ifndef SAFE_DELETE
-#define SAFE_DELETE(p)          { if (p) { delete (p);       (p) = NULL; } \
+#define SAFE_DELETE(p)          { if (p) { delete (p);       (p) = nullptr; } \
 }
 }
 #endif
 #endif
 
 
 #ifndef SAFE_DELETE_ARRAY
 #ifndef SAFE_DELETE_ARRAY
-#define SAFE_DELETE_ARRAY(p)    { if (p) { delete[] (p);     (p) = NULL; } \
+#define SAFE_DELETE_ARRAY(p)    { if (p) { delete[] (p);     (p) = nullptr; } \
 }
 }
 #endif
 #endif
 
 
 #ifndef SAFE_RELEASE
 #ifndef SAFE_RELEASE
-#define SAFE_RELEASE(p)         { if (p) { (p)->Release();   (p) = NULL; } \
+#define SAFE_RELEASE(p)         { if (p) { (p)->Release();   (p) = nullptr; } \
 }
 }
 #endif
 #endif
 
 

+ 1 - 1
Code/Editor/EditorFileMonitor.cpp

@@ -162,7 +162,7 @@ QString RemoveGameName(const QString &filename)
 void CEditorFileMonitor::OnFileMonitorChange(const SFileChangeInfo& rChange)
 void CEditorFileMonitor::OnFileMonitorChange(const SFileChangeInfo& rChange)
 {
 {
     CCryEditApp* app = CCryEditApp::instance();
     CCryEditApp* app = CCryEditApp::instance();
-    if (app == NULL || app->IsExiting())
+    if (app == nullptr || app->IsExiting())
     {
     {
         return;
         return;
     }
     }

+ 1 - 1
Code/Editor/EditorFileMonitor.h

@@ -42,7 +42,7 @@ private:
         QString extension;
         QString extension;
 
 
         SFileChangeCallback()
         SFileChangeCallback()
-            : pListener(NULL)
+            : pListener(nullptr)
         {}
         {}
 
 
         SFileChangeCallback(IFileChangeListener* pListener, const char* item, const char* extension)
         SFileChangeCallback(IFileChangeListener* pListener, const char* item, const char* extension)

+ 23 - 23
Code/Editor/EditorPanelUtils.cpp

@@ -49,7 +49,7 @@ class CEditorPanelUtils_Impl
 {
 {
     #pragma region Drag & Drop
     #pragma region Drag & Drop
 public:
 public:
-    virtual void SetViewportDragOperation(void(* dropCallback)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) override
+    void SetViewportDragOperation(void(* dropCallback)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) override
     {
     {
         for (int i = 0; i < GetIEditor()->GetViewManager()->GetViewCount(); i++)
         for (int i = 0; i < GetIEditor()->GetViewManager()->GetViewCount(); i++)
         {
         {
@@ -60,13 +60,13 @@ public:
     #pragma region Preview Window
     #pragma region Preview Window
 public:
 public:
 
 
-    virtual int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings)
+    int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings) override
     {
     {
         CRY_ASSERT(settings);
         CRY_ASSERT(settings);
         return settings->GetDebugFlags();
         return settings->GetDebugFlags();
     }
     }
 
 
-    virtual void PreviewWindow_SetDisplaySettingsDebugFlags(CDisplaySettings* settings, int flags)
+    void PreviewWindow_SetDisplaySettingsDebugFlags(CDisplaySettings* settings, int flags) override
     {
     {
         CRY_ASSERT(settings);
         CRY_ASSERT(settings);
         settings->SetDebugFlags(flags);
         settings->SetDebugFlags(flags);
@@ -79,7 +79,7 @@ protected:
     bool m_hotkeysAreEnabled;
     bool m_hotkeysAreEnabled;
 public:
 public:
 
 
-    virtual bool HotKey_Import() override
+    bool HotKey_Import() override
     {
     {
         QVector<QPair<QString, QString> > keys;
         QVector<QPair<QString, QString> > keys;
         QString filepath = QFileDialog::getOpenFileName(nullptr, "Select shortcut configuration to load",
         QString filepath = QFileDialog::getOpenFileName(nullptr, "Select shortcut configuration to load",
@@ -143,7 +143,7 @@ public:
         return result;
         return result;
     }
     }
 
 
-    virtual void HotKey_Export() override
+    void HotKey_Export() override
     {
     {
         auto settingDir = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Editor" / "Plugins" / "ParticleEditorPlugin" / "settings";
         auto settingDir = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Editor" / "Plugins" / "ParticleEditorPlugin" / "settings";
         QString filepath = QFileDialog::getSaveFileName(nullptr, "Select shortcut configuration to load", settingDir.c_str(), "HotKey Config Files (*.hkxml)");
         QString filepath = QFileDialog::getSaveFileName(nullptr, "Select shortcut configuration to load", settingDir.c_str(), "HotKey Config Files (*.hkxml)");
@@ -170,7 +170,7 @@ public:
         file.close();
         file.close();
     }
     }
 
 
-    virtual QKeySequence HotKey_GetShortcut(const char* path) override
+    QKeySequence HotKey_GetShortcut(const char* path) override
     {
     {
         for (HotKey combo : hotkeys)
         for (HotKey combo : hotkeys)
         {
         {
@@ -182,7 +182,7 @@ public:
         return QKeySequence();
         return QKeySequence();
     }
     }
 
 
-    virtual bool HotKey_IsPressed(const QKeyEvent* event, const char* path) override
+    bool HotKey_IsPressed(const QKeyEvent* event, const char* path) override
     {
     {
         if (!m_hotkeysAreEnabled)
         if (!m_hotkeysAreEnabled)
         {
         {
@@ -221,7 +221,7 @@ public:
         return false;
         return false;
     }
     }
 
 
-    virtual bool HotKey_IsPressed(const QShortcutEvent* event, const char* path) override
+    bool HotKey_IsPressed(const QShortcutEvent* event, const char* path) override
     {
     {
         if (!m_hotkeysAreEnabled)
         if (!m_hotkeysAreEnabled)
         {
         {
@@ -239,7 +239,7 @@ public:
         return false;
         return false;
     }
     }
 
 
-    virtual bool HotKey_LoadExisting() override
+    bool HotKey_LoadExisting() override
     {
     {
         QSettings settings("O3DE", "O3DE");
         QSettings settings("O3DE", "O3DE");
         QString group = "Hotkeys/";
         QString group = "Hotkeys/";
@@ -275,7 +275,7 @@ public:
         return true;
         return true;
     }
     }
 
 
-    virtual void HotKey_SaveCurrent() override
+    void HotKey_SaveCurrent() override
     {
     {
         QSettings settings("O3DE", "O3DE");
         QSettings settings("O3DE", "O3DE");
         QString group = "Hotkeys/";
         QString group = "Hotkeys/";
@@ -296,7 +296,7 @@ public:
         settings.sync();
         settings.sync();
     }
     }
 
 
-    virtual void HotKey_BuildDefaults() override
+    void HotKey_BuildDefaults() override
     {
     {
         m_hotkeysAreEnabled = true;
         m_hotkeysAreEnabled = true;
         QVector<QPair<QString, QString> > keys;
         QVector<QPair<QString, QString> > keys;
@@ -356,17 +356,17 @@ public:
         }
         }
     }
     }
 
 
-    virtual void HotKey_SetKeys(QVector<HotKey> keys) override
+    void HotKey_SetKeys(QVector<HotKey> keys) override
     {
     {
         hotkeys = keys;
         hotkeys = keys;
     }
     }
 
 
-    virtual QVector<HotKey> HotKey_GetKeys() override
+    QVector<HotKey> HotKey_GetKeys() override
     {
     {
         return hotkeys;
         return hotkeys;
     }
     }
 
 
-    virtual QString HotKey_GetPressedHotkey(const QKeyEvent* event) override
+    QString HotKey_GetPressedHotkey(const QKeyEvent* event) override
     {
     {
         if (!m_hotkeysAreEnabled)
         if (!m_hotkeysAreEnabled)
         {
         {
@@ -381,7 +381,7 @@ public:
         }
         }
         return "";
         return "";
     }
     }
-    virtual QString HotKey_GetPressedHotkey(const QShortcutEvent* event) override
+    QString HotKey_GetPressedHotkey(const QShortcutEvent* event) override
     {
     {
         if (!m_hotkeysAreEnabled)
         if (!m_hotkeysAreEnabled)
         {
         {
@@ -398,12 +398,12 @@ public:
     }
     }
     //building the default hotkey list re-enables hotkeys
     //building the default hotkey list re-enables hotkeys
     //do not use this when rebuilding the default list is a possibility.
     //do not use this when rebuilding the default list is a possibility.
-    virtual void HotKey_SetEnabled(bool val) override
+    void HotKey_SetEnabled(bool val) override
     {
     {
         m_hotkeysAreEnabled = val;
         m_hotkeysAreEnabled = val;
     }
     }
 
 
-    virtual bool HotKey_IsEnabled() const override
+    bool HotKey_IsEnabled() const override
     {
     {
         return m_hotkeysAreEnabled;
         return m_hotkeysAreEnabled;
     }
     }
@@ -457,13 +457,13 @@ protected:
     }
     }
 
 
 public:
 public:
-    virtual void ToolTip_LoadConfigXML(QString filepath) override
+    void ToolTip_LoadConfigXML(QString filepath) override
     {
     {
         XmlNodeRef node = GetIEditor()->GetSystem()->LoadXmlFromFile(filepath.toStdString().c_str());
         XmlNodeRef node = GetIEditor()->GetSystem()->LoadXmlFromFile(filepath.toStdString().c_str());
         ToolTip_ParseNode(node);
         ToolTip_ParseNode(node);
     }
     }
 
 
-    virtual void ToolTip_BuildFromConfig(IQToolTip* tooltip, QString path, QString option, QString optionalData = "", bool isEnabled = true)
+    void ToolTip_BuildFromConfig(IQToolTip* tooltip, QString path, QString option, QString optionalData = "", bool isEnabled = true) override
     {
     {
         AZ_Assert(tooltip, "tooltip cannot be null");
         AZ_Assert(tooltip, "tooltip cannot be null");
 
 
@@ -488,7 +488,7 @@ public:
         }
         }
     }
     }
 
 
-    virtual QString ToolTip_GetTitle(QString path, QString option) override
+    QString ToolTip_GetTitle(QString path, QString option) override
     {
     {
         if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
         if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
         {
         {
@@ -501,7 +501,7 @@ public:
         return GetToolTip(path).title;
         return GetToolTip(path).title;
     }
     }
 
 
-    virtual QString ToolTip_GetContent(QString path, QString option) override
+    QString ToolTip_GetContent(QString path, QString option) override
     {
     {
         if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
         if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
         {
         {
@@ -514,7 +514,7 @@ public:
         return GetToolTip(path).content;
         return GetToolTip(path).content;
     }
     }
 
 
-    virtual QString ToolTip_GetSpecialContentType(QString path, QString option) override
+    QString ToolTip_GetSpecialContentType(QString path, QString option) override
     {
     {
         if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
         if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
         {
         {
@@ -527,7 +527,7 @@ public:
         return GetToolTip(path).specialContent;
         return GetToolTip(path).specialContent;
     }
     }
 
 
-    virtual QString ToolTip_GetDisabledContent(QString path, QString option) override
+    QString ToolTip_GetDisabledContent(QString path, QString option) override
     {
     {
         if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
         if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
         {
         {

+ 1 - 1
Code/Editor/EditorPreferencesDialog.cpp

@@ -282,7 +282,7 @@ void EditorPreferencesDialog::CreatePages()
     {
     {
         auto pUnknown = classes[i];
         auto pUnknown = classes[i];
 
 
-        IPreferencesPageCreator* pPageCreator = 0;
+        IPreferencesPageCreator* pPageCreator = nullptr;
         if (FAILED(pUnknown->QueryInterface(&pPageCreator)))
         if (FAILED(pUnknown->QueryInterface(&pPageCreator)))
         {
         {
             continue;
             continue;

+ 18 - 2
Code/Editor/EditorPreferencesPageFiles.cpp

@@ -43,11 +43,16 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
         ->Field("MaxCount", &AutoBackup::m_maxCount)
         ->Field("MaxCount", &AutoBackup::m_maxCount)
         ->Field("RemindTime", &AutoBackup::m_remindTime);
         ->Field("RemindTime", &AutoBackup::m_remindTime);
 
 
+    serialize.Class<AssetBrowserSearch>()
+        ->Version(1)
+        ->Field("Max number of items displayed", &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch);
+
     serialize.Class<CEditorPreferencesPage_Files>()
     serialize.Class<CEditorPreferencesPage_Files>()
         ->Version(1)
         ->Version(1)
         ->Field("Files", &CEditorPreferencesPage_Files::m_files)
         ->Field("Files", &CEditorPreferencesPage_Files::m_files)
         ->Field("Editors", &CEditorPreferencesPage_Files::m_editors)
         ->Field("Editors", &CEditorPreferencesPage_Files::m_editors)
-        ->Field("AutoBackup", &CEditorPreferencesPage_Files::m_autoBackup);
+        ->Field("AutoBackup", &CEditorPreferencesPage_Files::m_autoBackup)
+        ->Field("AssetBrowserSearch", &CEditorPreferencesPage_Files::m_assetBrowserSearch);
 
 
 
 
     AZ::EditContext* editContext = serialize.GetEditContext();
     AZ::EditContext* editContext = serialize.GetEditContext();
@@ -80,12 +85,19 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
             ->Attribute(AZ::Edit::Attributes::Max, 100)
             ->Attribute(AZ::Edit::Attributes::Max, 100)
             ->DataElement(AZ::Edit::UIHandlers::SpinBox, &AutoBackup::m_remindTime, "Remind Time", "Auto Remind Every (Minutes)");
             ->DataElement(AZ::Edit::UIHandlers::SpinBox, &AutoBackup::m_remindTime, "Remind Time", "Auto Remind Every (Minutes)");
 
 
+        editContext->Class<AssetBrowserSearch>("Asset Browser Search View", "Asset Browser Search View")
+            ->DataElement(AZ::Edit::UIHandlers::SpinBox, &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch, "Maximum number of displayed items",
+                "Maximum number of displayed items displayed in the Search View")
+            ->Attribute(AZ::Edit::Attributes::Min, 50)
+            ->Attribute(AZ::Edit::Attributes::Max, 5000);
+
         editContext->Class<CEditorPreferencesPage_Files>("File Preferences", "Class for handling File Preferences")
         editContext->Class<CEditorPreferencesPage_Files>("File Preferences", "Class for handling File Preferences")
             ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
             ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
             ->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
             ->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
             ->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_files, "Files", "File Preferences")
             ->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_files, "Files", "File Preferences")
             ->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_editors, "External Editors", "External Editors")
             ->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_editors, "External Editors", "External Editors")
-            ->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_autoBackup, "Auto Backup", "Auto Backup");
+            ->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_autoBackup, "Auto Backup", "Auto Backup")
+            ->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_assetBrowserSearch, "Asset Browser Search", "Asset Browser Search");
     }
     }
 }
 }
 
 
@@ -124,6 +136,8 @@ void CEditorPreferencesPage_Files::OnApply()
     gSettings.autoBackupTime = m_autoBackup.m_timeInterval;
     gSettings.autoBackupTime = m_autoBackup.m_timeInterval;
     gSettings.autoBackupMaxCount = m_autoBackup.m_maxCount;
     gSettings.autoBackupMaxCount = m_autoBackup.m_maxCount;
     gSettings.autoRemindTime = m_autoBackup.m_remindTime;
     gSettings.autoRemindTime = m_autoBackup.m_remindTime;
+
+    gSettings.maxNumberOfItemsShownInSearch = m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch;
 }
 }
 
 
 void CEditorPreferencesPage_Files::InitializeSettings()
 void CEditorPreferencesPage_Files::InitializeSettings()
@@ -148,4 +162,6 @@ void CEditorPreferencesPage_Files::InitializeSettings()
     m_autoBackup.m_timeInterval = gSettings.autoBackupTime;
     m_autoBackup.m_timeInterval = gSettings.autoBackupTime;
     m_autoBackup.m_maxCount = gSettings.autoBackupMaxCount;
     m_autoBackup.m_maxCount = gSettings.autoBackupMaxCount;
     m_autoBackup.m_remindTime = gSettings.autoRemindTime;
     m_autoBackup.m_remindTime = gSettings.autoRemindTime;
+
+    m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch = gSettings.maxNumberOfItemsShownInSearch;
 }
 }

+ 7 - 0
Code/Editor/EditorPreferencesPageFiles.h

@@ -69,10 +69,17 @@ private:
         int m_remindTime;
         int m_remindTime;
     };
     };
 
 
+    struct AssetBrowserSearch
+    {
+        AZ_TYPE_INFO(AssetBrowserSearch, "{9FBFCD24-9452-49DF-99F4-2711443CEAAE}")
+
+        int m_maxNumberOfItemsShownInSearch;
+    };
 
 
     Files m_files;
     Files m_files;
     ExternalEditors m_editors;
     ExternalEditors m_editors;
     AutoBackup m_autoBackup;
     AutoBackup m_autoBackup;
+    AssetBrowserSearch m_assetBrowserSearch;
     QIcon m_icon;
     QIcon m_icon;
 };
 };
 
 

Файловите разлики са ограничени, защото са твърде много
+ 218 - 507
Code/Editor/EditorViewportWidget.cpp


+ 187 - 390
Code/Editor/EditorViewportWidget.h

@@ -8,8 +8,6 @@
 
 
 
 
 #pragma once
 #pragma once
-// RenderViewport.h : header file
-//
 
 
 #if !defined(Q_MOC_RUN)
 #if !defined(Q_MOC_RUN)
 #include <Cry_Camera.h>
 #include <Cry_Camera.h>
@@ -34,6 +32,7 @@
 #include <MathConversion.h>
 #include <MathConversion.h>
 #include <Atom/RPI.Public/ViewportContext.h>
 #include <Atom/RPI.Public/ViewportContext.h>
 #include <Atom/RPI.Public/SceneBus.h>
 #include <Atom/RPI.Public/SceneBus.h>
+#include <AzFramework/Components/CameraBus.h>
 #endif
 #endif
 
 
 #include <AzFramework/Windowing/WindowBus.h>
 #include <AzFramework/Windowing/WindowBus.h>
@@ -65,130 +64,120 @@ namespace AzToolsFramework
 // EditorViewportWidget window
 // EditorViewportWidget window
 AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
 AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
 AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
 AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-class SANDBOX_API EditorViewportWidget
+class SANDBOX_API EditorViewportWidget final
     : public QtViewport
     : public QtViewport
-    , public IEditorNotifyListener
-    , public IUndoManagerListener
-    , public Camera::EditorCameraRequestBus::Handler
-    , public AzFramework::InputSystemCursorConstraintRequestBus::Handler
-    , public AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler
-    , public AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
-    , public AzFramework::AssetCatalogEventBus::Handler
-    , public AZ::RPI::SceneNotificationBus::Handler
+    , private IEditorNotifyListener
+    , private IUndoManagerListener
+    , private Camera::EditorCameraRequestBus::Handler
+    , private Camera::CameraNotificationBus::Handler
+    , private AzFramework::InputSystemCursorConstraintRequestBus::Handler
+    , private AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler
+    , private AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
+    , private AzFramework::AssetCatalogEventBus::Handler
+    , private AZ::RPI::SceneNotificationBus::Handler
 {
 {
 AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
 AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
 AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
 AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
     Q_OBJECT
     Q_OBJECT
-public:
-    struct SResolution
-    {
-        SResolution()
-            : width(0)
-            , height(0)
-        {
-        }
-
-        SResolution(int w, int h)
-            : width(w)
-            , height(h)
-        {
-        }
-
-        int width;
-        int height;
-    };
 
 
 public:
 public:
     EditorViewportWidget(const QString& name, QWidget* parent = nullptr);
     EditorViewportWidget(const QString& name, QWidget* parent = nullptr);
+    ~EditorViewportWidget() override;
 
 
     static const GUID& GetClassID()
     static const GUID& GetClassID()
     {
     {
         return QtViewport::GetClassID<EditorViewportWidget>();
         return QtViewport::GetClassID<EditorViewportWidget>();
     }
     }
 
 
-    /** Get type of this viewport.
-    */
-    virtual EViewportType GetType() const { return ET_ViewportCamera; }
-    virtual void SetType([[maybe_unused]] EViewportType type) { assert(type == ET_ViewportCamera); };
-
-    virtual ~EditorViewportWidget();
-
-    Q_INVOKABLE void InjectFakeMouseMove(int deltaX, int deltaY, Qt::MouseButtons buttons);
-
-    // Replacement for still used CRenderer methods
-    void UnProjectFromScreen(float sx, float sy, float sz, float* px, float* py, float* pz) const;
-    void ProjectToScreen(float ptx, float pty, float ptz, float* sx, float* sy, float* sz) const;
+    static EditorViewportWidget* GetPrimaryViewport();
 
 
-public:
-    virtual void Update();
+    // Used by ViewPan in some circumstances
+    void ConnectViewportInteractionRequestBus();
+    void DisconnectViewportInteractionRequestBus();
 
 
-    virtual void ResetContent();
-    virtual void UpdateContent(int flags);
+    // QtViewport/IDisplayViewport/CViewport
+    // These methods are made public in the derived class because they are called with an object whose static type is known to be this class type.
+    void SetFOV(float fov) override;
+    float GetFOV() const override;
 
 
-    void OnTitleMenu(QMenu* menu) override;
+private:
+    ////////////////////////////////////////////////////////////////////////
+    // Private types ...
 
 
-    void SetCamera(const CCamera& camera);
-    const CCamera& GetCamera() const { return m_Camera; };
-    virtual void SetViewTM(const Matrix34& tm)
+    enum class ViewSourceType
     {
     {
-        if (m_viewSourceType == ViewSourceType::None)
-        {
-            m_defaultViewTM = tm;
-        }
-        SetViewTM(tm, false);
-    }
+        None,
+        CameraComponent,
+        ViewSourceTypesCount,
+    };
+    enum class PlayInEditorState
+    {
+        Editor, Starting, Started
+    };
+    enum class KeyPressedState
+    {
+        AllUp,
+        PressedThisFrame,
+        PressedInPreviousFrame,
+    };
 
 
-    //! Map world space position to viewport position.
-    virtual QPoint WorldToView(const Vec3& wp) const;
-    virtual QPoint WorldToViewParticleEditor(const Vec3& wp, int width, int height) const;
-    virtual Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const;
-
-    //! Map viewport position to world space position.
-    virtual Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
-    virtual void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override;
-    virtual Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) override;
-    virtual float GetScreenScaleFactor(const Vec3& worldPoint) const;
-    virtual float GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position);
-    virtual float GetAspectRatio() const;
-    virtual bool HitTest(const QPoint& point, HitContext& hitInfo);
-    virtual bool IsBoundsVisible(const AABB& box) const;
-    virtual void CenterOnSelection();
-    virtual void CenterOnAABB(const AABB& aabb);
-    void CenterOnSliceInstance() override;
+    ////////////////////////////////////////////////////////////////////////
+    // Method overrides ...
 
 
+    // QWidget
     void focusOutEvent(QFocusEvent* event) override;
     void focusOutEvent(QFocusEvent* event) override;
     void keyPressEvent(QKeyEvent* event) override;
     void keyPressEvent(QKeyEvent* event) override;
+    bool event(QEvent* event) override;
+    void resizeEvent(QResizeEvent* event) override;
+    void paintEvent(QPaintEvent* event) override;
+    void mousePressEvent(QMouseEvent* event) override;
 
 
-    void SetFOV(float fov);
-    float GetFOV() const;
+    // QtViewport/IDisplayViewport/CViewport
+    EViewportType GetType() const override { return ET_ViewportCamera; }
+    void SetType([[maybe_unused]] EViewportType type) override { assert(type == ET_ViewportCamera); };
+    AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
+        Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point) override;
+    void SetViewportId(int id) override;
+    QPoint WorldToView(const Vec3& wp) const override;
+    QPoint WorldToViewParticleEditor(const Vec3& wp, int width, int height) const override;
+    Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const override;
+    Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
+    void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override;
+    Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) override;
+    float GetScreenScaleFactor(const Vec3& worldPoint) const override;
+    float GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position) override;
+    float GetAspectRatio() const override;
+    bool HitTest(const QPoint& point, HitContext& hitInfo) override;
+    bool IsBoundsVisible(const AABB& box) const override;
+    void CenterOnSelection() override;
+    void CenterOnAABB(const AABB& aabb) override;
+    void CenterOnSliceInstance() override;
+    void OnTitleMenu(QMenu* menu) override;
+    void SetViewTM(const Matrix34& tm) override;
+    const Matrix34& GetViewTM() const override;
+    void Update() override;
+    void UpdateContent(int flags) override;
 
 
-    void SetDefaultCamera();
-    bool IsDefaultCamera() const;
-    void SetSequenceCamera();
-    bool IsSequenceCamera() const { return m_viewSourceType == ViewSourceType::SequenceCamera; }
-    void SetSelectedCamera();
-    bool IsSelectedCamera() const;
-    void SetComponentCamera(const AZ::EntityId& entityId);
-    void SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement = false);
-    void SetFirstComponentCamera();
-    void SetViewEntity(const AZ::EntityId& cameraEntityId, bool lockCameraMovement = false);
-    void PostCameraSet();
-    // This switches the active camera to the next one in the list of (default, all custom cams).
-    void CycleCamera();
+    // SceneNotificationBus
+    void OnBeginPrepareRender() override;
 
 
-    // Camera::EditorCameraRequestBus
-    void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
-    void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
-    AZ::EntityId GetCurrentViewEntityId() override { return m_viewEntityId; }
-    bool GetActiveCameraPosition(AZ::Vector3& cameraPos) override;
-    bool GetActiveCameraState(AzFramework::CameraState& cameraState) override;
+    // Camera::CameraNotificationBus
+    void OnActiveViewChanged(const AZ::EntityId&) override;
+
+    // IEditorEventListener
+    void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
 
 
     // AzToolsFramework::EditorEntityContextNotificationBus (handler moved to cpp to resolve link issues in unity builds)
     // AzToolsFramework::EditorEntityContextNotificationBus (handler moved to cpp to resolve link issues in unity builds)
-    virtual void OnStartPlayInEditor();
-    virtual void OnStopPlayInEditor();
+    void OnStartPlayInEditor();
+    void OnStopPlayInEditor();
+    void OnStartPlayInEditorBegin();
 
 
-    AzFramework::CameraState GetCameraState();
-    AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition);
+    // IUndoManagerListener
+    void BeginUndoTransaction() override;
+    void EndUndoTransaction() override;
+
+    // AzFramework::InputSystemCursorConstraintRequestBus
+    void* GetSystemCursorConstraintWindow() const override;
 
 
     // AzToolsFramework::ViewportFreezeRequestBus
     // AzToolsFramework::ViewportFreezeRequestBus
     bool IsViewportInputFrozen() override;
     bool IsViewportInputFrozen() override;
@@ -204,142 +193,19 @@ public:
     void BeginWidgetContext() override;
     void BeginWidgetContext() override;
     void EndWidgetContext() override;
     void EndWidgetContext() override;
 
 
-    // CViewport...
-    void SetViewportId(int id) override;
-
-    void ConnectViewportInteractionRequestBus();
-    void DisconnectViewportInteractionRequestBus();
-
-    void LockCameraMovement(bool bLock) { m_bLockCameraMovement = bLock; }
-    bool IsCameraMovementLocked() const { return m_bLockCameraMovement; }
-
-    void EnableCameraObjectMove(bool bMove) { m_bMoveCameraObject = bMove; }
-    bool IsCameraObjectMove() const { return m_bMoveCameraObject; }
-
-    void SetPlayerControl(uint32 i) { m_PlayerControl = i; };
-    uint32 GetPlayerControl() { return m_PlayerControl; };
-
-    const DisplayContext& GetDisplayContext() const { return m_displayContext; }
-    CBaseObject* GetCameraObject() const;
-
-    QPoint WidgetToViewport(const QPoint& point) const;
-    QPoint ViewportToWidget(const QPoint& point) const;
-    QSize WidgetToViewport(const QSize& size) const;
-
-    AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
-        Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point) override;
-
-    void SetPlayerPos()
-    {
-        Matrix34 m = GetViewTM();
-        m.SetTranslation(m.GetTranslation() - m_PhysicalLocation.t);
-        SetViewTM(m);
-
-        m_AverageFrameTime = 0.14f;
-
-        m_PhysicalLocation.SetIdentity();
-
-        m_LocalEntityMat.SetIdentity();
-        m_PrevLocalEntityMat.SetIdentity();
-
-        m_absCameraHigh = 2.0f;
-        m_absCameraPos = Vec3(0, 3, 2);
-        m_absCameraPosVP = Vec3(0, -3, 1.5);
-
-        m_absCurrentSlope = 0.0f;
-
-        m_absLookDirectionXY = Vec2(0, 1);
-
-        m_LookAt = Vec3(ZERO);
-        m_LookAtRate = Vec3(ZERO);
-        m_vCamPos = Vec3(ZERO);
-        m_vCamPosRate = Vec3(ZERO);
-
-        m_relCameraRotX = 0;
-        m_relCameraRotZ = 0;
-
-        uint32 numSample6 = static_cast<uint32>(m_arrAnimatedCharacterPath.size());
-        for (uint32 i = 0; i < numSample6; i++)
-        {
-            m_arrAnimatedCharacterPath[i] = Vec3(ZERO);
-        }
-
-        numSample6 = static_cast<uint32>(m_arrSmoothEntityPath.size());
-        for (uint32 i = 0; i < numSample6; i++)
-        {
-            m_arrSmoothEntityPath[i] = Vec3(ZERO);
-        }
-
-        uint32 numSample7 = static_cast<uint32>(m_arrRunStrafeSmoothing.size());
-        for (uint32 i = 0; i < numSample7; i++)
-        {
-            m_arrRunStrafeSmoothing[i] = 0;
-        }
-
-        m_vWorldDesiredBodyDirection = Vec2(0, 1);
-        m_vWorldDesiredBodyDirectionSmooth = Vec2(0, 1);
-        m_vWorldDesiredBodyDirectionSmoothRate = Vec2(0, 1);
-
-        m_vWorldDesiredBodyDirection2 = Vec2(0, 1);
-
-        m_vWorldDesiredMoveDirection = Vec2(0, 1);
-        m_vWorldDesiredMoveDirectionSmooth = Vec2(0, 1);
-        m_vWorldDesiredMoveDirectionSmoothRate = Vec2(0, 1);
-        m_vLocalDesiredMoveDirection = Vec2(0, 1);
-        m_vLocalDesiredMoveDirectionSmooth = Vec2(0, 1);
-        m_vLocalDesiredMoveDirectionSmoothRate = Vec2(0, 1);
-
-        m_vWorldAimBodyDirection = Vec2(0, 1);
-
-        m_MoveSpeedMSec = 5.0f;
-        m_key_W = 0;
-        m_keyrcr_W = 0;
-        m_key_S = 0;
-        m_keyrcr_S = 0;
-        m_key_A = 0;
-        m_keyrcr_A = 0;
-        m_key_D = 0;
-        m_keyrcr_D = 0;
-        m_key_SPACE = 0;
-        m_keyrcr_SPACE = 0;
-        m_ControllMode = 0;
-
-        m_State = -1;
-        m_Stance = 1; //combat
-
-        m_udGround = 0.0f;
-        m_lrGround = 0.0f;
-        AABB aabb = AABB(Vec3(-40.0f, -40.0f, -0.25f), Vec3(+40.0f, +40.0f, +0.0f));
-        m_GroundOBB = OBB::CreateOBBfromAABB(Matrix33(IDENTITY), aabb);
-        m_GroundOBBPos = Vec3(0, 0, -0.01f);
-    };
-
-    static EditorViewportWidget* GetPrimaryViewport();
-
-    AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-    CCamera m_Camera;
-    AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-
-protected:
-    struct SScopedCurrentContext;
+    // Camera::EditorCameraRequestBus
+    void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
+    void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
+    AZ::EntityId GetCurrentViewEntityId() override;
+    bool GetActiveCameraPosition(AZ::Vector3& cameraPos) override;
+    bool GetActiveCameraState(AzFramework::CameraState& cameraState) override;
 
 
+    ////////////////////////////////////////////////////////////////////////
+    // Private helpers...
     void SetViewTM(const Matrix34& tm, bool bMoveOnly);
     void SetViewTM(const Matrix34& tm, bool bMoveOnly);
-
-    // Called to render stuff.
-    virtual void OnRender();
-
-    virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
-
-    //! Get currently active camera object.
-    void ToggleCameraObject();
-
-    void RenderConstructionPlane();
     void RenderSnapMarker();
     void RenderSnapMarker();
-
     void RenderAll();
     void RenderAll();
 
 
-    void OnBeginPrepareRender() override;
-
     // Update the safe frame, safe action, safe title, and borders rectangles based on
     // Update the safe frame, safe action, safe title, and borders rectangles based on
     // viewport size and target aspect ratio.
     // viewport size and target aspect ratio.
     void UpdateSafeFrame();
     void UpdateSafeFrame();
@@ -353,242 +219,173 @@ protected:
     // Draw a selected region if it has been selected
     // Draw a selected region if it has been selected
     void RenderSelectedRegion();
     void RenderSelectedRegion();
 
 
-    virtual bool CreateRenderContext();
-    virtual void DestroyRenderContext();
-
-    void OnMenuCommandChangeAspectRatio(unsigned int commandId);
-
     bool AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const;
     bool AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const;
     bool RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const;
     bool RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const;
 
 
     bool AddCameraMenuItems(QMenu* menu);
     bool AddCameraMenuItems(QMenu* menu);
     void ResizeView(int width, int height);
     void ResizeView(int width, int height);
 
 
-    void OnCameraFOVVariableChanged(IVariable* var);
-
     void HideCursor();
     void HideCursor();
     void ShowCursor();
     void ShowCursor();
 
 
-    bool IsKeyDown(Qt::Key key) const;
-
-    enum class ViewSourceType
-    {
-        None,
-        SequenceCamera,
-        LegacyCamera,
-        CameraComponent,
-        AZ_Entity,
-        ViewSourceTypesCount,
-    };
-    void ResetToViewSourceType(const ViewSourceType& viewSourType);
+    double WidgetToViewportFactor() const;
 
 
     bool ShouldPreviewFullscreen() const;
     bool ShouldPreviewFullscreen() const;
     void StartFullscreenPreview();
     void StartFullscreenPreview();
     void StopFullscreenPreview();
     void StopFullscreenPreview();
 
 
-    bool m_inFullscreenPreview = false;
-    bool m_bRenderContextCreated = false;
-    bool m_bInRotateMode = false;
-    bool m_bInMoveMode = false;
-    bool m_bInOrbitMode = false;
-    bool m_bInZoomMode = false;
-
-    QPoint m_mousePos = QPoint(0, 0);
-    QPoint m_prevMousePos = QPoint(0, 0);  // for tablets, you can't use SetCursorPos and need to remember the prior point and delta with that.
-
-
-    float m_moveSpeed = 1;
-
-    float m_orbitDistance = 10.0f;
-    AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-    Vec3 m_orbitTarget;
+    void OnMenuResolutionCustom();
+    void OnMenuCreateCameraEntityFromCurrentView();
+    void OnMenuSelectCurrentCamera();
 
 
-    //-------------------------------------------
-    //---   player-control in CharEdit        ---
-    //-------------------------------------------
-    f32 m_MoveSpeedMSec;
+    // From a series of input primitives, compose a complete mouse interaction.
+    AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteractionInternal(
+        AzToolsFramework::ViewportInteraction::MouseButtons buttons,
+        AzToolsFramework::ViewportInteraction::KeyboardModifiers modifiers,
+        const AzToolsFramework::ViewportInteraction::MousePick& mousePick) const;
 
 
-    uint32 m_key_W, m_keyrcr_W;
-    uint32 m_key_S, m_keyrcr_S;
-    uint32 m_key_A, m_keyrcr_A;
-    uint32 m_key_D, m_keyrcr_D;
+    // Given a point in the viewport, return the pick ray into the scene.
+    // note: The argument passed to parameter **point**, originating
+    // from a Qt event, must first be passed to WidgetToViewport before being
+    // passed to BuildMousePick.
+    AzToolsFramework::ViewportInteraction::MousePick BuildMousePick(const QPoint& point);
 
 
-    uint32 m_key_SPACE, m_keyrcr_SPACE;
-    uint32 m_ControllMode;
+    bool CheckRespondToInput() const;
 
 
-    int32 m_Stance;
-    int32 m_State;
-    f32 m_AverageFrameTime;
+    void BuildDragDropContext(AzQtComponents::ViewportDragContext& context, const QPoint& pt) override;
 
 
-    uint32 m_PlayerControl = 0;
+    void SetAsActiveViewport();
+    void PushDisableRendering();
+    void PopDisableRendering();
+    bool IsRenderingDisabled() const;
+    AzToolsFramework::ViewportInteraction::MousePick BuildMousePickInternal(const QPoint& point) const;
 
 
-    f32 m_absCameraHigh;
-    Vec3 m_absCameraPos;
-    Vec3 m_absCameraPosVP;
+    void RestoreViewportAfterGameMode();
 
 
-    f32  m_absCurrentSlope;  //in radiants
+    void UpdateScene();
 
 
-    Vec2 m_absLookDirectionXY;
+    void SetDefaultCamera();
+    void SetSelectedCamera();
+    bool IsSelectedCamera() const;
+    void SetComponentCamera(const AZ::EntityId& entityId);
+    void SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement = false);
+    void SetFirstComponentCamera();
+    void PostCameraSet();
+    // This switches the active camera to the next one in the list of (default, all custom cams).
+    void CycleCamera();
 
 
-    Vec3 m_LookAt;
-    Vec3 m_LookAtRate;
-    Vec3 m_vCamPos;
-    Vec3 m_vCamPosRate;
-    float m_camFOV;
+    AzFramework::CameraState GetCameraState();
+    AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition);
 
 
-    f32 m_relCameraRotX;
-    f32 m_relCameraRotZ;
+    QPoint WidgetToViewport(const QPoint& point) const;
+    QPoint ViewportToWidget(const QPoint& point) const;
+    QSize WidgetToViewport(const QSize& size) const;
 
 
-    QuatTS m_PhysicalLocation;
+    const DisplayContext& GetDisplayContext() const { return m_displayContext; }
+    CBaseObject* GetCameraObject() const;
 
 
-    Matrix34 m_AnimatedCharacterMat;
+    void UnProjectFromScreen(float sx, float sy, float sz, float* px, float* py, float* pz) const;
+    void ProjectToScreen(float ptx, float pty, float ptz, float* sx, float* sy, float* sz) const;
 
 
-    Matrix34 m_LocalEntityMat;  //this is used for data-driven animations where the character is running on the spot
-    Matrix34 m_PrevLocalEntityMat;
+    AZ::RPI::ViewPtr GetCurrentAtomView() const;
 
 
-    std::vector<Vec3> m_arrVerticesHF;
-    std::vector<vtx_idx> m_arrIndicesHF;
+    ////////////////////////////////////////////////////////////////////////
+    // Members ...
+    friend class AZ::ViewportHelpers::EditorEntityNotifications;
 
 
-    std::vector<Vec3> m_arrAnimatedCharacterPath;
-    std::vector<Vec3> m_arrSmoothEntityPath;
-    std::vector<f32> m_arrRunStrafeSmoothing;
+    AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
 
 
-    Vec2 m_vWorldDesiredBodyDirection;
-    Vec2 m_vWorldDesiredBodyDirectionSmooth;
-    Vec2 m_vWorldDesiredBodyDirectionSmoothRate;
+    // Singleton for the primary viewport
+    static EditorViewportWidget* m_pPrimaryViewport;
 
 
-    Vec2 m_vWorldDesiredBodyDirection2;
+    // The simulation (play-game in editor) state
+    PlayInEditorState m_playInEditorState = PlayInEditorState::Editor;
 
 
+    // Whether we are doing a full screen game preview (play-game in editor) or a regular one
+    bool m_inFullscreenPreview = false;
 
 
-    Vec2 m_vWorldDesiredMoveDirection;
-    Vec2 m_vWorldDesiredMoveDirectionSmooth;
-    Vec2 m_vWorldDesiredMoveDirectionSmoothRate;
-    Vec2 m_vLocalDesiredMoveDirection;
-    Vec2 m_vLocalDesiredMoveDirectionSmooth;
-    Vec2 m_vLocalDesiredMoveDirectionSmoothRate;
-    Vec2 m_vWorldAimBodyDirection;
+    // The entity ID of the current camera for this viewport, or invalid if the default editor camera
+    AZ::EntityId m_viewEntityId;
 
 
-    f32 m_udGround;
-    f32 m_lrGround;
-    OBB m_GroundOBB;
-    Vec3 m_GroundOBBPos;
+    // Determines also if the current camera for this viewport is default editor camera
+    ViewSourceType m_viewSourceType = ViewSourceType::None;
 
 
-    // Index of camera objects.
-    mutable GUID m_cameraObjectId;
-    mutable AZ::EntityId m_viewEntityId;
-    mutable ViewSourceType m_viewSourceType = ViewSourceType::None;
+    // During play game in editor, holds the editor entity ID of the last 
     AZ::EntityId m_viewEntityIdCachedForEditMode;
     AZ::EntityId m_viewEntityIdCachedForEditMode;
+
+    // The editor camera TM before switching to game mode
     Matrix34 m_preGameModeViewTM;
     Matrix34 m_preGameModeViewTM;
+
+    // Disables rendering during some periods of time, e.g. undo/redo, resize events
     uint m_disableRenderingCount = 0;
     uint m_disableRenderingCount = 0;
-    bool m_bLockCameraMovement;
+
+    // Determines if the viewport needs updating (false when out of focus for example)
     bool m_bUpdateViewport = false;
     bool m_bUpdateViewport = false;
-    bool m_bMoveCameraObject = true;
 
 
-    enum class KeyPressedState
-    {
-        AllUp,
-        PressedThisFrame,
-        PressedInPreviousFrame,
-    };
+    // Avoid re-entering PostCameraSet->OnActiveViewChanged->PostCameraSet
+    bool m_sendingOnActiveChanged = false;
+
+    // Legacy...
     KeyPressedState m_pressedKeyState = KeyPressedState::AllUp;
     KeyPressedState m_pressedKeyState = KeyPressedState::AllUp;
 
 
+    // The last camera matrix of the default editor camera, used when switching back to editor camera to restore the right TM
     Matrix34 m_defaultViewTM;
     Matrix34 m_defaultViewTM;
+
+    // The name to use for the default editor camera
     const QString m_defaultViewName;
     const QString m_defaultViewName;
 
 
+    // Note that any attempts to draw anything with this object will crash. Exists here for legacy "reasons"
     DisplayContext m_displayContext;
     DisplayContext m_displayContext;
 
 
-
+    // Re-entrency guard for on paint events
     bool m_isOnPaint = false;
     bool m_isOnPaint = false;
-    static EditorViewportWidget* m_pPrimaryViewport;
 
 
+    // Shapes of various safe frame helpers which can be displayed in the editor
     QRect m_safeFrame;
     QRect m_safeFrame;
     QRect m_safeAction;
     QRect m_safeAction;
     QRect m_safeTitle;
     QRect m_safeTitle;
 
 
+    // Aspect ratios available in the title bar
     CPredefinedAspectRatios m_predefinedAspectRatios;
     CPredefinedAspectRatios m_predefinedAspectRatios;
 
 
+    // Is the cursor hidden or displayed?
     bool m_bCursorHidden = false;
     bool m_bCursorHidden = false;
 
 
-    void OnMenuResolutionCustom();
-    void OnMenuCreateCameraEntityFromCurrentView();
-    void OnMenuSelectCurrentCamera();
-
-    int OnCreate();
-    void resizeEvent(QResizeEvent* event) override;
-    void paintEvent(QPaintEvent* event) override;
-    void mousePressEvent(QMouseEvent* event) override;
-
-    // From a series of input primitives, compose a complete mouse interaction.
-    AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteractionInternal(
-        AzToolsFramework::ViewportInteraction::MouseButtons buttons,
-        AzToolsFramework::ViewportInteraction::KeyboardModifiers modifiers,
-        const AzToolsFramework::ViewportInteraction::MousePick& mousePick) const;
-    // Given a point in the viewport, return the pick ray into the scene.
-    // note: The argument passed to parameter **point**, originating
-    // from a Qt event, must first be passed to WidgetToViewport before being
-    // passed to BuildMousePick.
-    AzToolsFramework::ViewportInteraction::MousePick BuildMousePick(const QPoint& point);
-
-    bool event(QEvent* event) override;
-    void OnDestroy();
-
-    bool CheckRespondToInput() const;
-
-    // AzFramework::InputSystemCursorConstraintRequestBus
-    void* GetSystemCursorConstraintWindow() const override;
-
-    void BuildDragDropContext(AzQtComponents::ViewportDragContext& context, const QPoint& pt) override;
-
-private:
-    void SetAsActiveViewport();
-    void PushDisableRendering();
-    void PopDisableRendering();
-    bool IsRenderingDisabled() const;
-    AzToolsFramework::ViewportInteraction::MousePick BuildMousePickInternal(const QPoint& point) const;
-
-    void RestoreViewportAfterGameMode();
-    void UpdateCameraFromViewportContext();
-
-    double WidgetToViewportFactor() const
-    {
-#if defined(AZ_PLATFORM_WINDOWS)
-        // Needed for high DPI mode on windows
-        return devicePixelRatioF();
-#else
-        return 1.0f;
-#endif
-    }
-
-    void BeginUndoTransaction() override;
-    void EndUndoTransaction() override;
-
-    void UpdateCurrentMousePos(const QPoint& newPosition);
-    void UpdateScene();
-
+    // Shim for QtViewport, which used to be responsible for visibility queries in the editor,
+    // these are now forwarded to EntityVisibilityQuery
     AzFramework::EntityVisibilityQuery m_entityVisibilityQuery;
     AzFramework::EntityVisibilityQuery m_entityVisibilityQuery;
 
 
+    // Handlers for grid snapping/editor event callbacks
     SandboxEditor::GridSnappingChangedEvent::Handler m_gridSnappingHandler;
     SandboxEditor::GridSnappingChangedEvent::Handler m_gridSnappingHandler;
     AZStd::unique_ptr<SandboxEditor::EditorViewportSettingsCallbacks> m_editorViewportSettingsCallbacks;
     AZStd::unique_ptr<SandboxEditor::EditorViewportSettingsCallbacks> m_editorViewportSettingsCallbacks;
 
 
+    // Used for some legacy logic which lets the widget release a grabbed keyboard at the right times
+    // Unclear if it's still necessary.
     QSet<int> m_keyDown;
     QSet<int> m_keyDown;
 
 
+    // State for ViewportFreezeRequestBus, currently does nothing
     bool m_freezeViewportInput = false;
     bool m_freezeViewportInput = false;
 
 
+    // This widget holds a reference to the manipulator manage because its responsible for drawing manipulators
     AZStd::shared_ptr<AzToolsFramework::ManipulatorManager> m_manipulatorManager;
     AZStd::shared_ptr<AzToolsFramework::ManipulatorManager> m_manipulatorManager;
 
 
-    // Used to prevent circular set camera events
-    bool m_ignoreSetViewFromEntityPerspective = false;
-    bool m_windowResizedEvent = false;
-
+    // Helper for getting EditorEntityNotificationBus events
     AZStd::unique_ptr<AZ::ViewportHelpers::EditorEntityNotifications> m_editorEntityNotifications;
     AZStd::unique_ptr<AZ::ViewportHelpers::EditorEntityNotifications> m_editorEntityNotifications;
+
+    // The widget to which Atom will actually render
     AtomToolsFramework::RenderViewportWidget* m_renderViewport = nullptr;
     AtomToolsFramework::RenderViewportWidget* m_renderViewport = nullptr;
 
 
-    bool m_updateCameraPositionNextTick = false;
-    AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraViewMatrixChangeHandler;
-    AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraProjectionMatrixChangeHandler;
+    // Atom debug display
     AzFramework::DebugDisplayRequests* m_debugDisplay = nullptr;
     AzFramework::DebugDisplayRequests* m_debugDisplay = nullptr;
 
 
+    // The default view created for the viewport context, which is used as the "Editor Camera"
+    AZ::RPI::ViewPtr m_defaultView;
+
+    // The name to set on the viewport context when this viewport widget is set as the active one
     AZ::Name m_defaultViewportContextName;
     AZ::Name m_defaultViewportContextName;
 
 
+    // DO NOT USE THIS! It exists only to satisfy the signature of the base class method GetViewTm
+    mutable Matrix34 m_viewTmStorage;
+
     AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
     AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
 };
 };

+ 2 - 2
Code/Editor/ErrorReport.cpp

@@ -136,11 +136,11 @@ void CErrorReport::ReportError(CErrorRecord& err)
     }
     }
     else
     else
     {
     {
-        if (err.pObject == NULL && m_pObject != NULL)
+        if (err.pObject == nullptr && m_pObject != nullptr)
         {
         {
             err.pObject = m_pObject;
             err.pObject = m_pObject;
         }
         }
-        else if (err.pItem == NULL && m_pItem != NULL)
+        else if (err.pItem == nullptr && m_pItem != nullptr)
         {
         {
             err.pItem = m_pItem;
             err.pItem = m_pItem;
         }
         }

+ 8 - 8
Code/Editor/ErrorReportDialog.cpp

@@ -39,7 +39,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
 
 
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
-CErrorReportDialog* CErrorReportDialog::m_instance = 0;
+CErrorReportDialog* CErrorReportDialog::m_instance = nullptr;
 
 
 // CErrorReportDialog dialog
 // CErrorReportDialog dialog
 
 
@@ -88,12 +88,12 @@ CErrorReportDialog::CErrorReportDialog(QWidget* parent)
     m_instance = this;
     m_instance = this;
     //CErrorReport *report,
     //CErrorReport *report,
     //m_pErrorReport = report;
     //m_pErrorReport = report;
-    m_pErrorReport = 0;
+    m_pErrorReport = nullptr;
 }
 }
 
 
 CErrorReportDialog::~CErrorReportDialog()
 CErrorReportDialog::~CErrorReportDialog()
 {
 {
-    m_instance = 0;
+    m_instance = nullptr;
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -141,7 +141,7 @@ void CErrorReportDialog::Clear()
 {
 {
     if (m_instance)
     if (m_instance)
     {
     {
-        m_instance->SetReport(0);
+        m_instance->SetReport(nullptr);
         m_instance->UpdateErrors();
         m_instance->UpdateErrors();
     }
     }
 }
 }
@@ -500,7 +500,7 @@ void CErrorReportDialog::OnReportItemDblClick(const QModelIndex& index)
 {
 {
     bool bDone = false;
     bool bDone = false;
     const CErrorRecord* pError = index.data(Qt::UserRole).value<const CErrorRecord*>();
     const CErrorRecord* pError = index.data(Qt::UserRole).value<const CErrorRecord*>();
-    if (pError && pError->pObject != NULL)
+    if (pError && pError->pObject != nullptr)
     {
     {
         CUndo undo("Select Object(s)");
         CUndo undo("Select Object(s)");
         // Clear other selection.
         // Clear other selection.
@@ -563,7 +563,7 @@ void CErrorReportDialog::OnReportHyperlink(const QModelIndex& index)
 {
 {
     const CErrorRecord* pError = index.data(Qt::UserRole).value<const CErrorRecord*>();
     const CErrorRecord* pError = index.data(Qt::UserRole).value<const CErrorRecord*>();
     bool bDone = false;
     bool bDone = false;
-    if (pError && pError->pObject != NULL)
+    if (pError && pError->pObject != nullptr)
     {
     {
         CUndo undo("Select Object(s)");
         CUndo undo("Select Object(s)");
         // Clear other selection.
         // Clear other selection.
@@ -593,8 +593,8 @@ void CErrorReportDialog::OnShowFieldChooser()
     CMainFrm* pMainFrm = (CMainFrame*)AfxGetMainWnd();
     CMainFrm* pMainFrm = (CMainFrame*)AfxGetMainWnd();
     if (pMainFrm)
     if (pMainFrm)
     {
     {
-        BOOL bShow = !pMainFrm->m_wndFieldChooser.IsVisible();
-        pMainFrm->ShowControlBar(&pMainFrm->m_wndFieldChooser, bShow, FALSE);
+        bool bShow = !pMainFrm->m_wndFieldChooser.IsVisible();
+        pMainFrm->ShowControlBar(&pMainFrm->m_wndFieldChooser, bShow, false);
     }
     }
 }
 }
 */
 */

+ 1 - 1
Code/Editor/ErrorReportTableModel.cpp

@@ -105,7 +105,7 @@ void CErrorReportTableModel::setErrorReport(CErrorReport* report)
     {
     {
         m_errorRecords.clear();
         m_errorRecords.clear();
     }
     }
-    if (report != 0)
+    if (report != nullptr)
     {
     {
         const int count = report->GetErrorCount();
         const int count = report->GetErrorCount();
         m_errorRecords.reserve(count);
         m_errorRecords.reserve(count);

+ 0 - 7
Code/Editor/Export/ExportManager.cpp

@@ -22,7 +22,6 @@
 #include "OBJExporter.h"
 #include "OBJExporter.h"
 #include "OCMExporter.h"
 #include "OCMExporter.h"
 #include "FBXExporterDialog.h"
 #include "FBXExporterDialog.h"
-#include "RenderViewport.h"
 #include "TrackViewExportKeyTimeDlg.h"
 #include "TrackViewExportKeyTimeDlg.h"
 #include "AnimationContext.h"
 #include "AnimationContext.h"
 #include "TrackView/DirectorNodeAnimator.h"
 #include "TrackView/DirectorNodeAnimator.h"
@@ -662,12 +661,6 @@ bool CExportManager::ProcessObjectsForExport()
     GetIEditor()->GetAnimation()->SetRecording(false);
     GetIEditor()->GetAnimation()->SetRecording(false);
     GetIEditor()->GetAnimation()->SetPlaying(false);
     GetIEditor()->GetAnimation()->SetPlaying(false);
 
 
-    CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
-    if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
-    {
-        rvp->SetSequenceCamera();
-    }
-
     int startFrame = 0;
     int startFrame = 0;
     timeValue = startFrame * fpsTimeInterval;
     timeValue = startFrame * fpsTimeInterval;
 
 

+ 16 - 25
Code/Editor/GameEngine.cpp

@@ -57,12 +57,12 @@ struct SSystemUserCallback
     : public ISystemUserCallback
     : public ISystemUserCallback
 {
 {
     SSystemUserCallback(IInitializeUIInfo* logo) : m_threadErrorHandler(this) { m_pLogo = logo; };
     SSystemUserCallback(IInitializeUIInfo* logo) : m_threadErrorHandler(this) { m_pLogo = logo; };
-    virtual void OnSystemConnect(ISystem* pSystem)
+    void OnSystemConnect(ISystem* pSystem) override
     {
     {
         ModuleInitISystem(pSystem, "Editor");
         ModuleInitISystem(pSystem, "Editor");
     }
     }
 
 
-    virtual bool OnError(const char* szErrorString)
+    bool OnError(const char* szErrorString) override
     {
     {
         // since we show a message box, we have to use the GUI thread
         // since we show a message box, we have to use the GUI thread
         if (QThread::currentThread() != qApp->thread())
         if (QThread::currentThread() != qApp->thread())
@@ -95,7 +95,7 @@ struct SSystemUserCallback
 
 
         int res = IDNO;
         int res = IDNO;
 
 
-        ICVar* pCVar = gEnv->pConsole ? gEnv->pConsole->GetCVar("sys_no_crash_dialog") : NULL;
+        ICVar* pCVar = gEnv->pConsole ? gEnv->pConsole->GetCVar("sys_no_crash_dialog") : nullptr;
 
 
         if (!pCVar || pCVar->GetIVal() == 0)
         if (!pCVar || pCVar->GetIVal() == 0)
         {
         {
@@ -116,7 +116,7 @@ struct SSystemUserCallback
         return true;
         return true;
     }
     }
 
 
-    virtual bool OnSaveDocument()
+    bool OnSaveDocument() override
     {
     {
         bool success = false;
         bool success = false;
 
 
@@ -133,7 +133,7 @@ struct SSystemUserCallback
         return success;
         return success;
     }
     }
 
 
-    virtual bool OnBackupDocument()
+    bool OnBackupDocument() override
     {
     {
         CCryEditDoc* level = GetIEditor() ? GetIEditor()->GetDocument() : nullptr;
         CCryEditDoc* level = GetIEditor() ? GetIEditor()->GetDocument() : nullptr;
         if (level)
         if (level)
@@ -144,7 +144,7 @@ struct SSystemUserCallback
         return false;
         return false;
     }
     }
 
 
-    virtual void OnProcessSwitch()
+    void OnProcessSwitch() override
     {
     {
         if (GetIEditor()->IsInGameMode())
         if (GetIEditor()->IsInGameMode())
         {
         {
@@ -152,7 +152,7 @@ struct SSystemUserCallback
         }
         }
     }
     }
 
 
-    virtual void OnInitProgress(const char* sProgressMsg)
+    void OnInitProgress(const char* sProgressMsg) override
     {
     {
         if (m_pLogo)
         if (m_pLogo)
         {
         {
@@ -160,7 +160,7 @@ struct SSystemUserCallback
         }
         }
     }
     }
 
 
-    virtual int ShowMessage(const char* text, const char* caption, unsigned int uType)
+    int ShowMessage(const char* text, const char* caption, unsigned int uType) override
     {
     {
         if (CCryEditApp::instance()->IsInAutotestMode())
         if (CCryEditApp::instance()->IsInAutotestMode())
         {
         {
@@ -176,7 +176,7 @@ struct SSystemUserCallback
         return CryMessageBox(text, caption, uType);
         return CryMessageBox(text, caption, uType);
     }
     }
 
 
-    virtual void GetMemoryUsage(ICrySizer* pSizer)
+    void GetMemoryUsage(ICrySizer* pSizer) override
     {
     {
         GetIEditor()->GetMemoryUsage(pSizer);
         GetIEditor()->GetMemoryUsage(pSizer);
     }
     }
@@ -215,7 +215,7 @@ public:
     {
     {
         AzFramework::AssetSystemConnectionNotificationsBus::Handler::BusConnect();
         AzFramework::AssetSystemConnectionNotificationsBus::Handler::BusConnect();
     };
     };
-    ~AssetProcessConnectionStatus()
+    ~AssetProcessConnectionStatus() override
     {
     {
         AzFramework::AssetSystemConnectionNotificationsBus::Handler::BusDisconnect();
         AzFramework::AssetSystemConnectionNotificationsBus::Handler::BusDisconnect();
     }
     }
@@ -247,18 +247,18 @@ private:
 
 
 AZ_PUSH_DISABLE_WARNING(4273, "-Wunknown-warning-option")
 AZ_PUSH_DISABLE_WARNING(4273, "-Wunknown-warning-option")
 CGameEngine::CGameEngine()
 CGameEngine::CGameEngine()
-    : m_gameDll(0)
+    : m_gameDll(nullptr)
     , m_bIgnoreUpdates(false)
     , m_bIgnoreUpdates(false)
     , m_ePendingGameMode(ePGM_NotPending)
     , m_ePendingGameMode(ePGM_NotPending)
     , m_modalWindowDismisser(nullptr)
     , m_modalWindowDismisser(nullptr)
 AZ_POP_DISABLE_WARNING
 AZ_POP_DISABLE_WARNING
 {
 {
-    m_pISystem = NULL;
+    m_pISystem = nullptr;
     m_bLevelLoaded = false;
     m_bLevelLoaded = false;
     m_bInGameMode = false;
     m_bInGameMode = false;
     m_bSimulationMode = false;
     m_bSimulationMode = false;
     m_bSyncPlayerPosition = true;
     m_bSyncPlayerPosition = true;
-    m_hSystemHandle = 0;
+    m_hSystemHandle = nullptr;
     m_bJustCreated = false;
     m_bJustCreated = false;
     m_levelName = "Untitled";
     m_levelName = "Untitled";
     m_levelExtension = EditorUtils::LevelFile::GetDefaultFileExtension();
     m_levelExtension = EditorUtils::LevelFile::GetDefaultFileExtension();
@@ -271,7 +271,7 @@ CGameEngine::~CGameEngine()
 {
 {
 AZ_POP_DISABLE_WARNING
 AZ_POP_DISABLE_WARNING
     GetIEditor()->UnregisterNotifyListener(this);
     GetIEditor()->UnregisterNotifyListener(this);
-    m_pISystem->GetIMovieSystem()->SetCallback(NULL);
+    m_pISystem->GetIMovieSystem()->SetCallback(nullptr);
 
 
     if (m_gameDll)
     if (m_gameDll)
     {
     {
@@ -279,7 +279,7 @@ AZ_POP_DISABLE_WARNING
     }
     }
 
 
     delete m_pISystem;
     delete m_pISystem;
-    m_pISystem = NULL;
+    m_pISystem = nullptr;
 
 
     if (m_hSystemHandle)
     if (m_hSystemHandle)
     {
     {
@@ -572,8 +572,6 @@ void CGameEngine::SwitchToInGame()
     m_pISystem->GetIMovieSystem()->EnablePhysicsEvents(true);
     m_pISystem->GetIMovieSystem()->EnablePhysicsEvents(true);
     m_bInGameMode = true;
     m_bInGameMode = true;
 
 
-    gEnv->pSystem->GetViewCamera().SetMatrix(m_playerViewTM);
-
     // Disable accelerators.
     // Disable accelerators.
     GetIEditor()->EnableAcceleratos(false);
     GetIEditor()->EnableAcceleratos(false);
     //! Send event to switch into game.
     //! Send event to switch into game.
@@ -627,13 +625,6 @@ void CGameEngine::SwitchToInEditor()
 
 
     m_bInGameMode = false;
     m_bInGameMode = false;
 
 
-    // save the current gameView matrix for editor
-    if (pGameViewport)
-    {
-        Matrix34 gameView = gEnv->pSystem->GetViewCamera().GetMatrix();
-        pGameViewport->SetGameTM(gameView);
-    }
-
     // Out of game in Editor mode.
     // Out of game in Editor mode.
     if (pGameViewport)
     if (pGameViewport)
     {
     {
@@ -875,7 +866,7 @@ void CGameEngine::OnEditorNotifyEvent(EEditorNotifyEvent event)
     {
     {
     case eNotify_OnSplashScreenDestroyed:
     case eNotify_OnSplashScreenDestroyed:
     {
     {
-        if (m_pSystemUserCallback != NULL)
+        if (m_pSystemUserCallback != nullptr)
         {
         {
             m_pSystemUserCallback->OnSplashScreenDone();
             m_pSystemUserCallback->OnSplashScreenDone();
         }
         }

+ 2 - 2
Code/Editor/GameExporter.cpp

@@ -63,7 +63,7 @@ void SGameExporterSettings::SetHiQuality()
     nApplySS = 1;
     nApplySS = 1;
 }
 }
 
 
-CGameExporter* CGameExporter::m_pCurrentExporter = NULL;
+CGameExporter* CGameExporter::m_pCurrentExporter = nullptr;
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 // CGameExporter
 // CGameExporter
@@ -76,7 +76,7 @@ CGameExporter::CGameExporter()
 
 
 CGameExporter::~CGameExporter()
 CGameExporter::~CGameExporter()
 {
 {
-    m_pCurrentExporter = NULL;
+    m_pCurrentExporter = nullptr;
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////

+ 1 - 1
Code/Editor/GenericSelectItemDialog.cpp

@@ -17,7 +17,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
 
 
 // CGenericSelectItemDialog dialog
 // CGenericSelectItemDialog dialog
 
 
-CGenericSelectItemDialog::CGenericSelectItemDialog(QWidget* pParent /*=NULL*/)
+CGenericSelectItemDialog::CGenericSelectItemDialog(QWidget* pParent /*=nullptr*/)
     : QDialog(pParent)
     : QDialog(pParent)
     , ui(new Ui::CGenericSelectItemDialog)
     , ui(new Ui::CGenericSelectItemDialog)
     , m_initialized(false)
     , m_initialized(false)

+ 2 - 2
Code/Editor/IEditor.h

@@ -570,7 +570,7 @@ struct IEditor
     //////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////
     virtual class CLevelIndependentFileMan* GetLevelIndependentFileMan() = 0;
     virtual class CLevelIndependentFileMan* GetLevelIndependentFileMan() = 0;
     //! Notify all views that data is changed.
     //! Notify all views that data is changed.
-    virtual void UpdateViews(int flags = 0xFFFFFFFF, const AABB* updateRegion = NULL) = 0;
+    virtual void UpdateViews(int flags = 0xFFFFFFFF, const AABB* updateRegion = nullptr) = 0;
     virtual void ResetViews() = 0;
     virtual void ResetViews() = 0;
     //! Update information in track view dialog.
     //! Update information in track view dialog.
     virtual void ReloadTrackView() = 0;
     virtual void ReloadTrackView() = 0;
@@ -589,7 +589,7 @@ struct IEditor
     //! if bShow is true also returns a valid ITransformManipulator pointer.
     //! if bShow is true also returns a valid ITransformManipulator pointer.
     virtual ITransformManipulator* ShowTransformManipulator(bool bShow) = 0;
     virtual ITransformManipulator* ShowTransformManipulator(bool bShow) = 0;
     //! Return a pointer to a ITransformManipulator pointer if shown.
     //! Return a pointer to a ITransformManipulator pointer if shown.
-    //! NULL is manipulator is not shown.
+    //! nullptr if manipulator is not shown.
     virtual ITransformManipulator* GetTransformManipulator() = 0;
     virtual ITransformManipulator* GetTransformManipulator() = 0;
     //! Set constrain on specified axis for objects construction and modifications.
     //! Set constrain on specified axis for objects construction and modifications.
     //! @param axis one of AxisConstrains enumerations.
     //! @param axis one of AxisConstrains enumerations.

+ 14 - 14
Code/Editor/IEditorImpl.cpp

@@ -415,7 +415,7 @@ void CEditorImpl::Update()
     }
     }
     if (IsInPreviewMode())
     if (IsInPreviewMode())
     {
     {
-        SetModifiedFlag(FALSE);
+        SetModifiedFlag(false);
         SetModifiedModule(eModifiedNothing);
         SetModifiedModule(eModifiedNothing);
     }
     }
 
 
@@ -550,7 +550,7 @@ QString CEditorImpl::GetResolvedUserFolder()
 
 
 void CEditorImpl::SetDataModified()
 void CEditorImpl::SetDataModified()
 {
 {
-    GetDocument()->SetModifiedFlag(TRUE);
+    GetDocument()->SetModifiedFlag(true);
 }
 }
 
 
 void CEditorImpl::SetStatusText(const QString& pszString)
 void CEditorImpl::SetStatusText(const QString& pszString)
@@ -597,9 +597,9 @@ ITransformManipulator* CEditorImpl::ShowTransformManipulator(bool bShow)
             GetObjectManager()->GetGizmoManager()->RemoveGizmo(m_pAxisGizmo);
             GetObjectManager()->GetGizmoManager()->RemoveGizmo(m_pAxisGizmo);
             m_pAxisGizmo->Release();
             m_pAxisGizmo->Release();
         }
         }
-        m_pAxisGizmo = 0;
+        m_pAxisGizmo = nullptr;
     }
     }
-    return 0;
+    return nullptr;
 }
 }
 
 
 ITransformManipulator* CEditorImpl::GetTransformManipulator()
 ITransformManipulator* CEditorImpl::GetTransformManipulator()
@@ -614,7 +614,7 @@ void CEditorImpl::SetAxisConstraints(AxisConstrains axisFlags)
     SetTerrainAxisIgnoreObjects(false);
     SetTerrainAxisIgnoreObjects(false);
 
 
     // Update all views.
     // Update all views.
-    UpdateViews(eUpdateObjects, NULL);
+    UpdateViews(eUpdateObjects, nullptr);
 }
 }
 
 
 AxisConstrains CEditorImpl::GetAxisConstrains()
 AxisConstrains CEditorImpl::GetAxisConstrains()
@@ -637,15 +637,15 @@ void CEditorImpl::SetReferenceCoordSys(RefCoordSys refCoords)
     m_refCoordsSys = refCoords;
     m_refCoordsSys = refCoords;
 
 
     // Update all views.
     // Update all views.
-    UpdateViews(eUpdateObjects, NULL);
+    UpdateViews(eUpdateObjects, nullptr);
 
 
     // Update the construction plane infos.
     // Update the construction plane infos.
     CViewport* pViewport = GetActiveView();
     CViewport* pViewport = GetActiveView();
     if (pViewport)
     if (pViewport)
     {
     {
         //Pre and Post widget rendering calls are made here to make sure that the proper camera state is set.
         //Pre and Post widget rendering calls are made here to make sure that the proper camera state is set.
-        //MakeConstructionPlane will make a call to ViewToWorldRay which needs the correct camera state 
-        //in the CRenderViewport to be set. 
+        //MakeConstructionPlane will make a call to ViewToWorldRay which needs the correct camera state
+        //in the CRenderViewport to be set.
         pViewport->PreWidgetRendering();
         pViewport->PreWidgetRendering();
 
 
         pViewport->MakeConstructionPlane(GetIEditor()->GetAxisConstrains());
         pViewport->MakeConstructionPlane(GetIEditor()->GetAxisConstrains());
@@ -671,7 +671,7 @@ CBaseObject* CEditorImpl::NewObject(const char* typeName, const char* fileName,
         editor->SetModifiedFlag();
         editor->SetModifiedFlag();
         editor->SetModifiedModule(eModifiedBrushes);
         editor->SetModifiedModule(eModifiedBrushes);
     }
     }
-    CBaseObject* object = editor->GetObjectManager()->NewObject(typeName, 0, fileName, name);
+    CBaseObject* object = editor->GetObjectManager()->NewObject(typeName, nullptr, fileName, name);
     if (!object)
     if (!object)
     {
     {
         return nullptr;
         return nullptr;
@@ -932,7 +932,7 @@ void CEditorImpl::CloseView(const GUID& classId)
 
 
 IDataBaseManager* CEditorImpl::GetDBItemManager([[maybe_unused]] EDataBaseItemType itemType)
 IDataBaseManager* CEditorImpl::GetDBItemManager([[maybe_unused]] EDataBaseItemType itemType)
 {
 {
-    return 0;
+    return nullptr;
 }
 }
 
 
 bool CEditorImpl::SelectColor(QColor& color, QWidget* parent)
 bool CEditorImpl::SelectColor(QColor& color, QWidget* parent)
@@ -1109,7 +1109,7 @@ void CEditorImpl::DetectVersion()
 
 
     char ver[1024 * 8];
     char ver[1024 * 8];
 
 
-    GetModuleFileName(NULL, exe, _MAX_PATH);
+    GetModuleFileName(nullptr, exe, _MAX_PATH);
 
 
     int verSize = GetFileVersionInfoSize(exe, &dwHandle);
     int verSize = GetFileVersionInfoSize(exe, &dwHandle);
     if (verSize > 0)
     if (verSize > 0)
@@ -1431,7 +1431,7 @@ void CEditorImpl::NotifyExcept(EEditorNotifyEvent event, IEditorNotifyListener*
         {
         {
             m_pAxisGizmo->Release();
             m_pAxisGizmo->Release();
         }
         }
-        m_pAxisGizmo = 0;
+        m_pAxisGizmo = nullptr;
     }
     }
 
 
     if (event == eNotify_OnInit)
     if (event == eNotify_OnInit)
@@ -1472,7 +1472,7 @@ ISourceControl* CEditorImpl::GetSourceControl()
         for (int i = 0; i < classes.size(); i++)
         for (int i = 0; i < classes.size(); i++)
         {
         {
             IClassDesc* pClass = classes[i];
             IClassDesc* pClass = classes[i];
-            ISourceControl* pSCM = NULL;
+            ISourceControl* pSCM = nullptr;
             HRESULT hRes = pClass->QueryInterface(__uuidof(ISourceControl), (void**)&pSCM);
             HRESULT hRes = pClass->QueryInterface(__uuidof(ISourceControl), (void**)&pSCM);
             if (!FAILED(hRes) && pSCM)
             if (!FAILED(hRes) && pSCM)
             {
             {
@@ -1482,7 +1482,7 @@ ISourceControl* CEditorImpl::GetSourceControl()
         }
         }
     }
     }
 
 
-    return 0;
+    return nullptr;
 }
 }
 
 
 bool CEditorImpl::IsSourceControlAvailable()
 bool CEditorImpl::IsSourceControlAvailable()

+ 4 - 4
Code/Editor/IEditorImpl.h

@@ -22,7 +22,7 @@
 #include <AzToolsFramework/Thumbnails/ThumbnailerBus.h>
 #include <AzToolsFramework/Thumbnails/ThumbnailerBus.h>
 #include <AzCore/std/string/string.h>
 #include <AzCore/std/string/string.h>
 
 
-#include "Commands/CommandManager.h"                
+#include "Commands/CommandManager.h"
 
 
 #include "Include/IErrorReport.h"
 #include "Include/IErrorReport.h"
 #include "ErrorReport.h"
 #include "ErrorReport.h"
@@ -63,7 +63,7 @@ namespace AssetDatabase
     class AssetDatabaseLocationListener;
     class AssetDatabaseLocationListener;
 }
 }
 
 
-class CEditorImpl 
+class CEditorImpl
     : public IEditor
     : public IEditor
 {
 {
     Q_DECLARE_TR_FUNCTIONS(CEditorImpl)
     Q_DECLARE_TR_FUNCTIONS(CEditorImpl)
@@ -176,7 +176,7 @@ public:
         {
         {
             return m_pSystem->GetIMovieSystem();
             return m_pSystem->GetIMovieSystem();
         }
         }
-        return NULL;
+        return nullptr;
     };
     };
 
 
     CPluginManager* GetPluginManager() { return m_pPluginManager; }
     CPluginManager* GetPluginManager() { return m_pPluginManager; }
@@ -210,7 +210,7 @@ public:
     RefCoordSys GetReferenceCoordSys();
     RefCoordSys GetReferenceCoordSys();
     XmlNodeRef FindTemplate(const QString& templateName);
     XmlNodeRef FindTemplate(const QString& templateName);
     void AddTemplate(const QString& templateName, XmlNodeRef& tmpl);
     void AddTemplate(const QString& templateName, XmlNodeRef& tmpl);
-   
+
     const QtViewPane* OpenView(QString sViewClassName, bool reuseOpened = true) override;
     const QtViewPane* OpenView(QString sViewClassName, bool reuseOpened = true) override;
 
 
     /**
     /**

+ 5 - 5
Code/Editor/IconManager.cpp

@@ -81,7 +81,7 @@ void CIconManager::Reset()
         {
         {
             m_objects[i]->Release();
             m_objects[i]->Release();
         }
         }
-        m_objects[i] = 0;
+        m_objects[i] = nullptr;
     }
     }
     for (i = 0; i < eIcon_COUNT; i++)
     for (i = 0; i < eIcon_COUNT; i++)
     {
     {
@@ -135,7 +135,7 @@ IStatObj*   CIconManager::GetObject(EStatObject)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 QImage* CIconManager::GetIconBitmap(const char* filename, bool& bHaveAlpha, uint32 effects /*=0*/)
 QImage* CIconManager::GetIconBitmap(const char* filename, bool& bHaveAlpha, uint32 effects /*=0*/)
 {
 {
-    QImage* pBitmap = 0;
+    QImage* pBitmap = nullptr;
 
 
     QString iconFilename = filename;
     QString iconFilename = filename;
 
 
@@ -160,11 +160,11 @@ QImage* CIconManager::GetIconBitmap(const char* filename, bool& bHaveAlpha, uint
         return pBitmap;
         return pBitmap;
     }
     }
 
 
-    BOOL bAlphaBitmap = FALSE;
+    bool bAlphaBitmap = false;
     QPixmap pm(iconFilename);
     QPixmap pm(iconFilename);
     bAlphaBitmap = pm.hasAlpha();
     bAlphaBitmap = pm.hasAlpha();
 
 
-    bHaveAlpha = (bAlphaBitmap == TRUE);
+    bHaveAlpha = (bAlphaBitmap == true);
     if (!pm.isNull())
     if (!pm.isNull())
     {
     {
         pBitmap = new QImage;
         pBitmap = new QImage;
@@ -252,5 +252,5 @@ QImage* CIconManager::GetIconBitmap(const char* filename, bool& bHaveAlpha, uint
 
 
         return pBitmap;
         return pBitmap;
     }
     }
-    return NULL;
+    return nullptr;
 }
 }

+ 1 - 1
Code/Editor/LayoutConfigDialog.cpp

@@ -68,7 +68,7 @@ QVariant LayoutConfigModel::data(const QModelIndex& index, int role) const
 
 
 // CLayoutConfigDialog dialog
 // CLayoutConfigDialog dialog
 
 
-CLayoutConfigDialog::CLayoutConfigDialog(QWidget* pParent /*=NULL*/)
+CLayoutConfigDialog::CLayoutConfigDialog(QWidget* pParent /*=nullptr*/)
     : QDialog(pParent)
     : QDialog(pParent)
     , m_model(new LayoutConfigModel(this))
     , m_model(new LayoutConfigModel(this))
     , ui(new Ui::CLayoutConfigDialog)
     , ui(new Ui::CLayoutConfigDialog)

+ 2 - 2
Code/Editor/LayoutWnd.cpp

@@ -98,7 +98,7 @@ CLayoutWnd::CLayoutWnd(QSettings* settings, QWidget* parent)
     , m_settings(settings)
     , m_settings(settings)
 {
 {
     m_bMaximized = false;
     m_bMaximized = false;
-    m_maximizedView = 0;
+    m_maximizedView = nullptr;
     m_layout = (EViewLayout) - 1;
     m_layout = (EViewLayout) - 1;
 
 
     m_maximizedViewId = 0;
     m_maximizedViewId = 0;
@@ -729,7 +729,7 @@ void CLayoutWnd::OnDestroy()
     if (m_maximizedView)
     if (m_maximizedView)
     {
     {
         delete m_maximizedView;
         delete m_maximizedView;
-        m_maximizedView = 0;
+        m_maximizedView = nullptr;
     }
     }
 }
 }
 
 

+ 2 - 2
Code/Editor/Lib/Tests/test_EditorUtils.cpp

@@ -23,12 +23,12 @@ namespace EditorUtilsTest
             BusConnect();
             BusConnect();
         }
         }
 
 
-        ~WarningDetector()
+        ~WarningDetector() override
         {
         {
             BusDisconnect();
             BusDisconnect();
         }
         }
 
 
-        virtual bool OnWarning(const char* /*window*/, const char* /*message*/) override 
+        bool OnWarning(const char* /*window*/, const char* /*message*/) override 
         {
         {
             m_gotWarning = true;
             m_gotWarning = true;
             return true;
             return true;

+ 1 - 1
Code/Editor/Lib/Tests/test_Main.cpp

@@ -17,7 +17,7 @@ class EditorLibTestEnvironment
     : public AZ::Test::ITestEnvironment
     : public AZ::Test::ITestEnvironment
 {
 {
 public:
 public:
-    virtual ~EditorLibTestEnvironment() {}
+    ~EditorLibTestEnvironment() override = default;
 
 
 protected:
 protected:
     void SetupEnvironment() override
     void SetupEnvironment() override

+ 30 - 30
Code/Editor/Objects/BaseObject.cpp

@@ -57,12 +57,12 @@ public:
     CUndoBaseObject(CBaseObject* pObj, const char* undoDescription);
     CUndoBaseObject(CBaseObject* pObj, const char* undoDescription);
 
 
 protected:
 protected:
-    virtual int GetSize() { return sizeof(*this);   }
-    virtual QString GetDescription() { return m_undoDescription; };
-    virtual QString GetObjectName();
+    int GetSize() override { return sizeof(*this);   }
+    QString GetDescription() override { return m_undoDescription; };
+    QString GetObjectName() override;
 
 
-    virtual void Undo(bool bUndo);
-    virtual void Redo();
+    void Undo(bool bUndo) override;
+    void Redo() override;
 
 
 protected:
 protected:
     QString m_undoDescription;
     QString m_undoDescription;
@@ -81,12 +81,12 @@ public:
     CUndoBaseObjectMinimal(CBaseObject* obj, const char* undoDescription, int flags);
     CUndoBaseObjectMinimal(CBaseObject* obj, const char* undoDescription, int flags);
 
 
 protected:
 protected:
-    virtual int GetSize() { return sizeof(*this); }
-    virtual QString GetDescription() { return m_undoDescription; };
-    virtual QString GetObjectName();
+    int GetSize() override { return sizeof(*this); }
+    QString GetDescription() override { return m_undoDescription; };
+    QString GetObjectName() override;
 
 
-    virtual void Undo(bool bUndo);
-    virtual void Redo();
+    void Undo(bool bUndo) override;
+    void Redo() override;
 
 
 private:
 private:
     struct StateStruct
     struct StateStruct
@@ -119,7 +119,7 @@ public:
         , m_bKeepPos(bKeepPos)
         , m_bKeepPos(bKeepPos)
         , m_bAttach(bAttach) {}
         , m_bAttach(bAttach) {}
 
 
-    virtual void Undo([[maybe_unused]] bool bUndo) override
+    void Undo([[maybe_unused]] bool bUndo) override
     {
     {
         if (m_bAttach)
         if (m_bAttach)
         {
         {
@@ -131,7 +131,7 @@ public:
         }
         }
     }
     }
 
 
-    virtual void Redo() override
+    void Redo() override
     {
     {
         if (m_bAttach)
         if (m_bAttach)
         {
         {
@@ -167,8 +167,8 @@ private:
         }
         }
     }
     }
 
 
-    virtual int GetSize() { return sizeof(CUndoAttachBaseObject); }
-    virtual QString GetDescription() { return "Attachment Changed"; }
+    int GetSize() override { return sizeof(CUndoAttachBaseObject); }
+    QString GetDescription() override { return "Attachment Changed"; }
 
 
     GUID m_attachedObjectGUID;
     GUID m_attachedObjectGUID;
     GUID m_parentObjectGUID;
     GUID m_parentObjectGUID;
@@ -184,7 +184,7 @@ CUndoBaseObject::CUndoBaseObject(CBaseObject* obj, const char* undoDescription)
     m_undoDescription = undoDescription;
     m_undoDescription = undoDescription;
     m_guid = obj->GetId();
     m_guid = obj->GetId();
 
 
-    m_redo = 0;
+    m_redo = nullptr;
     m_undo = XmlHelpers::CreateXmlNode("Undo");
     m_undo = XmlHelpers::CreateXmlNode("Undo");
     CObjectArchive ar(GetIEditor()->GetObjectManager(), m_undo, false);
     CObjectArchive ar(GetIEditor()->GetObjectManager(), m_undo, false);
     ar.bUndo = true;
     ar.bUndo = true;
@@ -355,7 +355,7 @@ void CObjectCloneContext::AddClone(CBaseObject* pFromObject, CBaseObject* pToObj
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 CBaseObject* CObjectCloneContext::FindClone(CBaseObject* pFromObject)
 CBaseObject* CObjectCloneContext::FindClone(CBaseObject* pFromObject)
 {
 {
-    CBaseObject* pTarget = stl::find_in_map(m_objectsMap, pFromObject, (CBaseObject*) NULL);
+    CBaseObject* pTarget = stl::find_in_map(m_objectsMap, pFromObject, (CBaseObject*) nullptr);
     return pTarget;
     return pTarget;
 }
 }
 
 
@@ -426,7 +426,7 @@ bool CBaseObject::Init([[maybe_unused]] IEditor* ie, CBaseObject* prev, [[maybe_
 {
 {
     SetFlags(m_flags & (~OBJFLAG_DELETED));
     SetFlags(m_flags & (~OBJFLAG_DELETED));
 
 
-    if (prev != 0)
+    if (prev != nullptr)
     {
     {
         SetUniqueName(prev->GetName());
         SetUniqueName(prev->GetName());
         SetLocalTM(prev->GetPos(), prev->GetRotation(), prev->GetScale());
         SetLocalTM(prev->GetPos(), prev->GetRotation(), prev->GetScale());
@@ -457,7 +457,7 @@ CBaseObject::~CBaseObject()
     for (Childs::iterator c = m_childs.begin(); c != m_childs.end(); c++)
     for (Childs::iterator c = m_childs.begin(); c != m_childs.end(); c++)
     {
     {
         CBaseObject* child = *c;
         CBaseObject* child = *c;
-        child->m_parent = 0;
+        child->m_parent = nullptr;
     }
     }
     m_childs.clear();
     m_childs.clear();
 }
 }
@@ -470,10 +470,10 @@ void CBaseObject::Done()
     // From children
     // From children
     DetachAll();
     DetachAll();
 
 
-    SetLookAt(0);
+    SetLookAt(nullptr);
     if (m_lookatSource)
     if (m_lookatSource)
     {
     {
-        m_lookatSource->SetLookAt(0);
+        m_lookatSource->SetLookAt(nullptr);
     }
     }
     SetFlags(m_flags | OBJFLAG_DELETED);
     SetFlags(m_flags | OBJFLAG_DELETED);
 
 
@@ -1730,7 +1730,7 @@ bool CBaseObject::IntersectRayBounds(const Ray& ray)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 namespace
 namespace
 {
 {
-    typedef std::pair<Vec2, Vec2> Edge2D;
+    using Edge2D = std::pair<Vec2, Vec2>;
 }
 }
 bool IsIncludePointsInConvexHull(Edge2D* pEdgeArray0, int nEdgeArray0Size, Edge2D* pEdgeArray1, int nEdgeArray1Size)
 bool IsIncludePointsInConvexHull(Edge2D* pEdgeArray0, int nEdgeArray0Size, Edge2D* pEdgeArray1, int nEdgeArray1Size)
 {
 {
@@ -2065,7 +2065,7 @@ void CBaseObject::GetAllChildren(TBaseObjects& outAllChildren, CBaseObject* pObj
     for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
     for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
     {
     {
         CBaseObject* pChild = pBaseObj->GetChild(i);
         CBaseObject* pChild = pBaseObj->GetChild(i);
-        if (pChild == NULL)
+        if (pChild == nullptr)
         {
         {
             continue;
             continue;
         }
         }
@@ -2081,7 +2081,7 @@ void CBaseObject::GetAllChildren(DynArray< _smart_ptr<CBaseObject> >& outAllChil
     for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
     for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
     {
     {
         CBaseObject* pChild = pBaseObj->GetChild(i);
         CBaseObject* pChild = pBaseObj->GetChild(i);
-        if (pChild == NULL)
+        if (pChild == nullptr)
         {
         {
             continue;
             continue;
         }
         }
@@ -2097,7 +2097,7 @@ void CBaseObject::GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* p
     for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
     for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
     {
     {
         CBaseObject* pChild = pBaseObj->GetChild(i);
         CBaseObject* pChild = pBaseObj->GetChild(i);
-        if (pChild == NULL)
+        if (pChild == nullptr)
         {
         {
             continue;
             continue;
         }
         }
@@ -2109,7 +2109,7 @@ void CBaseObject::GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* p
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void CBaseObject::CloneChildren(CBaseObject* pFromObject)
 void CBaseObject::CloneChildren(CBaseObject* pFromObject)
 {
 {
-    if (pFromObject == NULL)
+    if (pFromObject == nullptr)
     {
     {
         return;
         return;
     }
     }
@@ -2119,7 +2119,7 @@ void CBaseObject::CloneChildren(CBaseObject* pFromObject)
         CBaseObject* pFromChildObject = pFromObject->GetChild(i);
         CBaseObject* pFromChildObject = pFromObject->GetChild(i);
 
 
         CBaseObject* pChildClone = GetObjectManager()->CloneObject(pFromChildObject);
         CBaseObject* pChildClone = GetObjectManager()->CloneObject(pFromChildObject);
-        if (pChildClone == NULL)
+        if (pChildClone == nullptr)
         {
         {
             continue;
             continue;
         }
         }
@@ -2248,7 +2248,7 @@ void CBaseObject::DetachThis(bool bKeepPos)
 
 
             // Copy parent to temp var, erasing child from parent may delete this node if child referenced only from parent.
             // Copy parent to temp var, erasing child from parent may delete this node if child referenced only from parent.
             CBaseObject* parent = m_parent;
             CBaseObject* parent = m_parent;
-            m_parent = 0;
+            m_parent = nullptr;
             parent->RemoveChild(this);
             parent->RemoveChild(this);
 
 
             if (bKeepPos)
             if (bKeepPos)
@@ -2389,7 +2389,7 @@ void CBaseObject::InvalidateTM([[maybe_unused]] int flags)
         // Invalidate matrices off all child objects.
         // Invalidate matrices off all child objects.
         for (int i = 0; i < m_childs.size(); i++)
         for (int i = 0; i < m_childs.size(); i++)
         {
         {
-            if (m_childs[i] != 0 && m_childs[i]->m_bMatrixValid)
+            if (m_childs[i] != nullptr && m_childs[i]->m_bMatrixValid)
             {
             {
                 m_childs[i]->InvalidateTM(eObjectUpdateFlags_ParentChanged);
                 m_childs[i]->InvalidateTM(eObjectUpdateFlags_ParentChanged);
             }
             }
@@ -2538,7 +2538,7 @@ void CBaseObject::SetLookAt(CBaseObject* target)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 bool CBaseObject::IsLookAtTarget() const
 bool CBaseObject::IsLookAtTarget() const
 {
 {
-    return m_lookatSource != 0;
+    return m_lookatSource != nullptr;
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -2806,7 +2806,7 @@ bool CBaseObject::IntersectRayMesh(const Vec3& raySrc, const Vec3& rayDir, SRayH
     outHitInfo.bInFirstHit = false;
     outHitInfo.bInFirstHit = false;
     outHitInfo.bUseCache = false;
     outHitInfo.bUseCache = false;
 
 
-    return pStatObj->RayIntersection(outHitInfo, 0);
+    return pStatObj->RayIntersection(outHitInfo, nullptr);
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////

+ 8 - 8
Code/Editor/Objects/BaseObject.h

@@ -321,7 +321,7 @@ public:
     //! Set object selected status.
     //! Set object selected status.
     virtual void SetSelected(bool bSelect);
     virtual void SetSelected(bool bSelect);
     //! Return associated 3DEngine render node
     //! Return associated 3DEngine render node
-    virtual IRenderNode* GetEngineNode() const { return NULL; };
+    virtual IRenderNode* GetEngineNode() const { return nullptr; };
     //! Set object highlighted (Note: not selected)
     //! Set object highlighted (Note: not selected)
     virtual void SetHighlight(bool bHighlight);
     virtual void SetHighlight(bool bHighlight);
     //! Check if object is highlighted.
     //! Check if object is highlighted.
@@ -410,9 +410,9 @@ public:
     //! Scans hierarchy up to determine if we child of specified node.
     //! Scans hierarchy up to determine if we child of specified node.
     virtual bool IsChildOf(CBaseObject* node);
     virtual bool IsChildOf(CBaseObject* node);
     //! Get all child objects
     //! Get all child objects
-    void GetAllChildren(TBaseObjects& outAllChildren, CBaseObject* pObj = NULL) const;
-    void GetAllChildren(DynArray< _smart_ptr<CBaseObject> >& outAllChildren, CBaseObject* pObj = NULL) const;
-    void GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* pObj = NULL) const;
+    void GetAllChildren(TBaseObjects& outAllChildren, CBaseObject* pObj = nullptr) const;
+    void GetAllChildren(DynArray< _smart_ptr<CBaseObject> >& outAllChildren, CBaseObject* pObj = nullptr) const;
+    void GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* pObj = nullptr) const;
     //! Clone Children
     //! Clone Children
     void CloneChildren(CBaseObject* pFromObject);
     void CloneChildren(CBaseObject* pFromObject);
     //! Attach new child node.
     //! Attach new child node.
@@ -468,8 +468,8 @@ public:
     //! Called when object is being created (use GetMouseCreateCallback for more advanced mouse creation callback).
     //! Called when object is being created (use GetMouseCreateCallback for more advanced mouse creation callback).
     virtual int MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags);
     virtual int MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags);
     // Return pointer to the callback object used when creating object by the mouse.
     // Return pointer to the callback object used when creating object by the mouse.
-    // If this function return NULL MouseCreateCallback method will be used instead.
-    virtual IMouseCreateCallback* GetMouseCreateCallback() { return 0; };
+    // If this function return nullptr MouseCreateCallback method will be used instead.
+    virtual IMouseCreateCallback* GetMouseCreateCallback() { return nullptr; };
 
 
     //! Draw object to specified viewport.
     //! Draw object to specified viewport.
     virtual void Display([[maybe_unused]] DisplayContext& disp) {}
     virtual void Display([[maybe_unused]] DisplayContext& disp) {}
@@ -598,7 +598,7 @@ public:
     bool CanBeHightlighted() const;
     bool CanBeHightlighted() const;
     bool IsSkipSelectionHelper() const;
     bool IsSkipSelectionHelper() const;
 
 
-    virtual IStatObj* GetIStatObj() {   return NULL; }
+    virtual IStatObj* GetIStatObj() {   return nullptr; }
 
 
     // Invalidates cached transformation matrix.
     // Invalidates cached transformation matrix.
     // nWhyFlags - Flags that indicate the reason for matrix invalidation.
     // nWhyFlags - Flags that indicate the reason for matrix invalidation.
@@ -672,7 +672,7 @@ protected:
     //! Draw warning icons
     //! Draw warning icons
     virtual void DrawWarningIcons(DisplayContext& dc, const Vec3& pos);
     virtual void DrawWarningIcons(DisplayContext& dc, const Vec3& pos);
     //! Check if dimension's figures can be displayed before draw them.
     //! Check if dimension's figures can be displayed before draw them.
-    virtual void DrawDimensions(DisplayContext& dc, AABB* pMergedBoundBox = NULL);
+    virtual void DrawDimensions(DisplayContext& dc, AABB* pMergedBoundBox = nullptr);
 
 
     //! Draw highlight.
     //! Draw highlight.
     virtual void DrawHighlight(DisplayContext& dc);
     virtual void DrawHighlight(DisplayContext& dc);

+ 25 - 25
Code/Editor/Objects/EntityObject.cpp

@@ -56,18 +56,18 @@ public:
     }
     }
 
 
 protected:
 protected:
-    virtual void Release() { delete this; };
-    virtual int GetSize() { return sizeof(*this); }; // Return size of xml state.
-    virtual QString GetDescription() { return "Entity Link"; };
-    virtual QString GetObjectName(){ return ""; };
+    void Release() override { delete this; };
+    int GetSize() override { return sizeof(*this); }; // Return size of xml state.
+    QString GetDescription() override { return "Entity Link"; };
+    QString GetObjectName() override{ return ""; };
 
 
-    virtual void Undo([[maybe_unused]] bool bUndo)
+    void Undo([[maybe_unused]] bool bUndo) override
     {
     {
         for (int i = 0, iLinkSize(m_Links.size()); i < iLinkSize; ++i)
         for (int i = 0, iLinkSize(m_Links.size()); i < iLinkSize; ++i)
         {
         {
             SLink& link = m_Links[i];
             SLink& link = m_Links[i];
             CBaseObject* pObj = GetIEditor()->GetObjectManager()->FindObject(link.entityID);
             CBaseObject* pObj = GetIEditor()->GetObjectManager()->FindObject(link.entityID);
-            if (pObj == NULL)
+            if (pObj == nullptr)
             {
             {
                 continue;
                 continue;
             }
             }
@@ -83,7 +83,7 @@ protected:
             pEntity->LoadLink(link.linkXmlNode->getChild(0));
             pEntity->LoadLink(link.linkXmlNode->getChild(0));
         }
         }
     }
     }
-    virtual void Redo(){}
+    void Redo() override{}
 
 
 private:
 private:
 
 
@@ -109,7 +109,7 @@ public:
         , m_bAttach(bAttach)
         , m_bAttach(bAttach)
     {}
     {}
 
 
-    virtual void Undo([[maybe_unused]] bool bUndo) override
+    void Undo([[maybe_unused]] bool bUndo) override
     {
     {
         if (!m_bAttach)
         if (!m_bAttach)
         {
         {
@@ -117,7 +117,7 @@ public:
         }
         }
     }
     }
 
 
-    virtual void Redo() override
+    void Redo() override
     {
     {
         if (m_bAttach)
         if (m_bAttach)
         {
         {
@@ -138,8 +138,8 @@ private:
         }
         }
     }
     }
 
 
-    virtual int GetSize() { return sizeof(CUndoAttachEntity); }
-    virtual QString GetDescription() { return "Attachment Changed"; }
+    int GetSize() override { return sizeof(CUndoAttachEntity); }
+    QString GetDescription() override { return "Attachment Changed"; }
 
 
     GUID m_attachedEntityGUID;
     GUID m_attachedEntityGUID;
     CEntityObject::EAttachmentType m_attachmentType;
     CEntityObject::EAttachmentType m_attachmentType;
@@ -167,7 +167,7 @@ CEntityObject::CEntityObject()
 {
 {
     m_bLoadFailed = false;
     m_bLoadFailed = false;
 
 
-    m_visualObject = 0;
+    m_visualObject = nullptr;
 
 
     m_box.min.Set(0, 0, 0);
     m_box.min.Set(0, 0, 0);
     m_box.max.Set(0, 0, 0);
     m_box.max.Set(0, 0, 0);
@@ -225,7 +225,7 @@ CEntityObject::CEntityObject()
     mv_ratioLOD.SetLimits(0, 255);
     mv_ratioLOD.SetLimits(0, 255);
     mv_viewDistanceMultiplier.SetLimits(0.0f, IRenderNode::VIEW_DISTANCE_MULTIPLIER_MAX);
     mv_viewDistanceMultiplier.SetLimits(0.0f, IRenderNode::VIEW_DISTANCE_MULTIPLIER_MAX);
 
 
-    m_physicsState = 0;
+    m_physicsState = nullptr;
 
 
     m_attachmentType = eAT_Pivot;
     m_attachmentType = eAT_Pivot;
 
 
@@ -540,7 +540,7 @@ IVariable* CEntityObject::FindVariableInSubBlock(CVarBlockPtr& properties, IVari
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void CEntityObject::AdjustLightProperties(CVarBlockPtr& properties, const char* pSubBlock)
 void CEntityObject::AdjustLightProperties(CVarBlockPtr& properties, const char* pSubBlock)
 {
 {
-    IVariable* pSubBlockVar = pSubBlock ? properties->FindVariable(pSubBlock) : NULL;
+    IVariable* pSubBlockVar = pSubBlock ? properties->FindVariable(pSubBlock) : nullptr;
 
 
     if (IVariable* pRadius = FindVariableInSubBlock(properties, pSubBlockVar, "Radius"))
     if (IVariable* pRadius = FindVariableInSubBlock(properties, pSubBlockVar, "Radius"))
     {
     {
@@ -933,7 +933,7 @@ void CEntityObject::Serialize(CObjectArchive& ar)
             {
             {
                 XmlNodeRef eventTarget = eventTargets->getChild(i);
                 XmlNodeRef eventTarget = eventTargets->getChild(i);
                 CEntityEventTarget et;
                 CEntityEventTarget et;
-                et.target = 0;
+                et.target = nullptr;
                 GUID targetId = GUID_NULL;
                 GUID targetId = GUID_NULL;
                 eventTarget->getAttr("TargetId", targetId);
                 eventTarget->getAttr("TargetId", targetId);
                 eventTarget->getAttr("Event", et.event);
                 eventTarget->getAttr("Event", et.event);
@@ -1029,7 +1029,7 @@ void CEntityObject::Serialize(CObjectArchive& ar)
             {
             {
                 CEntityEventTarget& et = m_eventTargets[i];
                 CEntityEventTarget& et = m_eventTargets[i];
                 GUID targetId = GUID_NULL;
                 GUID targetId = GUID_NULL;
-                if (et.target != 0)
+                if (et.target != nullptr)
                 {
                 {
                     targetId = et.target->GetId();
                     targetId = et.target->GetId();
                 }
                 }
@@ -1060,7 +1060,7 @@ XmlNodeRef CEntityObject::Export([[maybe_unused]] const QString& levelPath, XmlN
 {
 {
     if (m_bLoadFailed)
     if (m_bLoadFailed)
     {
     {
-        return 0;
+        return nullptr;
     }
     }
 
 
     // Do not export entity with bad id.
     // Do not export entity with bad id.
@@ -1268,7 +1268,7 @@ void CEntityObject::OnEvent(ObjectEvent event)
         IObjectManager* objMan = GetIEditor()->GetObjectManager();
         IObjectManager* objMan = GetIEditor()->GetObjectManager();
         if (objMan && objMan->IsLightClass(this))
         if (objMan && objMan->IsLightClass(this))
         {
         {
-            OnPropertyChange(NULL);
+            OnPropertyChange(nullptr);
         }
         }
         break;
         break;
     }
     }
@@ -1314,7 +1314,7 @@ IVariable* CEntityObject::GetLightVariable(const char* name0) const
             {
             {
                 IVariable* pChild = pLightProperties->GetVariable(i);
                 IVariable* pChild = pLightProperties->GetVariable(i);
 
 
-                if (pChild == NULL)
+                if (pChild == nullptr)
                 {
                 {
                     continue;
                     continue;
                 }
                 }
@@ -1341,7 +1341,7 @@ QString CEntityObject::GetLightAnimation() const
         {
         {
             IVariable* pChild = pStyleGroup->GetVariable(i);
             IVariable* pChild = pStyleGroup->GetVariable(i);
 
 
-            if (pChild == NULL)
+            if (pChild == nullptr)
             {
             {
                 continue;
                 continue;
             }
             }
@@ -1617,7 +1617,7 @@ void CEntityObject::RemoveEventTarget(int index, [[maybe_unused]] bool bUpdateSc
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 int CEntityObject::AddEntityLink(const QString& name, GUID targetEntityId)
 int CEntityObject::AddEntityLink(const QString& name, GUID targetEntityId)
 {
 {
-    CEntityObject* target = 0;
+    CEntityObject* target = nullptr;
     if (targetEntityId != GUID_NULL)
     if (targetEntityId != GUID_NULL)
     {
     {
         CBaseObject* pObject = FindObject(targetEntityId);
         CBaseObject* pObject = FindObject(targetEntityId);
@@ -1635,7 +1635,7 @@ int CEntityObject::AddEntityLink(const QString& name, GUID targetEntityId)
 
 
     StoreUndo("Add EntityLink");
     StoreUndo("Add EntityLink");
 
 
-    CLineGizmo* pLineGizmo = 0;
+    CLineGizmo* pLineGizmo = nullptr;
 
 
     // Assign event target.
     // Assign event target.
     if (target)
     if (target)
@@ -1968,7 +1968,7 @@ void CEntityObject::ResetCallbacks()
 
 
         //@FIXME Hack to display radii of properties.
         //@FIXME Hack to display radii of properties.
         // wires properties from param block, to this entity internal variables.
         // wires properties from param block, to this entity internal variables.
-        IVariable* var = 0;
+        IVariable* var = nullptr;
         var = pProperties->FindVariable("Radius", false);
         var = pProperties->FindVariable("Radius", false);
         if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
         if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
         {
         {
@@ -2194,7 +2194,7 @@ template <typename T>
 T CEntityObject::GetEntityProperty(const char* pName, T defaultvalue) const
 T CEntityObject::GetEntityProperty(const char* pName, T defaultvalue) const
 {
 {
     CVarBlock* pProperties = GetProperties2();
     CVarBlock* pProperties = GetProperties2();
-    IVariable* pVariable = NULL;
+    IVariable* pVariable = nullptr;
     if (pProperties)
     if (pProperties)
     {
     {
         pVariable = pProperties->FindVariable(pName);
         pVariable = pProperties->FindVariable(pName);
@@ -2228,7 +2228,7 @@ template <typename T>
 void CEntityObject::SetEntityProperty(const char* pName, T value)
 void CEntityObject::SetEntityProperty(const char* pName, T value)
 {
 {
     CVarBlock* pProperties = GetProperties2();
     CVarBlock* pProperties = GetProperties2();
-    IVariable* pVariable = NULL;
+    IVariable* pVariable = nullptr;
     if (pProperties)
     if (pProperties)
     {
     {
         pVariable = pProperties->FindVariable(pName);
         pVariable = pProperties->FindVariable(pName);

+ 1 - 1
Code/Editor/Objects/EntityObject.h

@@ -185,7 +185,7 @@ public:
     void RemoveAllEntityLinks();
     void RemoveAllEntityLinks();
     virtual void EntityLinked([[maybe_unused]] const QString& name, [[maybe_unused]] GUID targetEntityId){}
     virtual void EntityLinked([[maybe_unused]] const QString& name, [[maybe_unused]] GUID targetEntityId){}
     virtual void EntityUnlinked([[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 = NULL);
+    void LoadLink(XmlNodeRef xmlNode, CObjectArchive* pArchive = nullptr);
     void SaveLink(XmlNodeRef xmlNode);
     void SaveLink(XmlNodeRef xmlNode);
     //////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////

+ 1 - 1
Code/Editor/Objects/Gizmo.h

@@ -67,7 +67,7 @@ public:
     //! Set this gizmo to be deleted.
     //! Set this gizmo to be deleted.
     void DeleteThis();
     void DeleteThis();
 
 
-    virtual CBaseObjectPtr GetBaseObject() const {  return NULL; }
+    virtual CBaseObjectPtr GetBaseObject() const {  return nullptr; }
 
 
 
 
 protected:
 protected:

+ 1 - 1
Code/Editor/Objects/GizmoManager.cpp

@@ -79,7 +79,7 @@ CGizmo* CGizmoManager::GetGizmoByIndex(int nIndex) const
             return *ii;
             return *ii;
         }
         }
     }
     }
-    return NULL;
+    return nullptr;
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////

+ 3 - 3
Code/Editor/Objects/LineGizmo.cpp

@@ -37,8 +37,8 @@ CLineGizmo::~CLineGizmo()
     {
     {
         m_object[1]->RemoveEventListener(this);
         m_object[1]->RemoveEventListener(this);
     }
     }
-    m_object[0] = 0;
-    m_object[1] = 0;
+    m_object[0] = nullptr;
+    m_object[1] = nullptr;
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -164,7 +164,7 @@ void CLineGizmo::SetName(const char* sName)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 bool CLineGizmo::HitTest([[maybe_unused]] HitContext& hc)
 bool CLineGizmo::HitTest([[maybe_unused]] HitContext& hc)
 {
 {
-    return 0;
+    return false;
     /*
     /*
     if (hc.distanceTollerance != 0)
     if (hc.distanceTollerance != 0)
         return 0;
         return 0;

+ 7 - 7
Code/Editor/Objects/ObjectLoader.cpp

@@ -28,8 +28,8 @@ CObjectArchive::CObjectArchive(IObjectManager* objMan, XmlNodeRef xmlRoot, bool
     m_nFlags = 0;
     m_nFlags = 0;
     node = xmlRoot;
     node = xmlRoot;
     m_pCurrentErrorReport = GetIEditor()->GetErrorReport();
     m_pCurrentErrorReport = GetIEditor()->GetErrorReport();
-    m_pGeometryPak = NULL;
-    m_pCurrentObject = NULL;
+    m_pGeometryPak = nullptr;
+    m_pCurrentObject = nullptr;
     m_bNeedResolveObjects = false;
     m_bNeedResolveObjects = false;
     m_bProgressBarEnabled = true;
     m_bProgressBarEnabled = true;
 }
 }
@@ -145,7 +145,7 @@ void CObjectArchive::ResolveObjects()
             // Objects can be added to the list here (from Groups).
             // Objects can be added to the list here (from Groups).
             numObj = m_loadedObjects.size();
             numObj = m_loadedObjects.size();
         }
         }
-        m_pCurrentErrorReport->SetCurrentValidatorObject(NULL);
+        m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
         //////////////////////////////////////////////////////////////////////////
         //////////////////////////////////////////////////////////////////////////
         GetIEditor()->ResumeUndo();
         GetIEditor()->ResumeUndo();
     }
     }
@@ -238,7 +238,7 @@ void CObjectArchive::ResolveObjects()
             // might generate unrelated errors
             // might generate unrelated errors
             m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
             m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
         }
         }
-        m_pCurrentErrorReport->SetCurrentValidatorObject(NULL);
+        m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
         //////////////////////////////////////////////////////////////////////////
         //////////////////////////////////////////////////////////////////////////
     }
     }
 
 
@@ -257,7 +257,7 @@ void CObjectArchive::ResolveObjects()
     }
     }
 
 
     m_bNeedResolveObjects = false;
     m_bNeedResolveObjects = false;
-    m_pCurrentErrorReport->SetCurrentValidatorObject(NULL);
+    m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
     m_sequenceIdRemap.clear();
     m_sequenceIdRemap.clear();
     m_pendingIds.clear();
     m_pendingIds.clear();
 }
 }
@@ -314,7 +314,7 @@ void CObjectArchive::LoadObjects(XmlNodeRef& rootObjectsNode)
     for (int i = 0; i < numObjects; i++)
     for (int i = 0; i < numObjects; i++)
     {
     {
         XmlNodeRef objNode = rootObjectsNode->getChild(i);
         XmlNodeRef objNode = rootObjectsNode->getChild(i);
-        LoadObject(objNode, NULL);
+        LoadObject(objNode, nullptr);
     }
     }
 }
 }
 
 
@@ -401,7 +401,7 @@ void CObjectArchive::AddSequenceIdMapping(uint32 oldId, uint32 newId)
 {
 {
     assert(oldId != newId);
     assert(oldId != newId);
     assert(GetIEditor()->GetMovieSystem()->FindSequenceById(oldId) || stl::find(m_pendingIds, oldId));
     assert(GetIEditor()->GetMovieSystem()->FindSequenceById(oldId) || stl::find(m_pendingIds, oldId));
-    assert(GetIEditor()->GetMovieSystem()->FindSequenceById(newId) == NULL);
+    assert(GetIEditor()->GetMovieSystem()->FindSequenceById(newId) == nullptr);
     assert(stl::find(m_pendingIds, newId) == false);
     assert(stl::find(m_pendingIds, newId) == false);
     m_sequenceIdRemap[oldId] = newId;
     m_sequenceIdRemap[oldId] = newId;
     m_pendingIds.push_back(newId);
     m_pendingIds.push_back(newId);

+ 1 - 1
Code/Editor/Objects/ObjectLoader.h

@@ -67,7 +67,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
     void LoadObjects(XmlNodeRef& rootObjectsNode);
     void LoadObjects(XmlNodeRef& rootObjectsNode);
 
 
     //! Load one object from archive.
     //! Load one object from archive.
-    CBaseObject* LoadObject(const XmlNodeRef& objNode, CBaseObject* pPrevObject = NULL);
+    CBaseObject* LoadObject(const XmlNodeRef& objNode, CBaseObject* pPrevObject = nullptr);
 
 
     //////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////
     int GetLoadedObjectsCount() { return static_cast<int>(m_loadedObjects.size()); }
     int GetLoadedObjectsCount() { return static_cast<int>(m_loadedObjects.size()); }

+ 52 - 51
Code/Editor/Objects/ObjectManager.cpp

@@ -32,7 +32,11 @@
 #include <AzCore/Console/Console.h>
 #include <AzCore/Console/Console.h>
 
 
 AZ_CVAR_EXTERNED(bool, ed_visibility_logTiming);
 AZ_CVAR_EXTERNED(bool, ed_visibility_logTiming);
-AZ_CVAR_EXTERNED(bool, ed_visibility_use);
+
+AZ_CVAR(
+    bool, ed_visibility_use, true, nullptr, AZ::ConsoleFunctorFlags::Null,
+    "Enable/disable using the new IVisibilitySystem for Entity visibility determination");
+
 
 
 /*!
 /*!
  *  Class Description used for object templates.
  *  Class Description used for object templates.
@@ -49,16 +53,16 @@ public:
     GUID guid;
     GUID guid;
 
 
 public:
 public:
-    REFGUID ClassID()
+    REFGUID ClassID() override
     {
     {
         return guid;
         return guid;
     }
     }
-    ObjectType GetObjectType() { return superType->GetObjectType(); };
-    QString ClassName() { return type; };
-    QString Category() { return category; };
+    ObjectType GetObjectType() override { return superType->GetObjectType(); };
+    QString ClassName() override { return type; };
+    QString Category() override { return category; };
     QObject* CreateQObject() const override { return superType->CreateQObject(); }
     QObject* CreateQObject() const override { return superType->CreateQObject(); }
-    QString GetTextureIcon() { return superType->GetTextureIcon(); };
-    QString GetFileSpec()
+    QString GetTextureIcon() override { return superType->GetTextureIcon(); };
+    QString GetFileSpec() override
     {
     {
         if (!fileSpec.isEmpty())
         if (!fileSpec.isEmpty())
         {
         {
@@ -69,7 +73,7 @@ public:
             return superType->GetFileSpec();
             return superType->GetFileSpec();
         }
         }
     };
     };
-    virtual int GameCreationOrder() { return superType->GameCreationOrder(); };
+    int GameCreationOrder() override { return superType->GameCreationOrder(); };
 };
 };
 
 
 void CBaseObjectsCache::AddObject(CBaseObject* object)
 void CBaseObjectsCache::AddObject(CBaseObject* object)
@@ -86,7 +90,7 @@ void CBaseObjectsCache::AddObject(CBaseObject* object)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 // CObjectManager implementation.
 // CObjectManager implementation.
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
-CObjectManager* g_pObjectManager = 0;
+CObjectManager* g_pObjectManager = nullptr;
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 CObjectManager::CObjectManager()
 CObjectManager::CObjectManager()
@@ -182,19 +186,19 @@ CBaseObject* CObjectManager::NewObject(CObjectClassDesc* cls, CBaseObject* prev,
 
 
             if (!AddObject(obj))
             if (!AddObject(obj))
             {
             {
-                obj = 0;
+                obj = nullptr;
             }
             }
         }
         }
         else
         else
         {
         {
-            obj = 0;
+            obj = nullptr;
         }
         }
-        GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(NULL);
+        GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
     }
     }
 
 
     GetIEditor()->ResumeUndo();
     GetIEditor()->ResumeUndo();
 
 
-    if (obj != 0 && GetIEditor()->IsUndoRecording())
+    if (obj != nullptr && GetIEditor()->IsUndoRecording())
     {
     {
         // AZ entity creations are handled through the AZ undo system.
         // AZ entity creations are handled through the AZ undo system.
         if (obj->GetType() != OBJTYPE_AZENTITY)
         if (obj->GetType() != OBJTYPE_AZENTITY)
@@ -228,7 +232,7 @@ CBaseObject* CObjectManager::NewObject(CObjectArchive& ar, CBaseObject* pUndoObj
 
 
     if (!objNode->getAttr("Type", typeName))
     if (!objNode->getAttr("Type", typeName))
     {
     {
-        return 0;
+        return nullptr;
     }
     }
 
 
     if (!objNode->getAttr("Id", id))
     if (!objNode->getAttr("Id", id))
@@ -268,7 +272,7 @@ CBaseObject* CObjectManager::NewObject(CObjectArchive& ar, CBaseObject* pUndoObj
         if (!cls)
         if (!cls)
         {
         {
             CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_ERROR, "RuntimeClass %s not registered", typeName.toUtf8().data());
             CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_ERROR, "RuntimeClass %s not registered", typeName.toUtf8().data());
-            return 0;
+            return nullptr;
         }
         }
 
 
         pObject = qobject_cast<CBaseObject*>(cls->CreateQObject());
         pObject = qobject_cast<CBaseObject*>(cls->CreateQObject());
@@ -301,29 +305,29 @@ CBaseObject* CObjectManager::NewObject(CObjectArchive& ar, CBaseObject* pUndoObj
                 GetIEditor()->GetErrorReport()->ReportError(errorRecord);
                 GetIEditor()->GetErrorReport()->ReportError(errorRecord);
             }
             }
 
 
-            return 0;
+            return nullptr;
             //CoCreateGuid( &pObject->m_guid ); // generate uniq GUID for this object.
             //CoCreateGuid( &pObject->m_guid ); // generate uniq GUID for this object.
         }
         }
     }
     }
 
 
     GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(pObject);
     GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(pObject);
-    if (!pObject->Init(GetIEditor(), 0, ""))
+    if (!pObject->Init(GetIEditor(), nullptr, ""))
     {
     {
-        GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(NULL);
-        return 0;
+        GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
+        return nullptr;
     }
     }
 
 
     if (!AddObject(pObject))
     if (!AddObject(pObject))
     {
     {
-        GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(NULL);
-        return 0;
+        GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
+        return nullptr;
     }
     }
 
 
     //pObject->Serialize( ar );
     //pObject->Serialize( ar );
 
 
-    GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(NULL);
+    GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
 
 
-    if (pObject != 0 && pUndoObject == 0)
+    if (pObject != nullptr && pUndoObject == nullptr)
     {
     {
         // If new object with no undo, record it.
         // If new object with no undo, record it.
         if (CUndo::IsRecording())
         if (CUndo::IsRecording())
@@ -355,7 +359,7 @@ CBaseObject* CObjectManager::NewObject(const QString& typeName, CBaseObject* pre
     if (!cls)
     if (!cls)
     {
     {
         GetIEditor()->GetSystem()->GetILog()->Log("Warning: RuntimeClass %s (as well as %s) not registered", typeName.toUtf8().data(), fullName.toUtf8().data());
         GetIEditor()->GetSystem()->GetILog()->Log("Warning: RuntimeClass %s (as well as %s) not registered", typeName.toUtf8().data(), fullName.toUtf8().data());
-        return 0;
+        return nullptr;
     }
     }
     CBaseObject* pObject = NewObject(cls, prev, file, newObjectName);
     CBaseObject* pObject = NewObject(cls, prev, file, newObjectName);
     return pObject;
     return pObject;
@@ -411,7 +415,7 @@ void    CObjectManager::DeleteObject(CBaseObject* obj)
 void CObjectManager::DeleteSelection(CSelectionGroup* pSelection)
 void CObjectManager::DeleteSelection(CSelectionGroup* pSelection)
 {
 {
     AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
     AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
-    if (pSelection == NULL)
+    if (pSelection == nullptr)
     {
     {
         return;
         return;
     }
     }
@@ -527,7 +531,7 @@ CBaseObject* CObjectManager::CloneObject(CBaseObject* obj)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 CBaseObject* CObjectManager::FindObject(REFGUID guid) const
 CBaseObject* CObjectManager::FindObject(REFGUID guid) const
 {
 {
-    CBaseObject* result = stl::find_in_map(m_objects, guid, (CBaseObject*)0);
+    CBaseObject* result = stl::find_in_map(m_objects, guid, (CBaseObject*)nullptr);
     return result;
     return result;
 }
 }
 
 
@@ -603,7 +607,7 @@ void CObjectManager::FindObjectsInAABB(const AABB& aabb, std::vector<CBaseObject
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 bool CObjectManager::AddObject(CBaseObject* obj)
 bool CObjectManager::AddObject(CBaseObject* obj)
 {
 {
-    CBaseObjectPtr p = stl::find_in_map(m_objects, obj->GetId(), 0);
+    CBaseObjectPtr p = stl::find_in_map(m_objects, obj->GetId(), nullptr);
     if (p)
     if (p)
     {
     {
         CErrorRecord err;
         CErrorRecord err;
@@ -908,7 +912,7 @@ void CObjectManager::UnfreezeAll()
 bool CObjectManager::SelectObject(CBaseObject* obj, bool bUseMask)
 bool CObjectManager::SelectObject(CBaseObject* obj, bool bUseMask)
 {
 {
     assert(obj);
     assert(obj);
-    if (obj == NULL)
+    if (obj == nullptr)
     {
     {
         return false;
         return false;
     }
     }
@@ -974,7 +978,7 @@ void CObjectManager::UnselectObject(CBaseObject* obj)
 
 
 CSelectionGroup* CObjectManager::GetSelection(const QString& name) const
 CSelectionGroup* CObjectManager::GetSelection(const QString& name) const
 {
 {
-    CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)0);
+    CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
     return selection;
     return selection;
 }
 }
 
 
@@ -993,7 +997,7 @@ void CObjectManager::NameSelection(const QString& name)
         return;
         return;
     }
     }
 
 
-    CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)0);
+    CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
     if (selection)
     if (selection)
     {
     {
         assert(selection != 0);
         assert(selection != 0);
@@ -1020,7 +1024,7 @@ void CObjectManager::SerializeNameSelection(XmlNodeRef& rootNode, bool bLoading)
         return;
         return;
     }
     }
 
 
-    _smart_ptr<CSelectionGroup> tmpGroup(0);
+    _smart_ptr<CSelectionGroup> tmpGroup(nullptr);
 
 
     QString selRootStr("NameSelection");
     QString selRootStr("NameSelection");
     QString selNodeStr("NameSelectionNode");
     QString selNodeStr("NameSelectionNode");
@@ -1075,7 +1079,7 @@ void CObjectManager::SerializeNameSelection(XmlNodeRef& rootNode, bool bLoading)
     else
     else
     {
     {
         startNode = rootNode->newChild(selRootStr.toUtf8().data());
         startNode = rootNode->newChild(selRootStr.toUtf8().data());
-        CSelectionGroup* objSelection = 0;
+        CSelectionGroup* objSelection = nullptr;
 
 
         for (TNameSelectionMap::iterator it = m_selections.begin(); it != m_selections.end(); ++it)
         for (TNameSelectionMap::iterator it = m_selections.begin(); it != m_selections.end(); ++it)
         {
         {
@@ -1186,7 +1190,7 @@ int CObjectManager::InvertSelection()
 void CObjectManager::SetSelection(const QString& name)
 void CObjectManager::SetSelection(const QString& name)
 {
 {
     AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
     AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
-    CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)0);
+    CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
     if (selection)
     if (selection)
     {
     {
         UnselectCurrent();
         UnselectCurrent();
@@ -1201,7 +1205,7 @@ void CObjectManager::RemoveSelection(const QString& name)
     AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
     AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
 
 
     QString selName = name;
     QString selName = name;
-    CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)0);
+    CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
     if (selection)
     if (selection)
     {
     {
         if (selection == m_currSelection)
         if (selection == m_currSelection)
@@ -1327,7 +1331,6 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
 
 
     pDispayedViewObjects->SetSerialNumber(m_visibilitySerialNumber); // update viewport to be latest serial number
     pDispayedViewObjects->SetSerialNumber(m_visibilitySerialNumber); // update viewport to be latest serial number
 
 
-    const CCamera& camera = GetIEditor()->GetSystem()->GetViewCamera();
     AABB bbox;
     AABB bbox;
     bbox.min.zero();
     bbox.min.zero();
     bbox.max.zero();
     bbox.max.zero();
@@ -1359,7 +1362,7 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
             for (int i = 0, iCount(pSelection->GetCount()); i < iCount; ++i)
             for (int i = 0, iCount(pSelection->GetCount()); i < iCount; ++i)
             {
             {
                 CBaseObject* pObj(pSelection->GetObject(i));
                 CBaseObject* pObj(pSelection->GetObject(i));
-                if (pObj == NULL)
+                if (pObj == nullptr)
                 {
                 {
                     continue;
                     continue;
                 }
                 }
@@ -1376,11 +1379,9 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
         {
         {
             CBaseObject* obj = m_visibleObjects[i];
             CBaseObject* obj = m_visibleObjects[i];
 
 
-            if (obj && obj->IsInCameraView(camera))
+            if (obj)
             {
             {
-                // Check if object is too far.
-                float visRatio = obj->GetCameraVisRatio(camera);
-                if (visRatio > m_maxObjectViewDistRatio || (dc.flags & DISPLAY_SELECTION_HELPERS) || obj->IsSelected())
+                if ((dc.flags & DISPLAY_SELECTION_HELPERS) || obj->IsSelected())
                 {
                 {
                     pDispayedViewObjects->AddObject(obj);
                     pDispayedViewObjects->AddObject(obj);
                 }
                 }
@@ -1443,7 +1444,7 @@ void CObjectManager::BeginEditParams(CBaseObject* obj, int flags)
 void CObjectManager::EndEditParams([[maybe_unused]] int flags)
 void CObjectManager::EndEditParams([[maybe_unused]] int flags)
 {
 {
     m_bSingleSelection = false;
     m_bSingleSelection = false;
-    m_currEditObject = 0;
+    m_currEditObject = nullptr;
     //m_bSelectionChanged = false; // don't need to clear for ungroup
     //m_bSelectionChanged = false; // don't need to clear for ungroup
 }
 }
 
 
@@ -1657,7 +1658,7 @@ bool CObjectManager::HitTest(HitContext& hitInfo)
     HitContext hcOrg = hitInfo;
     HitContext hcOrg = hitInfo;
     if (hcOrg.view)
     if (hcOrg.view)
     {
     {
-        hcOrg.view->GetPerpendicularAxis(0, &hcOrg.b2DViewport);
+        hcOrg.view->GetPerpendicularAxis(nullptr, &hcOrg.b2DViewport);
     }
     }
     hcOrg.rayDir = hcOrg.rayDir.GetNormalized();
     hcOrg.rayDir = hcOrg.rayDir.GetNormalized();
 
 
@@ -1692,7 +1693,7 @@ bool CObjectManager::HitTest(HitContext& hitInfo)
 
 
     const bool iconsPrioritized = true; // Force icons to always be prioritized over other things you hit. Can change to be a configurable option in the future.
     const bool iconsPrioritized = true; // Force icons to always be prioritized over other things you hit. Can change to be a configurable option in the future.
 
 
-    CBaseObject* selected = 0;
+    CBaseObject* selected = nullptr;
     const char* name = nullptr;
     const char* name = nullptr;
     bool iconHit = false;
     bool iconHit = false;
     int numVis = pDispayedViewObjects->GetObjectCount();
     int numVis = pDispayedViewObjects->GetObjectCount();
@@ -1993,11 +1994,11 @@ bool CObjectManager::EnableUniqObjectNames(bool bEnable)
 CObjectClassDesc* CObjectManager::FindClass(const QString& className)
 CObjectClassDesc* CObjectManager::FindClass(const QString& className)
 {
 {
     IClassDesc* cls = CClassFactory::Instance()->FindClass(className.toUtf8().data());
     IClassDesc* cls = CClassFactory::Instance()->FindClass(className.toUtf8().data());
-    if (cls != NULL && cls->SystemClassID() == ESYSTEM_CLASS_OBJECT)
+    if (cls != nullptr && cls->SystemClassID() == ESYSTEM_CLASS_OBJECT)
     {
     {
         return (CObjectClassDesc*)cls;
         return (CObjectClassDesc*)cls;
     }
     }
-    return 0;
+    return nullptr;
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -2101,7 +2102,7 @@ void CObjectManager::LoadClassTemplates(const QString& path)
     {
     {
         // Construct the full filepath of the current file
         // Construct the full filepath of the current file
         XmlNodeRef node = XmlHelpers::LoadXmlFromFile((dir + files[k].filename).toUtf8().data());
         XmlNodeRef node = XmlHelpers::LoadXmlFromFile((dir + files[k].filename).toUtf8().data());
-        if (node != 0 && node->isTag("ObjectTemplates"))
+        if (node != nullptr && node->isTag("ObjectTemplates"))
         {
         {
             QString name;
             QString name;
             for (int i = 0; i < node->getChildCount(); i++)
             for (int i = 0; i < node->getChildCount(); i++)
@@ -2449,7 +2450,7 @@ void CObjectManager::EndObjectsLoading()
     {
     {
         delete m_pLoadProgress;
         delete m_pLoadProgress;
     }
     }
-    m_pLoadProgress = 0;
+    m_pLoadProgress = nullptr;
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -2481,20 +2482,20 @@ bool CObjectManager::IsLightClass(CBaseObject* pObject)
         {
         {
             if (pEntity->GetEntityClass().compare(CLASS_LIGHT) == 0)
             if (pEntity->GetEntityClass().compare(CLASS_LIGHT) == 0)
             {
             {
-                return TRUE;
+                return true;
             }
             }
             if (pEntity->GetEntityClass().compare(CLASS_RIGIDBODY_LIGHT) == 0)
             if (pEntity->GetEntityClass().compare(CLASS_RIGIDBODY_LIGHT) == 0)
             {
             {
-                return TRUE;
+                return true;
             }
             }
             if (pEntity->GetEntityClass().compare(CLASS_DESTROYABLE_LIGHT) == 0)
             if (pEntity->GetEntityClass().compare(CLASS_DESTROYABLE_LIGHT) == 0)
             {
             {
-                return TRUE;
+                return true;
             }
             }
         }
         }
     }
     }
 
 
-    return FALSE;
+    return false;
 }
 }
 
 
 void CObjectManager::FindAndRenameProperty2(const char* property2Name, const QString& oldValue, const QString& newValue)
 void CObjectManager::FindAndRenameProperty2(const char* property2Name, const QString& oldValue, const QString& newValue)

+ 1 - 1
Code/Editor/Objects/SelectionGroup.cpp

@@ -636,7 +636,7 @@ void CSelectionGroup::FinishChanges()
     for (int i = 0; i < iObjectSize; ++i)
     for (int i = 0; i < iObjectSize; ++i)
     {
     {
         CBaseObject* pObject = selectedObjects[i];
         CBaseObject* pObject = selectedObjects[i];
-        if (pObject == NULL)
+        if (pObject == nullptr)
         {
         {
             continue;
             continue;
         }
         }

+ 1 - 1
Code/Editor/Objects/TrackGizmo.cpp

@@ -34,7 +34,7 @@ namespace {
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 CTrackGizmo::CTrackGizmo()
 CTrackGizmo::CTrackGizmo()
 {
 {
-    m_pAnimNode = 0;
+    m_pAnimNode = nullptr;
 
 
     m_worldBbox.min = Vec3(-10000, -10000, -10000);
     m_worldBbox.min = Vec3(-10000, -10000, -10000);
     m_worldBbox.max = Vec3(10000, 10000, 10000);
     m_worldBbox.max = Vec3(10000, 10000, 10000);

+ 24 - 0
Code/Editor/Platform/Mac/editor_mac.cmake

@@ -13,3 +13,27 @@ set_target_properties(Editor PROPERTIES
     RESOURCE ${CMAKE_CURRENT_LIST_DIR}/Images.xcassets
     RESOURCE ${CMAKE_CURRENT_LIST_DIR}/Images.xcassets
     XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME EditorAppIcon
     XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME EditorAppIcon
 )
 )
+
+# We cannot use ly_add_target here because we're already including this file from inside ly_add_target
+# So we need to setup target, dependencies and install logic manually.
+add_executable(EditorDummy Platform/Mac/main_dummy.cpp)
+add_executable(AZ::EditorDummy ALIAS EditorDummy)
+
+ly_target_link_libraries(EditorDummy
+    PRIVATE
+        AZ::AzCore
+        AZ::AzFramework)
+
+ly_add_dependencies(Editor EditorDummy)
+
+# Store the aliased target into a DIRECTORY property
+set_property(DIRECTORY APPEND PROPERTY LY_DIRECTORY_TARGETS AZ::EditorDummy)
+
+# Store the directory path in a GLOBAL property so that it can be accessed
+# in the layout install logic. Skip if the directory has already been added
+get_property(ly_all_target_directories GLOBAL PROPERTY LY_ALL_TARGET_DIRECTORIES)
+if(NOT CMAKE_CURRENT_SOURCE_DIR IN_LIST ly_all_target_directories)
+    set_property(GLOBAL APPEND PROPERTY LY_ALL_TARGET_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
+endif()
+
+ly_install_add_install_path_setreg(Editor)

+ 1 - 1
Code/Editor/Platform/Mac/gui_info.plist

@@ -3,7 +3,7 @@
 <plist version="1.0">
 <plist version="1.0">
 <dict>
 <dict>
 	<key>CFBundleExecutable</key>
 	<key>CFBundleExecutable</key>
-	<string>Editor</string>
+	<string>EditorDummy</string>
 	<key>CFBundleIdentifier</key>
 	<key>CFBundleIdentifier</key>
 	<string>org.O3DE.Editor</string>
 	<string>org.O3DE.Editor</string>
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>

+ 75 - 0
Code/Editor/Platform/Mac/main_dummy.cpp

@@ -0,0 +1,75 @@
+/*
+ * 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 <AzCore/Component/ComponentApplication.h>
+#include <AzCore/Memory/SystemAllocator.h>
+#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
+#include <AzCore/Utils/Utils.h>
+#include <AzFramework/Process/ProcessWatcher.h>
+
+#include <cstdlib>
+
+int main(int argc, char* argv[])
+{
+    // Create a ComponentApplication to initialize the AZ::SystemAllocator and initialize the SettingsRegistry
+    AZ::ComponentApplication::Descriptor desc;
+    AZ::ComponentApplication application;
+    application.Create(desc);
+    
+    AZStd::vector<AZStd::string> envVars;
+    
+    const char* homePath = std::getenv("HOME");
+    envVars.push_back(AZStd::string::format("HOME=%s", homePath));
+    
+    if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
+    {
+        const char* dyldLibPathOrig = std::getenv("DYLD_LIBRARY_PATH");
+        AZStd::string dyldSearchPath = AZStd::string::format("DYLD_LIBRARY_PATH=%s", dyldLibPathOrig);
+        if (AZ::IO::FixedMaxPath projectModulePath;
+            settingsRegistry->Get(projectModulePath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_ProjectConfigurationBinPath))
+        {
+            dyldSearchPath.append(":");
+            dyldSearchPath.append(projectModulePath.c_str());
+        }
+        
+        if (AZ::IO::FixedMaxPath installedBinariesFolder;
+            settingsRegistry->Get(installedBinariesFolder.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_InstalledBinaryFolder))
+        {
+            if (AZ::IO::FixedMaxPath engineRootFolder;
+                settingsRegistry->Get(engineRootFolder.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder))
+            {
+                installedBinariesFolder = engineRootFolder / installedBinariesFolder;
+                dyldSearchPath.append(":");
+                dyldSearchPath.append(installedBinariesFolder.c_str());
+            }
+        }
+        envVars.push_back(dyldSearchPath);
+    }
+    
+    AZStd::string commandArgs;
+    for (int i = 1; i < argc; i++)
+    {
+        commandArgs.append(argv[i]);
+        commandArgs.append(" ");
+    }
+    
+    AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo;
+    AZ::IO::Path processPath{ AZ::IO::PathView(AZ::Utils::GetExecutableDirectory()) };
+    processPath /= "Editor";
+    processLaunchInfo.m_processExecutableString = AZStd::move(processPath.Native());
+    processLaunchInfo.m_commandlineParameters = commandArgs;
+    processLaunchInfo.m_environmentVariables = &envVars;
+    processLaunchInfo.m_showWindow = true;
+
+    AzFramework::ProcessWatcher* processWatcher = AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE);
+    
+    application.Destroy();
+
+    return 0;
+}
+

+ 4 - 4
Code/Editor/Platform/Windows/Util/Mailer_Windows.cpp

@@ -51,8 +51,8 @@ bool CMailer::SendMail(const char* subject,
         attachments[i].flFlags      = 0;
         attachments[i].flFlags      = 0;
         attachments[i].nPosition    = (ULONG)-1;
         attachments[i].nPosition    = (ULONG)-1;
         attachments[i].lpszPathName = (char*)(const char*)_attachments[k];
         attachments[i].lpszPathName = (char*)(const char*)_attachments[k];
-        attachments[i].lpszFileName = NULL;
-        attachments[i].lpFileType   = NULL;
+        attachments[i].lpszFileName = nullptr;
+        attachments[i].lpFileType   = nullptr;
         i++;
         i++;
     }
     }
     int numAttachments = i;
     int numAttachments = i;
@@ -74,14 +74,14 @@ bool CMailer::SendMail(const char* subject,
         recipients[i].lpszName     = (char*)(const char*)_recipients[i];
         recipients[i].lpszName     = (char*)(const char*)_recipients[i];
         recipients[i].lpszAddress  = (char*)addresses[i].c_str();
         recipients[i].lpszAddress  = (char*)addresses[i].c_str();
         recipients[i].ulEIDSize    = 0;
         recipients[i].ulEIDSize    = 0;
-        recipients[i].lpEntryID    = NULL;
+        recipients[i].lpEntryID    = nullptr;
     }
     }
 
 
     MapiMessage message;
     MapiMessage message;
     memset(&message, 0, sizeof(message));
     memset(&message, 0, sizeof(message));
     message.lpszSubject = (char*)(const char*)subject;
     message.lpszSubject = (char*)(const char*)subject;
     message.lpszNoteText = (char*)(const char*)messageBody;
     message.lpszNoteText = (char*)(const char*)messageBody;
-    message.lpszMessageType = NULL;
+    message.lpszMessageType = nullptr;
 
 
     message.nRecipCount = numRecipients;
     message.nRecipCount = numRecipients;
     message.lpRecips = recipients;
     message.lpRecips = recipients;

+ 2 - 1
Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp

@@ -84,6 +84,7 @@
 #include <Editor/Util/PathUtil.h>
 #include <Editor/Util/PathUtil.h>
 #include <IResourceSelectorHost.h>
 #include <IResourceSelectorHost.h>
 #include "CryEdit.h"
 #include "CryEdit.h"
+#include "Undo/Undo.h"
 
 
 #include <QMenu>
 #include <QMenu>
 #include <QAction>
 #include <QAction>
@@ -1815,7 +1816,7 @@ void SandboxIntegrationManager::ContextMenu_PushEntitiesToSlice(AzToolsFramework
     (void)targetAncestorId;
     (void)targetAncestorId;
     (void)affectEntireHierarchy;
     (void)affectEntireHierarchy;
 
 
-    AZ::SerializeContext* serializeContext = NULL;
+    AZ::SerializeContext* serializeContext = nullptr;
     EBUS_EVENT_RESULT(serializeContext, AZ::ComponentApplicationBus, GetSerializeContext);
     EBUS_EVENT_RESULT(serializeContext, AZ::ComponentApplicationBus, GetSerializeContext);
     AZ_Assert(serializeContext, "No serialize context");
     AZ_Assert(serializeContext, "No serialize context");
 
 

+ 1 - 1
Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentPaletteWindow.cpp

@@ -42,7 +42,7 @@ void ComponentPaletteWindow::Init()
     layout->setContentsMargins(0, 0, 0, 0);
     layout->setContentsMargins(0, 0, 0, 0);
     layout->setSpacing(0);
     layout->setSpacing(0);
 
 
-    QHBoxLayout* gridLayout = new QHBoxLayout(NULL);
+    QHBoxLayout* gridLayout = new QHBoxLayout(nullptr);
     gridLayout->setSizeConstraint(QLayout::SetMaximumSize);
     gridLayout->setSizeConstraint(QLayout::SetMaximumSize);
     gridLayout->setContentsMargins(0, 0, 0, 0);
     gridLayout->setContentsMargins(0, 0, 0, 0);
     gridLayout->setSpacing(0);
     gridLayout->setSpacing(0);

+ 8 - 8
Code/Editor/Plugins/EditorCommon/DockTitleBarWidget.cpp

@@ -30,13 +30,13 @@ class CDockWidgetTitleButton
 public:
 public:
     CDockWidgetTitleButton(QWidget* parent);
     CDockWidgetTitleButton(QWidget* parent);
 
 
-    QSize sizeHint() const;
-    QSize minimumSizeHint() const { return sizeHint(); }
+    QSize sizeHint() const override;
+    QSize minimumSizeHint() const override { return sizeHint(); }
 
 
 protected:
 protected:
-    void enterEvent(QEvent* ev);
-    void leaveEvent(QEvent* ev);
-    void paintEvent(QPaintEvent* ev);
+    void enterEvent(QEvent* ev) override;
+    void leaveEvent(QEvent* ev) override;
+    void paintEvent(QPaintEvent* ev) override;
 };
 };
 
 
 class CTitleBarText
 class CTitleBarText
@@ -85,10 +85,10 @@ QSize CDockWidgetTitleButton::sizeHint() const
 {
 {
     ensurePolished();
     ensurePolished();
 
 
-    int size = 2 * style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, 0, this);
+    int size = 2 * style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, nullptr, this);
     if (!icon().isNull())
     if (!icon().isNull())
     {
     {
-        int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
+        int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
         QSize sz = icon().actualSize(QSize(iconSize, iconSize));
         QSize sz = icon().actualSize(QSize(iconSize, iconSize));
         size += qMax(sz.width(), sz.height());
         size += qMax(sz.width(), sz.height());
     }
     }
@@ -145,7 +145,7 @@ void CDockWidgetTitleButton::paintEvent([[maybe_unused]] QPaintEvent* ev)
     opt.activeSubControls = QStyle::SubControls();
     opt.activeSubControls = QStyle::SubControls();
     opt.features = QStyleOptionToolButton::None;
     opt.features = QStyleOptionToolButton::None;
     opt.arrowType = Qt::NoArrow;
     opt.arrowType = Qt::NoArrow;
-    int size = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
+    int size = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
     opt.iconSize = QSize(size, size);
     opt.iconSize = QSize(size, size);
     style()->drawComplexControl(QStyle::CC_ToolButton, &opt, &painter, this);
     style()->drawComplexControl(QStyle::CC_ToolButton, &opt, &painter, this);
 }
 }

+ 1 - 1
Code/Editor/Plugins/FFMPEGPlugin/main.cpp

@@ -15,7 +15,7 @@ PLUGIN_API IPlugin* CreatePluginInstance(PLUGIN_INIT_PARAM* pInitParam)
     if (pInitParam->pluginVersion != SANDBOX_PLUGIN_SYSTEM_VERSION)
     if (pInitParam->pluginVersion != SANDBOX_PLUGIN_SYSTEM_VERSION)
     {
     {
         pInitParam->outErrorCode = IPlugin::eError_VersionMismatch;
         pInitParam->outErrorCode = IPlugin::eError_VersionMismatch;
-        return 0;
+        return nullptr;
     }
     }
 
 
     ModuleInitISystem(GetIEditor()->GetSystem(), "FFMPEGPlugin");
     ModuleInitISystem(GetIEditor()->GetSystem(), "FFMPEGPlugin");

+ 1 - 1
Code/Editor/Plugins/PerforcePlugin/PerforceSourceControl.cpp

@@ -56,7 +56,7 @@ void CPerforceSourceControl::ShowSettings()
 
 
 void CPerforceSourceControl::SetSourceControlState(SourceControlState state)
 void CPerforceSourceControl::SetSourceControlState(SourceControlState state)
 {
 {
-    AUTO_LOCK(g_cPerforceValues);
+    CryAutoLock<CryCriticalSection> lock(g_cPerforceValues);
 
 
     switch (state)
     switch (state)
     {
     {

+ 2 - 2
Code/Editor/Plugins/ProjectSettingsTool/PlatformSettings_Android.cpp

@@ -165,8 +165,8 @@ namespace ProjectSettingsTool
             if (editContext)
             if (editContext)
             {
             {
                 editContext->Class<AndroidSplashscreens>("Splashscreens", "All splashscreen overrides for Android.")
                 editContext->Class<AndroidSplashscreens>("Splashscreens", "All splashscreen overrides for Android.")
-                    ->DataElement(0, &AndroidSplashscreens::m_landscapeSplashscreens)
-                    ->DataElement(0, &AndroidSplashscreens::m_portraitSplashscreens)
+                    ->DataElement(AZ::Edit::UIHandlers::Default, &AndroidSplashscreens::m_landscapeSplashscreens)
+                    ->DataElement(AZ::Edit::UIHandlers::Default, &AndroidSplashscreens::m_portraitSplashscreens)
                 ;
                 ;
             }
             }
         }
         }

+ 1 - 1
Code/Editor/Plugins/ProjectSettingsTool/Validators.cpp

@@ -16,7 +16,7 @@
 
 
 namespace 
 namespace 
 {
 {
-    typedef ProjectSettingsTool::FunctorValidator::ReturnType RetType;
+    using RetType = ProjectSettingsTool::FunctorValidator::ReturnType;
 
 
     static const int noMaxLength = -1;
     static const int noMaxLength = -1;
     static const int maxIosVersionLength = 18;
     static const int maxIosVersionLength = 18;

+ 0 - 4142
Code/Editor/RenderViewport.cpp

@@ -1,4142 +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 : implementation filefov
-
-
-#include "EditorDefs.h"
-
-#include "RenderViewport.h"
-
-// Qt
-#include <QPainter>
-#include <QScopedValueRollback>
-#include <QCheckBox>
-#include <QMessageBox>
-#include <QTimer>
-
-// AzCore
-#include <AzCore/Console/Console.h>
-#include <AzCore/Component/EntityId.h>
-#include <AzCore/Interface/Interface.h>
-#include <AzCore/Math/Frustum.h>
-#include <AzCore/Math/VectorConversions.h>
-#include <AzCore/std/sort.h>
-#include <AzCore/Component/ComponentApplicationBus.h>
-
-// AzFramework
-#include <AzFramework/Components/CameraBus.h>
-#include <AzFramework/Viewport/DisplayContextRequestBus.h>
-#include <AzFramework/Terrain/TerrainDataRequestBus.h>
-#if defined(AZ_PLATFORM_WINDOWS)
-#   include <AzFramework/Input/Buses/Notifications/RawInputNotificationBus_Platform.h>
-#endif // defined(AZ_PLATFORM_WINDOWS)
-#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h>                   // for AzFramework::InputDeviceMouse
-
-// AzQtComponents
-#include <AzQtComponents/Utilities/QtWindowUtilities.h>
-
-// AzToolsFramework
-#include <AzToolsFramework/API/ComponentEntityObjectBus.h>
-#include <AzToolsFramework/API/ComponentEntitySelectionBus.h>
-#include <AzToolsFramework/Editor/EditorContextMenuBus.h>
-#include <AzToolsFramework/Manipulators/ManipulatorManager.h>
-#include <AzToolsFramework/ViewportSelection/EditorInteractionSystemViewportSelectionRequestBus.h>
-#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
-
-
-// CryCommon
-#include <CryCommon/HMDBus.h>
-
-// AzFramework
-#include <AzFramework/Render/IntersectorInterface.h>
-
-// Editor
-#include "Util/fastlib.h"
-#include "CryEditDoc.h"
-#include "GameEngine.h"
-#include "ViewManager.h"
-#include "Objects/DisplayContext.h"
-#include "DisplaySettings.h"
-#include "Include/IObjectManager.h"
-#include "Include/IDisplayViewport.h"
-#include "Objects/ObjectManager.h"
-#include "ProcessInfo.h"
-#include "IPostEffectGroup.h"
-#include "EditorPreferencesPageGeneral.h"
-
-#include "ViewPane.h"
-#include "CustomResolutionDlg.h"
-#include "AnimationContext.h"
-#include "Objects/SelectionGroup.h"
-#include "Core/QtEditorApplication.h"
-
-// ComponentEntityEditorPlugin
-#include <Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.h>
-
-// LmbrCentral
-#include <LmbrCentral/Rendering/EditorCameraCorrectionBus.h>
-
-#include <QtGui/private/qhighdpiscaling_p.h>
-
-#include <IEntityRenderState.h>
-#include <IPhysics.h>
-#include <IStatObj.h>
-
-AZ_CVAR(
-    bool, ed_visibility_use, true, nullptr, AZ::ConsoleFunctorFlags::Null,
-    "Enable/disable using the new IVisibilitySystem for Entity visibility determination");
-
-CRenderViewport* CRenderViewport::m_pPrimaryViewport = nullptr;
-
-#if AZ_TRAIT_OS_PLATFORM_APPLE
-void StopFixedCursorMode();
-void StartFixedCursorMode(QObject *viewport);
-#endif
-
-#define MAX_ORBIT_DISTANCE (2000.0f)
-#define RENDER_MESH_TEST_DISTANCE (0.2f)
-#define CURSOR_FONT_HEIGHT  8.0f
-#define FORWARD_DIRECTION Vec3(0, 1, 0)
-
-static const char TextCantCreateCameraNoLevel[] = "Cannot create camera when no level is loaded.";
-
-class EditorEntityNotifications
-    : public AzToolsFramework::EditorEntityContextNotificationBus::Handler
-    , public AzToolsFramework::EditorContextMenuBus::Handler
-{
-public:
-    EditorEntityNotifications(CRenderViewport& renderViewport)
-        : m_renderViewport(renderViewport)
-    {
-        AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
-        AzToolsFramework::EditorContextMenuBus::Handler::BusConnect();
-    }
-
-    ~EditorEntityNotifications() override
-    {
-        AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
-        AzToolsFramework::EditorContextMenuBus::Handler::BusDisconnect();
-    }
-
-    // AzToolsFramework::EditorEntityContextNotificationBus
-    void OnStartPlayInEditor() override
-    {
-        m_renderViewport.OnStartPlayInEditor();
-    }
-    void OnStopPlayInEditor() override
-    {
-        m_renderViewport.OnStopPlayInEditor();
-    }
-
-    // AzToolsFramework::EditorContextMenu::Bus
-    void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) override
-    {
-        m_renderViewport.PopulateEditorGlobalContextMenu(menu, point, flags);
-    }
-private:
-    CRenderViewport& m_renderViewport;
-};
-
-struct CRenderViewport::SScopedCurrentContext
-{
-    const CRenderViewport* m_viewport;
-    CRenderViewport::SPreviousContext m_previousContext;
-
-    explicit SScopedCurrentContext(const CRenderViewport* viewport)
-        : m_viewport(viewport)
-    {
-        m_previousContext = viewport->SetCurrentContext();
-
-        // During normal updates of RenderViewport the value of m_cameraSetForWidgetRenderingCount is expected to be 0.
-        // This is to guarantee no loss in performance by tracking unnecessary calls to SetCurrentContext/RestorePreviousContext.
-        // If some code makes additional calls to Pre/PostWidgetRendering then the assert will be triggered because
-        // m_cameraSetForWidgetRenderingCount will be greater than 0.
-        // There is a legitimate case where the counter can be greater than 0. This is when QtViewport is processing mouse callbacks.
-        // QtViewport::MouseCallback() is surrounded by Pre/PostWidgetRendering and the m_processingMouseCallbacksCounter
-        // tracks this specific case. If an update of a RenderViewport happens while processing the mouse callback,
-        // for example when showing a QMessageBox, then both counters must match.
-        AZ_Assert(viewport->m_cameraSetForWidgetRenderingCount == viewport->m_processingMouseCallbacksCounter,
-            "SScopedCurrentContext constructor was called while viewport widget context is active "
-            "- this is unnecessary");
-    }
-
-    ~SScopedCurrentContext()
-    {
-        m_viewport->RestorePreviousContext(m_previousContext);
-    }
-};
-
-//////////////////////////////////////////////////////////////////////////
-// CRenderViewport
-//////////////////////////////////////////////////////////////////////////
-
-CRenderViewport::CRenderViewport(const QString& name, QWidget* parent)
-    : QtViewport(parent)
-    , m_Camera(GetIEditor()->GetSystem()->GetViewCamera())
-    , m_camFOV(gSettings.viewports.fDefaultFov)
-    , m_defaultViewName(name)
-{
-    // need this to be set in order to allow for language switching on Windows
-    setAttribute(Qt::WA_InputMethodEnabled);
-    LockCameraMovement(true);
-
-    CRenderViewport::SetViewTM(m_Camera.GetMatrix());
-    m_defaultViewTM.SetIdentity();
-
-    if (GetIEditor()->GetViewManager()->GetSelectedViewport() == nullptr)
-    {
-        GetIEditor()->GetViewManager()->SelectViewport(this);
-    }
-
-    GetIEditor()->RegisterNotifyListener(this);
-
-    m_displayContext.pIconManager = GetIEditor()->GetIconManager();
-    GetIEditor()->GetUndoManager()->AddListener(this);
-
-    m_PhysicalLocation.SetIdentity();
-
-    // The renderer requires something, so don't allow us to shrink to absolutely nothing
-    // This won't in fact stop the viewport from being shrunk, when it's the centralWidget for
-    // the MainWindow, but it will stop the viewport from getting resize events
-    // once it's smaller than that, which from the renderer's perspective works out
-    // to be the same thing.
-    setMinimumSize(50, 50);
-
-    OnCreate();
-
-    setFocusPolicy(Qt::StrongFocus);
-
-    Camera::EditorCameraRequestBus::Handler::BusConnect();
-    m_editorEntityNotifications = AZStd::make_unique<EditorEntityNotifications>(*this);
-
-    m_manipulatorManager = GetIEditor()->GetViewManager()->GetManipulatorManager();
-    if (!m_pPrimaryViewport)
-    {
-        m_pPrimaryViewport = this;
-    }
-
-    m_hwnd = renderOverlayHWND();
-}
-
-//////////////////////////////////////////////////////////////////////////
-CRenderViewport::~CRenderViewport()
-{
-    AzFramework::WindowNotificationBus::Event(m_hwnd, &AzFramework::WindowNotificationBus::Handler::OnWindowClosed);
-
-    if (m_pPrimaryViewport == this)
-    {
-        m_pPrimaryViewport = nullptr;
-    }
-
-    AzFramework::WindowRequestBus::Handler::BusDisconnect();
-    DisconnectViewportInteractionRequestBus();
-    m_editorEntityNotifications.reset();
-    Camera::EditorCameraRequestBus::Handler::BusDisconnect();
-    OnDestroy();
-    GetIEditor()->GetUndoManager()->RemoveListener(this);
-    GetIEditor()->UnregisterNotifyListener(this);
-}
-
-//////////////////////////////////////////////////////////////////////////
-// CRenderViewport message handlers
-//////////////////////////////////////////////////////////////////////////
-int CRenderViewport::OnCreate()
-{
-    CreateRenderContext();
-
-    return 0;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::resizeEvent(QResizeEvent* event)
-{
-    PushDisableRendering();
-    QtViewport::resizeEvent(event);
-    PopDisableRendering();
-
-    const QRect rcWindow = rect().translated(mapToGlobal(QPoint()));
-
-    gEnv->pSystem->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_MOVE, rcWindow.left(), rcWindow.top());
-
-    m_rcClient = rect();
-    m_rcClient.setBottomRight(WidgetToViewport(m_rcClient.bottomRight()));
-
-    gEnv->pSystem->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_RESIZE, width(), height());
-
-    // We queue the window resize event because the render overlay may be hidden.
-    // If the render overlay is not visible, the native window that is backing it will
-    // also be hidden, and it will not resize until it becomes visible.
-    m_windowResizedEvent = true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::paintEvent([[maybe_unused]] QPaintEvent* event)
-{
-    // Do not call CViewport::OnPaint() for painting messages
-    // FIXME: paintEvent() isn't the best place for such logic. Should listen to proper eNotify events and to the stuff there instead. (Repeats for other view port classes too).
-    CGameEngine* ge = GetIEditor()->GetGameEngine();
-    if ((ge && ge->IsLevelLoaded()) || (GetType() != ET_ViewportCamera))
-    {
-        setRenderOverlayVisible(true);
-        m_isOnPaint = true;
-        Update();
-        m_isOnPaint = false;
-    }
-    else
-    {
-        setRenderOverlayVisible(false);
-        QPainter painter(this); // device context for painting
-
-        // draw gradient background
-        const QRect rc = rect();
-        QLinearGradient gradient(rc.topLeft(), rc.bottomLeft());
-        gradient.setColorAt(0, QColor(80, 80, 80));
-        gradient.setColorAt(1, QColor(200, 200, 200));
-        painter.fillRect(rc, gradient);
-
-        // if we have some level loaded/loading/new
-        // we draw a text
-        if (!GetIEditor()->GetLevelFolder().isEmpty())
-        {
-            const int kFontSize = 200;
-            const char* kFontName = "Arial";
-            const QColor kTextColor(255, 255, 255);
-            const QColor kTextShadowColor(0, 0, 0);
-            const QFont font(kFontName, kFontSize / 10.0);
-            painter.setFont(font);
-
-            QString friendlyName = QFileInfo(GetIEditor()->GetLevelName()).fileName();
-            const QString strMsg = tr("Preparing level %1...").arg(friendlyName);
-
-            // draw text shadow
-            painter.setPen(kTextShadowColor);
-            painter.drawText(rc, Qt::AlignCenter, strMsg);
-            painter.setPen(kTextColor);
-            // offset rect for normal text
-            painter.drawText(rc.translated(-1, -1), Qt::AlignCenter, strMsg);
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::mousePressEvent(QMouseEvent* event)
-{
-    // There's a bug caused by having a mix of MFC and Qt where if the render viewport
-    // had focus and then an MFC widget gets focus, Qt internally still thinks
-    // that the widget that had focus before (the render viewport) has it now.
-    // Because of this, Qt won't set the window that the viewport is in as the
-    // focused widget, and the render viewport won't get keyboard input.
-    // Forcing the window to activate should allow the window to take focus
-    // and then the call to setFocus() will give it focus.
-    // All so that the ::keyPressEvent() gets called.
-    ActivateWindowAndSetFocus();
-
-    GetIEditor()->GetViewManager()->SelectViewport(this);
-
-    QtViewport::mousePressEvent(event);
-}
-
-AzToolsFramework::ViewportInteraction::MousePick CRenderViewport::BuildMousePickInternal(const QPoint& point) const
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-
-    MousePick mousePick;
-    Vec3 from, dir;
-    ViewToWorldRay(point, from, dir);
-    mousePick.m_rayOrigin = LYVec3ToAZVec3(from);
-    mousePick.m_rayDirection = LYVec3ToAZVec3(dir);
-    mousePick.m_screenCoordinates = AzFramework::ScreenPoint(point.x(), point.y());
-    return mousePick;
-}
-
-AzToolsFramework::ViewportInteraction::MousePick CRenderViewport::BuildMousePick(const QPoint& point)
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-
-    PreWidgetRendering();
-    const MousePick mousePick = BuildMousePickInternal(point);
-    PostWidgetRendering();
-    return mousePick;
-}
-
-AzToolsFramework::ViewportInteraction::MouseInteraction CRenderViewport::BuildMouseInteractionInternal(
-    const AzToolsFramework::ViewportInteraction::MouseButtons buttons,
-    const AzToolsFramework::ViewportInteraction::KeyboardModifiers modifiers,
-    const AzToolsFramework::ViewportInteraction::MousePick& mousePick) const
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-
-    MouseInteraction mouse;
-    mouse.m_interactionId.m_cameraId = m_viewEntityId;
-    mouse.m_interactionId.m_viewportId = GetViewportId();
-    mouse.m_mouseButtons = buttons;
-    mouse.m_mousePick = mousePick;
-    mouse.m_keyboardModifiers = modifiers;
-    return mouse;
-}
-
-AzToolsFramework::ViewportInteraction::MouseInteraction CRenderViewport::BuildMouseInteraction(
-    const Qt::MouseButtons buttons, const Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-
-    return BuildMouseInteractionInternal(
-        BuildMouseButtons(buttons),
-        BuildKeyboardModifiers(modifiers),
-        BuildMousePick(WidgetToViewport(point)));
-}
-
-namespace RenderViewportUtil
-{
-    static bool JustAltHeld(const Qt::KeyboardModifiers modifiers)
-    {
-        return (modifiers & Qt::ShiftModifier) == 0
-            && (modifiers & Qt::ControlModifier) == 0
-            && (modifiers & Qt::AltModifier) != 0;
-    }
-
-    static bool NoModifiersHeld(const Qt::KeyboardModifiers modifiers)
-    {
-        return (modifiers & Qt::ShiftModifier) == 0
-            && (modifiers & Qt::ControlModifier) == 0
-            && (modifiers & Qt::AltModifier) == 0;
-    }
-
-    static bool AllowDolly(const Qt::KeyboardModifiers modifiers)
-    {
-        return JustAltHeld(modifiers);
-    }
-
-    static bool AllowOrbit(const Qt::KeyboardModifiers modifiers)
-    {
-        return JustAltHeld(modifiers);
-    }
-
-    static bool AllowPan(const Qt::KeyboardModifiers modifiers)
-    {
-        // begin pan with alt (inverted movement) or no modifiers
-        return JustAltHeld(modifiers) || NoModifiersHeld(modifiers);
-    }
-
-    static bool InvertPan(const Qt::KeyboardModifiers modifiers)
-    {
-        return JustAltHeld(modifiers);
-    }
-} // namespace RenderViewportUtil
-
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnLButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-    using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
-    if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
-    {
-        return;
-    }
-
-    if (!m_renderer)
-    {
-        return;
-    }
-
-    // Force the visible object cache to be updated - this is to ensure that
-    // selection will work properly even if helpers are not being displayed,
-    // in which case the cache is not updated every frame.
-    if (m_displayContext.settings && !m_displayContext.settings->IsDisplayHelpers())
-    {
-        GetIEditor()->GetObjectManager()->ForceUpdateVisibleObjectCache(m_displayContext);
-    }
-
-    const auto scaledPoint = WidgetToViewport(point);
-    const auto mouseInteraction = BuildMouseInteractionInternal(
-        MouseButtonsFromButton(MouseButton::Left),
-        BuildKeyboardModifiers(modifiers),
-        BuildMousePick(scaledPoint));
-
-    bool manipulatorInteraction = false;
-    EditorInteractionSystemViewportSelectionRequestBus::EventResult(
-        manipulatorInteraction, AzToolsFramework::GetEntityContextId(),
-        &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseManipulatorInteraction,
-        MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
-
-    if (!manipulatorInteraction)
-    {
-        if (RenderViewportUtil::AllowOrbit(modifiers))
-        {
-            m_bInOrbitMode = true;
-            m_orbitTarget =
-                GetViewTM().GetTranslation() + GetViewTM().TransformVector(FORWARD_DIRECTION) * m_orbitDistance;
-
-            // mouse buttons are treated as keys as well
-            if (m_pressedKeyState == KeyPressedState::AllUp)
-            {
-                m_pressedKeyState = KeyPressedState::PressedThisFrame;
-            }
-
-            m_mousePos = scaledPoint;
-            m_prevMousePos = scaledPoint;
-
-            HideCursor();
-            CaptureMouse();
-
-            // no further handling of left mouse button down
-            return;
-        }
-
-        EditorInteractionSystemViewportSelectionRequestBus::Event(
-            AzToolsFramework::GetEntityContextId(),
-            &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
-            MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnLButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-    using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
-    if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
-    {
-        return;
-    }
-
-    // Convert point to position on terrain.
-    if (!m_renderer)
-    {
-        return;
-    }
-
-    // Update viewports after done with actions.
-    GetIEditor()->UpdateViews(eUpdateObjects);
-
-    const auto scaledPoint = WidgetToViewport(point);
-
-    const auto mouseInteraction = BuildMouseInteractionInternal(
-        MouseButtonsFromButton(MouseButton::Left),
-        BuildKeyboardModifiers(modifiers),
-        BuildMousePick(scaledPoint));
-
-    if (m_bInOrbitMode)
-    {
-        m_bInOrbitMode = false;
-
-        ReleaseMouse();
-        ShowCursor();
-    }
-
-    AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
-        AzToolsFramework::GetEntityContextId(),
-        &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
-        MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnLButtonDblClk(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-    using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
-    if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
-    {
-        return;
-    }
-
-    const auto scaledPoint = WidgetToViewport(point);
-    const auto mouseInteraction = BuildMouseInteractionInternal(
-        MouseButtonsFromButton(MouseButton::Left),
-        BuildKeyboardModifiers(modifiers),
-        BuildMousePick(scaledPoint));
-
-    AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
-        AzToolsFramework::GetEntityContextId(),
-        &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
-        MouseInteractionEvent(mouseInteraction, MouseEvent::DoubleClick));
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnRButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-    using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
-    if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
-    {
-        return;
-    }
-
-    SetFocus();
-
-    const auto scaledPoint = WidgetToViewport(point);
-    const auto mouseInteraction = BuildMouseInteractionInternal(
-        MouseButtonsFromButton(MouseButton::Right),
-        BuildKeyboardModifiers(modifiers),
-        BuildMousePick(scaledPoint));
-
-    AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
-        AzToolsFramework::GetEntityContextId(),
-        &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
-        MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
-
-    if (RenderViewportUtil::AllowDolly(modifiers))
-    {
-        m_bInZoomMode = true;
-    }
-    else
-    {
-        m_bInRotateMode = true;
-    }
-
-    // mouse buttons are treated as keys as well
-    if (m_pressedKeyState == KeyPressedState::AllUp)
-    {
-        m_pressedKeyState = KeyPressedState::PressedThisFrame;
-    }
-
-    m_mousePos = scaledPoint;
-    m_prevMousePos = m_mousePos;
-
-    HideCursor();
-
-    // we can't capture the mouse here, or it will stop the popup menu
-    // when the mouse is released.
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnRButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-    using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
-    if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
-    {
-        return;
-    }
-
-    const auto scaledPoint = WidgetToViewport(point);
-    const auto mouseInteraction = BuildMouseInteractionInternal(
-        MouseButtonsFromButton(MouseButton::Right),
-        BuildKeyboardModifiers(modifiers),
-        BuildMousePick(scaledPoint));
-
-    AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
-        AzToolsFramework::GetEntityContextId(),
-        &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
-        MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
-
-    m_bInRotateMode = false;
-    m_bInZoomMode = false;
-
-    ReleaseMouse();
-
-    if (!m_bInMoveMode)
-    {
-        ShowCursor();
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnMButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-    using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
-    if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
-    {
-        return;
-    }
-
-    const auto scaledPoint = WidgetToViewport(point);
-    const auto mouseInteraction = BuildMouseInteractionInternal(
-        MouseButtonsFromButton(MouseButton::Middle),
-        BuildKeyboardModifiers(modifiers),
-        BuildMousePick(scaledPoint));
-
-    if (RenderViewportUtil::AllowPan(modifiers))
-    {
-        m_bInMoveMode = true;
-
-        // mouse buttons are treated as keys as well
-        if (m_pressedKeyState == KeyPressedState::AllUp)
-        {
-            m_pressedKeyState = KeyPressedState::PressedThisFrame;
-        }
-
-        m_mousePos = scaledPoint;
-        m_prevMousePos = scaledPoint;
-
-        HideCursor();
-        CaptureMouse();
-    }
-
-    AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
-        AzToolsFramework::GetEntityContextId(),
-        &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
-        MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnMButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-    using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
-    if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
-    {
-        return;
-    }
-
-    const auto scaledPoint = WidgetToViewport(point);
-    UpdateCurrentMousePos(scaledPoint);
-
-    const auto tryRestoreMouse = [this]
-    {
-        // if we are currently looking (rotateMode) or dollying (zoomMode)
-        // do not show the cursor on mouse up as rmb is still held
-        if (!m_bInZoomMode && !m_bInRotateMode)
-        {
-            ReleaseMouse();
-            ShowCursor();
-        }
-    };
-
-    if (m_bInMoveMode)
-    {
-        m_bInMoveMode = false;
-        tryRestoreMouse();
-    }
-
-    const auto mouseInteraction = BuildMouseInteractionInternal(
-        MouseButtonsFromButton(MouseButton::Middle),
-        BuildKeyboardModifiers(modifiers),
-        BuildMousePick(scaledPoint));
-
-    AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
-        AzToolsFramework::GetEntityContextId(),
-        &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
-        MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
-}
-
-void CRenderViewport::OnMouseMove(Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, const QPoint& point)
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-    using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
-    if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
-    {
-        return;
-    }
-
-    const auto scaledPoint = WidgetToViewport(point);
-
-    const auto mouseInteraction = BuildMouseInteractionInternal(
-        BuildMouseButtons(buttons),
-        BuildKeyboardModifiers(modifiers),
-        BuildMousePick(scaledPoint));
-
-    AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
-        AzToolsFramework::GetEntityContextId(),
-        &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
-        MouseInteractionEvent(mouseInteraction, MouseEvent::Move));
-}
-
-void CRenderViewport::InjectFakeMouseMove(int deltaX, int deltaY, Qt::MouseButtons buttons)
-{
-    // this is required, otherwise the user will see the context menu
-    OnMouseMove(Qt::NoModifier, buttons, QCursor::pos() + QPoint(deltaX, deltaY));
-    // we simply move the prev mouse position, so the change will be picked up
-    // by the next ProcessMouse call
-    m_prevMousePos -= QPoint(deltaX, deltaY);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ProcessMouse()
-{
-    if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
-    {
-        return;
-    }
-
-    const auto point = WidgetToViewport(mapFromGlobal(QCursor::pos()));
-
-    if (point == m_prevMousePos)
-    {
-        return;
-    }
-
-    // specifically for the right mouse button click, which triggers rotate or zoom,
-    // we can't capture the mouse until the user has moved the mouse, otherwise the
-    // right click context menu won't popup
-    if (!m_mouseCaptured && (m_bInZoomMode || m_bInRotateMode))
-    {
-        if ((point - m_mousePos).manhattanLength() > QApplication::startDragDistance())
-        {
-            CaptureMouse();
-        }
-    }
-
-    float speedScale = GetCameraMoveSpeed();
-
-    if (CheckVirtualKey(Qt::Key_Control))
-    {
-        speedScale *= gSettings.cameraFastMoveSpeed;
-    }
-
-    if (m_PlayerControl)
-    {
-        if (m_bInRotateMode)
-        {
-            f32 MousedeltaX = (m_mousePos.x() - point.x());
-            f32 MousedeltaY = (m_mousePos.y() - point.y());
-            m_relCameraRotZ += MousedeltaX;
-
-            if (GetCameraInvertYRotation())
-            {
-                MousedeltaY = -MousedeltaY;
-            }
-            m_relCameraRotZ += MousedeltaX;
-            m_relCameraRotX += MousedeltaY;
-
-            ResetCursor();
-        }
-    }
-    else if ((m_bInRotateMode && m_bInMoveMode) || m_bInZoomMode)
-    {
-        // Zoom.
-        Matrix34 m = GetViewTM();
-
-        Vec3 ydir = m.GetColumn1().GetNormalized();
-        Vec3 pos = m.GetTranslation();
-
-        const float posDelta = 0.2f * (m_prevMousePos.y() - point.y()) * speedScale;
-        pos = pos - ydir * posDelta;
-        m_orbitDistance = m_orbitDistance + posDelta;
-        m_orbitDistance = fabs(m_orbitDistance);
-
-        m.SetTranslation(pos);
-        SetViewTM(m);
-
-        ResetCursor();
-    }
-    else if (m_bInRotateMode)
-    {
-        Ang3 angles(-point.y() + m_prevMousePos.y(), 0, -point.x() + m_prevMousePos.x());
-        angles = angles * 0.002f * GetCameraRotateSpeed();
-        if (GetCameraInvertYRotation())
-        {
-            angles.x = -angles.x;
-        }
-        Matrix34 camtm = GetViewTM();
-        Ang3 ypr = CCamera::CreateAnglesYPR(Matrix33(camtm));
-        ypr.x += angles.z;
-        ypr.y += angles.x;
-
-        ypr.y = CLAMP(ypr.y, -1.5f, 1.5f);        // to keep rotation in reasonable range
-        // In the recording mode of a custom camera, the z rotation is allowed.
-        if (GetCameraObject() == nullptr || (!GetIEditor()->GetAnimation()->IsRecordMode() && !IsCameraObjectMove()))
-        {
-            ypr.z = 0;      // to have camera always upward
-        }
-
-        camtm = Matrix34(CCamera::CreateOrientationYPR(ypr), camtm.GetTranslation());
-        SetViewTM(camtm);
-
-        ResetCursor();
-    }
-    else if (m_bInMoveMode)
-    {
-        // Slide.
-        Matrix34 m = GetViewTM();
-        Vec3 xdir = m.GetColumn0().GetNormalized();
-        Vec3 zdir = m.GetColumn2().GetNormalized();
-
-        const auto modifiers = QGuiApplication::queryKeyboardModifiers();
-        if (RenderViewportUtil::InvertPan(modifiers))
-        {
-            xdir = -xdir;
-            zdir = -zdir;
-        }
-
-        Vec3 pos = m.GetTranslation();
-        pos += 0.1f * xdir * (point.x() - m_prevMousePos.x()) * speedScale + 0.1f * zdir * (m_prevMousePos.y() - point.y()) * speedScale;
-        m.SetTranslation(pos);
-        SetViewTM(m, true);
-
-        ResetCursor();
-    }
-    else if (m_bInOrbitMode)
-    {
-        Ang3 angles(-point.y() + m_prevMousePos.y(), 0, -point.x() + m_prevMousePos.x());
-        angles = angles * 0.002f * GetCameraRotateSpeed();
-
-        if (GetCameraInvertPan())
-        {
-            angles.z = -angles.z;
-        }
-
-        Ang3 ypr = CCamera::CreateAnglesYPR(Matrix33(GetViewTM()));
-        ypr.x += angles.z;
-        ypr.y = CLAMP(ypr.y, -1.5f, 1.5f);        // to keep rotation in reasonable range
-        ypr.y += angles.x;
-
-        Matrix33 rotateTM =  CCamera::CreateOrientationYPR(ypr);
-
-        Vec3 src = GetViewTM().GetTranslation();
-        Vec3 trg = m_orbitTarget;
-        float fCameraRadius = (trg - src).GetLength();
-
-        // Calc new source.
-        src = trg - rotateTM * Vec3(0, 1, 0) * fCameraRadius;
-        Matrix34 camTM = rotateTM;
-        camTM.SetTranslation(src);
-
-        SetViewTM(camTM);
-
-        ResetCursor();
-    }
-}
-
-void CRenderViewport::ResetCursor()
-{
-#ifdef AZ_PLATFORM_WINDOWS
-    if (!gSettings.stylusMode)
-    {
-        const QPoint point = mapToGlobal(ViewportToWidget(m_prevMousePos));
-        AzQtComponents::SetCursorPos(point);
-    }
-#endif
-
-    // Recalculate the prev mouse pos even if we just reset to it to avoid compounding floating point math issues with DPI scaling
-    m_prevMousePos = WidgetToViewport(mapFromGlobal(QCursor::pos()));
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool  CRenderViewport::event(QEvent* event)
-{
-    switch (event->type())
-    {
-    case QEvent::WindowActivate:
-        GetIEditor()->GetViewManager()->SelectViewport(this);
-        // also kill the keys; if we alt-tab back to the viewport, or come back from the debugger, it's done (and there's no guarantee we'll get the keyrelease event anyways)
-        m_keyDown.clear();
-        break;
-
-    case QEvent::Shortcut:
-        // a shortcut should immediately clear us, otherwise the release event never gets sent
-        m_keyDown.clear();
-        break;
-
-    case QEvent::ShortcutOverride:
-    {
-        // since we respond to the following things, let Qt know so that shortcuts don't override us
-        bool respondsToEvent = false;
-
-        auto keyEvent = static_cast<QKeyEvent*>(event);
-        bool manipulatorInteracting = false;
-        AzToolsFramework::ManipulatorManagerRequestBus::EventResult(
-            manipulatorInteracting,
-            AzToolsFramework::g_mainManipulatorManagerId,
-            &AzToolsFramework::ManipulatorManagerRequestBus::Events::Interacting);
-
-        // If a manipulator is active, stop all shortcuts from working, except for the escape key, which cancels in some cases
-        if ((keyEvent->key() != Qt::Key_Escape) &&  manipulatorInteracting)
-        {
-            respondsToEvent = true;
-        }
-        else
-        {
-            // In game mode we never want to be overridden by shortcuts
-            if (GetIEditor()->IsInGameMode() && GetType() == ET_ViewportCamera)
-            {
-                respondsToEvent = true;
-            }
-            else
-            {
-                if (!(keyEvent->modifiers() & Qt::ControlModifier))
-                {
-                    switch (keyEvent->key())
-                    {
-                    case Qt::Key_Up:
-                    case Qt::Key_W:
-                    case Qt::Key_Down:
-                    case Qt::Key_S:
-                    case Qt::Key_Left:
-                    case Qt::Key_A:
-                    case Qt::Key_Right:
-                    case Qt::Key_D:
-                        respondsToEvent = true;
-                        break;
-
-                    default:
-                        break;
-                    }
-                }
-            }
-        }
-
-        if (respondsToEvent)
-        {
-            event->accept();
-            return true;
-        }
-
-        // because we're doing keyboard grabs, we need to detect
-        // when a shortcut matched so that we can track the buttons involved
-        // in the shortcut, since the key released event won't be generated in that case
-        ProcessKeyRelease(keyEvent);
-    }
-    break;
-    default:
-        // do nothing
-        break;
-    }
-
-    return QtViewport::event(event);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ResetContent()
-{
-    QtViewport::ResetContent();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::UpdateContent(int flags)
-{
-    QtViewport::UpdateContent(flags);
-    if (flags & eUpdateObjects)
-    {
-        m_bUpdateViewport = true;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::Update()
-{
-    FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
-    if (Editor::EditorQtApplication::instance()->isMovingOrResizing())
-    {
-        return;
-    }
-
-    if (!m_renderer || m_rcClient.isEmpty() || GetIEditor()->IsInMatEditMode())
-    {
-        return;
-    }
-
-    if (!isVisible())
-    {
-        return;
-    }
-
-    // Only send the resize event if the render overlay is visible. This is to make sure
-    // the native window has resized.
-    if (m_windowResizedEvent && isRenderOverlayVisible())
-    {
-        AzFramework::WindowNotificationBus::Event(renderOverlayHWND(), &AzFramework::WindowNotificationBus::Handler::OnWindowResized, m_rcClient.width(), m_rcClient.height());
-        m_windowResizedEvent = false;
-    }
-
-    // Don't wait for changes to update the focused viewport.
-    if (CheckRespondToInput())
-    {
-        m_bUpdateViewport = true;
-    }
-
-    // While Renderer doesn't support fast rendering of the scene to more then 1 viewport
-    // render only focused viewport if more then 1 are opened and always update is off.
-    if (!m_isOnPaint && m_viewManager->GetNumberOfGameViewports() > 1 && GetType() == ET_ViewportCamera)
-    {
-        if (m_pPrimaryViewport != this)
-        {
-            if (CheckRespondToInput()) // If this is the focused window, set primary viewport.
-            {
-                m_pPrimaryViewport = this;
-            }
-            else if (!m_bUpdateViewport) // Skip this viewport.
-            {
-                return;
-            }
-        }
-    }
-
-    if (CheckRespondToInput())
-    {
-        ProcessMouse();
-        ProcessKeys();
-    }
-
-    const bool isGameMode = GetIEditor()->IsInGameMode();
-    const bool isSimulationMode = GetIEditor()->GetGameEngine()->GetSimulationMode();
-
-    // Allow debug visualization in both 'game' (Ctrl-G) and 'simulation' (Ctrl-P) modes
-    if (isGameMode || isSimulationMode)
-    {
-        if (!IsRenderingDisabled())
-        {
-            // Disable rendering to avoid recursion into Update()
-            PushDisableRendering();
-
-            // draw debug visualizations
-            {
-                const AzFramework::DisplayContextRequestGuard displayContextGuard(m_displayContext);
-
-                const AZ::u32 prevState = m_displayContext.GetState();
-                m_displayContext.SetState(
-                    e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn);
-
-                AzFramework::DebugDisplayRequestBus::BusPtr debugDisplayBus;
-                AzFramework::DebugDisplayRequestBus::Bind(
-                    debugDisplayBus, AzFramework::g_defaultSceneEntityDebugDisplayId);
-                AZ_Assert(debugDisplayBus, "Invalid DebugDisplayRequestBus.");
-
-                AzFramework::DebugDisplayRequests* debugDisplay =
-                    AzFramework::DebugDisplayRequestBus::FindFirstHandler(debugDisplayBus);
-
-                AzFramework::EntityDebugDisplayEventBus::Broadcast(
-                    &AzFramework::EntityDebugDisplayEvents::DisplayEntityViewport,
-                    AzFramework::ViewportInfo{ GetViewportId() }, *debugDisplay);
-
-                m_displayContext.SetState(prevState);
-            }
-
-            QtViewport::Update();
-            PopDisableRendering();
-        }
-
-        // Game mode rendering is handled by CryAction
-        if (isGameMode)
-        {
-            return;
-        }
-    }
-
-    // Prevents rendering recursion due to recursive Paint messages.
-    if (IsRenderingDisabled())
-    {
-        return;
-    }
-
-    PushDisableRendering();
-
-    m_viewTM = m_Camera.GetMatrix(); // synchronize.
-
-    // Render
-    if (!m_bRenderContextCreated)
-    {
-        if (!CreateRenderContext())
-        {
-            return;
-        }
-    }
-
-    if (ed_visibility_use)
-    {
-        auto start = std::chrono::steady_clock::now();
-
-        m_entityVisibilityQuery.UpdateVisibility(GetCameraState());
-    }
-
-    {
-        SScopedCurrentContext context(this);
-
-        m_renderer->SetClearColor(Vec3(0.4f, 0.4f, 0.4f));
-
-        InitDisplayContext();
-
-        OnRender();
-
-        ProcessRenderLisneters(m_displayContext);
-
-        m_displayContext.Flush2D();
-
-        m_renderer->SwitchToNativeResolutionBackbuffer();
-
-        // 3D engine stats
-
-        CCamera CurCamera = gEnv->pSystem->GetViewCamera();
-        gEnv->pSystem->SetViewCamera(m_Camera);
-
-        // Post Render Callback
-        {
-            PostRenderers::iterator itr = m_postRenderers.begin();
-            PostRenderers::iterator end = m_postRenderers.end();
-            for (; itr != end; ++itr)
-            {
-                (*itr)->OnPostRender();
-            }
-        }
-
-        gEnv->pSystem->SetViewCamera(CurCamera);
-    }
-
-    QtViewport::Update();
-
-    PopDisableRendering();
-    m_bUpdateViewport = false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetViewEntity(const AZ::EntityId& viewEntityId, bool lockCameraMovement)
-{
-    // if they've picked the same camera, then that means they want to toggle
-    if (viewEntityId.IsValid() && viewEntityId != m_viewEntityId)
-    {
-        LockCameraMovement(lockCameraMovement);
-        m_viewEntityId = viewEntityId;
-        AZStd::string entityName;
-        AZ::ComponentApplicationBus::BroadcastResult(entityName, &AZ::ComponentApplicationRequests::GetEntityName, viewEntityId);
-        SetName(QString("Camera entity: %1").arg(entityName.c_str()));
-    }
-    else
-    {
-        SetDefaultCamera();
-    }
-
-    PostCameraSet();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ResetToViewSourceType(const ViewSourceType& viewSourceType)
-{
-    LockCameraMovement(true);
-    m_pCameraFOVVariable = nullptr;
-    m_viewEntityId.SetInvalid();
-    m_cameraObjectId = GUID_NULL;
-    m_viewSourceType = viewSourceType;
-    SetViewTM(GetViewTM());
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::PostCameraSet()
-{
-    if (m_viewPane)
-    {
-        m_viewPane->OnFOVChanged(GetFOV());
-    }
-
-    GetIEditor()->Notify(eNotify_CameraChanged);
-    QScopedValueRollback<bool> rb(m_ignoreSetViewFromEntityPerspective, true);
-    Camera::EditorCameraNotificationBus::Broadcast(
-        &Camera::EditorCameraNotificationBus::Events::OnViewportViewEntityChanged, m_viewEntityId);
-}
-
-//////////////////////////////////////////////////////////////////////////
-CBaseObject* CRenderViewport::GetCameraObject() const
-{
-    CBaseObject* pCameraObject = nullptr;
-
-    if (m_viewSourceType == ViewSourceType::SequenceCamera)
-    {
-        m_cameraObjectId = GetViewManager()->GetCameraObjectId();
-    }
-    if (m_cameraObjectId != GUID_NULL)
-    {
-        // Find camera object from id.
-        pCameraObject = GetIEditor()->GetObjectManager()->FindObject(m_cameraObjectId);
-    }
-    else if (m_viewSourceType == ViewSourceType::CameraComponent || m_viewSourceType == ViewSourceType::AZ_Entity)
-    {
-        AzToolsFramework::ComponentEntityEditorRequestBus::EventResult(
-            pCameraObject, m_viewEntityId, &AzToolsFramework::ComponentEntityEditorRequests::GetSandboxObject);
-    }
-    return pCameraObject;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnEditorNotifyEvent(EEditorNotifyEvent event)
-{
-    switch (event)
-    {
-    case eNotify_OnBeginGameMode:
-    {
-        if (GetIEditor()->GetViewManager()->GetGameViewport() == this)
-        {
-            m_preGameModeViewTM = GetViewTM();
-            // this should only occur for the main viewport and no others.
-            ShowCursor();
-
-            // If the user has selected game mode, enable outputting to any attached HMD and properly size the context
-            // to the resolution specified by the VR device.
-            if (gSettings.bEnableGameModeVR)
-            {
-                const AZ::VR::HMDDeviceInfo* deviceInfo = nullptr;
-                EBUS_EVENT_RESULT(deviceInfo, AZ::VR::HMDDeviceRequestBus, GetDeviceInfo);
-                AZ_Warning("Render Viewport", deviceInfo, "No VR device detected");
-
-                if (deviceInfo)
-                {
-                    m_previousContext = SetCurrentContext(deviceInfo->renderWidth, deviceInfo->renderHeight);
-                    if (m_renderer->GetIStereoRenderer())
-                    {
-                        m_renderer->GetIStereoRenderer()->OnResolutionChanged();
-                    }
-                    SetActiveWindow();
-                    SetFocus();
-                    SetSelected(true);
-                }
-            }
-            else
-            {
-                m_previousContext = SetCurrentContext();
-            }
-            SetCurrentCursor(STD_CURSOR_GAME);
-        }
-    }
-    break;
-
-    case eNotify_OnEndGameMode:
-        if (GetIEditor()->GetViewManager()->GetGameViewport() == this)
-        {
-            SetCurrentCursor(STD_CURSOR_DEFAULT);
-            if (m_renderer->GetCurrentContextHWND() != renderOverlayHWND())
-            {
-                // if this warning triggers it means that someone else (ie, some other part of the code)
-                // called SetCurrentContext(...) on the renderer, probably did some rendering, but then either
-                // failed to set the context back when done, or set it back to the wrong one.
-                CryWarning(VALIDATOR_MODULE_3DENGINE, VALIDATOR_WARNING, "RenderViewport render context was not correctly restored by someone else.");
-            }
-            RestorePreviousContext(m_previousContext);
-            m_bInRotateMode = false;
-            m_bInMoveMode = false;
-            m_bInOrbitMode = false;
-            m_bInZoomMode = false;
-
-            RestoreViewportAfterGameMode();
-        }
-        break;
-
-    case eNotify_OnCloseScene:
-        SetDefaultCamera();
-        break;
-
-    case eNotify_OnBeginNewScene:
-        PushDisableRendering();
-        break;
-
-    case eNotify_OnEndNewScene:
-        PopDisableRendering();
-
-        {
-            // Default this to the size of default terrain in case there is no listener on the buss
-            AZ::Aabb terrainAabb = AZ::Aabb::CreateFromMinMaxValues(0, 0, 32, 1024, 1024, 32);
-            AzFramework::Terrain::TerrainDataRequestBus::BroadcastResult(terrainAabb, &AzFramework::Terrain::TerrainDataRequests::GetTerrainAabb);
-            float sx = terrainAabb.GetXExtent();
-            float sy = terrainAabb.GetYExtent();
-
-            Matrix34 viewTM;
-            viewTM.SetIdentity();
-            // Initial camera will be at middle of the map at the height of 2
-            // meters above the terrain (default terrain height is 32)
-            viewTM.SetTranslation(Vec3(sx * 0.5f, sy * 0.5f, 34.0f));
-            SetViewTM(viewTM);
-        }
-        break;
-
-    case eNotify_OnBeginTerrainCreate:
-        PushDisableRendering();
-        break;
-
-    case eNotify_OnEndTerrainCreate:
-        PopDisableRendering();
-
-        {
-            // Default this to the size of default terrain in case there is no listener on the buss
-            AZ::Aabb terrainAabb = AZ::Aabb::CreateFromMinMaxValues(0, 0, 32, 1024, 1024, 32);
-            AzFramework::Terrain::TerrainDataRequestBus::BroadcastResult(terrainAabb, &AzFramework::Terrain::TerrainDataRequests::GetTerrainAabb);
-            float sx = terrainAabb.GetXExtent();
-            float sy = terrainAabb.GetYExtent();
-
-            Matrix34 viewTM;
-            viewTM.SetIdentity();
-            // Initial camera will be at middle of the map at the height of 2
-            // meters above the terrain (default terrain height is 32)
-            viewTM.SetTranslation(Vec3(sx * 0.5f, sy * 0.5f, 34.0f));
-            SetViewTM(viewTM);
-        }
-        break;
-
-    case eNotify_OnBeginLayerExport:
-    case eNotify_OnBeginSceneSave:
-        PushDisableRendering();
-        break;
-    case eNotify_OnEndLayerExport:
-    case eNotify_OnEndSceneSave:
-        PopDisableRendering();
-        break;
-
-    case eNotify_OnBeginLoad: // disables viewport input when starting to load an existing level
-    case eNotify_OnBeginCreate: // disables viewport input when starting to create a new level
-        m_freezeViewportInput = true;
-        break;
-
-    case eNotify_OnEndLoad: // enables viewport input when finished loading an existing level
-    case eNotify_OnEndCreate: // enables viewport input when finished creating a new level
-        m_freezeViewportInput = false;
-        break;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-namespace {
-    inline Vec3 NegY(const Vec3& v, float y)
-    {
-        return Vec3(v.x, y - v.y, v.z);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnRender()
-{
-    if (m_rcClient.isEmpty() || m_renderer->GetRenderType() == eRT_Null) // Null is crashing in CryEngine on macOS
-    {
-        // Even in null rendering, update the view camera.
-        // This is necessary so that automated editor tests using the null renderer to test systems like dynamic vegetation
-        // are still able to manipulate the current logical camera position, even if nothing is rendered.
-        GetIEditor()->GetSystem()->SetViewCamera(m_Camera);
-        return;
-    }
-
-    FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
-    float fNearZ = GetIEditor()->GetConsoleVar("cl_DefaultNearPlane");
-    float fFarZ = m_Camera.GetFarPlane();
-
-    CBaseObject* cameraObject = GetCameraObject();
-    if (cameraObject)
-    {
-        AZ::Matrix3x3 lookThroughEntityCorrection = AZ::Matrix3x3::CreateIdentity();
-        if (m_viewEntityId.IsValid())
-        {
-            Camera::CameraRequestBus::EventResult(fNearZ, m_viewEntityId, &Camera::CameraComponentRequests::GetNearClipDistance);
-            Camera::CameraRequestBus::EventResult(fFarZ, m_viewEntityId, &Camera::CameraComponentRequests::GetFarClipDistance);
-            LmbrCentral::EditorCameraCorrectionRequestBus::EventResult(
-                lookThroughEntityCorrection, m_viewEntityId,
-                &LmbrCentral::EditorCameraCorrectionRequests::GetTransformCorrection);
-        }
-
-        m_viewTM = cameraObject->GetWorldTM() * AZMatrix3x3ToLYMatrix3x3(lookThroughEntityCorrection);
-        m_viewTM.OrthonormalizeFast();
-
-        m_Camera.SetMatrix(m_viewTM);
-
-        int w = m_rcClient.width();
-        int h = m_rcClient.height();
-
-        m_Camera.SetFrustum(w, h, GetFOV(), fNearZ, fFarZ);
-    }
-    else if (m_viewEntityId.IsValid())
-    {
-        Camera::CameraRequestBus::EventResult(fNearZ, m_viewEntityId, &Camera::CameraComponentRequests::GetNearClipDistance);
-        Camera::CameraRequestBus::EventResult(fFarZ, m_viewEntityId, &Camera::CameraComponentRequests::GetFarClipDistance);
-        int w = m_rcClient.width();
-        int h = m_rcClient.height();
-
-        m_Camera.SetFrustum(w, h, GetFOV(), fNearZ, fFarZ);
-    }
-    else
-    {
-        // Normal camera.
-        m_cameraObjectId = GUID_NULL;
-        int w = m_rcClient.width();
-        int h = m_rcClient.height();
-
-        float fov = gSettings.viewports.fDefaultFov;
-
-        // match viewport fov to default / selected title menu fov
-        if (GetFOV() != fov)
-        {
-            if (m_viewPane)
-            {
-                m_viewPane->OnFOVChanged(fov);
-                SetFOV(fov);
-            }
-        }
-
-        // Just for editor: Aspect ratio fix when changing the viewport
-        if (!GetIEditor()->IsInGameMode())
-        {
-            float viewportAspectRatio = float( w ) / h;
-            float targetAspectRatio = GetAspectRatio();
-            if (targetAspectRatio > viewportAspectRatio)
-            {
-                // Correct for vertical FOV change.
-                float maxTargetHeight = float( w ) / targetAspectRatio;
-                fov = 2 * atanf((h * tan(fov / 2)) / maxTargetHeight);
-            }
-        }
-
-        m_Camera.SetFrustum(w, h, fov, fNearZ);
-    }
-
-    GetIEditor()->GetSystem()->SetViewCamera(m_Camera);
-
-    CGameEngine* ge = GetIEditor()->GetGameEngine();
-
-    bool levelIsDisplayable = (ge && ge->IsLevelLoaded() && GetIEditor()->GetDocument() && GetIEditor()->GetDocument()->IsDocumentReady());
-
-    //Handle scene render tasks such as gizmos and handles but only when not in VR
-    if (!m_renderer->IsStereoEnabled())
-    {
-        DisplayContext& displayContext = m_displayContext;
-
-        PreWidgetRendering();
-
-        RenderAll();
-
-        // Draw 2D helpers.
-        TransformationMatrices backupSceneMatrices;
-        m_renderer->Set2DMode(m_rcClient.right(), m_rcClient.bottom(), backupSceneMatrices);
-        displayContext.SetState(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn);
-
-        // Display cursor string.
-        RenderCursorString();
-
-        if (gSettings.viewports.bShowSafeFrame)
-        {
-            UpdateSafeFrame();
-            RenderSafeFrame();
-        }
-
-        const AzFramework::DisplayContextRequestGuard displayContextGuard(displayContext);
-
-        AzFramework::DebugDisplayRequestBus::BusPtr debugDisplayBus;
-        AzFramework::DebugDisplayRequestBus::Bind(
-            debugDisplayBus, AzFramework::g_defaultSceneEntityDebugDisplayId);
-        AZ_Assert(debugDisplayBus, "Invalid DebugDisplayRequestBus.");
-
-        AzFramework::DebugDisplayRequests* debugDisplay =
-            AzFramework::DebugDisplayRequestBus::FindFirstHandler(debugDisplayBus);
-
-        AzFramework::ViewportDebugDisplayEventBus::Event(
-            AzToolsFramework::GetEntityContextId(), &AzFramework::ViewportDebugDisplayEvents::DisplayViewport2d,
-            AzFramework::ViewportInfo{ GetViewportId() }, *debugDisplay);
-
-        m_renderer->Unset2DMode(backupSceneMatrices);
-
-        PostWidgetRendering();
-    }
-
-    if (levelIsDisplayable)
-    {
-        m_renderer->SetViewport(0, 0, m_renderer->GetWidth(), m_renderer->GetHeight(), m_nCurViewportID);
-    }
-    else
-    {
-        ColorF viewportBackgroundColor(pow(71.0f / 255.0f, 2.2f), pow(71.0f / 255.0f, 2.2f), pow(71.0f / 255.0f, 2.2f));
-        m_renderer->ClearTargetsLater(FRT_CLEAR_COLOR, viewportBackgroundColor);
-        DrawBackground();
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderSelectionRectangle()
-{
-    if (m_selectedRect.isEmpty())
-    {
-        return;
-    }
-
-    Vec3 topLeft(m_selectedRect.left(), m_selectedRect.top(), 1);
-    Vec3 bottomRight(m_selectedRect.right() +1, m_selectedRect.bottom() + 1, 1);
-
-    m_displayContext.DepthTestOff();
-    m_displayContext.SetColor(1, 1, 1, 0.4f);
-    m_displayContext.DrawWireBox(topLeft, bottomRight);
-    m_displayContext.DepthTestOn();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::InitDisplayContext()
-{
-    FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
-    // Draw all objects.
-    DisplayContext& displayContext = m_displayContext;
-    displayContext.settings = GetIEditor()->GetDisplaySettings();
-    displayContext.view = this;
-    displayContext.renderer = m_renderer;
-    displayContext.box.min = Vec3(-100000.0f, -100000.0f, -100000.0f);
-    displayContext.box.max = Vec3(100000.0f, 100000.0f, 100000.0f);
-    displayContext.camera = &m_Camera;
-    displayContext.flags = 0;
-
-    if (!displayContext.settings->IsDisplayLabels() || !displayContext.settings->IsDisplayHelpers())
-    {
-        displayContext.flags |= DISPLAY_HIDENAMES;
-    }
-
-    if (displayContext.settings->IsDisplayLinks() && displayContext.settings->IsDisplayHelpers())
-    {
-        displayContext.flags |= DISPLAY_LINKS;
-    }
-
-    if (m_bDegradateQuality)
-    {
-        displayContext.flags |= DISPLAY_DEGRADATED;
-    }
-
-    if (displayContext.settings->GetRenderFlags() & RENDER_FLAG_BBOX)
-    {
-        displayContext.flags |= DISPLAY_BBOX;
-    }
-
-    if (displayContext.settings->IsDisplayTracks() && displayContext.settings->IsDisplayHelpers())
-    {
-        displayContext.flags |= DISPLAY_TRACKS;
-        displayContext.flags |= DISPLAY_TRACKTICKS;
-    }
-
-    if (GetIEditor()->GetReferenceCoordSys() == COORDS_WORLD)
-    {
-        displayContext.flags |= DISPLAY_WORLDSPACEAXIS;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::PopulateEditorGlobalContextMenu(QMenu* /*menu*/, const AZ::Vector2& /*point*/, int /*flags*/)
-{
-    m_bInMoveMode = false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderAll()
-{
-    // Draw all objects.
-    DisplayContext& displayContext = m_displayContext;
-
-    m_renderer->ResetToDefault();
-
-    displayContext.SetState(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn);
-    GetIEditor()->GetObjectManager()->Display(displayContext);
-
-    RenderSelectedRegion();
-
-    RenderSnapMarker();
-
-    if (gSettings.viewports.bShowGridGuide
-        && GetIEditor()->GetDisplaySettings()->IsDisplayHelpers())
-    {
-        RenderSnappingGrid();
-    }
-
-    if (displayContext.settings->GetDebugFlags() & DBG_MEMINFO)
-    {
-        ProcessMemInfo mi;
-        CProcessInfo::QueryMemInfo(mi);
-        int MB = 1024 * 1024;
-        QString str = QStringLiteral("WorkingSet=%1Mb, PageFile=%2Mb, PageFaults=%3").arg(mi.WorkingSet / MB).arg(mi.PagefileUsage / MB).arg(mi.PageFaultCount);
-        m_renderer->TextToScreenColor(1, 1, 1, 0, 0, 1, str.toUtf8().data());
-    }
-
-    {
-        const AzFramework::DisplayContextRequestGuard displayContextGuard(displayContext);
-
-        AzFramework::DebugDisplayRequestBus::BusPtr debugDisplayBus;
-        AzFramework::DebugDisplayRequestBus::Bind(
-            debugDisplayBus, AzFramework::g_defaultSceneEntityDebugDisplayId);
-        AZ_Assert(debugDisplayBus, "Invalid DebugDisplayRequestBus.");
-
-        AzFramework::DebugDisplayRequests* debugDisplay =
-            AzFramework::DebugDisplayRequestBus::FindFirstHandler(debugDisplayBus);
-
-        // allow the override of in-editor visualization
-        AzFramework::ViewportDebugDisplayEventBus::Event(
-            AzToolsFramework::GetEntityContextId(), &AzFramework::ViewportDebugDisplayEvents::DisplayViewport,
-            AzFramework::ViewportInfo{ GetViewportId() }, *debugDisplay);
-
-        m_entityVisibilityQuery.DisplayVisibility(*debugDisplay);
-
-        if (m_manipulatorManager != nullptr)
-        {
-            using namespace AzToolsFramework::ViewportInteraction;
-
-            debugDisplay->DepthTestOff();
-            m_manipulatorManager->DrawManipulators(
-                *debugDisplay, GetCameraState(),
-                BuildMouseInteractionInternal(
-                    MouseButtons(TranslateMouseButtons(QGuiApplication::mouseButtons())),
-                    BuildKeyboardModifiers(QGuiApplication::queryKeyboardModifiers()),
-                    BuildMousePickInternal(WidgetToViewport(mapFromGlobal(QCursor::pos())))));
-            debugDisplay->DepthTestOn();
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::DrawAxis()
-{
-    AZ_Assert(m_cameraSetForWidgetRenderingCount > 0,
-        "DrawAxis was called but viewport widget rendering was not set. PreWidgetRendering must be called before.");
-
-    DisplayContext& dc = m_displayContext;
-
-    // show axis only if draw helpers is activated
-    if (!dc.settings->IsDisplayHelpers())
-    {
-        return;
-    }
-
-    Vec3 colX(1, 0, 0), colY(0, 1, 0), colZ(0, 0, 1), colW(1, 1, 1);
-    Vec3 pos(50, 50, 0.1f); // Bottom-left corner
-
-    float wx, wy, wz;
-    m_renderer->UnProjectFromScreen(pos.x, pos.y, pos.z, &wx, &wy, &wz);
-    Vec3 posInWorld(wx, wy, wz);
-    float screenScale = GetScreenScaleFactor(posInWorld);
-    float length = 0.03f * screenScale;
-    float arrowSize = 0.02f * screenScale;
-    float textSize = 1.1f;
-
-    Vec3 x(length, 0, 0);
-    Vec3 y(0, length, 0);
-    Vec3 z(0, 0, length);
-
-    int prevRState = dc.GetState();
-    dc.DepthWriteOff();
-    dc.DepthTestOff();
-    dc.CullOff();
-    dc.SetLineWidth(1);
-
-    dc.SetColor(colX);
-    dc.DrawLine(posInWorld, posInWorld + x);
-    dc.DrawArrow(posInWorld + x * 0.9f, posInWorld + x, arrowSize);
-    dc.SetColor(colY);
-    dc.DrawLine(posInWorld, posInWorld + y);
-    dc.DrawArrow(posInWorld + y * 0.9f, posInWorld + y, arrowSize);
-    dc.SetColor(colZ);
-    dc.DrawLine(posInWorld, posInWorld + z);
-    dc.DrawArrow(posInWorld + z * 0.9f, posInWorld + z, arrowSize);
-
-    dc.SetColor(colW);
-    dc.DrawTextLabel(posInWorld + x, textSize, "x");
-    dc.DrawTextLabel(posInWorld + y, textSize, "y");
-    dc.DrawTextLabel(posInWorld + z, textSize, "z");
-
-    dc.DepthWriteOn();
-    dc.DepthTestOn();
-    dc.CullOn();
-    dc.SetState(prevRState);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::DrawBackground()
-{
-    DisplayContext& dc = m_displayContext;
-
-    if (!dc.settings->IsDisplayHelpers())            // show gradient bg only if draw helpers are activated
-    {
-        return;
-    }
-
-    int heightVP = m_renderer->GetHeight() - 1;
-    int widthVP = m_renderer->GetWidth() - 1;
-    Vec3 pos(0, 0, 0);
-
-    Vec3 x(widthVP, 0, 0);
-    Vec3 y(0, heightVP, 0);
-
-    float height = m_rcClient.height();
-
-    Vec3 src =  NegY(pos, height);
-    Vec3 trgx = NegY(pos + x, height);
-    Vec3 trgy = NegY(pos + y, height);
-
-    QColor topColor = palette().color(QPalette::Window);
-    QColor bottomColor = palette().color(QPalette::Disabled, QPalette::WindowText);
-
-    ColorB firstC(topColor.red(), topColor.green(), topColor.blue(), 255.0f);
-    ColorB secondC(bottomColor.red(), bottomColor.green(), bottomColor.blue(), 255.0f);
-
-    TransformationMatrices backupSceneMatrices;
-
-    m_renderer->Set2DMode(m_rcClient.right(), m_rcClient.bottom(), backupSceneMatrices);
-    m_displayContext.SetState(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn);
-    dc.DrawQuadGradient(src, trgx, pos + x, pos, secondC, firstC);
-    m_renderer->Unset2DMode(backupSceneMatrices);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderCursorString()
-{
-    if (m_cursorStr.isEmpty())
-    {
-        return;
-    }
-
-    const auto point = WidgetToViewport(mapFromGlobal(QCursor::pos()));
-
-    // Display hit object name.
-    float col[4] = { 1, 1, 1, 1 };
-    m_renderer->Draw2dLabel(point.x() + 12, point.y() + 4, 1.2f, col, false, "%s", m_cursorStr.toUtf8().data());
-
-    if (!m_cursorSupplementaryStr.isEmpty())
-    {
-        float col2[4] = { 1, 1, 0, 1 };
-        m_renderer->Draw2dLabel(point.x() + 12, point.y() + 4 + CURSOR_FONT_HEIGHT * 1.2f, 1.2f, col2, false, "%s", m_cursorSupplementaryStr.toUtf8().data());
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::UpdateSafeFrame()
-{
-    m_safeFrame = m_rcClient;
-
-    if (m_safeFrame.height() == 0)
-    {
-        return;
-    }
-
-    const bool allowSafeFrameBiggerThanViewport = false;
-
-    float safeFrameAspectRatio = float( m_safeFrame.width()) / m_safeFrame.height();
-    float targetAspectRatio = GetAspectRatio();
-    bool viewportIsWiderThanSafeFrame = (targetAspectRatio <= safeFrameAspectRatio);
-    if (viewportIsWiderThanSafeFrame || allowSafeFrameBiggerThanViewport)
-    {
-        float maxSafeFrameWidth = m_safeFrame.height() * targetAspectRatio;
-        float widthDifference = m_safeFrame.width() - maxSafeFrameWidth;
-
-        m_safeFrame.setLeft(m_safeFrame.left() + widthDifference * 0.5);
-        m_safeFrame.setRight(m_safeFrame.right() - widthDifference * 0.5);
-    }
-    else
-    {
-        float maxSafeFrameHeight = m_safeFrame.width() / targetAspectRatio;
-        float heightDifference = m_safeFrame.height() - maxSafeFrameHeight;
-
-        m_safeFrame.setTop(m_safeFrame.top() + heightDifference * 0.5);
-        m_safeFrame.setBottom(m_safeFrame.bottom() - heightDifference * 0.5);
-    }
-
-    m_safeFrame.adjust(0, 0, -1, -1); // <-- aesthetic improvement.
-
-    const float SAFE_ACTION_SCALE_FACTOR = 0.05f;
-    m_safeAction = m_safeFrame;
-    m_safeAction.adjust(m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR, m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR,
-        -m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR, -m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR);
-
-    const float SAFE_TITLE_SCALE_FACTOR = 0.1f;
-    m_safeTitle = m_safeFrame;
-    m_safeTitle.adjust(m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR, m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR,
-        -m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR, -m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderSafeFrame()
-{
-    RenderSafeFrame(m_safeFrame, 0.75f, 0.75f, 0, 0.8f);
-    RenderSafeFrame(m_safeAction, 0, 0.85f, 0.80f, 0.8f);
-    RenderSafeFrame(m_safeTitle, 0.80f, 0.60f, 0, 0.8f);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderSafeFrame(const QRect& frame, float r, float g, float b, float a)
-{
-    m_displayContext.SetColor(r, g, b, a);
-
-    const int LINE_WIDTH = 2;
-    for (int i = 0; i < LINE_WIDTH; i++)
-    {
-        Vec3 topLeft(frame.left() + i, frame.top() + i, 0);
-        Vec3 bottomRight(frame.right() - i, frame.bottom() - i, 0);
-        m_displayContext.DrawWireBox(topLeft, bottomRight);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetAspectRatio() const
-{
-    return gSettings.viewports.fDefaultAspectRatio;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderSnapMarker()
-{
-    if (!gSettings.snap.markerDisplay)
-    {
-        return;
-    }
-
-    QPoint point = QCursor::pos();
-    ScreenToClient(point);
-    Vec3 p = MapViewToCP(point);
-
-    DisplayContext& dc = m_displayContext;
-
-    float fScreenScaleFactor = GetScreenScaleFactor(p);
-
-    Vec3 x(1, 0, 0);
-    Vec3 y(0, 1, 0);
-    Vec3 z(0, 0, 1);
-    x = x * gSettings.snap.markerSize * fScreenScaleFactor * 0.1f;
-    y = y * gSettings.snap.markerSize * fScreenScaleFactor * 0.1f;
-    z = z * gSettings.snap.markerSize * fScreenScaleFactor * 0.1f;
-
-    dc.SetColor(gSettings.snap.markerColor);
-    dc.DrawLine(p - x, p + x);
-    dc.DrawLine(p - y, p + y);
-    dc.DrawLine(p - z, p + z);
-
-    point = WorldToView(p);
-
-    int s = 8;
-    dc.DrawLine2d(point + QPoint(-s, -s), point + QPoint(s, -s), 0);
-    dc.DrawLine2d(point + QPoint(-s, s), point + QPoint(s, s), 0);
-    dc.DrawLine2d(point + QPoint(-s, -s), point + QPoint(-s, s), 0);
-    dc.DrawLine2d(point + QPoint(s, -s), point + QPoint(s, s), 0);
-}
-
-//////////////////////////////////////////////////////////////////////////
-static void OnMenuDisplayWireframe()
-{
-    ICVar* piVar(gEnv->pConsole->GetCVar("r_wireframe"));
-    int nRenderMode = piVar->GetIVal();
-    if (nRenderMode != R_WIREFRAME_MODE)
-    {
-        piVar->Set(R_WIREFRAME_MODE);
-    }
-    else
-    {
-        piVar->Set(R_SOLID_MODE);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-static void OnMenuTargetAspectRatio(float aspect)
-{
-    gSettings.viewports.fDefaultAspectRatio = aspect;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnMenuResolutionCustom()
-{
-    CCustomResolutionDlg resDlg(width(), height(), parentWidget());
-    if (resDlg.exec() == QDialog::Accepted)
-    {
-        ResizeView(resDlg.GetWidth(), resDlg.GetHeight());
-
-        const QString text = QString::fromLatin1("%1 x %2").arg(resDlg.GetWidth()).arg(resDlg.GetHeight());
-
-        QStringList customResPresets;
-        CViewportTitleDlg::LoadCustomPresets("ResPresets", "ResPresetFor2ndView", customResPresets);
-        CViewportTitleDlg::UpdateCustomPresets(text, customResPresets);
-        CViewportTitleDlg::SaveCustomPresets("ResPresets", "ResPresetFor2ndView", customResPresets);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnMenuCreateCameraEntityFromCurrentView()
-{
-    Camera::EditorCameraSystemRequestBus::Broadcast(&Camera::EditorCameraSystemRequests::CreateCameraEntityFromViewport);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnMenuSelectCurrentCamera()
-{
-    CBaseObject* pCameraObject = GetCameraObject();
-
-    if (pCameraObject && !pCameraObject->IsSelected())
-    {
-        GetIEditor()->BeginUndo();
-        IObjectManager* pObjectManager = GetIEditor()->GetObjectManager();
-        pObjectManager->ClearSelection();
-        pObjectManager->SelectObject(pCameraObject);
-        GetIEditor()->AcceptUndo("Select Current Camera");
-    }
-}
-
-static AzFramework::CameraState CameraStateFromCCamera(
-    const CCamera& camera, const float fov, const float width, const float height)
-{
-    FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
-    AzFramework::CameraState state;
-    state.m_forward = LYVec3ToAZVec3(camera.GetViewdir());
-    state.m_up = LYVec3ToAZVec3(camera.GetUp());
-    state.m_side = state.m_forward.Cross(state.m_up);
-    state.m_position = LYVec3ToAZVec3(camera.GetPosition());
-    state.m_fovOrZoom = fov;
-    state.m_nearClip = camera.GetNearPlane();
-    state.m_farClip = camera.GetFarPlane();
-    state.m_orthographic = false;
-    state.m_viewportSize = AZ::Vector2(width, height);
-
-    return state;
-}
-
-AzFramework::CameraState CRenderViewport::GetCameraState()
-{
-    return CameraStateFromCCamera(GetCamera(), GetFOV(), m_rcClient.width(), m_rcClient.height());
-}
-
-bool CRenderViewport::GridSnappingEnabled()
-{
-    return false;
-}
-
-float CRenderViewport::GridSize()
-{
-    return 0.0f;
-}
-
-bool CRenderViewport::ShowGrid()
-{
-    return false;
-}
-
-bool CRenderViewport::AngleSnappingEnabled()
-{
-    return false;
-}
-
-float CRenderViewport::AngleStep()
-{
-    return 0.0f;
-}
-
-AZ::Vector3 CRenderViewport::PickTerrain(const AzFramework::ScreenPoint& point)
-{
-    FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
-    return LYVec3ToAZVec3(ViewToWorld(AzToolsFramework::ViewportInteraction::QPointFromScreenPoint(point), nullptr, true));
-}
-
-AZ::EntityId CRenderViewport::PickEntity(const AzFramework::ScreenPoint& point)
-{
-    FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
-    PreWidgetRendering();
-
-    AZ::EntityId entityId;
-    HitContext hitInfo;
-    hitInfo.view = this;
-    if (HitTest(AzToolsFramework::ViewportInteraction::QPointFromScreenPoint(point), hitInfo))
-    {
-        if (hitInfo.object && (hitInfo.object->GetType() == OBJTYPE_AZENTITY))
-        {
-            auto entityObject = static_cast<CComponentEntityObject*>(hitInfo.object);
-            entityId = entityObject->GetAssociatedEntityId();
-        }
-    }
-
-    PostWidgetRendering();
-
-    return entityId;
-}
-
-float CRenderViewport::TerrainHeight(const AZ::Vector2& position)
-{
-    return GetIEditor()->GetTerrainElevation(position.GetX(), position.GetY());
-}
-
-void CRenderViewport::FindVisibleEntities(AZStd::vector<AZ::EntityId>& visibleEntitiesOut)
-{
-    FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
-    if (ed_visibility_use)
-    {
-        visibleEntitiesOut.assign(m_entityVisibilityQuery.Begin(), m_entityVisibilityQuery.End());
-    }
-    else
-    {
-        if (m_displayContext.GetView() == nullptr)
-        {
-            return;
-        }
-
-        const AZStd::vector<AZ::EntityId>& entityIdCache =
-            m_displayContext.GetView()->GetVisibleObjectsCache()->GetEntityIdCache();
-
-        visibleEntitiesOut.assign(entityIdCache.begin(), entityIdCache.end());
-    }
-}
-
-AzFramework::ScreenPoint CRenderViewport::ViewportWorldToScreen(const AZ::Vector3& worldPosition)
-{
-    FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
-    PreWidgetRendering();
-    const AzFramework::ScreenPoint screenPosition =
-        AzToolsFramework::ViewportInteraction::ScreenPointFromQPoint(WorldToView(AZVec3ToLYVec3(worldPosition)));
-    PostWidgetRendering();
-
-    return screenPosition;
-}
-
-bool CRenderViewport::IsViewportInputFrozen()
-{
-    return m_freezeViewportInput;
-}
-
-void CRenderViewport::FreezeViewportInput(bool freeze)
-{
-    m_freezeViewportInput = freeze;
-}
-
-QWidget* CRenderViewport::GetWidgetForViewportContextMenu()
-{
-    return this;
-}
-
-void CRenderViewport::BeginWidgetContext()
-{
-    PreWidgetRendering();
-}
-
-void CRenderViewport::EndWidgetContext()
-{
-    PostWidgetRendering();
-}
-
-bool CRenderViewport::ShowingWorldSpace()
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-    return BuildKeyboardModifiers(QGuiApplication::queryKeyboardModifiers()).Shift();
-}
-
-void CRenderViewport::SetWindowTitle(const AZStd::string& title)
-{
-    // Do not support the WindowRequestBus changing the editor window title
-    AZ_UNUSED(title);
-}
-
-AzFramework::WindowSize CRenderViewport::GetClientAreaSize() const
-{
-    return AzFramework::WindowSize(m_rcClient.width(), m_rcClient.height());
-}
-
-
-void CRenderViewport::ResizeClientArea(AzFramework::WindowSize clientAreaSize)
-{
-    QWidget* window = this->window();
-    window->resize(aznumeric_cast<int>(clientAreaSize.m_width), aznumeric_cast<int>(clientAreaSize.m_height));
-}
-
-bool CRenderViewport::GetFullScreenState() const
-{
-    // CRenderViewport does not currently support full screen.
-    return false;
-}
-
-void CRenderViewport::SetFullScreenState([[maybe_unused]]bool fullScreenState)
-{
-    // CRenderViewport does not currently support full screen.
-}
-
-bool CRenderViewport::CanToggleFullScreenState() const
-{
-    // CRenderViewport does not currently support full screen.
-    return false;
-}
-
-void CRenderViewport::ToggleFullScreenState()
-{
-    // CRenderViewport does not currently support full screen.
-}
-
-void CRenderViewport::ConnectViewportInteractionRequestBus()
-{
-    AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler::BusConnect(GetViewportId());
-    AzToolsFramework::ViewportInteraction::ViewportInteractionRequestBus::Handler::BusConnect(GetViewportId());
-    AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler::BusConnect(GetViewportId());
-    m_viewportUi.ConnectViewportUiBus(GetViewportId());
-
-    AzFramework::InputSystemCursorConstraintRequestBus::Handler::BusConnect();
-}
-
-void CRenderViewport::DisconnectViewportInteractionRequestBus()
-{
-    AzFramework::InputSystemCursorConstraintRequestBus::Handler::BusDisconnect();
-
-    m_viewportUi.DisconnectViewportUiBus();
-    AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler::BusDisconnect();
-    AzToolsFramework::ViewportInteraction::ViewportInteractionRequestBus::Handler::BusDisconnect();
-    AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler::BusDisconnect();
-}
-
-//////////////////////////////////////////////////////////////////////////
-static void ToggleBool(bool* variable, bool* disableVariableIfOn)
-{
-    *variable = !*variable;
-    if (*variable && disableVariableIfOn)
-    {
-        *disableVariableIfOn = false;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-static void ToggleInt(int* variable)
-{
-    *variable = !*variable;
-}
-
-//////////////////////////////////////////////////////////////////////////
-static void AddCheckbox(QMenu* menu, const QString& text, bool* variable, bool* disableVariableIfOn = nullptr)
-{
-    QAction* action = menu->addAction(text);
-    QObject::connect(action, &QAction::triggered, action, [variable, disableVariableIfOn] { ToggleBool(variable, disableVariableIfOn);
-        });
-    action->setCheckable(true);
-    action->setChecked(*variable);
-}
-
-//////////////////////////////////////////////////////////////////////////
-static void AddCheckbox(QMenu* menu, const QString& text, int* variable)
-{
-    QAction* action = menu->addAction(text);
-    QObject::connect(action, &QAction::triggered, action, [variable] { ToggleInt(variable);
-        });
-    action->setCheckable(true);
-    action->setChecked(*variable);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnTitleMenu(QMenu* menu)
-{
-    const int nWireframe = gEnv->pConsole->GetCVar("r_wireframe")->GetIVal();
-    QAction* action = menu->addAction(tr("Wireframe"));
-    connect(action, &QAction::triggered, action, OnMenuDisplayWireframe);
-    action->setCheckable(true);
-    action->setChecked(nWireframe == R_WIREFRAME_MODE);
-
-    const bool bDisplayLabels = GetIEditor()->GetDisplaySettings()->IsDisplayLabels();
-    action = menu->addAction(tr("Labels"));
-    connect(action, &QAction::triggered, this, [bDisplayLabels] {GetIEditor()->GetDisplaySettings()->DisplayLabels(!bDisplayLabels);
-        });
-    action->setCheckable(true);
-    action->setChecked(bDisplayLabels);
-
-    AddCheckbox(menu, tr("Show Safe Frame"), &gSettings.viewports.bShowSafeFrame);
-    AddCheckbox(menu, tr("Show Construction Plane"), &gSettings.snap.constructPlaneDisplay);
-    AddCheckbox(menu, tr("Show Trigger Bounds"), &gSettings.viewports.bShowTriggerBounds);
-    AddCheckbox(menu, tr("Show Icons"), &gSettings.viewports.bShowIcons, &gSettings.viewports.bShowSizeBasedIcons);
-    AddCheckbox(menu, tr("Show Size-based Icons"), &gSettings.viewports.bShowSizeBasedIcons, &gSettings.viewports.bShowIcons);
-    AddCheckbox(menu, tr("Show Helpers of Frozen Objects"), &gSettings.viewports.nShowFrozenHelpers);
-
-    if (!m_predefinedAspectRatios.IsEmpty())
-    {
-        QMenu* aspectRatiosMenu = menu->addMenu(tr("Target Aspect Ratio"));
-
-        for (size_t i = 0; i < m_predefinedAspectRatios.GetCount(); ++i)
-        {
-            const QString& aspectRatioString = m_predefinedAspectRatios.GetName(i);
-            QAction* aspectRatioAction = aspectRatiosMenu->addAction(aspectRatioString);
-            connect(aspectRatioAction, &QAction::triggered, this, [i, this] { OnMenuTargetAspectRatio(m_predefinedAspectRatios.GetValue(i));
-                });
-            aspectRatioAction->setCheckable(true);
-            aspectRatioAction->setChecked(m_predefinedAspectRatios.IsCurrent(i));
-        }
-    }
-
-    // Set ourself as the active viewport so the following actions create a camera from this view
-    GetIEditor()->GetViewManager()->SelectViewport(this);
-
-    CGameEngine* gameEngine = GetIEditor()->GetGameEngine();
-
-    if (Camera::EditorCameraSystemRequestBus::HasHandlers())
-    {
-        action = menu->addAction(tr("Create camera entity from current view"));
-        connect(action, &QAction::triggered, this, &CRenderViewport::OnMenuCreateCameraEntityFromCurrentView);
-
-        if (!gameEngine || !gameEngine->IsLevelLoaded())
-        {
-            action->setEnabled(false);
-            action->setToolTip(tr(TextCantCreateCameraNoLevel));
-            menu->setToolTipsVisible(true);
-        }
-    }
-
-    if (!gameEngine || !gameEngine->IsLevelLoaded())
-    {
-        action->setEnabled(false);
-        action->setToolTip(tr(TextCantCreateCameraNoLevel));
-        menu->setToolTipsVisible(true);
-    }
-
-    if (GetCameraObject())
-    {
-        action = menu->addAction(tr("Select Current Camera"));
-        connect(action, &QAction::triggered, this, &CRenderViewport::OnMenuSelectCurrentCamera);
-    }
-
-    // Add Cameras.
-    bool bHasCameras = AddCameraMenuItems(menu);
-    CRenderViewport* pFloatingViewport = nullptr;
-
-    if (GetIEditor()->GetViewManager()->GetViewCount() > 1)
-    {
-        for (int i = 0; i < GetIEditor()->GetViewManager()->GetViewCount(); ++i)
-        {
-            CViewport* vp = GetIEditor()->GetViewManager()->GetView(i);
-            if (!vp)
-            {
-                continue;
-            }
-
-            if (viewport_cast<CRenderViewport*>(vp) == nullptr)
-            {
-                continue;
-            }
-
-            if (vp->GetViewportId() == MAX_NUM_VIEWPORTS - 1)
-            {
-                menu->addSeparator();
-
-                QMenu* floatViewMenu = menu->addMenu(tr("Floating View"));
-
-                pFloatingViewport = (CRenderViewport*)vp;
-                pFloatingViewport->AddCameraMenuItems(floatViewMenu);
-
-                if (bHasCameras)
-                {
-                    floatViewMenu->addSeparator();
-                }
-
-                QMenu* resolutionMenu = floatViewMenu->addMenu(tr("Resolution"));
-
-                QStringList customResPresets;
-                CViewportTitleDlg::LoadCustomPresets("ResPresets", "ResPresetFor2ndView", customResPresets);
-                CViewportTitleDlg::AddResolutionMenus(resolutionMenu, [this](int width, int height) { ResizeView(width, height); }, customResPresets);
-                if (!resolutionMenu->actions().isEmpty())
-                {
-                    resolutionMenu->addSeparator();
-                }
-                QAction* customResolutionAction = resolutionMenu->addAction(tr("Custom..."));
-                connect(customResolutionAction, &QAction::triggered, this, &CRenderViewport::OnMenuResolutionCustom);
-                break;
-            }
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::AddCameraMenuItems(QMenu* menu)
-{
-    if (!menu->isEmpty())
-    {
-        menu->addSeparator();
-    }
-
-    AddCheckbox(menu, "Lock Camera Movement", &m_bLockCameraMovement);
-    menu->addSeparator();
-
-    // Camera Sub menu
-    QMenu* customCameraMenu = menu->addMenu(tr("Camera"));
-
-    QAction* action = customCameraMenu->addAction("Editor Camera");
-    action->setCheckable(true);
-    action->setChecked(m_viewSourceType == ViewSourceType::None);
-    connect(action, &QAction::triggered, this, &CRenderViewport::SetDefaultCamera);
-
-    AZ::EBusAggregateResults<AZ::EntityId> getCameraResults;
-    Camera::CameraBus::BroadcastResult(getCameraResults, &Camera::CameraRequests::GetCameras);
-
-    const int numCameras = static_cast<int>(getCameraResults.values.size());
-
-    // only enable if we're editing a sequence in Track View and have cameras in the level
-    bool enableSequenceCameraMenu = (GetIEditor()->GetAnimation()->GetSequence() && numCameras);
-
-    action = customCameraMenu->addAction(tr("Sequence Camera"));
-    action->setCheckable(true);
-    action->setChecked(m_viewSourceType == ViewSourceType::SequenceCamera);
-    action->setEnabled(enableSequenceCameraMenu);
-    connect(action, &QAction::triggered, this, &CRenderViewport::SetSequenceCamera);
-
-    QVector<QAction*> additionalCameras;
-    additionalCameras.reserve(static_cast<int>(getCameraResults.values.size()));
-
-    for (const AZ::EntityId& entityId : getCameraResults.values)
-    {
-        AZStd::string entityName;
-        AZ::ComponentApplicationBus::BroadcastResult(entityName, &AZ::ComponentApplicationRequests::GetEntityName, entityId);
-        action = new QAction(QString(entityName.c_str()), nullptr);
-        additionalCameras.append(action);
-        action->setCheckable(true);
-        action->setChecked(m_viewEntityId == entityId && m_viewSourceType == ViewSourceType::CameraComponent);
-        connect(action, &QAction::triggered, this, [this, entityId](bool isChecked)
-            {
-                if (isChecked)
-                {
-                    SetComponentCamera(entityId);
-                }
-                else
-                {
-                    SetDefaultCamera();
-                }
-            });
-    }
-
-    std::sort(additionalCameras.begin(), additionalCameras.end(), [] (QAction* a1, QAction* a2) {
-        return QString::compare(a1->text(), a2->text(), Qt::CaseInsensitive) < 0;
-    });
-
-    for (QAction* cameraAction : additionalCameras)
-    {
-        customCameraMenu->addAction(cameraAction);
-    }
-
-    action = customCameraMenu->addAction(tr("Look through entity"));
-    AzToolsFramework::EntityIdList selectedEntityList;
-    AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
-    action->setCheckable(selectedEntityList.size() > 0 || m_viewSourceType == ViewSourceType::AZ_Entity);
-    action->setEnabled(selectedEntityList.size() > 0 || m_viewSourceType == ViewSourceType::AZ_Entity);
-    action->setChecked(m_viewSourceType == ViewSourceType::AZ_Entity);
-    connect(action, &QAction::triggered, this, [this](bool isChecked)
-        {
-            if (isChecked)
-            {
-                AzToolsFramework::EntityIdList selectedEntityList;
-                AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
-                if (selectedEntityList.size())
-                {
-                    SetEntityAsCamera(*selectedEntityList.begin());
-                }
-            }
-            else
-            {
-                SetDefaultCamera();
-            }
-        });
-    return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ResizeView(int width, int height)
-{
-    const QRect rView = rect().translated(mapToGlobal(QPoint()));
-    int deltaWidth = width - rView.width();
-    int deltaHeight = height - rView.height();
-
-    if (window()->isFullScreen())
-    {
-        setGeometry(rView.left(), rView.top(), rView.width() + deltaWidth, rView.height() + deltaHeight);
-    }
-    else
-    {
-        QWidget* window = this->window();
-        if (window->isMaximized())
-        {
-            window->showNormal();
-        }
-
-        const QSize deltaSize = QSize(width, height) - size();
-        window->move(0, 0);
-        window->resize(window->size() + deltaSize);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ToggleCameraObject()
-{
-    if (m_viewSourceType == ViewSourceType::SequenceCamera)
-    {
-        ResetToViewSourceType(ViewSourceType::LegacyCamera);
-    }
-    else
-    {
-        ResetToViewSourceType(ViewSourceType::SequenceCamera);
-    }
-    PostCameraSet();
-    GetIEditor()->GetAnimation()->ForceAnimation();
-}
-
-void CRenderViewport::OnMouseWheel(Qt::KeyboardModifiers modifiers, short zDelta, const QPoint& point)
-{
-    using namespace AzToolsFramework::ViewportInteraction;
-    using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
-    if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
-    {
-        return;
-    }
-
-    const auto scaledPoint = WidgetToViewport(point);
-    const auto mouseInteraction = BuildMouseInteractionInternal(
-        MouseButtonsFromButton(MouseButton::None),
-        BuildKeyboardModifiers(modifiers),
-        BuildMousePick(scaledPoint));
-
-    bool handled = false;
-    MouseInteractionResult result = MouseInteractionResult::None;
-    AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::EventResult(
-        result, AzToolsFramework::GetEntityContextId(),
-        &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
-        MouseInteractionEvent(mouseInteraction, zDelta));
-
-    handled = result != MouseInteractionResult::None;
-
-    if (!handled)
-    {
-        Matrix34 m = GetViewTM();
-        const Vec3 ydir = m.GetColumn1().GetNormalized();
-
-        Vec3 pos = m.GetTranslation();
-
-        const float posDelta = 0.01f * zDelta * gSettings.wheelZoomSpeed;
-        pos += ydir * posDelta;
-        m_orbitDistance = m_orbitDistance - posDelta;
-        m_orbitDistance = fabs(m_orbitDistance);
-
-        m.SetTranslation(pos);
-        SetViewTM(m, true);
-
-        QtViewport::OnMouseWheel(modifiers, zDelta, scaledPoint);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetCamera(const CCamera& camera)
-{
-    m_Camera = camera;
-    SetViewTM(m_Camera.GetMatrix());
-}
-
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetCameraMoveSpeed() const
-{
-    return gSettings.cameraMoveSpeed;
-}
-
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetCameraRotateSpeed() const
-{
-    return gSettings.cameraRotateSpeed;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::GetCameraInvertYRotation() const
-{
-    return gSettings.invertYRotation;
-}
-
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetCameraInvertPan() const
-{
-    return gSettings.invertPan;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CRenderViewport* CRenderViewport::GetPrimaryViewport()
-{
-    return m_pPrimaryViewport;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::focusOutEvent([[maybe_unused]] QFocusEvent* event)
-{
-    // if we lose focus, the keyboard map needs to be cleared immediately
-    if (!m_keyDown.isEmpty())
-    {
-        m_keyDown.clear();
-
-        releaseKeyboard();
-    }
-}
-
-void CRenderViewport::keyPressEvent(QKeyEvent* event)
-{
-    // Special case Escape key and bubble way up to the top level parent so that it can cancel us out of any active tool
-    // or clear the current selection
-    if (event->key() == Qt::Key_Escape)
-    {
-        QCoreApplication::sendEvent(GetIEditor()->GetEditorMainWindow(), event);
-    }
-
-    // NOTE: we keep track of keypresses and releases explicitly because the OS/Qt will insert a slight delay between sending
-    // keyevents when the key is held down. This is standard, but makes responding to key events for game style input silly
-    // because we want the movement to be butter smooth.
-    if (!event->isAutoRepeat())
-    {
-        if (m_keyDown.isEmpty())
-        {
-            grabKeyboard();
-        }
-
-        m_keyDown.insert(event->key());
-    }
-
-    QtViewport::keyPressEvent(event);
-
-#if defined(AZ_PLATFORM_WINDOWS)
-    // In game mode on windows we need to forward raw text events to the input system.
-    if (GetIEditor()->IsInGameMode() && GetType() == ET_ViewportCamera)
-    {
-        // Get the QString as a '\0'-terminated array of unsigned shorts.
-        // The result remains valid until the string is modified.
-        const ushort* codeUnitsUTF16 = event->text().utf16();
-        while (ushort codeUnitUTF16 = *codeUnitsUTF16)
-        {
-            AzFramework::RawInputNotificationBusWindows::Broadcast(&AzFramework::RawInputNotificationsWindows::OnRawInputCodeUnitUTF16Event, codeUnitUTF16);
-            ++codeUnitsUTF16;
-        }
-    }
-#endif // defined(AZ_PLATFORM_WINDOWS)
-}
-
-void CRenderViewport::ProcessKeyRelease(QKeyEvent* event)
-{
-    if (!event->isAutoRepeat())
-    {
-        if (m_keyDown.contains(event->key()))
-        {
-            m_keyDown.remove(event->key());
-
-            if (m_keyDown.isEmpty())
-            {
-                releaseKeyboard();
-            }
-        }
-    }
-}
-
-void CRenderViewport::keyReleaseEvent(QKeyEvent* event)
-{
-    ProcessKeyRelease(event);
-
-    QtViewport::keyReleaseEvent(event);
-}
-
-void CRenderViewport::SetViewTM(const Matrix34& viewTM, bool bMoveOnly)
-{
-    Matrix34 camMatrix = viewTM;
-
-    // If no collision flag set do not check for terrain elevation.
-    if (GetType() == ET_ViewportCamera)
-    {
-        if ((GetIEditor()->GetDisplaySettings()->GetSettings() & SETTINGS_NOCOLLISION) == 0)
-        {
-            Vec3 p = camMatrix.GetTranslation();
-            bool adjustCameraElevation = true;
-            auto terrain = AzFramework::Terrain::TerrainDataRequestBus::FindFirstHandler();
-            if (terrain)
-            {
-                AZ::Aabb terrainAabb(terrain->GetTerrainAabb());
-
-                // Adjust the AABB to include all Z values.  Since the goal here is to snap the camera to the terrain height if
-                // it's below the terrain, we only want to verify the camera is within the XY bounds of the terrain to adjust the elevation.
-                terrainAabb.SetMin(AZ::Vector3(terrainAabb.GetMin().GetX(), terrainAabb.GetMin().GetY(), -AZ::Constants::FloatMax));
-                terrainAabb.SetMax(AZ::Vector3(terrainAabb.GetMax().GetX(), terrainAabb.GetMax().GetY(), AZ::Constants::FloatMax));
-
-                if (!terrainAabb.Contains(LYVec3ToAZVec3(p)))
-                {
-                    adjustCameraElevation = false;
-                }
-                else if (terrain->GetIsHoleFromFloats(p.x, p.y))
-                {
-                    adjustCameraElevation = false;
-                }
-            }
-
-            if (adjustCameraElevation)
-            {
-                float z = GetIEditor()->GetTerrainElevation(p.x, p.y);
-                if (p.z < z + 0.25)
-                {
-                    p.z = z + 0.25;
-                    camMatrix.SetTranslation(p);
-                }
-            }
-        }
-
-        // Also force this position on game.
-        if (GetIEditor()->GetGameEngine())
-        {
-            GetIEditor()->GetGameEngine()->SetPlayerViewMatrix(viewTM);
-        }
-    }
-
-    CBaseObject* cameraObject = GetCameraObject();
-    if (cameraObject)
-    {
-        // Ignore camera movement if locked.
-        if (IsCameraMovementLocked() || (!GetIEditor()->GetAnimation()->IsRecordMode() && !IsCameraObjectMove()))
-        {
-            return;
-        }
-
-        AZ::Matrix3x3 lookThroughEntityCorrection = AZ::Matrix3x3::CreateIdentity();
-        if (m_viewEntityId.IsValid())
-        {
-            LmbrCentral::EditorCameraCorrectionRequestBus::EventResult(
-                lookThroughEntityCorrection, m_viewEntityId,
-                &LmbrCentral::EditorCameraCorrectionRequests::GetInverseTransformCorrection);
-        }
-
-        if (m_pressedKeyState != KeyPressedState::PressedInPreviousFrame)
-        {
-            CUndo undo("Move Camera");
-            if (bMoveOnly)
-            {
-                // specify eObjectUpdateFlags_UserInput so that an undo command gets logged
-                cameraObject->SetWorldPos(camMatrix.GetTranslation(), eObjectUpdateFlags_UserInput);
-            }
-            else
-            {
-                // specify eObjectUpdateFlags_UserInput so that an undo command gets logged
-                cameraObject->SetWorldTM(camMatrix * AZMatrix3x3ToLYMatrix3x3(lookThroughEntityCorrection), eObjectUpdateFlags_UserInput);
-            }
-        }
-        else
-        {
-            if (bMoveOnly)
-            {
-                // Do not specify eObjectUpdateFlags_UserInput, so that an undo command does not get logged; we covered it already when m_pressedKeyState was PressedThisFrame
-                cameraObject->SetWorldPos(camMatrix.GetTranslation());
-            }
-            else
-            {
-                // Do not specify eObjectUpdateFlags_UserInput, so that an undo command does not get logged; we covered it already when m_pressedKeyState was PressedThisFrame
-                cameraObject->SetWorldTM(camMatrix * AZMatrix3x3ToLYMatrix3x3(lookThroughEntityCorrection));
-            }
-        }
-
-        using namespace AzToolsFramework;
-        ComponentEntityObjectRequestBus::Event(cameraObject, &ComponentEntityObjectRequestBus::Events::UpdatePreemptiveUndoCache);
-    }
-    else if (m_viewEntityId.IsValid())
-    {
-        // Ignore camera movement if locked.
-        if (IsCameraMovementLocked() || (!GetIEditor()->GetAnimation()->IsRecordMode() && !IsCameraObjectMove()))
-        {
-            return;
-        }
-
-        if (m_pressedKeyState != KeyPressedState::PressedInPreviousFrame)
-        {
-            CUndo undo("Move Camera");
-            if (bMoveOnly)
-            {
-                AZ::TransformBus::Event(
-                    m_viewEntityId, &AZ::TransformInterface::SetWorldTranslation,
-                    LYVec3ToAZVec3(camMatrix.GetTranslation()));
-            }
-            else
-            {
-                AZ::TransformBus::Event(
-                    m_viewEntityId, &AZ::TransformInterface::SetWorldTM,
-                    LYTransformToAZTransform(camMatrix));
-            }
-        }
-        else
-        {
-            if (bMoveOnly)
-            {
-                AZ::TransformBus::Event(
-                    m_viewEntityId, &AZ::TransformInterface::SetWorldTranslation,
-                    LYVec3ToAZVec3(camMatrix.GetTranslation()));
-            }
-            else
-            {
-                AZ::TransformBus::Event(
-                    m_viewEntityId, &AZ::TransformInterface::SetWorldTM,
-                    LYTransformToAZTransform(camMatrix));
-            }
-        }
-
-        AzToolsFramework::PropertyEditorGUIMessages::Bus::Broadcast(
-            &AzToolsFramework::PropertyEditorGUIMessages::RequestRefresh,
-            AzToolsFramework::PropertyModificationRefreshLevel::Refresh_AttributesAndValues);
-    }
-
-    if (m_pressedKeyState == KeyPressedState::PressedThisFrame)
-    {
-        m_pressedKeyState = KeyPressedState::PressedInPreviousFrame;
-    }
-
-    QtViewport::SetViewTM(camMatrix);
-
-    m_Camera.SetMatrix(camMatrix);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderSelectedRegion()
-{
-    AABB box;
-    GetIEditor()->GetSelectedRegion(box);
-    if (box.IsEmpty())
-    {
-        return;
-    }
-
-    float x1 = box.min.x;
-    float y1 = box.min.y;
-    float x2 = box.max.x;
-    float y2 = box.max.y;
-
-    DisplayContext& dc = m_displayContext;
-
-    float fMaxSide = MAX(y2 - y1, x2 - x1);
-    if (fMaxSide < 0.1f)
-    {
-        return;
-    }
-    float fStep = fMaxSide / 100.0f;
-
-    float fMinZ = 0;
-    float fMaxZ = 0;
-
-    // Draw yellow border lines.
-    dc.SetColor(1, 1, 0, 1);
-    float offset = 0.01f;
-    Vec3 p1, p2;
-
-    const float defaultTerrainHeight = AzFramework::Terrain::TerrainDataRequests::GetDefaultTerrainHeight();
-    auto terrain = AzFramework::Terrain::TerrainDataRequestBus::FindFirstHandler();
-
-    for (float y = y1; y < y2; y += fStep)
-    {
-        p1.x = x1;
-        p1.y = y;
-        p1.z = terrain ? terrain->GetHeightFromFloats(p1.x, p1.y) + offset : defaultTerrainHeight + offset;
-
-        p2.x = x1;
-        p2.y = y + fStep;
-        p2.z = terrain ? terrain->GetHeightFromFloats(p2.x, p2.y) + offset : defaultTerrainHeight + offset;
-        dc.DrawLine(p1, p2);
-
-        p1.x = x2;
-        p1.y = y;
-        p1.z = terrain ? terrain->GetHeightFromFloats(p1.x, p1.y) + offset : defaultTerrainHeight + offset;
-
-        p2.x = x2;
-        p2.y = y + fStep;
-        p2.z = terrain ? terrain->GetHeightFromFloats(p2.x, p2.y) + offset : defaultTerrainHeight + offset;
-        dc.DrawLine(p1, p2);
-
-        fMinZ = min(fMinZ, min(p1.z, p2.z));
-        fMaxZ = max(fMaxZ, max(p1.z, p2.z));
-    }
-    for (float x = x1; x < x2; x += fStep)
-    {
-        p1.x = x;
-        p1.y = y1;
-        p1.z = terrain ? terrain->GetHeightFromFloats(p1.x, p1.y) + offset : defaultTerrainHeight + offset;
-
-        p2.x = x + fStep;
-        p2.y = y1;
-        p2.z = terrain ? terrain->GetHeightFromFloats(p2.x, p2.y) + offset : defaultTerrainHeight + offset;
-        dc.DrawLine(p1, p2);
-
-        p1.x = x;
-        p1.y = y2;
-        p1.z = terrain ? terrain->GetHeightFromFloats(p1.x, p1.y) + offset : defaultTerrainHeight + offset;
-
-        p2.x = x + fStep;
-        p2.y = y2;
-        p2.z = terrain ? terrain->GetHeightFromFloats(p2.x, p2.y) + offset : defaultTerrainHeight + offset;
-        dc.DrawLine(p1, p2);
-
-        fMinZ = min(fMinZ, min(p1.z, p2.z));
-        fMaxZ = max(fMaxZ, max(p1.z, p2.z));
-    }
-
-    {
-        // Draw a box area
-        float fBoxOver = fMaxSide / 5.0f;
-        float fBoxHeight = fBoxOver + fMaxZ - fMinZ;
-
-        ColorB boxColor(64, 64, 255, 128); // light blue
-        ColorB transparent(boxColor.r, boxColor.g, boxColor.b, 0);
-
-        Vec3 base[] = {
-            Vec3(x1, y1, fMinZ),
-            Vec3(x2, y1, fMinZ),
-            Vec3(x2, y2, fMinZ),
-            Vec3(x1, y2, fMinZ)
-        };
-
-
-        // Generate vertices
-        static AABB boxPrev(AABB::RESET);
-        static std::vector<Vec3> verts;
-        static std::vector<ColorB> colors;
-
-        if (!IsEquivalent(boxPrev, box))
-        {
-            verts.resize(0);
-            colors.resize(0);
-            for (int i = 0; i < 4; ++i)
-            {
-                Vec3& p = base[i];
-
-                verts.push_back(p);
-                verts.push_back(Vec3(p.x, p.y, p.z + fBoxHeight));
-                verts.push_back(Vec3(p.x, p.y, p.z + fBoxHeight + fBoxOver));
-
-                colors.push_back(boxColor);
-                colors.push_back(boxColor);
-                colors.push_back(transparent);
-            }
-            boxPrev = box;
-        }
-
-        // Generate indices
-        const int numInds = 4 * 12;
-        static vtx_idx inds[numInds];
-        static bool bNeedIndsInit = true;
-        if (bNeedIndsInit)
-        {
-            vtx_idx* pInds = &inds[0];
-
-            for (int i = 0; i < 4; ++i)
-            {
-                int over = 0;
-                if (i == 3)
-                {
-                    over = -12;
-                }
-
-                int ind = i * 3;
-                *pInds++ = ind;
-                *pInds++ = ind + 3 + over;
-                *pInds++ = ind + 1;
-
-                *pInds++ = ind + 1;
-                *pInds++ = ind + 3 + over;
-                *pInds++ = ind + 4 + over;
-
-                ind = i * 3 + 1;
-                *pInds++ = ind;
-                *pInds++ = ind + 3 + over;
-                *pInds++ = ind + 1;
-
-                *pInds++ = ind + 1;
-                *pInds++ = ind + 3 + over;
-                *pInds++ = ind + 4 + over;
-            }
-            bNeedIndsInit = false;
-        }
-
-        // Draw lines
-        for (int i = 0; i < 4; ++i)
-        {
-            Vec3& p = base[i];
-
-            dc.DrawLine(p, Vec3(p.x, p.y, p.z + fBoxHeight), ColorF(1, 1, 0, 1), ColorF(1, 1, 0, 1));
-            dc.DrawLine(Vec3(p.x, p.y, p.z + fBoxHeight), Vec3(p.x, p.y, p.z + fBoxHeight + fBoxOver), ColorF(1, 1, 0, 1), ColorF(1, 1, 0, 0));
-        }
-
-        // Draw volume
-        dc.DepthWriteOff();
-        dc.CullOff();
-        dc.pRenderAuxGeom->DrawTriangles(&verts[0], static_cast<uint32>(verts.size()), &inds[0], numInds, &colors[0]);
-        dc.CullOn();
-        dc.DepthWriteOn();
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ProcessKeys()
-{
-    FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
-    if (m_PlayerControl || GetIEditor()->IsInGameMode() || !CheckRespondToInput() || m_freezeViewportInput)
-    {
-        return;
-    }
-
-    //m_Camera.UpdateFrustum();
-    Matrix34 m = GetViewTM();
-    Vec3 ydir = m.GetColumn1().GetNormalized();
-    Vec3 xdir = m.GetColumn0().GetNormalized();
-    Vec3 zdir = m.GetColumn2().GetNormalized();
-
-    Vec3 pos = GetViewTM().GetTranslation();
-
-    float speedScale = AZStd::GetMin(
-        60.0f * GetIEditor()->GetSystem()->GetITimer()->GetFrameTime(), 20.0f);
-
-    speedScale *= GetCameraMoveSpeed();
-
-    // Use the global modifier keys instead of our keymap. It's more reliable.
-    const bool shiftPressed = QGuiApplication::queryKeyboardModifiers() & Qt::ShiftModifier;
-    const bool controlPressed = QGuiApplication::queryKeyboardModifiers() & Qt::ControlModifier;
-
-    if (shiftPressed)
-    {
-        speedScale *= gSettings.cameraFastMoveSpeed;
-    }
-
-    if (controlPressed)
-    {
-        return;
-    }
-
-    bool bIsPressedSome = false;
-
-    if (IsKeyDown(Qt::Key_Up) || IsKeyDown(Qt::Key_W))
-    {
-        // move forward
-        bIsPressedSome = true;
-        pos = pos + (speedScale * m_moveSpeed * ydir);
-    }
-
-    if (IsKeyDown(Qt::Key_Down) || IsKeyDown(Qt::Key_S))
-    {
-        // move backward
-        bIsPressedSome = true;
-        pos = pos - (speedScale * m_moveSpeed * ydir);
-    }
-
-    if (IsKeyDown(Qt::Key_Left) || IsKeyDown(Qt::Key_A))
-    {
-        // move left
-        bIsPressedSome = true;
-        pos = pos - (speedScale * m_moveSpeed * xdir);
-    }
-
-    if (IsKeyDown(Qt::Key_Right) || IsKeyDown(Qt::Key_D))
-    {
-        // move right
-        bIsPressedSome = true;
-        pos = pos + (speedScale * m_moveSpeed * xdir);
-    }
-
-    if (IsKeyDown(Qt::Key_E))
-    {
-        // move Up
-        bIsPressedSome = true;
-        pos = pos + (speedScale * m_moveSpeed * zdir);
-    }
-
-    if (IsKeyDown(Qt::Key_Q))
-    {
-        // move down
-        bIsPressedSome = true;
-        pos = pos - (speedScale * m_moveSpeed * zdir);
-    }
-
-    if (bIsPressedSome)
-    {
-        // Only change the keystate to pressed if it wasn't already marked in
-        // a previous frame. Otherwise, the undo/redo stack will be all off
-        // from what SetViewTM() does.
-        if (m_pressedKeyState == KeyPressedState::AllUp)
-        {
-            m_pressedKeyState = KeyPressedState::PressedThisFrame;
-        }
-
-        m.SetTranslation(pos);
-        SetViewTM(m, true);
-    }
-
-    bool mouseModifierKeysDown = ((QGuiApplication::mouseButtons() & (Qt::RightButton | Qt::MiddleButton)) != 0);
-
-    if (!bIsPressedSome && !mouseModifierKeysDown)
-    {
-        m_pressedKeyState = KeyPressedState::AllUp;
-    }
-}
-
-Vec3 CRenderViewport::WorldToView3D(const Vec3& wp, [[maybe_unused]] int nFlags) const
-{
-    AZ_Assert(m_cameraSetForWidgetRenderingCount > 0,
-        "WorldToView3D was called but viewport widget rendering was not set. PreWidgetRendering must be called before.");
-
-    Vec3 out(0, 0, 0);
-    float x, y, z;
-
-    m_renderer->ProjectToScreen(wp.x, wp.y, wp.z, &x, &y, &z);
-    if (_finite(x) && _finite(y) && _finite(z))
-    {
-        out.x = (x / 100) * m_rcClient.width();
-        out.y = (y / 100) * m_rcClient.height();
-        out.x /= QHighDpiScaling::factor(windowHandle()->screen());
-        out.y /= QHighDpiScaling::factor(windowHandle()->screen());
-        out.z = z;
-    }
-    return out;
-}
-
-//////////////////////////////////////////////////////////////////////////
-QPoint CRenderViewport::WorldToView(const Vec3& wp) const
-{
-    AZ_Assert(m_cameraSetForWidgetRenderingCount > 0,
-        "WorldToView was called but viewport widget rendering was not set. PreWidgetRendering must be called before.");
-
-    QPoint p;
-    float x, y, z;
-
-    m_renderer->ProjectToScreen(wp.x, wp.y, wp.z, &x, &y, &z);
-    if (_finite(x) || _finite(y))
-    {
-        p.rx() = (x / 100) * m_rcClient.width();
-        p.ry() = (y / 100) * m_rcClient.height();
-    }
-    else
-    {
-        QPoint(0, 0);
-    }
-
-    return p;
-}
-//////////////////////////////////////////////////////////////////////////
-QPoint CRenderViewport::WorldToViewParticleEditor(const Vec3& wp, int width, int height) const
-{
-    QPoint p;
-    float x, y, z;
-
-    m_renderer->ProjectToScreen(wp.x, wp.y, wp.z, &x, &y, &z);
-    if (_finite(x) || _finite(y))
-    {
-        p.rx() = (x / 100) * width;
-        p.ry() = (y / 100) * height;
-    }
-    else
-    {
-        QPoint(0, 0);
-    }
-    return p;
-}
-
-//////////////////////////////////////////////////////////////////////////
-Vec3 CRenderViewport::ViewToWorld(const QPoint& vp, bool* collideWithTerrain, bool onlyTerrain, bool bSkipVegetation, bool bTestRenderMesh, bool* collideWithObject) const
-{
-    AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
-
-    // Make sure we initialize the value if a pointer has been passed in
-    if (collideWithTerrain != nullptr)
-    {
-        *collideWithTerrain = false;
-    }
-
-    // Make sure we initialize the value if a pointer has been passed in
-    if (collideWithObject != nullptr)
-{
-        *collideWithObject = false;
-    }
-
-    if (!m_renderer)
-    {
-        return Vec3(0, 0, 0);
-    }
-
-    QRect rc = m_rcClient;
-
-    Vec3 pos0;
-    if (!m_Camera.Unproject(Vec3(vp.x(), rc.bottom() - vp.y(), 0), pos0))
-    {
-        return Vec3(0, 0, 0);
-    }
-    if (!IsVectorInValidRange(pos0))
-    {
-        pos0.Set(0, 0, 0);
-    }
-
-    Vec3 pos1;
-    if (!m_Camera.Unproject(Vec3(vp.x(), rc.bottom() - vp.y(), 1), pos1))
-    {
-        return Vec3(0, 0, 0);
-    }
-    if (!IsVectorInValidRange(pos1))
-    {
-        pos1.Set(1, 0, 0);
-    }
-
-    const float maxDistance = 10000.f;
-
-    Vec3 v = (pos1 - pos0);
-    v = v.GetNormalized();
-    v = v * maxDistance;
-
-    if (!_finite(v.x) || !_finite(v.y) || !_finite(v.z))
-    {
-        return Vec3(0, 0, 0);
-    }
-
-    Vec3 colp = pos0 + 0.002f * v;
-
-    AZ_UNUSED(vp)
-    AZ_UNUSED(bTestRenderMesh)
-    AZ_UNUSED(bSkipVegetation)
-    AZ_UNUSED(bSkipVegetation)
-    AZStd::optional<AZStd::pair<float, AZ::Vector3>> hitDistancePosition;
-
-    if (!onlyTerrain && !GetIEditor()->IsTerrainAxisIgnoreObjects())
-    {
-        AzFramework::EntityContextId editorContextId;
-        AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
-            editorContextId, &AzToolsFramework::EditorEntityContextRequests::GetEditorEntityContextId);
-
-        AzFramework::RenderGeometry::RayRequest ray;
-        ray.m_startWorldPosition = LYVec3ToAZVec3(pos0);
-        ray.m_endWorldPosition = LYVec3ToAZVec3(pos0 + v);
-        ray.m_onlyVisible = true;
-
-        AzFramework::RenderGeometry::RayResult result;
-        AzFramework::RenderGeometry::IntersectorBus::EventResult(result, editorContextId,
-            &AzFramework::RenderGeometry::IntersectorInterface::RayIntersect, ray);
-
-        if (result)
-        {
-            if (!hitDistancePosition || result.m_distance < hitDistancePosition->first)
-            {
-                hitDistancePosition = {result.m_distance, result.m_worldPosition};
-                if (collideWithObject)
-                {
-                    *collideWithObject = true;
-                }
-            }
-        }
-    }
-
-    if (hitDistancePosition)
-    {
-        colp = AZVec3ToLYVec3(hitDistancePosition->second);
-    }
-
-
-    return colp;
-}
-
-//////////////////////////////////////////////////////////////////////////
-Vec3 CRenderViewport::ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh)
-{
-    AZ_UNUSED(vp)
-    AZ_UNUSED(bTestRenderMesh)
-
-    AZ_Assert(m_cameraSetForWidgetRenderingCount > 0,
-        "ViewToWorldNormal was called but viewport widget rendering was not set. PreWidgetRendering must be called before.");
-
-    AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
-
-    if (!m_renderer)
-    {
-        return Vec3(0, 0, 1);
-    }
-
-    QRect rc = m_rcClient;
-
-    Vec3 pos0, pos1;
-    float wx, wy, wz;
-    m_renderer->UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 0, &wx, &wy, &wz);
-    if (!_finite(wx) || !_finite(wy) || !_finite(wz))
-    {
-        return Vec3(0, 0, 1);
-    }
-    pos0(wx, wy, wz);
-    if (!IsVectorInValidRange(pos0))
-    {
-        pos0.Set(0, 0, 0);
-    }
-
-    m_renderer->UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 1, &wx, &wy, &wz);
-    if (!_finite(wx) || !_finite(wy) || !_finite(wz))
-    {
-        return Vec3(0, 0, 1);
-    }
-    pos1(wx, wy, wz);
-
-    Vec3 v = (pos1 - pos0);
-    if (!IsVectorInValidRange(pos1))
-    {
-        pos1.Set(1, 0, 0);
-    }
-
-    const float maxDistance = 2000.f;
-    v = v.GetNormalized();
-    v = v * maxDistance;
-
-    if (!_finite(v.x) || !_finite(v.y) || !_finite(v.z))
-    {
-        return Vec3(0, 0, 1);
-    }
-
-    Vec3 colp(0, 0, 0);
-
-
-    AZStd::optional<AZStd::pair<float, AZ::Vector3>> hitDistanceNormal;
-
-    if (!onlyTerrain && !GetIEditor()->IsTerrainAxisIgnoreObjects())
-    {
-        AzFramework::EntityContextId editorContextId;
-        AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
-            editorContextId, &AzToolsFramework::EditorEntityContextRequests::GetEditorEntityContextId);
-
-        AzFramework::RenderGeometry::RayRequest ray;
-        ray.m_startWorldPosition = LYVec3ToAZVec3(pos0);
-        ray.m_endWorldPosition = LYVec3ToAZVec3(pos0 + v);
-        ray.m_onlyVisible = true;
-
-        AzFramework::RenderGeometry::RayResult result;
-        AzFramework::RenderGeometry::IntersectorBus::EventResult(result, editorContextId,
-            &AzFramework::RenderGeometry::IntersectorInterface::RayIntersect, ray);
-
-        if (result)
-        {
-            if (!hitDistanceNormal || result.m_distance < hitDistanceNormal->first)
-            {
-                hitDistanceNormal = { result.m_distance, result.m_worldNormal };
-            }
-        }
-    }
-
-    return hitDistanceNormal ? AZVec3ToLYVec3(hitDistanceNormal->second) : Vec3(0, 0, 1);
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const
-{
-    Matrix34A objMat, objMatInv;
-    Matrix33 objRot, objRotInv;
-
-    if (hit.pCollider->GetiForeignData() != PHYS_FOREIGN_ID_STATIC)
-    {
-        return false;
-    }
-
-    IRenderNode* pNode = (IRenderNode*) hit.pCollider->GetForeignData(PHYS_FOREIGN_ID_STATIC);
-    if (!pNode || !pNode->GetEntityStatObj())
-    {
-        return false;
-    }
-
-    IStatObj* pEntObject  = pNode->GetEntityStatObj(hit.partid, 0, &objMat, false);
-    if (!pEntObject || !pEntObject->GetRenderMesh())
-    {
-        return false;
-    }
-
-    objRot = Matrix33(objMat);
-    objRot.NoScale(); // No scale.
-    objRotInv = objRot;
-    objRotInv.Invert();
-
-    float fWorldScale = objMat.GetColumn(0).GetLength(); // GetScale
-    float fWorldScaleInv = 1.0f / fWorldScale;
-
-    // transform decal into object space
-    objMatInv = objMat;
-    objMatInv.Invert();
-
-    // put into normal object space hit direction of projection
-    Vec3 invhitn = -(hit.n);
-    Vec3 vOS_HitDir = objRotInv.TransformVector(invhitn).GetNormalized();
-
-    // put into position object space hit position
-    Vec3 vOS_HitPos = objMatInv.TransformPoint(hit.pt);
-    vOS_HitPos -= vOS_HitDir * RENDER_MESH_TEST_DISTANCE * fWorldScaleInv;
-
-    IRenderMesh* pRM = pEntObject->GetRenderMesh();
-
-    AABB aabbRNode;
-    pRM->GetBBox(aabbRNode.min, aabbRNode.max);
-    Vec3 vOut(0, 0, 0);
-    if (!Intersect::Ray_AABB(Ray(vOS_HitPos, vOS_HitDir), aabbRNode, vOut))
-    {
-        return false;
-    }
-
-    if (!pRM || !pRM->GetVerticesCount())
-    {
-        return false;
-    }
-
-    if (RayRenderMeshIntersection(pRM, vOS_HitPos, vOS_HitDir, outPos, outNormal))
-    {
-        outNormal = objRot.TransformVector(outNormal).GetNormalized();
-        outPos = objMat.TransformPoint(outPos);
-        return true;
-    }
-    return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::RayRenderMeshIntersection(IRenderMesh*, const Vec3&, const Vec3&, Vec3&, Vec3&) const
-{
-    return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const
-{
-    AZ_Assert(m_cameraSetForWidgetRenderingCount > 0,
-        "ViewToWorldRay was called but SScopedCurrentContext was not set at a higher scope! This means the camera for this call is incorrect.");
-
-    if (!m_renderer)
-    {
-        return;
-    }
-
-    QRect rc = m_rcClient;
-
-    Vec3 pos0, pos1;
-    float wx, wy, wz;
-    m_renderer->UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 0, &wx, &wy, &wz);
-    if (!_finite(wx) || !_finite(wy) || !_finite(wz))
-    {
-        return;
-    }
-    if (fabs(wx) > 1000000 || fabs(wy) > 1000000 || fabs(wz) > 1000000)
-    {
-        return;
-    }
-    pos0(wx, wy, wz);
-    m_renderer->UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 1, &wx, &wy, &wz);
-    if (!_finite(wx) || !_finite(wy) || !_finite(wz))
-    {
-        return;
-    }
-    if (fabs(wx) > 1000000 || fabs(wy) > 1000000 || fabs(wz) > 1000000)
-    {
-        return;
-    }
-    pos1(wx, wy, wz);
-
-    Vec3 v = (pos1 - pos0);
-    v = v.GetNormalized();
-
-    raySrc = pos0;
-    rayDir = v;
-}
-
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetScreenScaleFactor(const Vec3& worldPoint) const
-{
-    float dist = m_Camera.GetPosition().GetDistance(worldPoint);
-    if (dist < m_Camera.GetNearPlane())
-    {
-        dist = m_Camera.GetNearPlane();
-    }
-    return dist;
-}
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position)
-{
-    Vec3 camPos = camera.GetPosition();
-    float dist = camPos.GetDistance(object_position);
-    return dist;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnDestroy()
-{
-    DestroyRenderContext();
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::CheckRespondToInput() const
-{
-    if (!Editor::EditorQtApplication::IsActive())
-    {
-        return false;
-    }
-
-    if (!hasFocus())
-    {
-        return false;
-    }
-
-    return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::HitTest(const QPoint& point, HitContext& hitInfo)
-{
-    hitInfo.camera = &m_Camera;
-    hitInfo.pExcludedObject = GetCameraObject();
-    return QtViewport::HitTest(point, hitInfo);
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::IsBoundsVisible(const AABB& box) const
-{
-    // If at least part of bbox is visible then its visible.
-    return m_Camera.IsAABBVisible_F(AABB(box.min, box.max));
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::CenterOnSelection()
-{
-    if (!GetIEditor()->GetSelection()->IsEmpty())
-    {
-        // Get selection bounds & center
-        CSelectionGroup* sel = GetIEditor()->GetSelection();
-        AABB selectionBounds = sel->GetBounds();
-        CenterOnAABB(selectionBounds);
-    }
-}
-
-void CRenderViewport::CenterOnAABB(const AABB& aabb)
-{
-    Vec3 selectionCenter = aabb.GetCenter();
-
-    // Minimum center size is 40cm
-    const float minSelectionRadius = 0.4f;
-    const float selectionSize = std::max(minSelectionRadius, aabb.GetRadius());
-
-    // Move camera 25% further back than required
-    const float centerScale = 1.25f;
-
-    // Decompose original transform matrix
-    const Matrix34& originalTM = GetViewTM();
-    AffineParts affineParts;
-    affineParts.SpectralDecompose(originalTM);
-
-    // Forward vector is y component of rotation matrix
-    Matrix33 rotationMatrix(affineParts.rot);
-    const Vec3 viewDirection = rotationMatrix.GetColumn1().GetNormalized();
-
-    // Compute adjustment required by FOV != 90 degrees
-    const float fov = GetFOV();
-    const float fovScale = (1.0f / tan(fov * 0.5f));
-
-    // Compute new transform matrix
-    const float distanceToTarget = selectionSize * fovScale * centerScale;
-    const Vec3 newPosition = selectionCenter - (viewDirection * distanceToTarget);
-    Matrix34 newTM = Matrix34(rotationMatrix, newPosition);
-
-    // Set new orbit distance
-    m_orbitDistance = distanceToTarget;
-    m_orbitDistance = fabs(m_orbitDistance);
-
-    SetViewTM(newTM);
-}
-
-void CRenderViewport::CenterOnSliceInstance()
-{
-    AzToolsFramework::EntityIdList selectedEntityList;
-    AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
-
-    AZ::SliceComponent::SliceInstanceAddress sliceAddress;
-    AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(sliceAddress,
-        &AzToolsFramework::ToolsApplicationRequestBus::Events::FindCommonSliceInstanceAddress, selectedEntityList);
-
-    if (!sliceAddress.IsValid())
-    {
-        return;
-    }
-
-    AZ::EntityId sliceRootEntityId;
-    AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(sliceRootEntityId,
-        &AzToolsFramework::ToolsApplicationRequestBus::Events::GetRootEntityIdOfSliceInstance, sliceAddress);
-
-    if (!sliceRootEntityId.IsValid())
-    {
-        return;
-    }
-
-    AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
-        &AzToolsFramework::ToolsApplicationRequestBus::Events::SetSelectedEntities, AzToolsFramework::EntityIdList{sliceRootEntityId});
-
-    const AZ::SliceComponent::InstantiatedContainer* instantiatedContainer = sliceAddress.GetInstance()->GetInstantiated();
-
-    AABB aabb(Vec3(std::numeric_limits<float>::max()), Vec3(-std::numeric_limits<float>::max()));
-    for (AZ::Entity* entity : instantiatedContainer->m_entities)
-    {
-        CEntityObject* entityObject = nullptr;
-        AzToolsFramework::ComponentEntityEditorRequestBus::EventResult(entityObject, entity->GetId(),
-            &AzToolsFramework::ComponentEntityEditorRequestBus::Events::GetSandboxObject);
-        AABB box;
-        entityObject->GetBoundBox(box);
-        aabb.Add(box.min);
-        aabb.Add(box.max);
-    }
-    CenterOnAABB(aabb);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetFOV(float fov)
-{
-    if (m_pCameraFOVVariable)
-    {
-        m_pCameraFOVVariable->Set(fov);
-    }
-    else
-    {
-        m_camFOV = fov;
-    }
-
-    if (m_viewPane)
-    {
-        m_viewPane->OnFOVChanged(fov);
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetFOV() const
-{
-    if (m_viewSourceType == ViewSourceType::SequenceCamera)
-    {
-        CBaseObject* cameraObject = GetCameraObject();
-
-        AZ::EntityId cameraEntityId;
-        AzToolsFramework::ComponentEntityObjectRequestBus::EventResult(cameraEntityId, cameraObject, &AzToolsFramework::ComponentEntityObjectRequestBus::Events::GetAssociatedEntityId);
-        if (cameraEntityId.IsValid())
-        {
-            // component Camera
-            float fov = DEFAULT_FOV;
-            Camera::CameraRequestBus::EventResult(fov, cameraEntityId, &Camera::CameraComponentRequests::GetFov);
-            return AZ::DegToRad(fov);
-        }
-    }
-
-    if (m_pCameraFOVVariable)
-    {
-        float fov;
-        m_pCameraFOVVariable->Get(fov);
-        return fov;
-    }
-    else if (m_viewEntityId.IsValid())
-    {
-        float fov = AZ::RadToDeg(m_camFOV);
-        Camera::CameraRequestBus::EventResult(fov, m_viewEntityId, &Camera::CameraComponentRequests::GetFov);
-        return AZ::DegToRad(fov);
-    }
-
-    return m_camFOV;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::CreateRenderContext()
-{
-    // Create context.
-    if (m_renderer && !m_bRenderContextCreated)
-    {
-        m_bRenderContextCreated = true;
-
-        AzFramework::WindowRequestBus::Handler::BusConnect(renderOverlayHWND());
-        AzFramework::WindowSystemNotificationBus::Broadcast(&AzFramework::WindowSystemNotificationBus::Handler::OnWindowCreated, renderOverlayHWND());
-
-        WIN_HWND oldContext = m_renderer->GetCurrentContextHWND();
-        m_renderer->CreateContext(renderOverlayHWND());
-        m_renderer->SetCurrentContext(oldContext); // restore prior context
-        return true;
-    }
-    return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::DestroyRenderContext()
-{
-    // Destroy render context.
-    if (m_renderer && m_bRenderContextCreated)
-    {
-        // Do not delete primary context.
-        if (m_hwnd != m_renderer->GetHWND())
-        {
-            m_renderer->DeleteContext(m_hwnd);
-        }
-        m_bRenderContextCreated = false;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetDefaultCamera()
-{
-    if (IsDefaultCamera())
-    {
-        return;
-    }
-    ResetToViewSourceType(ViewSourceType::None);
-    GetViewManager()->SetCameraObjectId(m_cameraObjectId);
-    SetName(m_defaultViewName);
-    SetViewTM(m_defaultViewTM);
-    PostCameraSet();
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::IsDefaultCamera() const
-{
-    return m_viewSourceType == ViewSourceType::None;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetSequenceCamera()
-{
-    if (m_viewSourceType == ViewSourceType::SequenceCamera)
-    {
-        // Reset if we were checked before
-        SetDefaultCamera();
-    }
-    else
-    {
-        ResetToViewSourceType(ViewSourceType::SequenceCamera);
-
-        SetName(tr("Sequence Camera"));
-        SetViewTM(GetViewTM());
-
-        GetViewManager()->SetCameraObjectId(m_cameraObjectId);
-        PostCameraSet();
-
-        // ForceAnimation() so Track View will set the Camera params
-        // if a camera is animated in the sequences.
-        if (GetIEditor() && GetIEditor()->GetAnimation())
-        {
-            GetIEditor()->GetAnimation()->ForceAnimation();
-    }
-}
-}
-
-//////////////////////////////////////////////////////////////////////////
-void  CRenderViewport::SetComponentCamera(const AZ::EntityId& entityId)
-{
-    ResetToViewSourceType(ViewSourceType::CameraComponent);
-    SetViewEntity(entityId);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void  CRenderViewport::SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement)
-{
-    ResetToViewSourceType(ViewSourceType::AZ_Entity);
-    SetViewEntity(entityId, lockCameraMovement);
-}
-
-void CRenderViewport::SetFirstComponentCamera()
-{
-    AZ::EBusAggregateResults<AZ::EntityId> results;
-    Camera::CameraBus::BroadcastResult(results, &Camera::CameraRequests::GetCameras);
-    AZStd::sort_heap(results.values.begin(), results.values.end());
-    AZ::EntityId entityId;
-    if (results.values.size() > 0)
-    {
-        entityId = results.values[0];
-    }
-    SetComponentCamera(entityId);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetSelectedCamera()
-{
-    AZ::EBusAggregateResults<AZ::EntityId> cameraList;
-    Camera::CameraBus::BroadcastResult(cameraList, &Camera::CameraRequests::GetCameras);
-    if (cameraList.values.size() > 0)
-    {
-        AzToolsFramework::EntityIdList selectedEntityList;
-        AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
-        for (const AZ::EntityId& entityId : selectedEntityList)
-        {
-            if (AZStd::find(cameraList.values.begin(), cameraList.values.end(), entityId) != cameraList.values.end())
-            {
-                SetComponentCamera(entityId);
-            }
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::IsSelectedCamera() const
-{
-    CBaseObject* pCameraObject = GetCameraObject();
-    if (pCameraObject && pCameraObject == GetIEditor()->GetSelectedObject())
-    {
-        return true;
-    }
-
-    AzToolsFramework::EntityIdList selectedEntityList;
-    AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(
-        selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
-
-    if ((m_viewSourceType == ViewSourceType::CameraComponent  || m_viewSourceType == ViewSourceType::AZ_Entity)
-        && !selectedEntityList.empty()
-        && AZStd::find(selectedEntityList.begin(), selectedEntityList.end(), m_viewEntityId) != selectedEntityList.end())
-    {
-        return true;
-    }
-
-    return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::CycleCamera()
-{
-    // None -> Sequence -> LegacyCamera -> ... LegacyCamera -> CameraComponent -> ... CameraComponent -> None
-    // AZ_Entity has been intentionally left out of the cycle for now.
-    switch (m_viewSourceType)
-    {
-    case CRenderViewport::ViewSourceType::None:
-    {
-        SetFirstComponentCamera();
-        break;
-    }
-    case CRenderViewport::ViewSourceType::SequenceCamera:
-    {
-        AZ_Error("CRenderViewport", false, "Legacy cameras no longer exist, unable to set sequence camera.");
-        break;
-    }
-    case CRenderViewport::ViewSourceType::LegacyCamera:
-    {
-        AZ_Warning("CRenderViewport", false, "Legacy cameras no longer exist, using first found component camera instead.");
-        SetFirstComponentCamera();
-        break;
-    }
-    case CRenderViewport::ViewSourceType::CameraComponent:
-    {
-        AZ::EBusAggregateResults<AZ::EntityId> results;
-        Camera::CameraBus::BroadcastResult(results, &Camera::CameraRequests::GetCameras);
-        AZStd::sort_heap(results.values.begin(), results.values.end());
-        auto&& currentCameraIterator = AZStd::find(results.values.begin(), results.values.end(), m_viewEntityId);
-        if (currentCameraIterator != results.values.end())
-        {
-            ++currentCameraIterator;
-            if (currentCameraIterator != results.values.end())
-            {
-                SetComponentCamera(*currentCameraIterator);
-                break;
-            }
-        }
-        SetDefaultCamera();
-        break;
-    }
-    case CRenderViewport::ViewSourceType::AZ_Entity:
-    {
-        // we may decide to have this iterate over just selected entities
-        SetDefaultCamera();
-        break;
-    }
-    default:
-    {
-        SetDefaultCamera();
-        break;
-    }
-    }
-}
-
-void CRenderViewport::SetViewFromEntityPerspective(const AZ::EntityId& entityId)
-{
-    SetViewAndMovementLockFromEntityPerspective(entityId, false);
-}
-
-void CRenderViewport::SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement)
-{
-    if (!m_ignoreSetViewFromEntityPerspective)
-    {
-        SetEntityAsCamera(entityId, lockCameraMovement);
-    }
-}
-
-bool CRenderViewport::GetActiveCameraPosition(AZ::Vector3& cameraPos)
-{
-    cameraPos = LYVec3ToAZVec3(m_viewTM.GetTranslation());
-    return true;
-}
-
-bool CRenderViewport::GetActiveCameraState(AzFramework::CameraState& cameraState)
-{
-    if (m_pPrimaryViewport == this)
-    {
-        if (GetIEditor()->IsInGameMode())
-        {
-            return false;
-        }
-        else
-        {
-            const auto& camera = GetCamera();
-            cameraState = CameraStateFromCCamera(camera, GetFOV(), m_rcClient.width(), m_rcClient.height());
-        }
-
-        return true;
-    }
-
-    return false;
-}
-
-void CRenderViewport::OnStartPlayInEditor()
-{
-    if (m_viewEntityId.IsValid())
-    {
-        m_viewEntityIdCachedForEditMode = m_viewEntityId;
-        AZ::EntityId runtimeEntityId;
-        AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
-            &AzToolsFramework::EditorEntityContextRequestBus::Events::MapEditorIdToRuntimeId,
-            m_viewEntityId, runtimeEntityId);
-
-        m_viewEntityId = runtimeEntityId;
-    }
-    // Force focus the render viewport, otherwise we don't receive keyPressEvents until the user first clicks a
-    // mouse button. See also CRenderViewport::mousePressEvent for a deatiled description of the underlying bug.
-    // We need to queue this up because we don't actually lose focus until sometime after this function returns.
-    QTimer::singleShot(0, this, &CRenderViewport::ActivateWindowAndSetFocus);
-}
-
-void CRenderViewport::OnStopPlayInEditor()
-{
-    if (m_viewEntityIdCachedForEditMode.IsValid())
-    {
-        m_viewEntityId = m_viewEntityIdCachedForEditMode;
-        m_viewEntityIdCachedForEditMode.SetInvalid();
-    }
-}
-
-void CRenderViewport::ActivateWindowAndSetFocus()
-{
-    window()->activateWindow();
-    setFocus();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderConstructionPlane()
-{
-    // noop
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderSnappingGrid()
-{
-    // noop
-}
-
-//////////////////////////////////////////////////////////////////////////
-CRenderViewport::SPreviousContext CRenderViewport::SetCurrentContext(int newWidth, int newHeight) const
-{
-    SPreviousContext x;
-    x.window = reinterpret_cast<HWND>(m_renderer->GetCurrentContextHWND());
-    x.mainViewport = m_renderer->IsCurrentContextMainVP();
-    x.width = m_renderer->GetCurrentContextViewportWidth();
-    x.height = m_renderer->GetCurrentContextViewportHeight();
-    x.rendererCamera = m_renderer->GetCamera();
-
-    const float scale = CLAMP(gEnv->pConsole->GetCVar("r_ResolutionScale")->GetFVal(), MIN_RESOLUTION_SCALE, MAX_RESOLUTION_SCALE);
-    const QSize newSize = WidgetToViewport(QSize(newWidth, newHeight)) * scale;
-
-    // No way to query the requested Qt scale here, so do it this way for now
-    float widthScale = aznumeric_cast<float>(newSize.width()) / aznumeric_cast<float>(newWidth);
-    float heightScale = aznumeric_cast<float>(newSize.height()) / aznumeric_cast<float>(newHeight);
-
-    m_renderer->SetCurrentContext(renderOverlayHWND());
-    m_renderer->ChangeViewport(0, 0, newWidth, newHeight, true, widthScale, heightScale);
-    m_renderer->SetCamera(m_Camera);
-
-    return x;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CRenderViewport::SPreviousContext CRenderViewport::SetCurrentContext() const
-{
-    const auto r = rect();
-    return SetCurrentContext(r.width(), r.height());
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RestorePreviousContext(const SPreviousContext& x) const
-{
-    if (x.window && x.window != m_renderer->GetCurrentContextHWND())
-    {
-        m_renderer->SetCurrentContext(x.window);
-        m_renderer->ChangeViewport(0, 0, x.width, x.height, x.mainViewport);
-        m_renderer->SetCamera(x.rendererCamera);
-    }
-}
-
-void CRenderViewport::PreWidgetRendering()
-{
-    // if we have not already set the render context for the viewport, do it now
-    // based on the current state of the renderer/viewport, record the previous
-    // context to restore afterwards
-    if (m_cameraSetForWidgetRenderingCount == 0)
-    {
-        m_preWidgetContext = SetCurrentContext();
-    }
-
-    // keep track of how many times we've attempted to update the context
-    m_cameraSetForWidgetRenderingCount++;
-}
-
-void CRenderViewport::PostWidgetRendering()
-{
-    if (m_cameraSetForWidgetRenderingCount > 0)
-    {
-        m_cameraSetForWidgetRenderingCount--;
-
-        // unwinding - when the viewport context is no longer required,
-        // restore the previous context when widget rendering first began
-        if (m_cameraSetForWidgetRenderingCount == 0)
-        {
-            RestorePreviousContext(m_preWidgetContext);
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnCameraFOVVariableChanged([[maybe_unused]] IVariable* var)
-{
-    if (m_viewPane)
-    {
-        m_viewPane->OnFOVChanged(GetFOV());
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::HideCursor()
-{
-    if (m_bCursorHidden || !gSettings.viewports.bHideMouseCursorWhenCaptured)
-    {
-        return;
-    }
-
-    qApp->setOverrideCursor(Qt::BlankCursor);
-#if AZ_TRAIT_OS_PLATFORM_APPLE
-    StartFixedCursorMode(this);
-#endif
-    m_bCursorHidden = true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ShowCursor()
-{
-    if (!m_bCursorHidden || !gSettings.viewports.bHideMouseCursorWhenCaptured)
-    {
-        return;
-    }
-
-#if AZ_TRAIT_OS_PLATFORM_APPLE
-    StopFixedCursorMode();
-#endif
-    qApp->restoreOverrideCursor();
-    m_bCursorHidden = false;
-}
-
-bool CRenderViewport::IsKeyDown(Qt::Key key) const
-{
-    return m_keyDown.contains(key);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::PushDisableRendering()
-{
-    assert(m_disableRenderingCount >= 0);
-    ++m_disableRenderingCount;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::PopDisableRendering()
-{
-    assert(m_disableRenderingCount >= 1);
-    --m_disableRenderingCount;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::IsRenderingDisabled() const
-{
-    return m_disableRenderingCount > 0;
-}
-
-//////////////////////////////////////////////////////////////////////////
-QPoint CRenderViewport::WidgetToViewport(const QPoint &point) const
-{
-    return point * WidgetToViewportFactor();
-}
-
-QPoint CRenderViewport::ViewportToWidget(const QPoint &point) const
-{
-    return point / WidgetToViewportFactor();
-}
-
-//////////////////////////////////////////////////////////////////////////
-QSize CRenderViewport::WidgetToViewport(const QSize &size) const
-{
-    return size * WidgetToViewportFactor();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::BeginUndoTransaction()
-{
-    PushDisableRendering();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::EndUndoTransaction()
-{
-    PopDisableRendering();
-    Update();
-}
-
-void CRenderViewport::UpdateCurrentMousePos(const QPoint& newPosition)
-{
-    m_prevMousePos = m_mousePos;
-    m_mousePos = newPosition;
-}
-
-void CRenderViewport::BuildDragDropContext(AzQtComponents::ViewportDragContext& context, const QPoint& pt)
-{
-    const auto scaledPoint = WidgetToViewport(pt);
-    QtViewport::BuildDragDropContext(context, scaledPoint);
-}
-
-void* CRenderViewport::GetSystemCursorConstraintWindow() const
-{
-    AzFramework::SystemCursorState systemCursorState = AzFramework::SystemCursorState::Unknown;
-
-    AzFramework::InputSystemCursorRequestBus::EventResult(
-        systemCursorState,
-        AzFramework::InputDeviceMouse::Id,
-        &AzFramework::InputSystemCursorRequests::GetSystemCursorState);
-
-    const bool systemCursorConstrained =
-        (systemCursorState == AzFramework::SystemCursorState::ConstrainedAndHidden ||
-         systemCursorState == AzFramework::SystemCursorState::ConstrainedAndVisible);
-
-    return systemCursorConstrained ? renderOverlayHWND() : nullptr;
-}
-
-void CRenderViewport::RestoreViewportAfterGameMode()
-{
-    Matrix34 preGameModeViewTM = m_preGameModeViewTM;
-
-    QString text =
-        QString(
-            tr("When leaving \" Game Mode \" the engine will automatically restore your camera position to the default position before you "
-            "had entered Game mode.<br/><br/><small>If you dislike this setting you can always change this anytime in the global "
-            "preferences.</small><br/><br/>"))
-            .arg(EditorPreferencesGeneralRestoreViewportCameraSettingName);
-    QString restoreOnExitGameModePopupDisabledRegKey("Editor/AutoHide/ViewportCameraRestoreOnExitGameMode");
-
-    // Read the popup disabled registry value
-    QSettings settings;
-    QVariant restoreOnExitGameModePopupDisabledRegValue = settings.value(restoreOnExitGameModePopupDisabledRegKey);
-
-    // Has the user previously disabled being asked about restoring the camera on exiting game mode?
-    if (restoreOnExitGameModePopupDisabledRegValue.isNull())
-    {
-        // No, ask them now
-        QMessageBox messageBox(QMessageBox::Question, "O3DE", text, QMessageBox::StandardButtons(QMessageBox::No | QMessageBox::Yes), this);
-        messageBox.setDefaultButton(QMessageBox::Yes);
-
-        QCheckBox* checkBox = new QCheckBox(QStringLiteral("Do not show this message again"));
-        checkBox->setChecked(true);
-        messageBox.setCheckBox(checkBox);
-
-        // Unconstrain the system cursor and make it visible before we show the dialog box, otherwise the user can't see the cursor.
-        AzFramework::InputSystemCursorRequestBus::Event(AzFramework::InputDeviceMouse::Id,
-            &AzFramework::InputSystemCursorRequests::SetSystemCursorState,
-            AzFramework::SystemCursorState::UnconstrainedAndVisible);
-
-        int response = messageBox.exec();
-
-        if (checkBox->isChecked())
-        {
-            settings.setValue(restoreOnExitGameModePopupDisabledRegKey, response);
-        }
-
-        // Update the value only if the popup hasn't previously been disabled and the value has changed
-        bool newSetting = (response == QMessageBox::Yes);
-        if (newSetting != GetIEditor()->GetEditorSettings()->restoreViewportCamera)
-        {
-            GetIEditor()->GetEditorSettings()->restoreViewportCamera = newSetting;
-            GetIEditor()->GetEditorSettings()->Save();
-        }
-    }
-
-    bool restoreViewportCamera = GetIEditor()->GetEditorSettings()->restoreViewportCamera;
-    if (restoreViewportCamera)
-    {
-        SetViewTM(preGameModeViewTM);
-    }
-    else
-    {
-        SetViewTM(m_gameTM);
-    }
-}
-
-#include <moc_RenderViewport.cpp>

+ 0 - 649
Code/Editor/RenderViewport.h

@@ -1,649 +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_RENDERVIEWPORT_H
-#define CRYINCLUDE_EDITOR_RENDERVIEWPORT_H
-
-#pragma once
-// RenderViewport.h : header file
-//
-
-#if !defined(Q_MOC_RUN)
-#include <Cry_Camera.h>
-
-#include <QSet>
-
-#include "Viewport.h"
-#include "Objects/DisplayContext.h"
-#include "Undo/Undo.h"
-#include "Util/PredefinedAspectRatios.h"
-
-#include <AzCore/Component/EntityId.h>
-#include <AzCore/std/optional.h>
-#include <AzFramework/Input/Buses/Requests/InputSystemCursorRequestBus.h>
-#include <AzToolsFramework/API/ToolsApplicationAPI.h>
-#include <AzToolsFramework/API/EditorCameraBus.h>
-#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
-#include <AzToolsFramework/Viewport/ViewportMessages.h>
-#include <MathConversion.h>
-#endif
-
-#include <AzFramework/Windowing/WindowBus.h>
-#include <AzFramework/Visibility/EntityVisibilityQuery.h>
-
-// forward declarations.
-class CBaseObject;
-class QMenu;
-class QKeyEvent;
-class EditorEntityNotifications;
-struct ray_hit;
-struct IRenderMesh;
-struct IVariable;
-
-namespace AzToolsFramework
-{
-    class ManipulatorManager;
-}
-
-// CRenderViewport window
-AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
-AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-class SANDBOX_API CRenderViewport
-    : public QtViewport
-    , public IEditorNotifyListener
-    , public IUndoManagerListener
-    , public Camera::EditorCameraRequestBus::Handler
-    , public AzFramework::InputSystemCursorConstraintRequestBus::Handler
-    , public AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler
-    , public AzToolsFramework::ViewportInteraction::ViewportInteractionRequestBus::Handler
-    , public AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
-    , public AzFramework::WindowRequestBus::Handler
-{
-AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
-    Q_OBJECT
-public:
-    struct SResolution
-    {
-        SResolution()
-            : width(0)
-            , height(0)
-        {
-        }
-
-        SResolution(int w, int h)
-            : width(w)
-            , height(h)
-        {
-        }
-
-        int width;
-        int height;
-    };
-
-public:
-    CRenderViewport(const QString& name, QWidget* parent = nullptr);
-
-    static const GUID& GetClassID()
-    {
-        return QtViewport::GetClassID<CRenderViewport>();
-    }
-
-    /** Get type of this viewport.
-    */
-    virtual EViewportType GetType() const { return ET_ViewportCamera; }
-    virtual void SetType([[maybe_unused]] EViewportType type) { assert(type == ET_ViewportCamera); };
-
-    // Implementation
-public:
-    virtual ~CRenderViewport();
-
-    Q_INVOKABLE void InjectFakeMouseMove(int deltaX, int deltaY, Qt::MouseButtons buttons);
-
-public:
-    virtual void Update();
-
-    virtual void ResetContent();
-    virtual void UpdateContent(int flags);
-
-    void OnTitleMenu(QMenu* menu) override;
-
-    void SetCamera(const CCamera& camera);
-    const CCamera& GetCamera() const { return m_Camera; };
-    virtual void SetViewTM(const Matrix34& tm)
-    {
-        if (m_viewSourceType == ViewSourceType::None)
-        {
-            m_defaultViewTM = tm;
-        }
-        SetViewTM(tm, false);
-    }
-
-    //! Map world space position to viewport position.
-    virtual QPoint WorldToView(const Vec3& wp) const;
-    virtual QPoint WorldToViewParticleEditor(const Vec3& wp, int width, int height) const;
-    virtual Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const;
-
-    //! Map viewport position to world space position.
-    virtual Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
-    virtual void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override;
-    virtual Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) override;
-    virtual float GetScreenScaleFactor(const Vec3& worldPoint) const;
-    virtual float GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position);
-    virtual float GetAspectRatio() const;
-    virtual bool HitTest(const QPoint& point, HitContext& hitInfo);
-    virtual bool IsBoundsVisible(const AABB& box) const;
-    virtual void CenterOnSelection();
-    virtual void CenterOnAABB(const AABB& aabb);
-    void CenterOnSliceInstance() override;
-
-    void focusOutEvent(QFocusEvent* event) override;
-    void keyPressEvent(QKeyEvent* event) override;
-    void keyReleaseEvent(QKeyEvent* event) override;
-
-    void SetFOV(float fov);
-    float GetFOV() const;
-
-    void SetDefaultCamera();
-    bool IsDefaultCamera() const;
-    void SetSequenceCamera();
-    bool IsSequenceCamera() const { return m_viewSourceType == ViewSourceType::SequenceCamera; }
-    void SetSelectedCamera();
-    bool IsSelectedCamera() const;
-    void SetComponentCamera(const AZ::EntityId& entityId);
-    void SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement = false);
-    void SetFirstComponentCamera();
-    void SetViewEntity(const AZ::EntityId& cameraEntityId, bool lockCameraMovement = false);
-    void PostCameraSet();
-    // This switches the active camera to the next one in the list of (default, all custom cams).
-    void CycleCamera();
-
-    // Camera::EditorCameraRequestBus
-    void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
-    void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
-    AZ::EntityId GetCurrentViewEntityId() override { return m_viewEntityId; }
-    bool GetActiveCameraPosition(AZ::Vector3& cameraPos) override;
-    bool GetActiveCameraState(AzFramework::CameraState& cameraState) override;
-
-    // AzToolsFramework::EditorEntityContextNotificationBus (handler moved to cpp to resolve link issues in unity builds)
-    virtual void OnStartPlayInEditor();
-    virtual void OnStopPlayInEditor();
-
-    // AzToolsFramework::EditorContextMenu::Bus (handler moved to cpp to resolve link issues in unity builds)
-    // We use this to determine when the viewport context menu is being displayed so we can exit move mode
-    void PopulateEditorGlobalContextMenu(QMenu* /*menu*/, const AZ::Vector2& /*point*/, int /*flags*/);
-
-    // AzToolsFramework::ViewportInteractionRequestBus
-    AzFramework::CameraState GetCameraState() override;
-    bool GridSnappingEnabled() override;
-    float GridSize() override;
-    bool ShowGrid() override;
-    bool AngleSnappingEnabled() override;
-    float AngleStep() override;
-    AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition) override;
-    AZStd::optional<AZ::Vector3> ViewportScreenToWorld(const AzFramework::ScreenPoint&, float) override
-    {
-        return {};
-    }
-    AZStd::optional<AzToolsFramework::ViewportInteraction::ProjectedViewportRay> ViewportScreenToWorldRay(
-        const AzFramework::ScreenPoint&) override
-    {
-        return {};
-    }
-    float DeviceScalingFactor() override { return 1.0f; }
-
-    // AzToolsFramework::ViewportFreezeRequestBus
-    bool IsViewportInputFrozen() override;
-    void FreezeViewportInput(bool freeze) override;
-
-    // AzToolsFramework::MainEditorViewportInteractionRequestBus
-    AZ::EntityId PickEntity(const AzFramework::ScreenPoint& point) override;
-    AZ::Vector3 PickTerrain(const AzFramework::ScreenPoint& point) override;
-    float TerrainHeight(const AZ::Vector2& position) override;
-    void FindVisibleEntities(AZStd::vector<AZ::EntityId>& visibleEntitiesOut) override;
-    bool ShowingWorldSpace() override;
-    QWidget* GetWidgetForViewportContextMenu() override;
-    void BeginWidgetContext() override;
-    void EndWidgetContext() override;
-
-    // WindowRequestBus::Handler...
-    void SetWindowTitle(const AZStd::string& title) override;
-    AzFramework::WindowSize GetClientAreaSize() const override;
-    void ResizeClientArea(AzFramework::WindowSize) override;
-    bool GetFullScreenState() const override;
-    void SetFullScreenState(bool fullScreenState) override;
-    bool CanToggleFullScreenState() const override;
-    void ToggleFullScreenState() override;
-    float GetDpiScaleFactor() const override { return 1.0f; };
-
-    void ConnectViewportInteractionRequestBus();
-    void DisconnectViewportInteractionRequestBus();
-
-    void ActivateWindowAndSetFocus();
-
-    void LockCameraMovement(bool bLock) { m_bLockCameraMovement = bLock; }
-    bool IsCameraMovementLocked() const { return m_bLockCameraMovement; }
-
-    void EnableCameraObjectMove(bool bMove) { m_bMoveCameraObject = bMove; }
-    bool IsCameraObjectMove() const { return m_bMoveCameraObject; }
-
-    void SetPlayerControl(uint32 i) { m_PlayerControl = i; };
-    uint32 GetPlayerControl() { return m_PlayerControl; };
-
-    const DisplayContext& GetDisplayContext() const { return m_displayContext; }
-    CBaseObject* GetCameraObject() const;
-
-    QPoint WidgetToViewport(const QPoint& point) const;
-    QPoint ViewportToWidget(const QPoint& point) const;
-    QSize WidgetToViewport(const QSize& size) const;
-
-    AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
-        Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point) override;
-
-    void SetPlayerPos()
-    {
-        Matrix34 m = GetViewTM();
-        m.SetTranslation(m.GetTranslation() - m_PhysicalLocation.t);
-        SetViewTM(m);
-
-        m_AverageFrameTime = 0.14f;
-
-        m_PhysicalLocation.SetIdentity();
-
-        m_LocalEntityMat.SetIdentity();
-        m_PrevLocalEntityMat.SetIdentity();
-
-        m_absCameraHigh = 2.0f;
-        m_absCameraPos = Vec3(0, 3, 2);
-        m_absCameraPosVP = Vec3(0, -3, 1.5);
-
-        m_absCurrentSlope = 0.0f;
-
-        m_absLookDirectionXY = Vec2(0, 1);
-
-        m_LookAt = Vec3(ZERO);
-        m_LookAtRate = Vec3(ZERO);
-        m_vCamPos = Vec3(ZERO);
-        m_vCamPosRate = Vec3(ZERO);
-
-        m_relCameraRotX = 0;
-        m_relCameraRotZ = 0;
-
-        uint32 numSample6 = static_cast<uint32>(m_arrAnimatedCharacterPath.size());
-        for (uint32 i = 0; i < numSample6; i++)
-        {
-            m_arrAnimatedCharacterPath[i] = Vec3(ZERO);
-        }
-
-        numSample6 = static_cast<uint32>(m_arrSmoothEntityPath.size());
-        for (uint32 i = 0; i < numSample6; i++)
-        {
-            m_arrSmoothEntityPath[i] = Vec3(ZERO);
-        }
-
-        uint32 numSample7 = static_cast<uint32>(m_arrRunStrafeSmoothing.size());
-        for (uint32 i = 0; i < numSample7; i++)
-        {
-            m_arrRunStrafeSmoothing[i] = 0;
-        }
-
-        m_vWorldDesiredBodyDirection = Vec2(0, 1);
-        m_vWorldDesiredBodyDirectionSmooth = Vec2(0, 1);
-        m_vWorldDesiredBodyDirectionSmoothRate = Vec2(0, 1);
-
-        m_vWorldDesiredBodyDirection2 = Vec2(0, 1);
-
-        m_vWorldDesiredMoveDirection = Vec2(0, 1);
-        m_vWorldDesiredMoveDirectionSmooth = Vec2(0, 1);
-        m_vWorldDesiredMoveDirectionSmoothRate = Vec2(0, 1);
-        m_vLocalDesiredMoveDirection = Vec2(0, 1);
-        m_vLocalDesiredMoveDirectionSmooth = Vec2(0, 1);
-        m_vLocalDesiredMoveDirectionSmoothRate = Vec2(0, 1);
-
-        m_vWorldAimBodyDirection = Vec2(0, 1);
-
-        m_MoveSpeedMSec = 5.0f;
-        m_key_W = 0;
-        m_keyrcr_W = 0;
-        m_key_S = 0;
-        m_keyrcr_S = 0;
-        m_key_A = 0;
-        m_keyrcr_A = 0;
-        m_key_D = 0;
-        m_keyrcr_D = 0;
-        m_key_SPACE = 0;
-        m_keyrcr_SPACE = 0;
-        m_ControllMode = 0;
-
-        m_State = -1;
-        m_Stance = 1; //combat
-
-        m_udGround = 0.0f;
-        m_lrGround = 0.0f;
-        AABB aabb = AABB(Vec3(-40.0f, -40.0f, -0.25f), Vec3(+40.0f, +40.0f, +0.0f));
-        m_GroundOBB = OBB::CreateOBBfromAABB(Matrix33(IDENTITY), aabb);
-        m_GroundOBBPos = Vec3(0, 0, -0.01f);
-    };
-
-    static CRenderViewport* GetPrimaryViewport();
-
-    AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-    CCamera m_Camera;
-    AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-
-protected:
-    struct SScopedCurrentContext;
-
-    void SetViewTM(const Matrix34& tm, bool bMoveOnly);
-
-    virtual float GetCameraMoveSpeed() const;
-    virtual float GetCameraRotateSpeed() const;
-    virtual bool  GetCameraInvertYRotation() const;
-    virtual float GetCameraInvertPan() const;
-
-    // Called to render stuff.
-    virtual void OnRender();
-
-    virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
-
-    //! Get currently active camera object.
-    void ToggleCameraObject();
-
-    void RenderConstructionPlane();
-    void RenderSnapMarker();
-    void RenderCursorString();
-    void RenderSnappingGrid();
-    void ProcessMouse();
-    void ProcessKeys();
-
-    void RenderAll();
-    void DrawAxis();
-    void DrawBackground();
-    void InitDisplayContext();
-    void ResetCursor();
-
-    struct SPreviousContext
-    {
-        CCamera rendererCamera;
-        HWND window;
-        int width;
-        int height;
-        bool mainViewport;
-    };
-
-    SPreviousContext m_preWidgetContext;
-
-    // Create an auto-sized render context that is sized based on the Editor's current
-    // viewport.
-    SPreviousContext SetCurrentContext() const;
-
-    SPreviousContext SetCurrentContext(int newWidth, int newHeight) const;
-    void RestorePreviousContext(const SPreviousContext& x) const;
-
-    void PreWidgetRendering() override;
-    void PostWidgetRendering() override;
-
-    // Update the safe frame, safe action, safe title, and borders rectangles based on
-    // viewport size and target aspect ratio.
-    void UpdateSafeFrame();
-
-    // Draw safe frame, safe action, safe title rectangles and borders.
-    void RenderSafeFrame();
-
-    // Draw one of the safe frame rectangles with the desired color.
-    void RenderSafeFrame(const QRect& frame, float r, float g, float b, float a);
-
-    // Draw the selection rectangle.
-    void RenderSelectionRectangle();
-
-    // Draw a selected region if it has been selected
-    void RenderSelectedRegion();
-
-    virtual bool CreateRenderContext();
-    virtual void DestroyRenderContext();
-
-    void OnMenuCommandChangeAspectRatio(unsigned int commandId);
-
-    bool AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const;
-    bool RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const;
-
-    bool AddCameraMenuItems(QMenu* menu);
-    void ResizeView(int width, int height);
-
-    void OnCameraFOVVariableChanged(IVariable* var);
-
-    void HideCursor();
-    void ShowCursor();
-
-    bool IsKeyDown(Qt::Key key) const;
-
-    enum class ViewSourceType
-    {
-        None,
-        SequenceCamera,
-        LegacyCamera,
-        CameraComponent,
-        AZ_Entity,
-        ViewSourceTypesCount,
-    };
-    void ResetToViewSourceType(const ViewSourceType& viewSourType);
-
-    //! Assigned renderer.
-    IRenderer*  m_renderer = nullptr;
-    bool m_bRenderContextCreated = false;
-    bool m_bInRotateMode = false;
-    bool m_bInMoveMode = false;
-    bool m_bInOrbitMode = false;
-    bool m_bInZoomMode = false;
-
-    QPoint m_mousePos = QPoint(0, 0);
-    QPoint m_prevMousePos = QPoint(0, 0);  // for tablets, you can't use SetCursorPos and need to remember the prior point and delta with that.
-
-
-    float m_moveSpeed = 1;
-
-    float m_orbitDistance = 10.0f;
-    AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-    Vec3 m_orbitTarget;
-
-    //-------------------------------------------
-    //---   player-control in CharEdit        ---
-    //-------------------------------------------
-    f32 m_MoveSpeedMSec;
-
-    uint32 m_key_W, m_keyrcr_W;
-    uint32 m_key_S, m_keyrcr_S;
-    uint32 m_key_A, m_keyrcr_A;
-    uint32 m_key_D, m_keyrcr_D;
-
-    uint32 m_key_SPACE, m_keyrcr_SPACE;
-    uint32 m_ControllMode;
-
-    int32 m_Stance;
-    int32 m_State;
-    f32 m_AverageFrameTime;
-
-    uint32 m_PlayerControl = 0;
-
-    f32 m_absCameraHigh;
-    Vec3 m_absCameraPos;
-    Vec3 m_absCameraPosVP;
-
-    f32  m_absCurrentSlope;  //in radiants
-
-    Vec2 m_absLookDirectionXY;
-
-    Vec3 m_LookAt;
-    Vec3 m_LookAtRate;
-    Vec3 m_vCamPos;
-    Vec3 m_vCamPosRate;
-    float m_camFOV;
-
-    f32 m_relCameraRotX;
-    f32 m_relCameraRotZ;
-
-    QuatTS m_PhysicalLocation;
-
-    Matrix34 m_AnimatedCharacterMat;
-
-    Matrix34 m_LocalEntityMat;  //this is used for data-driven animations where the character is running on the spot
-    Matrix34 m_PrevLocalEntityMat;
-
-    std::vector<Vec3> m_arrVerticesHF;
-    std::vector<vtx_idx> m_arrIndicesHF;
-
-    std::vector<Vec3> m_arrAnimatedCharacterPath;
-    std::vector<Vec3> m_arrSmoothEntityPath;
-    std::vector<f32> m_arrRunStrafeSmoothing;
-
-    Vec2 m_vWorldDesiredBodyDirection;
-    Vec2 m_vWorldDesiredBodyDirectionSmooth;
-    Vec2 m_vWorldDesiredBodyDirectionSmoothRate;
-
-    Vec2 m_vWorldDesiredBodyDirection2;
-
-
-    Vec2 m_vWorldDesiredMoveDirection;
-    Vec2 m_vWorldDesiredMoveDirectionSmooth;
-    Vec2 m_vWorldDesiredMoveDirectionSmoothRate;
-    Vec2 m_vLocalDesiredMoveDirection;
-    Vec2 m_vLocalDesiredMoveDirectionSmooth;
-    Vec2 m_vLocalDesiredMoveDirectionSmoothRate;
-    Vec2 m_vWorldAimBodyDirection;
-
-    f32 m_udGround;
-    f32 m_lrGround;
-    OBB m_GroundOBB;
-    Vec3 m_GroundOBBPos;
-
-    // Index of camera objects.
-    mutable GUID m_cameraObjectId = GUID_NULL;
-    mutable AZ::EntityId m_viewEntityId;
-    mutable ViewSourceType m_viewSourceType = ViewSourceType::None;
-    AZ::EntityId m_viewEntityIdCachedForEditMode;
-    Matrix34 m_preGameModeViewTM;
-    uint m_disableRenderingCount = 0;
-    bool m_bLockCameraMovement;
-    bool m_bUpdateViewport = false;
-    bool m_bMoveCameraObject = true;
-
-    enum class KeyPressedState
-    {
-        AllUp,
-        PressedThisFrame,
-        PressedInPreviousFrame,
-    };
-    KeyPressedState m_pressedKeyState = KeyPressedState::AllUp;
-
-    Matrix34 m_defaultViewTM;
-    const QString m_defaultViewName;
-
-    DisplayContext m_displayContext;
-
-
-    bool m_isOnPaint = false;
-    static CRenderViewport* m_pPrimaryViewport;
-
-    QRect m_safeFrame;
-    QRect m_safeAction;
-    QRect m_safeTitle;
-
-    CPredefinedAspectRatios m_predefinedAspectRatios;
-
-    IVariable* m_pCameraFOVVariable = nullptr;
-    bool m_bCursorHidden = false;
-
-    void OnMenuResolutionCustom();
-    void OnMenuCreateCameraEntityFromCurrentView();
-    void OnMenuSelectCurrentCamera();
-
-    int OnCreate();
-    void resizeEvent(QResizeEvent* event) override;
-    void paintEvent(QPaintEvent* event) override;
-    void mousePressEvent(QMouseEvent* event) override;
-    void OnLButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
-    void OnLButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
-    void OnLButtonDblClk(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
-    void OnMButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
-    void OnMButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
-    void OnRButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
-    void OnRButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
-    void OnMouseMove(Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, const QPoint& point) override;
-    void OnMouseWheel(Qt::KeyboardModifiers modifiers, short zDelta, const QPoint& pt) override;
-
-    // From a series of input primitives, compose a complete mouse interaction.
-    AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteractionInternal(
-        AzToolsFramework::ViewportInteraction::MouseButtons buttons,
-        AzToolsFramework::ViewportInteraction::KeyboardModifiers modifiers,
-        const AzToolsFramework::ViewportInteraction::MousePick& mousePick) const;
-    // Given a point in the viewport, return the pick ray into the scene.
-    // note: The argument passed to parameter **point**, originating
-    // from a Qt event, must first be passed to WidgetToViewport before being
-    // passed to BuildMousePick.
-    AzToolsFramework::ViewportInteraction::MousePick BuildMousePick(const QPoint& point);
-
-    bool event(QEvent* event) override;
-    void OnDestroy();
-
-    bool CheckRespondToInput() const;
-
-    // AzFramework::InputSystemCursorConstraintRequestBus
-    void* GetSystemCursorConstraintWindow() const override;
-
-    void BuildDragDropContext(AzQtComponents::ViewportDragContext& context, const QPoint& pt) override;
-
-private:
-    void ProcessKeyRelease(QKeyEvent* event);
-    void PushDisableRendering();
-    void PopDisableRendering();
-    bool IsRenderingDisabled() const;
-    AzToolsFramework::ViewportInteraction::MousePick BuildMousePickInternal(
-        const QPoint& point) const;
-
-    void RestoreViewportAfterGameMode();
-
-    double WidgetToViewportFactor() const
-    {
-#if defined(AZ_PLATFORM_WINDOWS)
-        // Needed for high DPI mode on windows
-        return devicePixelRatioF();
-#else
-        return 1.0f;
-#endif
-    }
-
-    void BeginUndoTransaction() override;
-    void EndUndoTransaction() override;
-
-    void UpdateCurrentMousePos(const QPoint& newPosition);
-
-    AzFramework::EntityVisibilityQuery m_entityVisibilityQuery;
-
-    SPreviousContext m_previousContext;
-    QSet<int> m_keyDown;
-
-    bool m_freezeViewportInput = false;
-
-    size_t m_cameraSetForWidgetRenderingCount = 0; ///< How many calls to PreWidgetRendering happened before
-                                                   ///< subsequent calls to PostWidetRendering.
-    AZStd::shared_ptr<AzToolsFramework::ManipulatorManager> m_manipulatorManager;
-
-    // Used to prevent circular set camera events
-    bool m_ignoreSetViewFromEntityPerspective = false;
-    bool m_windowResizedEvent = false;
-
-    // Cache hwnd value for teardown to avoid infinite loops in retrieving it from destroyed widgets.
-    HWND m_hwnd;
-
-    AZStd::unique_ptr<EditorEntityNotifications> m_editorEntityNotifications;
-
-    AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-};
-
-#endif // CRYINCLUDE_EDITOR_RENDERVIEWPORT_H

+ 8 - 0
Code/Editor/Settings.cpp

@@ -26,6 +26,7 @@
 
 
 // AzFramework
 // AzFramework
 #include <AzFramework/API/ApplicationAPI.h>
 #include <AzFramework/API/ApplicationAPI.h>
+#include <AzToolsFramework/API/ToolsApplicationAPI.h>
 
 
 // AzToolsFramework
 // AzToolsFramework
 #include <AzToolsFramework/SourceControl/SourceControlAPI.h>
 #include <AzToolsFramework/SourceControl/SourceControlAPI.h>
@@ -500,6 +501,7 @@ void SEditorSettings::Save()
     SaveValue("Settings", "AutoBackupTime", autoBackupTime);
     SaveValue("Settings", "AutoBackupTime", autoBackupTime);
     SaveValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
     SaveValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
     SaveValue("Settings", "AutoRemindTime", autoRemindTime);
     SaveValue("Settings", "AutoRemindTime", autoRemindTime);
+    SaveValue("Settings", "MaxDisplayedItemsNumInSearch", maxNumberOfItemsShownInSearch);
     SaveValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
     SaveValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
     SaveValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
     SaveValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
     SaveValue("Settings", "StylusMode", stylusMode);
     SaveValue("Settings", "StylusMode", stylusMode);
@@ -714,6 +716,7 @@ void SEditorSettings::Load()
     LoadValue("Settings", "AutoBackupTime", autoBackupTime);
     LoadValue("Settings", "AutoBackupTime", autoBackupTime);
     LoadValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
     LoadValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
     LoadValue("Settings", "AutoRemindTime", autoRemindTime);
     LoadValue("Settings", "AutoRemindTime", autoRemindTime);
+    LoadValue("Settings", "MaxDisplayedItemsNumInSearch", maxNumberOfItemsShownInSearch);
     LoadValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
     LoadValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
     LoadValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
     LoadValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
     LoadValue("Settings", "StylusMode", stylusMode);
     LoadValue("Settings", "StylusMode", stylusMode);
@@ -1209,3 +1212,8 @@ AzToolsFramework::ConsoleColorTheme SEditorSettings::GetConsoleColorTheme() cons
 {
 {
     return consoleBackgroundColorTheme;
     return consoleBackgroundColorTheme;
 }
 }
+
+int SEditorSettings::GetMaxNumberOfItemsShownInSearchView() const
+{
+    return SEditorSettings::maxNumberOfItemsShownInSearch;
+}

+ 8 - 0
Code/Editor/Settings.h

@@ -289,6 +289,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
     SettingOutcome GetValue(const AZStd::string_view path) override;
     SettingOutcome GetValue(const AZStd::string_view path) override;
     SettingOutcome SetValue(const AZStd::string_view path, const AZStd::any& value) override;
     SettingOutcome SetValue(const AZStd::string_view path, const AZStd::any& value) override;
     AzToolsFramework::ConsoleColorTheme GetConsoleColorTheme() const override;
     AzToolsFramework::ConsoleColorTheme GetConsoleColorTheme() const override;
+    int GetMaxNumberOfItemsShownInSearchView() const override;
 
 
     void ConvertPath(const AZStd::string_view sourcePath, AZStd::string& category, AZStd::string& attribute);
     void ConvertPath(const AZStd::string_view sourcePath, AZStd::string& category, AZStd::string& attribute);
 
 
@@ -364,6 +365,13 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
     int autoRemindTime;
     int autoRemindTime;
     //////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////
 
 
+    //////////////////////////////////////////////////////////////////////////
+    // Asset Browser Search View.
+    //////////////////////////////////////////////////////////////////////////
+    //! Current maximum number of items that can be displayed in the AssetBrowser Search View.
+    int maxNumberOfItemsShownInSearch;
+    //////////////////////////////////////////////////////////////////////////
+
 
 
     //! If true preview windows is displayed when browsing geometries.
     //! If true preview windows is displayed when browsing geometries.
     bool bPreviewGeometryWindow;
     bool bPreviewGeometryWindow;

+ 3 - 11
Code/Editor/TrackView/CommentNodeAnimator.cpp

@@ -159,18 +159,10 @@ void CCommentNodeAnimator::Render(CTrackViewAnimNode* pNode, [[maybe_unused]] co
     }
     }
 }
 }
 
 
-Vec2 CCommentNodeAnimator::GetScreenPosFromNormalizedPos(const Vec2& unitPos)
+Vec2 CCommentNodeAnimator::GetScreenPosFromNormalizedPos(const Vec2&)
 {
 {
-    const CCamera& cam = gEnv->pSystem->GetViewCamera();
-    float width = (float)cam.GetViewSurfaceX();
-    int height = cam.GetViewSurfaceZ();
-    float fAspectRatio = gSettings.viewports.fDefaultAspectRatio;
-    float camWidth = height * fAspectRatio;
-
-    float x = 0.5f * width + 0.5f * camWidth * unitPos.x;
-    float y = 0.5f * height * (1.f - unitPos.y);
-
-    return Vec2(x, y);
+    AZ_Error("CryLegacy", false, "CCommentNodeAnimator::GetScreenPosFromNormalizedPos not supported");
+    return Vec2(0, 0);
 }
 }
 
 
 void CCommentNodeAnimator::DrawText(const char* szFontName, float fSize, const Vec2& unitPos, const ColorF col, const char* szText, int align)
 void CCommentNodeAnimator::DrawText(const char* szFontName, float fSize, const Vec2& unitPos, const ColorF col, const char* szText, int align)

+ 10 - 2
Code/Editor/TrackView/SequenceBatchRenderDialog.cpp

@@ -44,7 +44,12 @@ namespace
 {
 {
     const int g_useActiveViewportResolution = -1;   // reserved value to indicate the use of the active viewport resolution
     const int g_useActiveViewportResolution = -1;   // reserved value to indicate the use of the active viewport resolution
     int resolutions[][2] = {
     int resolutions[][2] = {
-        { 1280, 720 }, { 1920, 1080 }, { 1998, 1080 }, { 2048, 858 }, { 2560, 1440 }, 
+        {1280, 720},
+        {1920, 1080},
+        {1998, 1080},
+        {2048, 858},
+        {2560, 1440},
+        {3840, 2160},
         { g_useActiveViewportResolution, g_useActiveViewportResolution }    // active viewport res must be the last element of the resolution array
         { g_useActiveViewportResolution, g_useActiveViewportResolution }    // active viewport res must be the last element of the resolution array
     };
     };
 
 
@@ -1066,6 +1071,10 @@ void CSequenceBatchRenderDialog::OnUpdateEnd(IAnimSequence* sequence)
 {
 {
     GetIEditor()->GetMovieSystem()->DisableFixedStepForCapture();
     GetIEditor()->GetMovieSystem()->DisableFixedStepForCapture();
 
 
+    // Important: End batch render mode BEFORE leaving Game Mode.
+    // Otherwise track view will set the active camera based on the directors in the current sequence while leaving game mode
+    GetIEditor()->GetMovieSystem()->EnableBatchRenderMode(false);
+
     GetIEditor()->GetMovieSystem()->RemoveMovieListener(sequence, this);
     GetIEditor()->GetMovieSystem()->RemoveMovieListener(sequence, this);
     GetIEditor()->SetInGameMode(false);
     GetIEditor()->SetInGameMode(false);
     GetIEditor()->GetGameEngine()->Update();        // Update is needed because SetInGameMode() queues game mode, Update() executes it.
     GetIEditor()->GetGameEngine()->Update();        // Update is needed because SetInGameMode() queues game mode, Update() executes it.
@@ -1185,7 +1194,6 @@ void CSequenceBatchRenderDialog::OnUpdateFinalize()
 
 
         m_ui->m_pGoBtn->setText(tr("Start"));
         m_ui->m_pGoBtn->setText(tr("Start"));
         m_ui->m_pGoBtn->setIcon(QPixmap(":/Trackview/clapperboard_ready.png"));
         m_ui->m_pGoBtn->setIcon(QPixmap(":/Trackview/clapperboard_ready.png"));
-        GetIEditor()->GetMovieSystem()->EnableBatchRenderMode(false);
         m_renderContext.currentItemIndex = -1;
         m_renderContext.currentItemIndex = -1;
         m_ui->BATCH_RENDER_PRESS_ESC_TO_CANCEL->setText(m_ffmpegPluginStatusMsg);
         m_ui->BATCH_RENDER_PRESS_ESC_TO_CANCEL->setText(m_ffmpegPluginStatusMsg);
 
 

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

@@ -27,13 +27,13 @@
 #include <CryCommon/Maestro/Types/AnimNodeType.h>
 #include <CryCommon/Maestro/Types/AnimNodeType.h>
 #include <CryCommon/Maestro/Types/AnimValueType.h>
 #include <CryCommon/Maestro/Types/AnimValueType.h>
 #include <CryCommon/Maestro/Types/AnimParamType.h>
 #include <CryCommon/Maestro/Types/AnimParamType.h>
+#include <CryCommon/MathConversion.h>
 
 
 // Editor
 // Editor
 #include "AnimationContext.h"
 #include "AnimationContext.h"
 #include "Clipboard.h"
 #include "Clipboard.h"
 #include "CommentNodeAnimator.h"
 #include "CommentNodeAnimator.h"
 #include "DirectorNodeAnimator.h"
 #include "DirectorNodeAnimator.h"
-#include "RenderViewport.h"
 #include "ViewManager.h"
 #include "ViewManager.h"
 #include "Include/IObjectManager.h"
 #include "Include/IObjectManager.h"
 #include "Objects/GizmoManager.h"
 #include "Objects/GizmoManager.h"

+ 19 - 2
Code/Editor/UndoViewRotation.cpp

@@ -17,10 +17,27 @@
 // Editor
 // Editor
 #include "ViewManager.h"
 #include "ViewManager.h"
 
 
+#include <AzCore/Math/Matrix3x3.h>
+#include <AzCore/Math/Matrix3x4.h>
+#include <AzFramework/Components/CameraBus.h>
+#include <MathConversion.h>
+
+Ang3 CUndoViewRotation::GetActiveCameraRotation()
+{
+    AZ::Transform activeCameraTm = AZ::Transform::CreateIdentity();
+    Camera::ActiveCameraRequestBus::BroadcastResult(
+        activeCameraTm,
+        &Camera::ActiveCameraRequestBus::Events::GetActiveCameraTransform
+    );
+    const AZ::Matrix3x4 cameraMatrix = AZ::Matrix3x4::CreateFromTransform(activeCameraTm);
+    const Matrix33 cameraMatrixCry = AZMatrix3x3ToLYMatrix3x3(AZ::Matrix3x3::CreateFromMatrix3x4(cameraMatrix));
+    return RAD2DEG(Ang3::GetAnglesXYZ(cameraMatrixCry));
+}
+
 CUndoViewRotation::CUndoViewRotation(const QString& pUndoDescription)
 CUndoViewRotation::CUndoViewRotation(const QString& pUndoDescription)
 {
 {
     m_undoDescription = pUndoDescription;
     m_undoDescription = pUndoDescription;
-    m_undo = RAD2DEG(Ang3::GetAnglesXYZ(Matrix33(GetIEditor()->GetSystem()->GetViewCamera().GetMatrix())));
+    m_undo = GetActiveCameraRotation();
 }
 }
 
 
 int CUndoViewRotation::GetSize()
 int CUndoViewRotation::GetSize()
@@ -40,7 +57,7 @@ void CUndoViewRotation::Undo(bool bUndo)
     {
     {
         if (bUndo)
         if (bUndo)
         {
         {
-            m_redo = RAD2DEG(Ang3::GetAnglesXYZ(Matrix33(GetIEditor()->GetSystem()->GetViewCamera().GetMatrix())));
+            m_redo = GetActiveCameraRotation();
         }
         }
 
 
         Matrix34 tm = pRenderViewport->GetViewTM();
         Matrix34 tm = pRenderViewport->GetViewTM();

+ 2 - 0
Code/Editor/UndoViewRotation.h

@@ -29,6 +29,8 @@ protected:
     void Redo();
     void Redo();
 
 
 private:
 private:
+    static Ang3 GetActiveCameraRotation();
+
     Ang3 m_undo;
     Ang3 m_undo;
     Ang3 m_redo;
     Ang3 m_redo;
     QString m_undoDescription;
     QString m_undoDescription;

+ 0 - 202
Code/Editor/Util/IndexedFiles.cpp

@@ -1,202 +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 : Tagged files database for 'SmartFileOpen' dialog
-
-#include "EditorDefs.h"
-
-#include "IndexedFiles.h"
-
-volatile TIntAtomic CIndexedFiles::s_bIndexingDone;
-CIndexedFiles* CIndexedFiles::s_pIndexedFiles = nullptr;
-
-bool CIndexedFiles::m_startedFileIndexing = false;
-
-void CIndexedFiles::Initialize(const QString& path, IFileUtil::ScanDirectoryUpdateCallBack updateCB)
-{
-    m_files.clear();
-    m_pathToIndex.clear();
-    m_tags.clear();
-    m_rootPath = path;
-
-    bool anyFiles = CFileUtil::ScanDirectory(path, "*.*", m_files, true, true, updateCB);
-
-    if (anyFiles == false)
-    {
-        m_files.clear();
-        return;
-    }
-
-    if (updateCB)
-    {
-        updateCB("Parsing & tagging...");
-    }
-
-    for (int i = 0; i < m_files.size(); ++i)
-    {
-        m_pathToIndex[m_files[i].filename] = i;
-    }
-
-    PrepareTagTable();
-
-    InvokeUpdateCallbacks();
-}
-
-void CIndexedFiles::AddFile(const IFileUtil::FileDesc& path)
-{
-    assert(m_pathToIndex.find(path.filename) == m_pathToIndex.end());
-    m_files.push_back(path);
-    m_pathToIndex[path.filename] = m_files.size() - 1;
-    QStringList tags;
-    GetTags(tags, path.filename);
-    for (int k = 0; k < tags.size(); ++k)
-    {
-        m_tags[tags[k]].insert(m_files.size() - 1);
-    }
-}
-
-void CIndexedFiles::RemoveFile(const QString& path)
-{
-    if (m_pathToIndex.find(path) == m_pathToIndex.end())
-    {
-        return;
-    }
-    std::map<QString, int>::iterator itr = m_pathToIndex.find(path);
-    int index = itr->second;
-    m_pathToIndex.erase(itr);
-    m_files.erase(m_files.begin() + index);
-    QStringList tags;
-    GetTags(tags, path);
-    for (int k = 0; k < tags.size(); ++k)
-    {
-        m_tags[tags[k]].erase(index);
-    }
-}
-
-void CIndexedFiles::Refresh(const QString& path, bool recursive)
-{
-    IFileUtil::FileArray files;
-    bool anyFiles = CFileUtil::ScanDirectory(m_rootPath, Path::Make(path, "*.*"), files, recursive, recursive ? true : false);
-
-    if (anyFiles == false)
-    {
-        return;
-    }
-
-    for (int i = 0; i < files.size(); ++i)
-    {
-        if (m_pathToIndex.find(files[i].filename) == m_pathToIndex.end())
-        {
-            AddFile(files[i]);
-        }
-    }
-
-    InvokeUpdateCallbacks();
-}
-
-void CIndexedFiles::GetFilesWithTags(IFileUtil::FileArray& files, const QStringList& tags) const
-{
-    files.clear();
-    if (tags.empty())
-    {
-        return;
-    }
-    int_set candidates;
-    TagTable::const_iterator i;
-    // Gets candidate files from the first tag.
-    for (i = m_tags.begin(); i != m_tags.end(); ++i)
-    {
-        if (i->first.startsWith(tags[0]))
-        {
-            candidates.insert(i->second.begin(), i->second.end());
-        }
-    }
-    // Reduces the candidates further using additional tags, if any.
-    for (int k = 1; k < tags.size(); ++k)
-    {
-        // Gathers the filter set.
-        int_set filter;
-        for (i = m_tags.begin(); i != m_tags.end(); ++i)
-        {
-            if (i->first.startsWith(tags[k]))
-            {
-                filter.insert(i->second.begin(), i->second.end());
-            }
-        }
-
-        // Filters the candidates using it.
-        for (int_set::iterator m = candidates.begin(); m != candidates.end(); )
-        {
-            if (filter.find(*m) == filter.end())
-            {
-                int_set::iterator target = m;
-                ++m;
-                candidates.erase(target);
-            }
-            else
-            {
-                ++m;
-            }
-        }
-    }
-    // Outputs the result.
-    files.reserve(candidates.size());
-    for (int_set::const_iterator m = candidates.begin(); m != candidates.end(); ++m)
-    {
-        files.push_back(m_files[*m]);
-    }
-}
-
-void CIndexedFiles::GetTags(QStringList& tags, const QString& path) const
-{
-    tags = path.split(QRegularExpression(QStringLiteral(R"([\\/.])")), Qt::SkipEmptyParts);
-}
-
-void CIndexedFiles::GetTagsOfPrefix(QStringList& tags, const QString& prefix) const
-{
-    tags.clear();
-    TagTable::const_iterator i;
-    for (i = m_tags.begin(); i != m_tags.end(); ++i)
-    {
-        if (i->first.startsWith(prefix))
-        {
-            tags.push_back(i->first);
-        }
-    }
-}
-
-void CIndexedFiles::PrepareTagTable()
-{
-    QStringList tags;
-    for (int i = 0; i < m_files.size(); ++i)
-    {
-        GetTags(tags, m_files[i].filename);
-        for (int k = 0; k < tags.size(); ++k)
-        {
-            m_tags[tags[k]].insert(i);
-        }
-    }
-}
-
-void CIndexedFiles::AddUpdateCallback(std::function<void()> updateCallback)
-{
-    CryAutoLock<CryMutex> lock(m_updateCallbackMutex);
-
-    m_updateCallbacks.push_back(updateCallback);
-}
-
-void CIndexedFiles::InvokeUpdateCallbacks()
-{
-    CryAutoLock<CryMutex> lock(m_updateCallbackMutex);
-
-    for (auto updateCallback : m_updateCallbacks)
-    {
-        updateCallback();
-    }
-}

+ 0 - 176
Code/Editor/Util/IndexedFiles.h

@@ -1,176 +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 : Tagged files database for 'SmartFileOpen' dialog
-//
-// Notice      : Refer  SmartFileOpenDialog h
-
-
-#ifndef CRYINCLUDE_EDITOR_UTIL_INDEXEDFILES_H
-#define CRYINCLUDE_EDITOR_UTIL_INDEXEDFILES_H
-#pragma once
-
-
-#include "FileUtil.h"
-#include <functional>
-
-class CIndexedFiles
-{
-    friend class CFileIndexingThread;
-public:
-    static CIndexedFiles& GetDB()
-    {
-        if (!s_pIndexedFiles)
-        {
-            assert(!"CIndexedFiles not created! Make sure you use CIndexedFiles::GetDB() after CIndexedFiles::StartFileIndexing() is called.");
-        }
-        assert(s_pIndexedFiles);
-        return *s_pIndexedFiles;
-    }
-
-    static bool HasFileIndexingDone()
-    { return s_bIndexingDone > 0; }
-
-    static void Create()
-    {
-        assert(!s_pIndexedFiles);
-        s_pIndexedFiles = new CIndexedFiles;
-    }
-
-    static void Destroy()
-    {
-        SAFE_DELETE(s_pIndexedFiles);
-    }
-
-    static void StartFileIndexing()
-    {
-        assert(s_bIndexingDone == 0);
-        assert(s_pIndexedFiles);
-
-        if (!s_pIndexedFiles)
-        {
-            return;
-        }
-
-        GetFileIndexingThread().Start(-1, "FileIndexing");
-        m_startedFileIndexing = true;
-    }
-
-    static void AbortFileIndexing()
-    {
-        if (!m_startedFileIndexing)
-        {
-            return;
-        }
-
-        if (HasFileIndexingDone() == false)
-        {
-            GetFileIndexingThread().Abort();
-        }
-        m_startedFileIndexing = false;
-    }
-
-    static void RegisterCallback(std::function<void()> callback)
-    {
-        assert(s_pIndexedFiles);
-        if (!s_pIndexedFiles)
-        {
-            return;
-        }
-
-        s_pIndexedFiles->AddUpdateCallback(callback);
-    }
-
-public:
-    void Initialize(const QString& path, IFileUtil::ScanDirectoryUpdateCallBack updateCB = nullptr);
-
-    // Adds a new file to the database.
-    void AddFile(const IFileUtil::FileDesc& path);
-    // Removes a no-longer-existing file from the database.
-    void RemoveFile(const QString& path);
-    // Refreshes this database for the subdirectory.
-    void Refresh(const QString& path, bool recursive = true);
-
-    void GetFilesWithTags(IFileUtil::FileArray& files, const QStringList& tags) const;
-
-    //! This method returns all the tags which start with a given prefix.
-    //! It is useful for the tag auto-completion.
-    void GetTagsOfPrefix(QStringList& tags, const QString& prefix) const;
-
-    uint32 GetTotalCount() const
-    { return (uint32)m_files.size(); }
-
-private:
-    static bool m_startedFileIndexing;
-
-    std::vector <std::function<void()> > m_updateCallbacks;
-    IFileUtil::FileArray m_files;
-    std::map<QString, int> m_pathToIndex;
-    typedef std::set<int, std::less<int> > int_set;
-    typedef std::map<QString, int_set, std::less<QString> > TagTable;
-    TagTable m_tags;
-    QString m_rootPath;
-
-    void GetTags(QStringList& tags, const QString& path) const;
-    void PrepareTagTable();
-
-    CryMutex m_updateCallbackMutex;
-
-    void AddUpdateCallback(std::function<void()> updateCallback);
-    void InvokeUpdateCallbacks();
-
-    // A done flag for the background file indexing
-    static volatile TIntAtomic s_bIndexingDone;
-    // A thread for the background file indexing
-    class CFileIndexingThread
-        : public CryThread<CFileIndexingThread>
-    {
-    public:
-        virtual void Run()
-        {
-            CIndexedFiles::GetDB().Initialize("@assets@", CallBack);
-            CryInterlockedAdd(CIndexedFiles::s_bIndexingDone.Addr(), 1);
-        }
-
-        CFileIndexingThread()
-            : m_abort(false) {}
-
-        void Abort()
-        {
-            m_abort = true;
-            WaitForThread();
-        }
-
-        virtual ~CFileIndexingThread()
-        {
-            Abort();
-        }
-    private:
-        bool m_abort;
-        static bool CallBack([[maybe_unused]] const QString& msg)
-        {
-            if (CIndexedFiles::GetFileIndexingThread().m_abort)
-            {
-                return false;
-            }
-            return true;
-        }
-    };
-
-    static CFileIndexingThread& GetFileIndexingThread()
-    {
-        static CFileIndexingThread s_fileIndexingThread;
-
-        return s_fileIndexingThread;
-    }
-
-    // A global database for tagged files
-    static CIndexedFiles* s_pIndexedFiles;
-};
-#endif // CRYINCLUDE_EDITOR_UTIL_INDEXEDFILES_H

+ 2 - 17
Code/Editor/ViewManager.cpp

@@ -26,18 +26,15 @@
 #include "LayoutWnd.h"
 #include "LayoutWnd.h"
 #include "2DViewport.h"
 #include "2DViewport.h"
 #include "TopRendererWnd.h"
 #include "TopRendererWnd.h"
-#include "RenderViewport.h"
 #include "EditorViewportWidget.h"
 #include "EditorViewportWidget.h"
 #include "CryEditDoc.h"
 #include "CryEditDoc.h"
 
 
 #include <AzCore/Console/IConsole.h>
 #include <AzCore/Console/IConsole.h>
 
 
-AZ_CVAR(bool, ed_useAtomNativeViewport, true, nullptr, AZ::ConsoleFunctorFlags::Null, "Use the new Atom-native Editor viewport (experimental, not yet stable");
-
 bool CViewManager::IsMultiViewportEnabled()
 bool CViewManager::IsMultiViewportEnabled()
 {
 {
     // Enable multi-viewport for legacy renderer, or if we're using the new fully Atom-native viewport
     // Enable multi-viewport for legacy renderer, or if we're using the new fully Atom-native viewport
-    return ed_useAtomNativeViewport;
+    return true;
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
@@ -74,14 +71,7 @@ CViewManager::CViewManager()
     RegisterQtViewPane<C2DViewport_YZ>(GetIEditor(), "Left", LyViewPane::CategoryViewport, viewportOptions);
     RegisterQtViewPane<C2DViewport_YZ>(GetIEditor(), "Left", LyViewPane::CategoryViewport, viewportOptions);
 
 
     viewportOptions.viewportType = ET_ViewportCamera;
     viewportOptions.viewportType = ET_ViewportCamera;
-    if (ed_useAtomNativeViewport)
-    {
-        RegisterQtViewPaneWithName<EditorViewportWidget>(GetIEditor(), "Perspective", LyViewPane::CategoryViewport, viewportOptions);
-    }
-    else
-    {
-        RegisterQtViewPaneWithName<CRenderViewport>(GetIEditor(), "Perspective", LyViewPane::CategoryViewport, viewportOptions);
-    }
+    RegisterQtViewPaneWithName<EditorViewportWidget>(GetIEditor(), "Perspective", LyViewPane::CategoryViewport, viewportOptions);
 
 
     viewportOptions.viewportType = ET_ViewportMap;
     viewportOptions.viewportType = ET_ViewportMap;
     RegisterQtViewPane<QTopRendererWnd>(GetIEditor(), "Map", LyViewPane::CategoryViewport, viewportOptions);
     RegisterQtViewPane<QTopRendererWnd>(GetIEditor(), "Map", LyViewPane::CategoryViewport, viewportOptions);
@@ -251,11 +241,6 @@ void CViewManager::SelectViewport(CViewport* pViewport)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 CViewport* CViewManager::GetGameViewport() const
 CViewport* CViewManager::GetGameViewport() const
 {
 {
-    if (CRenderViewport::GetPrimaryViewport())
-    {
-        return CRenderViewport::GetPrimaryViewport();
-    }
-
     return GetViewport(ET_ViewportCamera);;
     return GetViewport(ET_ViewportCamera);;
 }
 }
 
 

+ 0 - 18
Code/Editor/ViewPane.cpp

@@ -305,10 +305,6 @@ void CLayoutViewPane::AttachViewport(QWidget* pViewport)
         {
         {
             vp->SetViewportId(GetId());
             vp->SetViewportId(GetId());
             vp->SetViewPane(this);
             vp->SetViewPane(this);
-            if (CRenderViewport* renderViewport = viewport_cast<CRenderViewport*>(vp))
-            {
-                renderViewport->ConnectViewportInteractionRequestBus();
-            }
             if (EditorViewportWidget* renderViewport = viewport_cast<EditorViewportWidget*>(vp))
             if (EditorViewportWidget* renderViewport = viewport_cast<EditorViewportWidget*>(vp))
             {
             {
                 renderViewport->ConnectViewportInteractionRequestBus();
                 renderViewport->ConnectViewportInteractionRequestBus();
@@ -356,10 +352,6 @@ void CLayoutViewPane::DisconnectRenderViewportInteractionRequestBus()
 {
 {
     if (QtViewport* vp = qobject_cast<QtViewport*>(m_viewport))
     if (QtViewport* vp = qobject_cast<QtViewport*>(m_viewport))
     {
     {
-        if (CRenderViewport* renderViewport = viewport_cast<CRenderViewport*>(vp))
-        {
-            renderViewport->DisconnectViewportInteractionRequestBus();
-        }
         if (EditorViewportWidget* renderViewport = viewport_cast<EditorViewportWidget*>(vp))
         if (EditorViewportWidget* renderViewport = viewport_cast<EditorViewportWidget*>(vp))
         {
         {
             renderViewport->DisconnectViewportInteractionRequestBus();
             renderViewport->DisconnectViewportInteractionRequestBus();
@@ -469,16 +461,6 @@ void CLayoutViewPane::SetAspectRatio(unsigned int x, unsigned int y)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void CLayoutViewPane::SetViewportFOV(float fov)
 void CLayoutViewPane::SetViewportFOV(float fov)
 {
 {
-    if (CRenderViewport* pRenderViewport = qobject_cast<CRenderViewport*>(m_viewport))
-    {
-        pRenderViewport->SetFOV(DEG2RAD(fov));
-
-        // if viewport camera is active, make selected fov new default
-        if (pRenderViewport->GetViewManager()->GetCameraObjectId() == GUID_NULL)
-        {
-            gSettings.viewports.fDefaultFov = DEG2RAD(fov);
-        }
-    }
     if (EditorViewportWidget* pRenderViewport = qobject_cast<EditorViewportWidget*>(m_viewport))
     if (EditorViewportWidget* pRenderViewport = qobject_cast<EditorViewportWidget*>(m_viewport))
     {
     {
         pRenderViewport->SetFOV(DEG2RAD(fov));
         pRenderViewport->SetFOV(DEG2RAD(fov));

+ 0 - 1
Code/Editor/Viewport.cpp

@@ -189,7 +189,6 @@ QtViewport::QtViewport(QWidget* parent)
     {
     {
         m_constructionMatrix[i].SetIdentity();
         m_constructionMatrix[i].SetIdentity();
     }
     }
-    m_viewTM.SetIdentity();
     m_screenTM.SetIdentity();
     m_screenTM.SetIdentity();
 
 
     m_pMouseOverObject = nullptr;
     m_pMouseOverObject = nullptr;

+ 10 - 4
Code/Editor/Viewport.h

@@ -165,11 +165,19 @@ public:
     //////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////
     //! Set current view matrix,
     //! Set current view matrix,
     //! This is a matrix that transforms from world to view space.
     //! This is a matrix that transforms from world to view space.
-    virtual void SetViewTM(const Matrix34& tm) { m_viewTM = tm; };
+    virtual void SetViewTM([[maybe_unused]] const Matrix34& tm)
+    {
+        AZ_Error("CryLegacy", false, "QtViewport::SetViewTM not implemented");
+    }
 
 
     //! Get current view matrix.
     //! Get current view matrix.
     //! This is a matrix that transforms from world space to view space.
     //! This is a matrix that transforms from world space to view space.
-    virtual const Matrix34& GetViewTM() const { return m_viewTM; };
+    virtual const Matrix34& GetViewTM() const
+    {
+        AZ_Error("CryLegacy", false, "QtViewport::GetViewTM not implemented");
+        static const Matrix34 m;
+        return m;
+    };
 
 
     //////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////
     //! Get current screen matrix.
     //! Get current screen matrix.
@@ -277,8 +285,6 @@ protected:
     CLayoutViewPane* m_viewPane = nullptr;
     CLayoutViewPane* m_viewPane = nullptr;
     CViewManager* m_viewManager;
     CViewManager* m_viewManager;
     AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
     AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-    // Viewport matrix.
-    Matrix34 m_viewTM;
     // Screen Matrix
     // Screen Matrix
     Matrix34 m_screenTM;
     Matrix34 m_screenTM;
     int m_nCurViewportID;
     int m_nCurViewportID;

+ 25 - 7
Code/Editor/ViewportTitleDlg.cpp

@@ -644,13 +644,31 @@ void CViewportTitleDlg::CreateViewportInformationMenu()
 
 
 void CViewportTitleDlg::AddResolutionMenus(QMenu* menu, std::function<void(int, int)> callback, const QStringList& customPresets)
 void CViewportTitleDlg::AddResolutionMenus(QMenu* menu, std::function<void(int, int)> callback, const QStringList& customPresets)
 {
 {
-    static const CRenderViewport::SResolution resolutions[] = {
-        CRenderViewport::SResolution(1280, 720),
-        CRenderViewport::SResolution(1920, 1080),
-        CRenderViewport::SResolution(2560, 1440),
-        CRenderViewport::SResolution(2048, 858),
-        CRenderViewport::SResolution(1998, 1080),
-        CRenderViewport::SResolution(3840, 2160)
+    struct SResolution
+    {
+        SResolution()
+            : width(0)
+            , height(0)
+        {
+        }
+
+        SResolution(int w, int h)
+            : width(w)
+            , height(h)
+        {
+        }
+
+        int width;
+        int height;
+    };
+
+    static const SResolution resolutions[] = {
+        SResolution(1280, 720),
+        SResolution(1920, 1080),
+        SResolution(2560, 1440),
+        SResolution(2048, 858),
+        SResolution(1998, 1080),
+        SResolution(3840, 2160)
     };
     };
 
 
     static const size_t resolutionCount = sizeof(resolutions) / sizeof(resolutions[0]);
     static const size_t resolutionCount = sizeof(resolutions) / sizeof(resolutions[0]);

+ 0 - 1
Code/Editor/ViewportTitleDlg.h

@@ -12,7 +12,6 @@
 #pragma once
 #pragma once
 
 
 #if !defined(Q_MOC_RUN)
 #if !defined(Q_MOC_RUN)
-#include "RenderViewport.h"
 #include <AzCore/Component/Component.h>
 #include <AzCore/Component/Component.h>
 
 
 #include <IAudioSystem.h>
 #include <IAudioSystem.h>

+ 0 - 4
Code/Editor/editor_lib_files.cmake

@@ -724,8 +724,6 @@ set(FILES
     Util/GuidUtil.cpp
     Util/GuidUtil.cpp
     Util/GuidUtil.h
     Util/GuidUtil.h
     Util/IObservable.h
     Util/IObservable.h
-    Util/IndexedFiles.cpp
-    Util/IndexedFiles.h
     Util/KDTree.cpp
     Util/KDTree.cpp
     Util/Mailer.h
     Util/Mailer.h
     Util/NamedData.cpp
     Util/NamedData.cpp
@@ -807,8 +805,6 @@ set(FILES
     ViewportManipulatorController.h
     ViewportManipulatorController.h
     LegacyViewportCameraController.cpp
     LegacyViewportCameraController.cpp
     LegacyViewportCameraController.h
     LegacyViewportCameraController.h
-    RenderViewport.cpp
-    RenderViewport.h
     TopRendererWnd.cpp
     TopRendererWnd.cpp
     TopRendererWnd.h
     TopRendererWnd.h
     ViewManager.cpp
     ViewManager.cpp

+ 16 - 0
Code/Framework/AzCore/AzCore/Math/MatrixUtils.cpp

@@ -44,6 +44,22 @@ namespace AZ
         return &out;
         return &out;
     }
     }
 
 
+    void SetPerspectiveMatrixFOV(Matrix4x4& out, float fovY, float aspectRatio)
+    {
+        float sinFov, cosFov;
+        SinCos(0.5f * fovY, sinFov, cosFov);
+        float yScale = cosFov / sinFov; //cot(fovY/2)
+        float xScale = yScale / aspectRatio;
+
+        out.SetElement(0, 0, xScale);
+        out.SetElement(1, 1, yScale);
+    }
+
+    float GetPerspectiveMatrixFOV(const Matrix4x4& m)
+    {
+        return 2.0 * AZStd::atan(1.0f / m.GetElement(1, 1));
+    }
+
     Matrix4x4* MakeFrustumMatrixRH(Matrix4x4& out, float left, float right, float bottom, float top, float nearDist, float farDist, bool reverseDepth)
     Matrix4x4* MakeFrustumMatrixRH(Matrix4x4& out, float left, float right, float bottom, float top, float nearDist, float farDist, bool reverseDepth)
     {
     {
         AZ_Assert(right > left, "right should be greater than left");
         AZ_Assert(right > left, "right should be greater than left");

+ 4 - 0
Code/Framework/AzCore/AzCore/Math/MatrixUtils.h

@@ -64,4 +64,8 @@ namespace AZ
     //! Transforms a position by a matrix. This function can be used with any generic cases which include projection matrices.
     //! Transforms a position by a matrix. This function can be used with any generic cases which include projection matrices.
     Vector3 MatrixTransformPosition(const Matrix4x4& matrix, const Vector3& inPosition);
     Vector3 MatrixTransformPosition(const Matrix4x4& matrix, const Vector3& inPosition);
 
 
+
+    void SetPerspectiveMatrixFOV(Matrix4x4& out, float fovY, float aspectRatio);
+    float GetPerspectiveMatrixFOV(const Matrix4x4& m);
+
 } // namespace AZ
 } // namespace AZ

+ 3 - 4
Code/Framework/AzCore/AzCore/Memory/AllocationRecords.h

@@ -27,11 +27,10 @@ namespace AZ
         struct AllocationInfo
         struct AllocationInfo
         {
         {
             size_t          m_byteSize{};
             size_t          m_byteSize{};
-            unsigned int    m_alignment{};
             const char*     m_name{};
             const char*     m_name{};
-
             const char*     m_fileName{};
             const char*     m_fileName{};
             int             m_lineNum{};
             int             m_lineNum{};
+            unsigned int    m_alignment{};
             void*           m_namesBlock{}; ///< Memory block if m_name and m_fileName have been allocated specifically for this allocation record
             void*           m_namesBlock{}; ///< Memory block if m_name and m_fileName have been allocated specifically for this allocation record
             size_t          m_namesBlockSize{};
             size_t          m_namesBlockSize{};
 
 
@@ -41,7 +40,7 @@ namespace AZ
         };
         };
 
 
         // We use OSAllocator which uses system calls to allocate memory, they are not recorded or tracked!
         // We use OSAllocator which uses system calls to allocate memory, they are not recorded or tracked!
-        typedef AZStd::unordered_map<void*, AllocationInfo, AZStd::hash<void*>, AZStd::equal_to<void*>, OSStdAllocator>  AllocationRecordsType;
+        using AllocationRecordsType = AZStd::unordered_map<void*, AllocationInfo, AZStd::hash<void*>, AZStd::equal_to<void*>, OSStdAllocator>;
 
 
         /**
         /**
          * Records enumeration callback
          * Records enumeration callback
@@ -50,7 +49,7 @@ namespace AZ
          * \param unsigned char number of stack records/levels, if AllocationInfo::m_stackFrames != NULL.
          * \param unsigned char number of stack records/levels, if AllocationInfo::m_stackFrames != NULL.
          * \returns true if you want to continue traverse of the records and false if you want to stop.
          * \returns true if you want to continue traverse of the records and false if you want to stop.
          */
          */
-        typedef AZStd::function<bool (void*, const AllocationInfo&, unsigned char)> AllocationInfoCBType;
+        using AllocationInfoCBType = AZStd::function<bool (void*, const AllocationInfo&, unsigned char)>;
         /**
         /**
          * Example of records enumeration callback.
          * Example of records enumeration callback.
          */
          */

+ 0 - 50
Code/Framework/AzCore/AzCore/Script/ScriptProperty.cpp

@@ -31,7 +31,6 @@ namespace AZ
         ScriptPropertyGenericClassArray::Reflect(reflection);
         ScriptPropertyGenericClassArray::Reflect(reflection);
 
 
         ScriptPropertyAsset::Reflect(reflection);
         ScriptPropertyAsset::Reflect(reflection);
-        ScriptPropertyEntityRef::Reflect(reflection);
     }
     }
 
 
     template<class Iterator>
     template<class Iterator>
@@ -1358,53 +1357,4 @@ namespace AZ
             m_value = assetProperty->m_value;
             m_value = assetProperty->m_value;
         }
         }
     }
     }
-
-    ////////////////////////////
-    // ScriptPropertyEntityRef
-    ////////////////////////////
-    void ScriptPropertyEntityRef::Reflect(AZ::ReflectContext* reflection)
-    {
-        AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(reflection);
-
-        if (serializeContext)
-        {
-            serializeContext->Class<AZ::ScriptPropertyEntityRef, AZ::ScriptProperty>()->
-                Version(1)->
-                Field("value", &AZ::ScriptPropertyEntityRef::m_value);
-        }
-    }
-
-    const AZ::Uuid& ScriptPropertyEntityRef::GetDataTypeUuid() const
-    {
-        return AZ::SerializeTypeInfo<AZ::EntityId>::GetUuid();
-    }
-
-    bool ScriptPropertyEntityRef::DoesTypeMatch(AZ::ScriptDataContext& context, int valueIndex) const
-    {
-        return context.IsRegisteredClass(valueIndex);
-    }
-
-    AZ::ScriptPropertyEntityRef* ScriptPropertyEntityRef::Clone(const char* name) const
-    {
-        AZ::ScriptPropertyEntityRef* clonedValue = aznew AZ::ScriptPropertyEntityRef(name ? name : m_name.c_str());
-        clonedValue->m_value = m_value;
-        return clonedValue;
-    }
-
-    bool ScriptPropertyEntityRef::Write(AZ::ScriptContext& context)
-    {
-        AZ::ScriptValue<AZ::EntityId>::StackPush(context.NativeContext(), m_value);
-        return true;
-    }
-
-    void ScriptPropertyEntityRef::CloneDataFrom(const AZ::ScriptProperty* scriptProperty)
-    {
-        const AZ::ScriptPropertyEntityRef* entityProperty = azrtti_cast<const AZ::ScriptPropertyEntityRef*>(scriptProperty);
-
-        AZ_Error("ScriptPropertyEntityRef", entityProperty, "Invalid call to CloneData. Types must match before clone attempt is made.\n");
-        if (entityProperty)
-        {
-            m_value = entityProperty->m_value;
-        }
     }
     }
-}

Някои файлове не бяха показани, защото твърде много файлове са промени