Merge branch 'development' of https://github.com/o3de/o3de into daimini/FocusMode/setup
This commit is contained in:
+8
-8
@@ -13,9 +13,9 @@
|
||||
|
||||
if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED AND AutomatedTesting IN_LIST LY_PROJECTS)
|
||||
ly_add_pytest(
|
||||
NAME AutomatedTesting::AtomRenderer_HydraTests_Main
|
||||
NAME AutomatedTesting::Atom_TestSuite_Main
|
||||
TEST_SUITE main
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/test_Atom_MainSuite.py
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main.py
|
||||
TEST_SERIAL
|
||||
TIMEOUT 600
|
||||
RUNTIME_DEPENDENCIES
|
||||
@@ -26,9 +26,9 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED AND AutomatedT
|
||||
Atom
|
||||
)
|
||||
ly_add_pytest(
|
||||
NAME AutomatedTesting::AtomRenderer_HydraTests_MainOptimized
|
||||
NAME AutomatedTesting::Atom_TestSuite_Main_Optimized
|
||||
TEST_SUITE main
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/test_Atom_MainSuite_Optimized.py
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main_Optimized.py
|
||||
TEST_SERIAL
|
||||
TIMEOUT 600
|
||||
RUNTIME_DEPENDENCIES
|
||||
@@ -39,9 +39,9 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED AND AutomatedT
|
||||
Atom
|
||||
)
|
||||
ly_add_pytest(
|
||||
NAME AutomatedTesting::AtomRenderer_HydraTests_Sandbox
|
||||
NAME AutomatedTesting::Atom_TestSuite_Sandbox
|
||||
TEST_SUITE sandbox
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/test_Atom_SandboxSuite.py
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Sandbox.py
|
||||
TEST_SERIAL
|
||||
TIMEOUT 400
|
||||
RUNTIME_DEPENDENCIES
|
||||
@@ -52,12 +52,12 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED AND AutomatedT
|
||||
Atom
|
||||
)
|
||||
ly_add_pytest(
|
||||
NAME AutomatedTesting::AtomRenderer_HydraTests_GPUTests
|
||||
NAME AutomatedTesting::Atom_TestSuite_Main_GPU
|
||||
TEST_SUITE main
|
||||
TEST_REQUIRES gpu
|
||||
TEST_SERIAL
|
||||
TIMEOUT 1200
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/test_Atom_GPUTests.py
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main_GPU.py
|
||||
RUNTIME_DEPENDENCIES
|
||||
AssetProcessor
|
||||
AutomatedTesting.Assets
|
||||
+2
-2
@@ -13,10 +13,10 @@ import pytest
|
||||
|
||||
import ly_test_tools.environment.file_system as file_system
|
||||
import editor_python_test_tools.hydra_test_utils as hydra
|
||||
from atom_renderer.atom_utils.atom_constants import LIGHT_TYPES
|
||||
from Atom.atom_utils.atom_constants import LIGHT_TYPES
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "atom_hydra_scripts")
|
||||
TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "tests")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("project", ["AutomatedTesting"])
|
||||
+1
-3
@@ -3,8 +3,6 @@ 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
|
||||
|
||||
Tests that require a GPU in order to run.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
@@ -22,7 +20,7 @@ import editor_python_test_tools.hydra_test_utils as hydra
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
DEFAULT_SUBFOLDER_PATH = 'user/PythonTests/Automated/Screenshots'
|
||||
TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "atom_hydra_scripts")
|
||||
TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "tests")
|
||||
|
||||
|
||||
def golden_images_directory():
|
||||
+10
-10
@@ -15,32 +15,32 @@ from ly_test_tools.o3de.editor_test import EditorSharedTest, EditorTestSuite
|
||||
class TestAutomation(EditorTestSuite):
|
||||
|
||||
class AtomEditorComponents_DecalAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_DecalAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_DecalAdded as test_module
|
||||
|
||||
class AtomEditorComponents_DepthOfFieldAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_DepthOfFieldAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_DepthOfFieldAdded as test_module
|
||||
|
||||
class AtomEditorComponents_DirectionalLightAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_DirectionalLightAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_DirectionalLightAdded as test_module
|
||||
|
||||
class AtomEditorComponents_ExposureControlAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_ExposureControlAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_ExposureControlAdded as test_module
|
||||
|
||||
class AtomEditorComponents_GlobalSkylightIBLAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_GlobalSkylightIBLAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_GlobalSkylightIBLAdded as test_module
|
||||
|
||||
class AtomEditorComponents_PhysicalSkyAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_PhysicalSkyAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_PhysicalSkyAdded as test_module
|
||||
|
||||
class AtomEditorComponents_PostFXRadiusWeightModifierAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import (
|
||||
from Atom.tests import (
|
||||
hydra_AtomEditorComponents_PostFXRadiusWeightModifierAdded as test_module)
|
||||
|
||||
class AtomEditorComponents_LightAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_LightAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_LightAdded as test_module
|
||||
|
||||
class AtomEditorComponents_DisplayMapperAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_DisplayMapperAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_DisplayMapperAdded as test_module
|
||||
|
||||
class ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges(EditorSharedTest):
|
||||
from .atom_hydra_scripts import hydra_ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges as test_module
|
||||
from Atom.tests import hydra_ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges as test_module
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"Source" : "DependencyValidation.azsl",
|
||||
|
||||
"DepthStencilState" : {
|
||||
"DepthStencilState" : {
|
||||
"Depth" : { "Enable" : false, "CompareFunc" : "GreaterEqual" }
|
||||
},
|
||||
|
||||
@@ -22,5 +22,5 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -12,5 +12,5 @@
|
||||
|
||||
float4 GetTest2Color(float4 color)
|
||||
{
|
||||
return color * 0.5;
|
||||
return color * 0.5;
|
||||
}
|
||||
+1
-1
@@ -12,5 +12,5 @@
|
||||
|
||||
float4 GetTest3Color(float4 color)
|
||||
{
|
||||
return color * 0.13;
|
||||
return color * 0.13;
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@ import azlmbr.legacy.general as general
|
||||
sys.path.append(os.path.join(azlmbr.paths.devassets, "Gem", "PythonTests"))
|
||||
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from atom_renderer.atom_utils.atom_constants import LIGHT_TYPES
|
||||
from Atom.atom_utils.atom_constants import LIGHT_TYPES
|
||||
|
||||
LIGHT_TYPE_PROPERTY = 'Controller|Configuration|Light type'
|
||||
SPHERE_AND_SPOT_DISK_LIGHT_PROPERTIES = [
|
||||
+1
-1
@@ -18,7 +18,7 @@ import azlmbr.paths
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devassets, "Gem", "PythonTests"))
|
||||
|
||||
import atom_renderer.atom_utils.material_editor_utils as material_editor
|
||||
import Atom.atom_utils.material_editor_utils as material_editor
|
||||
|
||||
NEW_MATERIAL = "test_material.material"
|
||||
NEW_MATERIAL_1 = "test_material_1.material"
|
||||
+1
-1
@@ -14,7 +14,7 @@ sys.path.append(os.path.join(azlmbr.paths.devroot, "AutomatedTesting", "Gem", "P
|
||||
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
from atom_renderer.atom_utils.benchmark_utils import BenchmarkHelper
|
||||
from Atom.atom_utils.benchmark_utils import BenchmarkHelper
|
||||
|
||||
SCREEN_WIDTH = 1280
|
||||
SCREEN_HEIGHT = 720
|
||||
+1
-1
@@ -21,7 +21,7 @@ sys.path.append(os.path.join(azlmbr.paths.devroot, "AutomatedTesting", "Gem", "P
|
||||
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
from atom_renderer.atom_utils.screenshot_utils import ScreenshotHelper
|
||||
from Atom.atom_utils.screenshot_utils import ScreenshotHelper
|
||||
|
||||
SCREEN_WIDTH = 1280
|
||||
SCREEN_HEIGHT = 720
|
||||
+1
-1
@@ -17,7 +17,7 @@ import azlmbr.legacy.general as general
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, "AutomatedTesting", "Gem", "PythonTests"))
|
||||
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from atom_renderer.atom_utils import atom_component_helper, atom_constants, screenshot_utils
|
||||
from Atom.atom_utils import atom_component_helper, atom_constants, screenshot_utils
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
|
||||
helper = EditorTestHelper(log_prefix="Atom_EditorTestHelper")
|
||||
@@ -18,7 +18,7 @@ include(${pal_dir}/PAL_traits_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
|
||||
add_subdirectory(assetpipeline)
|
||||
|
||||
## Atom Renderer ##
|
||||
add_subdirectory(atom_renderer)
|
||||
add_subdirectory(Atom)
|
||||
|
||||
## Physics ##
|
||||
add_subdirectory(Physics)
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
|
||||
static const float4 s_AzslDebugColor = float4(165.0 / 255.0, 30.0 / 255.0, 36.0 / 255.0, 1);
|
||||
|
||||
// Uniform limitation need to be taken into consideration for mobile devices
|
||||
// Uniform limitation need to be taken into consideration for mobile devices. This would help alleviate device lost errors if the constant buffer
|
||||
// size overshoots the device's memory constraints. An example is a large number of constant buffers associated with mesh instances that would result in device lost,
|
||||
// but otherwise OK on PC. We can separate out the number of instances for the different platforms with this define.
|
||||
// [ATOM-14949]
|
||||
#define AZ_TRAIT_CONSTANT_BUFFER_LIMITATIONS 1
|
||||
#define AZ_TRAIT_CONSTANT_BUFFER_LIMITATIONS 1
|
||||
|
||||
// Different constant buffer alignment on platforms
|
||||
#define AZ_TRAIT_CONSTANT_BUFFER_ALIGNMENT 16
|
||||
|
||||
@@ -12,3 +12,7 @@
|
||||
*/
|
||||
|
||||
static const float4 s_AzslDebugColor = float4(165.0 / 255.0, 30.0 / 255.0, 36.0 / 255.0, 1);
|
||||
|
||||
|
||||
// Different constant buffer alignment on platforms
|
||||
#define AZ_TRAIT_CONSTANT_BUFFER_ALIGNMENT 128
|
||||
@@ -104,6 +104,7 @@ option bool o_layer3_enabled;
|
||||
enum class DebugDrawMode { None, BlendMask, Displacement, FinalBlendWeights };
|
||||
option DebugDrawMode o_debugDrawMode;
|
||||
|
||||
// If you modify this enum, you must update the BlendSourceUsesDisplacement function in StandardMultilayerPBR_Displacement.lua
|
||||
enum class LayerBlendSource { BlendMaskTexture, BlendMaskVertexColors, Displacement, Displacement_With_BlendMaskTexture, Displacement_With_BlendMaskVertexColors, Fallback };
|
||||
option LayerBlendSource o_layerBlendSource;
|
||||
|
||||
|
||||
+3
-2
@@ -88,7 +88,7 @@ end
|
||||
-- @return a table with two values {min,max}. Negative values are below the surface and positive values are above the surface.
|
||||
function CalcOverallHeightRange(context)
|
||||
|
||||
local heightMinMax = {nil, nil}
|
||||
local heightMinMax = {}
|
||||
|
||||
local function GetMergedHeightRange(heightMinMax, offset, factor)
|
||||
top = offset
|
||||
@@ -138,7 +138,8 @@ function CalcOverallHeightRange(context)
|
||||
if(enableLayer3) then GetMergedHeightRange(heightMinMax, offsetLayer3, factorLayer3) end
|
||||
|
||||
else
|
||||
heightMinMax = {0,0}
|
||||
heightMinMax[0] = 0
|
||||
heightMinMax[1] = 0
|
||||
end
|
||||
|
||||
return heightMinMax
|
||||
|
||||
@@ -18,8 +18,8 @@ ly_add_target(
|
||||
PUBLIC
|
||||
Gem::Atom_RPI.Public
|
||||
AZ::AtomCore
|
||||
PRIVATE
|
||||
Legacy::CryCommon
|
||||
AZ::AzCore
|
||||
AZ::AzFramework
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
@@ -32,7 +32,6 @@ ly_add_target(
|
||||
Source
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
Legacy::CryCommon
|
||||
Gem::Camera.Static
|
||||
)
|
||||
|
||||
@@ -56,9 +55,6 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
Source
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
Legacy::CryCommon
|
||||
Legacy::Editor.Headers
|
||||
Legacy::EditorCommon
|
||||
AZ::AzToolsFramework
|
||||
Gem::Camera.Static
|
||||
RUNTIME_DEPENDENCIES
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
|
||||
#include "CameraComponent.h"
|
||||
|
||||
#include <MathConversion.h>
|
||||
#include <AzCore/Math/MatrixUtils.h>
|
||||
#include <IRenderer.h>
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
|
||||
namespace Camera
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
#include <AzFramework/Components/ComponentAdapter.h>
|
||||
|
||||
#include <AzFramework/Components/CameraBus.h>
|
||||
#include <IViewSystem.h>
|
||||
#include <ISystem.h>
|
||||
#include <Cry_Camera.h>
|
||||
#include <CameraComponentController.h>
|
||||
|
||||
#include <Atom/RPI.Public/Base.h>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "CameraComponentController.h"
|
||||
#include "CameraViewRegistrationBus.h"
|
||||
|
||||
#include <MathConversion.h>
|
||||
#include <AzCore/Math/MatrixUtils.h>
|
||||
#include <Atom/RPI.Public/View.h>
|
||||
#include <Atom/RPI.Public/ViewportContextManager.h>
|
||||
@@ -53,7 +52,7 @@ namespace Camera
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::ValuesOnly)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CameraComponentConfig::m_fov, "Field of view", "Vertical field of view in degrees")
|
||||
->Attribute(AZ::Edit::Attributes::Min, MIN_FOV)
|
||||
->Attribute(AZ::Edit::Attributes::Min, MinFoV)
|
||||
->Attribute(AZ::Edit::Attributes::Suffix, " degrees")
|
||||
->Attribute(AZ::Edit::Attributes::Step, 1.f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, AZ::RadToDeg(AZ::Constants::Pi) - 0.0001f) //We assert at fovs >= Pi so set the max for this field to be just under that
|
||||
@@ -61,7 +60,7 @@ namespace Camera
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, &CameraComponentConfig::GetPerspectiveParameterVisibility)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CameraComponentConfig::m_nearClipDistance, "Near clip distance",
|
||||
"Distance to the near clip plane of the view Frustum")
|
||||
->Attribute(AZ::Edit::Attributes::Min, CAMERA_MIN_NEAR)
|
||||
->Attribute(AZ::Edit::Attributes::Min, MinimumNearPlaneDistance)
|
||||
->Attribute(AZ::Edit::Attributes::Suffix, " m")
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.1f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, &CameraComponentConfig::GetFarClipDistance)
|
||||
@@ -150,6 +149,11 @@ namespace Camera
|
||||
}
|
||||
}
|
||||
|
||||
void CameraComponentController::SetShouldActivateFunction(AZStd::function<bool()> shouldActivateFunction)
|
||||
{
|
||||
m_shouldActivateFn = shouldActivateFunction;
|
||||
}
|
||||
|
||||
void CameraComponentController::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
CameraComponentConfig::Reflect(context);
|
||||
@@ -202,36 +206,6 @@ namespace Camera
|
||||
{
|
||||
m_entityId = entityId;
|
||||
|
||||
if ((!m_viewSystem)||(!m_system))
|
||||
{
|
||||
// perform first-time init
|
||||
if (gEnv)
|
||||
{
|
||||
m_system = gEnv->pSystem;
|
||||
}
|
||||
if (m_system)
|
||||
{
|
||||
// Initialize local view.
|
||||
m_viewSystem = m_system->GetIViewSystem();
|
||||
if (!m_viewSystem)
|
||||
{
|
||||
AZ_Error("CameraComponent", m_viewSystem != nullptr, "The CameraComponent shouldn't be used without a local view system");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_viewSystem)
|
||||
{
|
||||
if (m_view == nullptr)
|
||||
{
|
||||
m_view = m_viewSystem->CreateView();
|
||||
|
||||
AZ::Entity* entity = nullptr;
|
||||
AZ::ComponentApplicationBus::BroadcastResult(entity, &AZ::ComponentApplicationRequests::FindEntity, m_entityId);
|
||||
m_view->LinkTo(entity);
|
||||
}
|
||||
}
|
||||
|
||||
auto atomViewportRequests = AZ::Interface<AZ::RPI::ViewportContextRequestsInterface>::Get();
|
||||
if (atomViewportRequests)
|
||||
{
|
||||
@@ -270,9 +244,8 @@ namespace Camera
|
||||
CameraBus::Handler::BusConnect();
|
||||
CameraNotificationBus::Broadcast(&CameraNotificationBus::Events::OnCameraAdded, m_entityId);
|
||||
|
||||
// Activate our camera if we're running from the launcher or Editor game mode
|
||||
// Otherwise, let the Editor keep managing the active camera
|
||||
if (m_config.m_makeActiveViewOnActivation && (!gEnv || !gEnv->IsEditor() || gEnv->IsEditorGameMode()))
|
||||
// Only activate if we're configured to do so, and our activation call back indicates that we should
|
||||
if (m_config.m_makeActiveViewOnActivation && (!m_shouldActivateFn || m_shouldActivateFn()))
|
||||
{
|
||||
MakeActiveView();
|
||||
}
|
||||
@@ -284,20 +257,6 @@ namespace Camera
|
||||
CameraBus::Handler::BusDisconnect();
|
||||
AZ::TransformNotificationBus::Handler::BusDisconnect(m_entityId);
|
||||
CameraRequestBus::Handler::BusDisconnect(m_entityId);
|
||||
if (m_viewSystem)
|
||||
{
|
||||
if (m_view != nullptr && m_viewSystem->GetViewId(m_view) != 0)
|
||||
{
|
||||
m_view->Unlink();
|
||||
}
|
||||
if (m_viewSystem->GetActiveView() == m_view)
|
||||
{
|
||||
m_viewSystem->SetActiveView(m_prevViewId);
|
||||
}
|
||||
m_viewSystem->RemoveView(m_view);
|
||||
m_prevViewId = 0;
|
||||
m_view = nullptr;
|
||||
}
|
||||
|
||||
auto atomViewportRequests = AZ::Interface<AZ::RPI::ViewportContextRequestsInterface>::Get();
|
||||
if (atomViewportRequests)
|
||||
@@ -429,13 +388,6 @@ namespace Camera
|
||||
return;
|
||||
}
|
||||
|
||||
// Set Legacy Cry view, if it exists
|
||||
if (m_viewSystem)
|
||||
{
|
||||
m_prevViewId = AZ::u32(m_viewSystem->GetActiveViewId());
|
||||
m_viewSystem->SetActiveView(m_view);
|
||||
}
|
||||
|
||||
// Set Atom camera, if it exists
|
||||
if (m_atomCamera)
|
||||
{
|
||||
@@ -461,12 +413,6 @@ namespace Camera
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_view)
|
||||
{
|
||||
CCamera& camera = m_view->GetCamera();
|
||||
camera.SetMatrix(AZTransformToLYTransform(world.GetOrthogonalized()));
|
||||
}
|
||||
|
||||
if (m_atomCamera)
|
||||
{
|
||||
m_updatingTransformFromEntity = true;
|
||||
@@ -495,25 +441,15 @@ namespace Camera
|
||||
|
||||
void CameraComponentController::UpdateCamera()
|
||||
{
|
||||
if (m_view)
|
||||
{
|
||||
auto viewParams = *m_view->GetCurrentParams();
|
||||
viewParams.fov = AZ::DegToRad(m_config.m_fov);
|
||||
viewParams.nearplane = m_config.m_nearClipDistance;
|
||||
viewParams.farplane = m_config.m_farClipDistance;
|
||||
m_view->SetCurrentParams(viewParams);
|
||||
}
|
||||
|
||||
if (auto viewportContext = GetViewportContext())
|
||||
{
|
||||
AZ::Matrix4x4 viewToClipMatrix;
|
||||
float aspectRatio = m_view ? m_view->GetCamera().GetPixelAspectRatio() : 1.f;
|
||||
if (!m_atomAuxGeom)
|
||||
{
|
||||
SetupAtomAuxGeom(viewportContext);
|
||||
}
|
||||
auto windowSize = viewportContext->GetViewportSize();
|
||||
aspectRatio = aznumeric_cast<float>(windowSize.m_width) / aznumeric_cast<float>(windowSize.m_height);
|
||||
const float aspectRatio = aznumeric_cast<float>(windowSize.m_width) / aznumeric_cast<float>(windowSize.m_height);
|
||||
|
||||
// This assumes a reversed depth buffer, in line with other LY Atom integration
|
||||
if (m_config.m_orthographic)
|
||||
|
||||
@@ -16,15 +16,12 @@
|
||||
#include <Atom/RPI.Public/ViewProviderBus.h>
|
||||
#include <Atom/RPI.Public/AuxGeom/AuxGeomFeatureProcessorInterface.h>
|
||||
|
||||
#include <IViewSystem.h>
|
||||
#include <ISystem.h>
|
||||
#include <Cry_Camera.h>
|
||||
|
||||
namespace Camera
|
||||
{
|
||||
static constexpr float DefaultFoV = 75.0f;
|
||||
static constexpr float MinFoV = std::numeric_limits<float>::epsilon();
|
||||
static constexpr float MaxFoV = AZ::RadToDeg(AZ::Constants::Pi);
|
||||
static constexpr float MinimumNearPlaneDistance = 0.001f;
|
||||
static constexpr float DefaultNearPlaneDistance = 0.2f;
|
||||
static constexpr float DefaultFarClipPlaneDistance = 1024.0f;
|
||||
static constexpr float DefaultFrustumDimension = 256.f;
|
||||
@@ -69,6 +66,10 @@ namespace Camera
|
||||
CameraComponentController() = default;
|
||||
explicit CameraComponentController(const CameraComponentConfig& config);
|
||||
|
||||
//! Defines a callback for determining whether this camera should push itself to the top of the Atom camera stack.
|
||||
//! Used by the Editor to disable undesirable camera changes in edit mode.
|
||||
void SetShouldActivateFunction(AZStd::function<bool()> shouldActivateFunction);
|
||||
|
||||
// Controller interface
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
|
||||
@@ -134,10 +135,6 @@ namespace Camera
|
||||
bool m_updatingTransformFromEntity = false;
|
||||
bool m_isActiveView = false;
|
||||
|
||||
// Cry view integration
|
||||
IView* m_view = nullptr;
|
||||
AZ::u32 m_prevViewId = 0;
|
||||
IViewSystem* m_viewSystem = nullptr;
|
||||
ISystem* m_system = nullptr;
|
||||
AZStd::function<bool()> m_shouldActivateFn;
|
||||
};
|
||||
} // namespace Camera
|
||||
|
||||
@@ -21,17 +21,12 @@
|
||||
#include <AzToolsFramework/API/EntityCompositionRequestBus.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
|
||||
|
||||
#include <IEditor.h>
|
||||
#include <ViewManager.h>
|
||||
#include <GameEngine.h>
|
||||
#include <Objects/BaseObject.h>
|
||||
#include <Include/IObjectManager.h>
|
||||
|
||||
#include <Cry_Geo.h>
|
||||
#include <MathConversion.h>
|
||||
#include <AzToolsFramework/API/EditorCameraBus.h>
|
||||
#include "ViewportCameraSelectorWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
|
||||
namespace Camera
|
||||
{
|
||||
void CameraEditorSystemComponent::Reflect(AZ::ReflectContext* context)
|
||||
@@ -72,15 +67,6 @@ namespace Camera
|
||||
|
||||
void CameraEditorSystemComponent::PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2&, int flags)
|
||||
{
|
||||
IEditor* editor;
|
||||
AzToolsFramework::EditorRequests::Bus::BroadcastResult(editor, &AzToolsFramework::EditorRequests::GetEditor);
|
||||
|
||||
CGameEngine* gameEngine = editor->GetGameEngine();
|
||||
if (!gameEngine || !gameEngine->IsLevelLoaded())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(flags & AzToolsFramework::EditorEvents::eECMF_HIDE_ENTITY_CREATION))
|
||||
{
|
||||
QAction* action = menu->addAction(QObject::tr("Create camera entity from view"));
|
||||
@@ -90,9 +76,6 @@ namespace Camera
|
||||
|
||||
void CameraEditorSystemComponent::CreateCameraEntityFromViewport()
|
||||
{
|
||||
IEditor* editor = nullptr;
|
||||
AzToolsFramework::EditorRequests::Bus::BroadcastResult(editor, &AzToolsFramework::EditorRequests::GetEditor);
|
||||
|
||||
AzFramework::CameraState cameraState{};
|
||||
AZ::EBusReduceResult<bool, AZStd::logical_or<bool>> aggregator;
|
||||
Camera::EditorCameraRequestBus::BroadcastResult(
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include <AzCore/Module/Module.h>
|
||||
#include <IGem.h>
|
||||
|
||||
#include "CameraComponent.h"
|
||||
#include "CameraSystemComponent.h"
|
||||
@@ -22,13 +21,13 @@
|
||||
namespace Camera
|
||||
{
|
||||
class CameraModule
|
||||
: public CryHooksModule
|
||||
: public AZ::Module
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(CameraModule, "{C2E72B0D-BCEF-452A-9BFA-03833015258C}", AZ::Module);
|
||||
|
||||
CameraModule()
|
||||
: CryHooksModule()
|
||||
: AZ::Module()
|
||||
{
|
||||
m_descriptors.insert(m_descriptors.end(), {
|
||||
Camera::CameraComponent::CreateDescriptor(),
|
||||
|
||||
@@ -12,10 +12,9 @@
|
||||
#include "EditorCameraComponent.h"
|
||||
#include "ViewportCameraSelectorWindow.h"
|
||||
|
||||
#include <MathConversion.h>
|
||||
#include <IRenderer.h>
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
|
||||
|
||||
#include <Atom/RPI.Public/ViewportContext.h>
|
||||
#include <Atom/RPI.Public/View.h>
|
||||
@@ -33,6 +32,14 @@ namespace Camera
|
||||
CameraComponentConfig controllerConfig = m_controller.GetConfiguration();
|
||||
controllerConfig.m_editorEntityId = GetEntityId().operator AZ::u64();
|
||||
m_controller.SetConfiguration(controllerConfig);
|
||||
// Only allow our camera to activate with the component if we're currently in game mode.
|
||||
m_controller.SetShouldActivateFunction([]()
|
||||
{
|
||||
bool isInGameMode = true;
|
||||
AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
|
||||
isInGameMode, &AzToolsFramework::EditorEntityContextRequestBus::Events::IsEditorRunningGame);
|
||||
return isInGameMode;
|
||||
});
|
||||
|
||||
// Call base class activate, which in turn calls Activate on our controller.
|
||||
EditorCameraComponentBase::Activate();
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#include <AzFramework/Components/EditorEntityEvents.h>
|
||||
#include "CameraComponent.h"
|
||||
#include "CameraComponentController.h"
|
||||
#include <IViewSystem.h>
|
||||
#include <Cry_Camera.h>
|
||||
|
||||
#include <Atom/RPI.Public/Base.h>
|
||||
|
||||
|
||||
@@ -7,17 +7,14 @@
|
||||
*/
|
||||
#include "ViewportCameraSelectorWindow.h"
|
||||
#include "ViewportCameraSelectorWindow_Internals.h"
|
||||
#include <IEditor.h>
|
||||
#include <qmetatype.h>
|
||||
#include <QScopedValueRollback>
|
||||
#include <QListView>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <ViewManager.h>
|
||||
#include <Maestro/Bus/EditorSequenceBus.h>
|
||||
#include <Maestro/Bus/SequenceComponentBus.h>
|
||||
#include <AzToolsFramework/API/EditorCameraBus.h>
|
||||
#include <AzToolsFramework/API/ViewPaneOptions.h>
|
||||
|
||||
namespace Qt
|
||||
{
|
||||
@@ -308,7 +305,7 @@ namespace Camera
|
||||
|
||||
void RegisterViewportCameraSelectorWindow()
|
||||
{
|
||||
QtViewOptions viewOptions;
|
||||
AzToolsFramework::ViewPaneOptions viewOptions;
|
||||
viewOptions.isPreview = true;
|
||||
viewOptions.showInMenu = true;
|
||||
viewOptions.preferedDockingArea = Qt::DockWidgetArea::LeftDockWidgetArea;
|
||||
|
||||
@@ -2512,6 +2512,26 @@ namespace LandscapeCanvasEditor
|
||||
{
|
||||
// See comment above in OnPrefabInstancePropagationBegin
|
||||
m_prefabPropagationInProgress = false;
|
||||
|
||||
// After prefab propagation is complete, the entity tied to one of our open
|
||||
// graphs might have been deleted (e.g. if a prefab was created from that entity).
|
||||
// Any open graphs tied to an entity that no longer exists will need to be closed.
|
||||
// We need to close them in a separate iterator because the CloseEditor API will
|
||||
// end up modifying m_dockWidgetsByEntity.
|
||||
AZStd::vector<GraphCanvas::DockWidgetId> dockWidgetsToDelete;
|
||||
for (auto [entityId, dockWidgetId] : m_dockWidgetsByEntity)
|
||||
{
|
||||
AZ::Entity* entity = nullptr;
|
||||
AZ::ComponentApplicationBus::BroadcastResult(entity, &AZ::ComponentApplicationRequests::FindEntity, entityId);
|
||||
if (!entity)
|
||||
{
|
||||
dockWidgetsToDelete.push_back(dockWidgetId);
|
||||
}
|
||||
}
|
||||
for (auto dockWidgetId : dockWidgetsToDelete)
|
||||
{
|
||||
CloseEditor(dockWidgetId);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::OnCryEditorEndCreate()
|
||||
|
||||
Reference in New Issue
Block a user