Selaa lähdekoodia

Addressing PR

Signed-off-by: Olex Lozitskiy <[email protected]>
Olex Lozitskiy 3 vuotta sitten
vanhempi
commit
b4d31436bf

+ 5 - 0
Gems/RecastNavigation/Code/Source/EditorComponents/EditorRecastNavigationMeshComponent.cpp

@@ -205,4 +205,9 @@ namespace RecastNavigation
     {
         m_controller.UpdateNavigationMeshAsync();
     }
+
+    void EditorRecastNavigationMeshComponent::SetEditorPreview(bool enable)
+    {
+        m_controller.m_configuration.m_enableEditorPreview = enable;
+    }
 } // namespace RecastNavigation

+ 4 - 2
Gems/RecastNavigation/Code/Source/EditorComponents/EditorRecastNavigationMeshComponent.h

@@ -34,13 +34,15 @@ namespace RecastNavigation
         void Activate() override;
         void Deactivate() override;
 
+        //! Enables or disables in-Editor preview of navigation mesh without entering game mode.
+        //! @param enable if true, the preview will be enabled
+        void SetEditorPreview(bool enable);
+
         void OnAutoUpdateChanged();
 
         void OnEditorUpdateTick();
 
     private:
         AZ::ScheduledEvent m_inEditorUpdateTick{ [this]() {OnEditorUpdateTick(); }, AZ::Name("EditorRecastNavigationMeshTick") };
-
-        friend class EditorNavigationTest;
     };
 } // namespace RecastNavigation

+ 0 - 1
Gems/RecastNavigation/Code/Source/Misc/RecastNavigationMeshComponentController.h

@@ -28,7 +28,6 @@ namespace RecastNavigation
         : public RecastNavigationMeshRequestBus::Handler
     {
         friend class EditorRecastNavigationMeshComponent;
-        friend class EditorNavigationTest;
     public:
         AZ_CLASS_ALLOCATOR(RecastNavigationMeshComponentController, AZ::SystemAllocator, 0);
         AZ_RTTI(RecastNavigationMeshComponentController, "{D34CD5E0-8C29-4545-8734-9C7A92F03740}");

+ 2 - 3
Gems/RecastNavigation/Code/Tests/EditorNavigationMeshTest.cpp

@@ -13,7 +13,6 @@
 #include <AzCore/Component/Entity.h>
 #include <AzCore/Console/Console.h>
 #include <AzCore/EBus/EventSchedulerSystemComponent.h>
-#include <AzCore/Serialization/ObjectStream.h>
 #include <AzCore/std/smart_ptr/unique_ptr.h>
 #include <AzCore/UnitTest/TestTypes.h>
 #include <AzCore/UnitTest/Mocks/MockITime.h>
@@ -139,7 +138,7 @@ namespace RecastNavigation
             e.CreateComponent<EditorDetourNavigationComponent>();
 
             m_editorRecastNavigationMeshComponent = e.CreateComponent<EditorRecastNavigationMeshComponent>(RecastNavigationMeshConfig{});
-            m_editorRecastNavigationMeshComponent->m_controller.m_configuration.m_enableEditorPreview = true;
+            m_editorRecastNavigationMeshComponent->SetEditorPreview(true);
         }
 
         void SetupNavigationMesh()
@@ -222,7 +221,7 @@ namespace RecastNavigation
 
         void SetEditorMeshConfig(EditorRecastNavigationMeshComponent* component, bool autoUpdate)
         {
-            component->m_controller.m_configuration.m_enableEditorPreview = autoUpdate;
+            component->SetEditorPreview(autoUpdate);
 
             component->OnAutoUpdateChanged();
         }