Merge remote-tracking branch 'upstream/development' into jckand/SliceDeprecationAutomationUtils
Signed-off-by: jckand-amzn <jckand@amazon.com>
This commit is contained in:
@@ -62164,7 +62164,7 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro
|
||||
<message id="HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGADDED_OUTPUT0_NAME">
|
||||
<source>HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGADDED_OUTPUT0_NAME</source>
|
||||
<comment>Simple Type: EntityID C++ Type: const EntityId&</comment>
|
||||
<translation type="unfinished">Entity</translation>
|
||||
<translation type="unfinished">EntityID</translation>
|
||||
</message>
|
||||
<message id="HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGADDED_OUTPUT0_TOOLTIP">
|
||||
<source>HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGADDED_OUTPUT0_TOOLTIP</source>
|
||||
@@ -62202,7 +62202,7 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro
|
||||
<message id="HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGREMOVED_OUTPUT0_NAME">
|
||||
<source>HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGREMOVED_OUTPUT0_NAME</source>
|
||||
<comment>Simple Type: EntityID C++ Type: const EntityId&</comment>
|
||||
<translation type="unfinished">Entity</translation>
|
||||
<translation type="unfinished">EntityId</translation>
|
||||
</message>
|
||||
<message id="HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGREMOVED_OUTPUT0_TOOLTIP">
|
||||
<source>HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGREMOVED_OUTPUT0_TOOLTIP</source>
|
||||
@@ -81852,7 +81852,7 @@ The element is removed from its current parent and added as a child of the new p
|
||||
<message id="HANDLER_SPAWNERCOMPONENTNOTIFICATIONBUS_ONENTITYSPAWNED_OUTPUT1_NAME">
|
||||
<source>HANDLER_SPAWNERCOMPONENTNOTIFICATIONBUS_ONENTITYSPAWNED_OUTPUT1_NAME</source>
|
||||
<comment>Simple Type: EntityID C++ Type: const EntityId&</comment>
|
||||
<translation type="unfinished">Entity</translation>
|
||||
<translation type="unfinished">EntityID</translation>
|
||||
</message>
|
||||
<message id="HANDLER_SPAWNERCOMPONENTNOTIFICATIONBUS_ONENTITYSPAWNED_OUTPUT1_TOOLTIP">
|
||||
<source>HANDLER_SPAWNERCOMPONENTNOTIFICATIONBUS_ONENTITYSPAWNED_OUTPUT1_TOOLTIP</source>
|
||||
@@ -89198,7 +89198,7 @@ The element is removed from its current parent and added as a child of the new p
|
||||
<message id="HANDLER_ENTITYBUS_ONENTITYACTIVATED_OUTPUT0_NAME">
|
||||
<source>HANDLER_ENTITYBUS_ONENTITYACTIVATED_OUTPUT0_NAME</source>
|
||||
<comment>Simple Type: EntityID C++ Type: const EntityId&</comment>
|
||||
<translation type="unfinished">Entity</translation>
|
||||
<translation type="unfinished">EntityID</translation>
|
||||
</message>
|
||||
<message id="HANDLER_ENTITYBUS_ONENTITYACTIVATED_OUTPUT0_TOOLTIP">
|
||||
<source>HANDLER_ENTITYBUS_ONENTITYACTIVATED_OUTPUT0_TOOLTIP</source>
|
||||
@@ -89236,7 +89236,7 @@ The element is removed from its current parent and added as a child of the new p
|
||||
<message id="HANDLER_ENTITYBUS_ONENTITYDEACTIVATED_OUTPUT0_NAME">
|
||||
<source>HANDLER_ENTITYBUS_ONENTITYDEACTIVATED_OUTPUT0_NAME</source>
|
||||
<comment>Simple Type: EntityID C++ Type: const EntityId&</comment>
|
||||
<translation type="unfinished">Entity</translation>
|
||||
<translation type="unfinished">EntityID</translation>
|
||||
</message>
|
||||
<message id="HANDLER_ENTITYBUS_ONENTITYDEACTIVATED_OUTPUT0_TOOLTIP">
|
||||
<source>HANDLER_ENTITYBUS_ONENTITYDEACTIVATED_OUTPUT0_TOOLTIP</source>
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
<Class name="float" field="ProjectorNearPlane" type="{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}" value="0.0000000" specializationTypeId="{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}"/>
|
||||
<Class name="AzFramework::SimpleAssetReference<LmbrCentral::TextureAsset>" field="ProjectorTexture" type="{68E92460-5C0C-4031-9620-6F1A08763243}" version="1" specializationTypeId="{68E92460-5C0C-4031-9620-6F1A08763243}">
|
||||
<Class name="SimpleAssetReferenceBase" field="BaseClass1" type="{E16CA6C5-5C78-4AD9-8E9B-F8C1FB4D1DB8}" version="1" specializationTypeId="{E16CA6C5-5C78-4AD9-8E9B-F8C1FB4D1DB8}">
|
||||
<Class name="AZStd::string" field="AssetPath" type="{EF8FF807-DDEE-4EB0-B678-4CA3A2C490A4}" value="engineassets/textures/defaults/spot_default.dds" specializationTypeId="{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9}"/>
|
||||
<Class name="AZStd::string" field="AssetPath" type="{EF8FF807-DDEE-4EB0-B678-4CA3A2C490A4}" value="" specializationTypeId="{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9}"/>
|
||||
</Class>
|
||||
</Class>
|
||||
<Class name="AzFramework::SimpleAssetReference<LmbrCentral::MaterialAsset>" field="ProjectorMaterial" type="{B7B8ECC7-FF89-4A76-A50E-4C6CA2B6E6B4}" version="1" specializationTypeId="{B7B8ECC7-FF89-4A76-A50E-4C6CA2B6E6B4}">
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cf441215a769562f88aa20711aee68dadcbf02597d1e2270547055e8e6aec6a3
|
||||
size 77
|
||||
@@ -1,178 +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
|
||||
--
|
||||
--
|
||||
--
|
||||
----------------------------------------------------------------------------------------------------
|
||||
Script.ReloadScript("scripts/Utils/EntityUtils.lua")
|
||||
|
||||
GeomCache =
|
||||
{
|
||||
Properties = {
|
||||
geomcacheFile = "EngineAssets/GeomCaches/defaultGeomCache.cax",
|
||||
bPlaying = 0,
|
||||
fStartTime = 0,
|
||||
bLooping = 0,
|
||||
objectStandIn = "",
|
||||
materialStandInMaterial = "",
|
||||
objectFirstFrameStandIn = "",
|
||||
materialFirstFrameStandInMaterial = "",
|
||||
objectLastFrameStandIn = "",
|
||||
materialLastFrameStandInMaterial = "",
|
||||
fStandInDistance = 0,
|
||||
fStreamInDistance = 0,
|
||||
Physics = {
|
||||
bPhysicalize = 0,
|
||||
}
|
||||
},
|
||||
|
||||
Editor={
|
||||
Icon = "animobject.bmp",
|
||||
IconOnTop = 1,
|
||||
},
|
||||
|
||||
bPlaying = 0,
|
||||
currentTime = 0,
|
||||
precacheTime = 0,
|
||||
bPrecachedOutputTriggered = false,
|
||||
}
|
||||
|
||||
function GeomCache:OnLoad(table)
|
||||
self.currentTime = table.currentTime;
|
||||
end
|
||||
|
||||
function GeomCache:OnSave(table)
|
||||
table.currentTime = self.currentTime;
|
||||
end
|
||||
|
||||
function GeomCache:OnSpawn()
|
||||
self.currentTime = self.Properties.fStartTime;
|
||||
self:SetFromProperties();
|
||||
end
|
||||
|
||||
function GeomCache:OnReset()
|
||||
self.currentTime = self.Properties.fStartTime;
|
||||
self.bPrecachedOutputTriggered = true;
|
||||
self:SetFromProperties();
|
||||
end
|
||||
|
||||
function GeomCache:SetFromProperties()
|
||||
local Properties = self.Properties;
|
||||
|
||||
if (Properties.geomcacheFile == "") then
|
||||
do return end;
|
||||
end
|
||||
|
||||
self:LoadGeomCache(0, Properties.geomcacheFile);
|
||||
|
||||
self.bPlaying = Properties.bPlaying;
|
||||
if (self.bPlaying == 0) then
|
||||
self.currentTime = Properties.fStartTime;
|
||||
end
|
||||
|
||||
self:SetGeomCachePlaybackTime(self.currentTime);
|
||||
self:SetGeomCacheParams(Properties.bLooping, Properties.objectStandIn, Properties.materialStandInMaterial, Properties.objectFirstFrameStandIn,
|
||||
Properties.materialFirstFrameStandInMaterial, Properties.objectLastFrameStandIn, Properties.materialLastFrameStandInMaterial,
|
||||
Properties.fStandInDistance, Properties.fStreamInDistance);
|
||||
self:SetGeomCacheStreaming(false, 0);
|
||||
|
||||
if (Properties.Physics.bPhysicalize == 1) then
|
||||
local tempPhysParams = EntityCommon.TempPhysParams;
|
||||
self:Physicalize(0, PE_ARTICULATED, tempPhysParams);
|
||||
end
|
||||
|
||||
self:Activate(1);
|
||||
end
|
||||
|
||||
function GeomCache:PhysicalizeThis()
|
||||
local Physics = self.Properties.Physics;
|
||||
EntityCommon.PhysicalizeRigid(self, 0, Physics, false);
|
||||
end
|
||||
|
||||
function GeomCache:OnUpdate(dt)
|
||||
if (self.bPlaying == 1) then
|
||||
self:SetGeomCachePlaybackTime(self.currentTime);
|
||||
end
|
||||
|
||||
if (self:IsGeomCacheStreaming() and not self.bPrecachedOutputTriggered) then
|
||||
local precachedTime = self:GetGeomCachePrecachedTime();
|
||||
if (precachedTime >= self.precacheTime) then
|
||||
self:ActivateOutput("Precached", true);
|
||||
self.bPrecachedOutputTriggered = true;
|
||||
end
|
||||
end
|
||||
|
||||
if (self.bPlaying == 1) then
|
||||
self.currentTime = self.currentTime + dt;
|
||||
end
|
||||
end
|
||||
|
||||
function GeomCache:OnPropertyChange()
|
||||
self:SetFromProperties();
|
||||
end
|
||||
|
||||
function GeomCache:Event_Start(sender, val)
|
||||
self.bPlaying = 1;
|
||||
end
|
||||
|
||||
function GeomCache:Event_Stop(sender, value)
|
||||
self.bPlaying = 0;
|
||||
end
|
||||
|
||||
function GeomCache:Event_SetTime(sender, value)
|
||||
self.currentTime = value;
|
||||
end
|
||||
|
||||
function GeomCache:Event_StartStreaming(sender, value)
|
||||
self.bPrecachedOutputTriggered = false;
|
||||
self:SetGeomCacheStreaming(true, self.currentTime);
|
||||
end
|
||||
|
||||
function GeomCache:Event_StopStreaming(sender, value)
|
||||
self:SetGeomCacheStreaming(false, 0);
|
||||
end
|
||||
|
||||
function GeomCache:Event_PrecacheTime(sender, value)
|
||||
self.precacheTime = value;
|
||||
end
|
||||
|
||||
function GeomCache:Event_Hide(sender, value)
|
||||
self:Hide(1);
|
||||
end
|
||||
|
||||
function GeomCache:Event_Unhide(sender, value)
|
||||
self:Hide(0);
|
||||
end
|
||||
|
||||
function GeomCache:Event_StopDrawing(sender, value)
|
||||
self:SetGeomCacheDrawing(false);
|
||||
end
|
||||
|
||||
function GeomCache:Event_StartDrawing(sender, value)
|
||||
self:SetGeomCacheDrawing(true);
|
||||
end
|
||||
|
||||
GeomCache.FlowEvents =
|
||||
{
|
||||
Inputs =
|
||||
{
|
||||
Start = { GeomCache.Event_Start, "any" },
|
||||
Stop = { GeomCache.Event_Stop, "any" },
|
||||
SetTime = { GeomCache.Event_SetTime, "float" },
|
||||
StartStreaming = { GeomCache.Event_StartStreaming, "any" },
|
||||
StopStreaming = { GeomCache.Event_StopStreaming, "any" },
|
||||
PrecacheTime = { GeomCache.Event_PrecacheTime, "float" },
|
||||
Hide = { GeomCache.Event_Hide, "any" },
|
||||
Unhide = { GeomCache.Event_Unhide, "any" },
|
||||
StopDrawing = { GeomCache.Event_StopDrawing, "any" },
|
||||
StartDrawing = { GeomCache.Event_StartDrawing, "any" },
|
||||
},
|
||||
Outputs =
|
||||
{
|
||||
Precached = "bool",
|
||||
},
|
||||
}
|
||||
@@ -54,6 +54,7 @@ set(ENABLED_GEMS
|
||||
AWSMetrics
|
||||
PrefabBuilder
|
||||
AudioSystem
|
||||
Terrain
|
||||
Profiler
|
||||
Multiplayer
|
||||
)
|
||||
|
||||
@@ -29,6 +29,10 @@ class TestAutomation(EditorTestSuite):
|
||||
class AtomEditorComponents_DepthOfFieldAdded(EditorSharedTest):
|
||||
from Atom.tests import hydra_AtomEditorComponents_DepthOfFieldAdded as test_module
|
||||
|
||||
@pytest.mark.test_case_id("C36525659")
|
||||
class AtomEditorComponents_DiffuseProbeGridAdded(EditorSharedTest):
|
||||
from Atom.tests import hydra_AtomEditorComponents_DiffuseProbeGridAdded as test_module
|
||||
|
||||
@pytest.mark.test_case_id("C32078120")
|
||||
class AtomEditorComponents_DirectionalLightAdded(EditorSharedTest):
|
||||
from Atom.tests import hydra_AtomEditorComponents_DirectionalLightAdded as test_module
|
||||
@@ -37,6 +41,10 @@ class TestAutomation(EditorTestSuite):
|
||||
class AtomEditorComponents_DisplayMapperAdded(EditorSharedTest):
|
||||
from Atom.tests import hydra_AtomEditorComponents_DisplayMapperAdded as test_module
|
||||
|
||||
@pytest.mark.test_case_id("C36525661")
|
||||
class AtomEditorComponents_EntityReferenceAdded(EditorSharedTest):
|
||||
from Atom.tests import hydra_AtomEditorComponents_EntityReferenceAdded as test_module
|
||||
|
||||
@pytest.mark.test_case_id("C32078121")
|
||||
class AtomEditorComponents_ExposureControlAdded(EditorSharedTest):
|
||||
from Atom.tests import hydra_AtomEditorComponents_ExposureControlAdded as test_module
|
||||
@@ -57,6 +65,10 @@ class TestAutomation(EditorTestSuite):
|
||||
class AtomEditorComponents_LightAdded(EditorSharedTest):
|
||||
from Atom.tests import hydra_AtomEditorComponents_LightAdded as test_module
|
||||
|
||||
@pytest.mark.test_case_id("C36525662")
|
||||
class AtomEditorComponents_LookModificationAdded(EditorSharedTest):
|
||||
from Atom.tests import hydra_AtomEditorComponents_LookModificationAdded as test_module
|
||||
|
||||
@pytest.mark.test_case_id("C32078123")
|
||||
class AtomEditorComponents_MaterialAdded(EditorSharedTest):
|
||||
from Atom.tests import hydra_AtomEditorComponents_MaterialAdded as test_module
|
||||
@@ -94,5 +106,9 @@ class TestAutomation(EditorTestSuite):
|
||||
class AtomEditorComponents_ReflectionProbeAdded(EditorSharedTest):
|
||||
from Atom.tests import hydra_AtomEditorComponents_ReflectionProbeAdded as test_module
|
||||
|
||||
@pytest.mark.test_case_id("C36525666")
|
||||
class AtomEditorComponents_SSAOAdded(EditorSharedTest):
|
||||
from Atom.tests import hydra_AtomEditorComponents_SSAOAdded as test_module
|
||||
|
||||
class ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges(EditorSharedTest):
|
||||
from Atom.tests import hydra_ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges as test_module
|
||||
|
||||
@@ -172,8 +172,7 @@ def create_basic_atom_level(level_name):
|
||||
entity_position=default_position,
|
||||
components=["HDRi Skybox", "Global Skylight (IBL)"],
|
||||
parent_id=default_level.id)
|
||||
global_skylight_asset_path = os.path.join(
|
||||
"LightingPresets", "greenwich_park_02_4k_iblskyboxcm_iblspecular.exr.streamingimage")
|
||||
global_skylight_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage")
|
||||
global_skylight_asset_value = asset.AssetCatalogRequestBus(
|
||||
bus.Broadcast, "GetAssetIdByPath", global_skylight_asset_path, math.Uuid(), False)
|
||||
global_skylight.get_set_test(0, "Controller|Configuration|Cubemap Texture", global_skylight_asset_value)
|
||||
|
||||
@@ -57,11 +57,13 @@ class AtomComponentProperties:
|
||||
def camera(property: str = 'name') -> str:
|
||||
"""
|
||||
Camera component properties.
|
||||
- 'Field of view': Sets the value for the camera's FOV (Field of View) in degrees, i.e. 60.0
|
||||
:param property: From the last element of the property tree path. Default 'name' for component name string.
|
||||
:return: Full property path OR component name if no property specified.
|
||||
"""
|
||||
properties = {
|
||||
'name': 'Camera',
|
||||
'Field of view': 'Controller|Configuration|Field of view'
|
||||
}
|
||||
return properties[property]
|
||||
|
||||
@@ -115,7 +117,7 @@ class AtomComponentProperties:
|
||||
return properties[property]
|
||||
|
||||
@staticmethod
|
||||
def diffuse_probe(property: str = 'name') -> str:
|
||||
def diffuse_probe_grid(property: str = 'name') -> str:
|
||||
"""
|
||||
Diffuse Probe Grid component properties. Requires one of 'shapes'.
|
||||
- 'shapes' a list of supported shapes as component names.
|
||||
@@ -202,11 +204,13 @@ class AtomComponentProperties:
|
||||
def grid(property: str = 'name') -> str:
|
||||
"""
|
||||
Grid component properties.
|
||||
- 'Secondary Grid Spacing': The spacing value for the secondary grid, i.e. 1.0
|
||||
:param property: From the last element of the property tree path. Default 'name' for component name string.
|
||||
:return: Full property path OR component name if no property specified.
|
||||
"""
|
||||
properties = {
|
||||
'name': 'Grid',
|
||||
'Secondary Grid Spacing': 'Controller|Configuration|Secondary Grid Spacing',
|
||||
}
|
||||
return properties[property]
|
||||
|
||||
@@ -231,11 +235,13 @@ class AtomComponentProperties:
|
||||
def hdri_skybox(property: str = 'name') -> str:
|
||||
"""
|
||||
HDRi Skybox component properties.
|
||||
- 'Cubemap Texture': Asset.id for the cubemap texture to set.
|
||||
:param property: From the last element of the property tree path. Default 'name' for component name string.
|
||||
:return: Full property path OR component name if no property specified.
|
||||
"""
|
||||
properties = {
|
||||
'name': 'HDRi Skybox',
|
||||
'Cubemap Texture': 'Controller|Configuration|Cubemap Texture',
|
||||
}
|
||||
return properties[property]
|
||||
|
||||
@@ -259,12 +265,16 @@ class AtomComponentProperties:
|
||||
Look Modification component properties. Requires PostFX Layer component.
|
||||
- 'requires' a list of component names as strings required by this component.
|
||||
Use editor_entity_utils EditorEntity.add_components(list) to add this list of requirements.\n
|
||||
- 'Enable look modification' Toggle active state of the component True/False
|
||||
- 'Color Grading LUT' Asset.id for the LUT used for affecting level look.
|
||||
:param property: From the last element of the property tree path. Default 'name' for component name string.
|
||||
:return: Full property path OR component name if no property specified.
|
||||
"""
|
||||
properties = {
|
||||
'name': 'Look Modification',
|
||||
'requires': [AtomComponentProperties.postfx_layer()],
|
||||
'Enable look modification': 'Controller|Configuration|Enable look modification',
|
||||
'Color Grading LUT': 'Controller|Configuration|Color Grading LUT',
|
||||
}
|
||||
return properties[property]
|
||||
|
||||
@@ -274,12 +284,14 @@ class AtomComponentProperties:
|
||||
Material component properties. Requires one of Actor OR Mesh component.
|
||||
- 'requires' a list of component names as strings required by this component.
|
||||
Only one of these is required at a time for this component.\n
|
||||
- 'Material Asset': the material Asset.id of the material.
|
||||
:param property: From the last element of the property tree path. Default 'name' for component name string.
|
||||
:return: Full property path OR component name if no property specified.
|
||||
"""
|
||||
properties = {
|
||||
'name': 'Material',
|
||||
'requires': [AtomComponentProperties.actor(), AtomComponentProperties.mesh()],
|
||||
'Material Asset': 'Default Material|Material Asset',
|
||||
}
|
||||
return properties[property]
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:954d7d0df47c840a24e313893800eb3126d0c0d47c3380926776b51833778db7
|
||||
oid sha256:aee1fd4d5264e5ef1676b507409ce70af6358cf1ff368d9aeb17f7b2597dfbca
|
||||
size 6220817
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e81c19128f42ba362a2d5f3ccf159dfbc942d67ceeb1ac8c21f295a6fd9d2ce5
|
||||
oid sha256:d4787cdafbcc2fe71c1cb3f1da53a249db839a9df539a9e88be43ccd6d8e4d6a
|
||||
size 6220817
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5e20801213e065b6ea8c95ede81c23faa9b6dc70a2002dc5bced293e1bed989f
|
||||
oid sha256:5fac5bf41c9b16b6fbd762868e5cf514376af92d6ef7ebb9e819f024f1a3e1a7
|
||||
size 6220817
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e250f812e594e5152bf2d6f23caa8b53b78276bfdf344d7a8d355dd96cb995c0
|
||||
oid sha256:7a23969670499524725535e8be7428b55b6f3e887cc24e2e903f7ea821a6d1a5
|
||||
size 6220817
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:95be359041f8291c74b335297a4dfe9902a180510f24a181b15e1a5ba4d3b024
|
||||
oid sha256:2f1f4d8865c56ed7f96f339c39e5feb4e0dbc6c6a8b4a7843b4166381b06b00d
|
||||
size 6220817
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:07e09d3eb5bf0cee3d9b3752aaad40f3ead1dcc5ddd837a6226fadde55d57274
|
||||
oid sha256:5d4ee5641e19eef08dd6b93d2f4054a1aae2165325416ed2cbf0b8243f2c0b06
|
||||
size 6220817
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:118e43e4b915e262726183467cc4b82f244565213fea5b6bfe02be07f0851ab1
|
||||
oid sha256:55c8f0d1790bb12660b7557630efca297b2a1b59e6c93167a2563da79e0a8255
|
||||
size 6220817
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:dc2ce3256a6552975962c9e113c52c1a22bf3817d417151f6f60640dd568e0fa
|
||||
oid sha256:082ff368b621e12b083d96562a0889b11a1d683767a74296cbe6d8732830e9e8
|
||||
size 6220817
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:287d98890b35427688999760f9d066bcbff1a3bc9001534241dc212b32edabd8
|
||||
oid sha256:78cc62d89782899747875b41abee57c2efdfacf4c8af6511c88f82d76eaae4ca
|
||||
size 6220817
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:66e91c92c868167c850078cd91714db47e10a96e23cc30191994486bd79c353f
|
||||
oid sha256:3d6719326f4dacae278d1723090ce1182193b793f250963af8be4b2c298e8841
|
||||
size 6220817
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d950d173f5101820c5e18205401ca08ce5feeff2302ac2920b292750d86a8fa4
|
||||
oid sha256:9e492bb394fb18fb117f8a5b61cd2789922f9d6e88fc83189b5b6d59ffb1c3ef
|
||||
size 6220817
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:72eddb7126eae0c839b933886e0fb69d78229f72d49ef13199de28df2b7879db
|
||||
oid sha256:caca85f7728f660daae36afc81d681ba2de2377c516eb3c637599de5c94012aa
|
||||
size 6220817
|
||||
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
class Tests:
|
||||
creation_undo = (
|
||||
"UNDO Entity creation success",
|
||||
"UNDO Entity creation failed")
|
||||
creation_redo = (
|
||||
"REDO Entity creation success",
|
||||
"REDO Entity creation failed")
|
||||
diffuse_probe_grid_creation = (
|
||||
"Diffuse Probe Grid Entity successfully created",
|
||||
"Diffuse Probe Grid Entity failed to be created")
|
||||
diffuse_probe_grid_component = (
|
||||
"Entity has a Diffuse Probe Grid component",
|
||||
"Entity failed to find Diffuse Probe Grid component")
|
||||
diffuse_probe_grid_disabled = (
|
||||
"Diffuse Probe Grid component disabled",
|
||||
"Diffuse Probe Grid component was not disabled")
|
||||
diffuse_probe_grid_enabled = (
|
||||
"Diffuse Probe Grid component enabled",
|
||||
"Diffuse Probe Grid component was not enabled")
|
||||
enter_game_mode = (
|
||||
"Entered game mode",
|
||||
"Failed to enter game mode")
|
||||
exit_game_mode = (
|
||||
"Exited game mode",
|
||||
"Couldn't exit game mode")
|
||||
is_visible = (
|
||||
"Entity is visible",
|
||||
"Entity was not visible")
|
||||
is_hidden = (
|
||||
"Entity is hidden",
|
||||
"Entity was not hidden")
|
||||
entity_deleted = (
|
||||
"Entity deleted",
|
||||
"Entity was not deleted")
|
||||
deletion_undo = (
|
||||
"UNDO deletion success",
|
||||
"UNDO deletion failed")
|
||||
deletion_redo = (
|
||||
"REDO deletion success",
|
||||
"REDO deletion failed")
|
||||
|
||||
|
||||
def AtomEditorComponents_DiffuseProbeGrid_AddedToEntity():
|
||||
"""
|
||||
Summary:
|
||||
Tests the Diffuse Probe Grid component can be added to an entity and has the expected functionality.
|
||||
|
||||
Test setup:
|
||||
- Wait for Editor idle loop.
|
||||
- Open the "Base" level.
|
||||
|
||||
Expected Behavior:
|
||||
The component can be added, used in game mode, hidden/shown, deleted, and has accurate required components.
|
||||
Creation and deletion undo/redo should also work.
|
||||
|
||||
Test Steps:
|
||||
1) Create a Diffuse Probe Grid entity with no components.
|
||||
2) Add a Diffuse Probe Grid component to Diffuse Probe Grid entity.
|
||||
3) UNDO the entity creation and component addition.
|
||||
4) REDO the entity creation and component addition.
|
||||
5) Verify Diffuse Probe Grid component not enabled.
|
||||
6) Add Shape component since it is required by the Diffuse Probe Grid component.
|
||||
7) Verify Diffuse Probe Grid component is enabled.
|
||||
8) Enter/Exit game mode.
|
||||
9) Test IsHidden.
|
||||
10) Test IsVisible.
|
||||
11) Delete Diffuse Probe Grid entity.
|
||||
12) UNDO deletion.
|
||||
13) REDO deletion.
|
||||
14) Look for errors.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
from editor_python_test_tools.editor_entity_utils import EditorEntity
|
||||
from editor_python_test_tools.utils import Report, Tracer, TestHelper
|
||||
from Atom.atom_utils.atom_constants import AtomComponentProperties
|
||||
|
||||
with Tracer() as error_tracer:
|
||||
# Test setup begins.
|
||||
# Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level.
|
||||
TestHelper.init_idle()
|
||||
TestHelper.open_level("", "Base")
|
||||
|
||||
# Test steps begin.
|
||||
# 1. Create a Diffuse Probe Grid entity with no components.
|
||||
diffuse_probe_grid_entity = EditorEntity.create_editor_entity(AtomComponentProperties.diffuse_probe_grid())
|
||||
Report.critical_result(Tests.diffuse_probe_grid_creation, diffuse_probe_grid_entity.exists())
|
||||
|
||||
# 2. Add a Diffuse Probe Grid component to Diffuse Probe Grid entity.
|
||||
diffuse_probe_grid_component = diffuse_probe_grid_entity.add_component(
|
||||
AtomComponentProperties.diffuse_probe_grid())
|
||||
Report.critical_result(
|
||||
Tests.diffuse_probe_grid_component,
|
||||
diffuse_probe_grid_entity.has_component(AtomComponentProperties.diffuse_probe_grid()))
|
||||
|
||||
# 3. UNDO the entity creation and component addition.
|
||||
# -> UNDO component addition.
|
||||
general.undo()
|
||||
# -> UNDO naming entity.
|
||||
general.undo()
|
||||
# -> UNDO selecting entity.
|
||||
general.undo()
|
||||
# -> UNDO entity creation.
|
||||
general.undo()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.creation_undo, not diffuse_probe_grid_entity.exists())
|
||||
|
||||
# 4. REDO the entity creation and component addition.
|
||||
# -> REDO entity creation.
|
||||
general.redo()
|
||||
# -> REDO selecting entity.
|
||||
general.redo()
|
||||
# -> REDO naming entity.
|
||||
general.redo()
|
||||
# -> REDO component addition.
|
||||
general.redo()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.creation_redo, diffuse_probe_grid_entity.exists())
|
||||
|
||||
# 5. Verify Diffuse Probe Grid component not enabled.
|
||||
Report.result(Tests.diffuse_probe_grid_disabled, not diffuse_probe_grid_component.is_enabled())
|
||||
|
||||
# 6. Add Shape component since it is required by the Diffuse Probe Grid component.
|
||||
for shape in AtomComponentProperties.diffuse_probe_grid('shapes'):
|
||||
diffuse_probe_grid_entity.add_component(shape)
|
||||
test_shape = (
|
||||
f"Entity has a {shape} component",
|
||||
f"Entity did not have a {shape} component")
|
||||
Report.result(test_shape, diffuse_probe_grid_entity.has_component(shape))
|
||||
|
||||
# 7. Check if required shape allows Diffuse Probe Grid to be enabled
|
||||
Report.result(Tests.diffuse_probe_grid_enabled, diffuse_probe_grid_component.is_enabled())
|
||||
|
||||
# Undo to remove each added shape except the last one and verify Diffuse Probe Grid is not enabled.
|
||||
if not (shape == AtomComponentProperties.diffuse_probe_grid('shapes')[-1]):
|
||||
general.undo()
|
||||
TestHelper.wait_for_condition(lambda: not diffuse_probe_grid_entity.has_component(shape), 1.0)
|
||||
Report.result(Tests.diffuse_probe_grid_disabled, not diffuse_probe_grid_component.is_enabled())
|
||||
|
||||
# 8. Enter/Exit game mode.
|
||||
TestHelper.enter_game_mode(Tests.enter_game_mode)
|
||||
general.idle_wait_frames(1)
|
||||
TestHelper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
# 9. Test IsHidden.
|
||||
diffuse_probe_grid_entity.set_visibility_state(False)
|
||||
Report.result(Tests.is_hidden, diffuse_probe_grid_entity.is_hidden() is True)
|
||||
|
||||
# 10. Test IsVisible.
|
||||
diffuse_probe_grid_entity.set_visibility_state(True)
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.is_visible, diffuse_probe_grid_entity.is_visible() is True)
|
||||
|
||||
# 11. Delete Diffuse Probe Grid entity.
|
||||
diffuse_probe_grid_entity.delete()
|
||||
Report.result(Tests.entity_deleted, not diffuse_probe_grid_entity.exists())
|
||||
|
||||
# 12. UNDO deletion.
|
||||
general.undo()
|
||||
Report.result(Tests.deletion_undo, diffuse_probe_grid_entity.exists())
|
||||
|
||||
# 13. REDO deletion.
|
||||
general.redo()
|
||||
Report.result(Tests.deletion_redo, not diffuse_probe_grid_entity.exists())
|
||||
|
||||
# 14. Look for errors or asserts.
|
||||
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
|
||||
for error_info in error_tracer.errors:
|
||||
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
|
||||
for assert_info in error_tracer.asserts:
|
||||
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(AtomEditorComponents_DiffuseProbeGrid_AddedToEntity)
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
class Tests:
|
||||
creation_undo = (
|
||||
"UNDO Entity creation success",
|
||||
"UNDO Entity creation failed")
|
||||
creation_redo = (
|
||||
"REDO Entity creation success",
|
||||
"REDO Entity creation failed")
|
||||
entity_reference_creation = (
|
||||
"Entity Reference Entity successfully created",
|
||||
"Entity Reference Entity failed to be created")
|
||||
entity_reference_component = (
|
||||
"Entity has an Entity Reference component",
|
||||
"Entity failed to find Entity Reference component")
|
||||
enter_game_mode = (
|
||||
"Entered game mode",
|
||||
"Failed to enter game mode")
|
||||
exit_game_mode = (
|
||||
"Exited game mode",
|
||||
"Couldn't exit game mode")
|
||||
is_visible = (
|
||||
"Entity is visible",
|
||||
"Entity was not visible")
|
||||
is_hidden = (
|
||||
"Entity is hidden",
|
||||
"Entity was not hidden")
|
||||
entity_deleted = (
|
||||
"Entity deleted",
|
||||
"Entity was not deleted")
|
||||
deletion_undo = (
|
||||
"UNDO deletion success",
|
||||
"UNDO deletion failed")
|
||||
deletion_redo = (
|
||||
"REDO deletion success",
|
||||
"REDO deletion failed")
|
||||
|
||||
|
||||
def AtomEditorComponents_EntityReference_AddedToEntity():
|
||||
"""
|
||||
Summary:
|
||||
Tests the Entity Reference component can be added to an entity and has the expected functionality.
|
||||
|
||||
Test setup:
|
||||
- Wait for Editor idle loop.
|
||||
- Open the "Base" level.
|
||||
|
||||
Expected Behavior:
|
||||
The component can be added, used in game mode, hidden/shown, deleted, and has accurate required components.
|
||||
Creation and deletion undo/redo should also work.
|
||||
|
||||
Test Steps:
|
||||
1) Create an Entity Reference entity with no components.
|
||||
2) Add Entity Reference component to Entity Reference entity.
|
||||
3) UNDO the entity creation and component addition.
|
||||
4) REDO the entity creation and component addition.
|
||||
5) Enter/Exit game mode.
|
||||
6) Test IsHidden.
|
||||
7) Test IsVisible.
|
||||
8) Delete Entity Reference entity.
|
||||
9) UNDO deletion.
|
||||
10) REDO deletion.
|
||||
11) Look for errors.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
from editor_python_test_tools.editor_entity_utils import EditorEntity
|
||||
from editor_python_test_tools.utils import Report, Tracer, TestHelper
|
||||
from Atom.atom_utils.atom_constants import AtomComponentProperties
|
||||
|
||||
with Tracer() as error_tracer:
|
||||
# Test setup begins.
|
||||
# Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level.
|
||||
TestHelper.init_idle()
|
||||
TestHelper.open_level("", "Base")
|
||||
|
||||
# Test steps begin.
|
||||
# 1. Create an Entity Reference entity with no components.
|
||||
entity_reference_entity = EditorEntity.create_editor_entity(AtomComponentProperties.entity_reference())
|
||||
Report.critical_result(Tests.entity_reference_creation, entity_reference_entity.exists())
|
||||
|
||||
# 2. Add Entity Reference component to Entity Reference entity.
|
||||
entity_reference_component = entity_reference_entity.add_component(
|
||||
AtomComponentProperties.entity_reference())
|
||||
Report.critical_result(
|
||||
Tests.entity_reference_component,
|
||||
entity_reference_entity.has_component(AtomComponentProperties.entity_reference()))
|
||||
|
||||
# 3. UNDO the entity creation and component addition.
|
||||
# -> UNDO component addition.
|
||||
general.undo()
|
||||
# -> UNDO naming entity.
|
||||
general.undo()
|
||||
# -> UNDO selecting entity.
|
||||
general.undo()
|
||||
# -> UNDO entity creation.
|
||||
general.undo()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.creation_undo, not entity_reference_entity.exists())
|
||||
|
||||
# 4. REDO the entity creation and component addition.
|
||||
# -> REDO entity creation.
|
||||
general.redo()
|
||||
# -> REDO selecting entity.
|
||||
general.redo()
|
||||
# -> REDO naming entity.
|
||||
general.redo()
|
||||
# -> REDO component addition.
|
||||
general.redo()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.creation_redo, entity_reference_entity.exists())
|
||||
|
||||
# 5. Enter/Exit game mode.
|
||||
TestHelper.enter_game_mode(Tests.enter_game_mode)
|
||||
general.idle_wait_frames(1)
|
||||
TestHelper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
# 6. Test IsHidden.
|
||||
entity_reference_entity.set_visibility_state(False)
|
||||
Report.result(Tests.is_hidden, entity_reference_entity.is_hidden() is True)
|
||||
|
||||
# 7. Test IsVisible.
|
||||
entity_reference_entity.set_visibility_state(True)
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.is_visible, entity_reference_entity.is_visible() is True)
|
||||
|
||||
# 8. Delete Entity Reference entity.
|
||||
entity_reference_entity.delete()
|
||||
Report.result(Tests.entity_deleted, not entity_reference_entity.exists())
|
||||
|
||||
# 9. UNDO deletion.
|
||||
general.undo()
|
||||
Report.result(Tests.deletion_undo, entity_reference_entity.exists())
|
||||
|
||||
# 10. REDO deletion.
|
||||
general.redo()
|
||||
Report.result(Tests.deletion_redo, not entity_reference_entity.exists())
|
||||
|
||||
# 11. Look for errors and asserts.
|
||||
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
|
||||
for error_info in error_tracer.errors:
|
||||
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
|
||||
for assert_info in error_tracer.asserts:
|
||||
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(AtomEditorComponents_EntityReference_AddedToEntity)
|
||||
+2
-2
@@ -151,7 +151,7 @@ def AtomEditorComponents_GlobalSkylightIBL_AddedToEntity():
|
||||
Report.result(Tests.is_visible, global_skylight_entity.is_visible() is True)
|
||||
|
||||
# 8. Set the Diffuse Image asset on the Global Skylight (IBL) entity.
|
||||
diffuse_image_path = os.path.join("LightingPresets", "greenwich_park_02_4k_iblskyboxcm.exr.streamingimage")
|
||||
diffuse_image_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage")
|
||||
diffuse_image_asset = Asset.find_asset_by_path(diffuse_image_path, False)
|
||||
global_skylight_component.set_component_property_value(
|
||||
AtomComponentProperties.global_skylight('Diffuse Image'), diffuse_image_asset.id)
|
||||
@@ -161,7 +161,7 @@ def AtomEditorComponents_GlobalSkylightIBL_AddedToEntity():
|
||||
AtomComponentProperties.global_skylight('Diffuse Image')))
|
||||
|
||||
# 9. Set the Specular Image asset on the Global Light (IBL) entity.
|
||||
specular_image_path = os.path.join("LightingPresets", "greenwich_park_02_4k_iblskyboxcm.exr.streamingimage")
|
||||
specular_image_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage")
|
||||
specular_image_asset = Asset.find_asset_by_path(specular_image_path, False)
|
||||
global_skylight_component.set_component_property_value(
|
||||
AtomComponentProperties.global_skylight('Specular Image'), specular_image_asset.id)
|
||||
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
class Tests:
|
||||
creation_undo = (
|
||||
"UNDO Entity creation success",
|
||||
"UNDO Entity creation failed")
|
||||
creation_redo = (
|
||||
"REDO Entity creation success",
|
||||
"REDO Entity creation failed")
|
||||
look_modification_creation = (
|
||||
"Look Modification Entity successfully created",
|
||||
"Look Modification Entity failed to be created")
|
||||
look_modification_component = (
|
||||
"Entity has a Look Modification component",
|
||||
"Entity failed to find Look Modification component")
|
||||
look_modification_disabled = (
|
||||
"Look Modification component disabled",
|
||||
"Look Modification component was not disabled")
|
||||
postfx_layer_component = (
|
||||
"Entity has a PostFX Layer component",
|
||||
"Entity did not have an PostFX Layer component")
|
||||
look_modification_enabled = (
|
||||
"Look Modification component enabled",
|
||||
"Look Modification component was not enabled")
|
||||
enable_look_modification_parameter_enabled = (
|
||||
"Enable look modification parameter enabled",
|
||||
"Enable look modification parameter was not enabled")
|
||||
color_grading_lut_set = (
|
||||
"Entity has the Color Grading LUT set",
|
||||
"Entity did not the Color Grading LUT set")
|
||||
enter_game_mode = (
|
||||
"Entered game mode",
|
||||
"Failed to enter game mode")
|
||||
exit_game_mode = (
|
||||
"Exited game mode",
|
||||
"Couldn't exit game mode")
|
||||
is_visible = (
|
||||
"Entity is visible",
|
||||
"Entity was not visible")
|
||||
is_hidden = (
|
||||
"Entity is hidden",
|
||||
"Entity was not hidden")
|
||||
entity_deleted = (
|
||||
"Entity deleted",
|
||||
"Entity was not deleted")
|
||||
deletion_undo = (
|
||||
"UNDO deletion success",
|
||||
"UNDO deletion failed")
|
||||
deletion_redo = (
|
||||
"REDO deletion success",
|
||||
"REDO deletion failed")
|
||||
|
||||
|
||||
def AtomEditorComponents_LookModification_AddedToEntity():
|
||||
"""
|
||||
Summary:
|
||||
Tests the Look Modification component can be added to an entity and has the expected functionality.
|
||||
|
||||
Test setup:
|
||||
- Wait for Editor idle loop.
|
||||
- Open the "Base" level.
|
||||
|
||||
Expected Behavior:
|
||||
The component can be added, used in game mode, hidden/shown, deleted, and has accurate required components.
|
||||
Creation and deletion undo/redo should also work.
|
||||
|
||||
Test Steps:
|
||||
1) Create an Look Modification entity with no components.
|
||||
2) Add Look Modification component to Look Modification entity.
|
||||
3) UNDO the entity creation and component addition.
|
||||
4) REDO the entity creation and component addition.
|
||||
5) Verify Look Modification component not enabled.
|
||||
6) Add PostFX Layer component since it is required by the Look Modification component.
|
||||
7) Verify Look Modification component is enabled.
|
||||
8) Enable the "Enable Look Modification" parameter.
|
||||
9) Add LUT asset to the Color Grading LUT parameter.
|
||||
9) Enter/Exit game mode.
|
||||
10) Test IsHidden.
|
||||
11) Test IsVisible.
|
||||
12) Delete Look Modification entity.
|
||||
13) UNDO deletion.
|
||||
14) REDO deletion.
|
||||
15) Look for errors.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
from editor_python_test_tools.asset_utils import Asset
|
||||
from editor_python_test_tools.editor_entity_utils import EditorEntity
|
||||
from editor_python_test_tools.utils import Report, Tracer, TestHelper
|
||||
from Atom.atom_utils.atom_constants import AtomComponentProperties
|
||||
|
||||
with Tracer() as error_tracer:
|
||||
# Test setup begins.
|
||||
# Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level.
|
||||
TestHelper.init_idle()
|
||||
TestHelper.open_level("", "Base")
|
||||
|
||||
# Test steps begin.
|
||||
# 1. Create an Look Modification entity with no components.
|
||||
look_modification_entity = EditorEntity.create_editor_entity(AtomComponentProperties.look_modification())
|
||||
Report.critical_result(Tests.look_modification_creation, look_modification_entity.exists())
|
||||
|
||||
# 2. Add Look Modification component to Look Modification entity.
|
||||
look_modification_component = look_modification_entity.add_component(
|
||||
AtomComponentProperties.look_modification())
|
||||
Report.critical_result(
|
||||
Tests.look_modification_component,
|
||||
look_modification_entity.has_component(AtomComponentProperties.look_modification()))
|
||||
|
||||
# 3. UNDO the entity creation and component addition.
|
||||
# -> UNDO component addition.
|
||||
general.undo()
|
||||
# -> UNDO naming entity.
|
||||
general.undo()
|
||||
# -> UNDO selecting entity.
|
||||
general.undo()
|
||||
# -> UNDO entity creation.
|
||||
general.undo()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.creation_undo, not look_modification_entity.exists())
|
||||
|
||||
# 4. REDO the entity creation and component addition.
|
||||
# -> REDO entity creation.
|
||||
general.redo()
|
||||
# -> REDO selecting entity.
|
||||
general.redo()
|
||||
# -> REDO naming entity.
|
||||
general.redo()
|
||||
# -> REDO component addition.
|
||||
general.redo()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.creation_redo, look_modification_entity.exists())
|
||||
|
||||
# 5. Verify Look Modification component not enabled.
|
||||
Report.result(Tests.look_modification_disabled, not look_modification_component.is_enabled())
|
||||
|
||||
# 6. Add PostFX Layer component since it is required by the Look Modification component.
|
||||
look_modification_entity.add_component(AtomComponentProperties.postfx_layer())
|
||||
Report.result(
|
||||
Tests.postfx_layer_component,
|
||||
look_modification_entity.has_component(AtomComponentProperties.postfx_layer()))
|
||||
|
||||
# 7. Verify Look Modification component is enabled.
|
||||
Report.result(Tests.look_modification_enabled, look_modification_component.is_enabled())
|
||||
|
||||
# 8. Enable the "Enable look modification" parameter.
|
||||
look_modification_component.set_component_property_value(
|
||||
AtomComponentProperties.look_modification('Enable look modification'), True)
|
||||
Report.result(Tests.enable_look_modification_parameter_enabled,
|
||||
look_modification_component.get_component_property_value(
|
||||
AtomComponentProperties.look_modification('Enable look modification')) is True)
|
||||
|
||||
# 9. Set the Color Grading LUT asset on the Look Modification entity.
|
||||
color_grading_lut_path = os.path.join("ColorGrading", "TestData", "Photoshop", "inv-Log2-48nits",
|
||||
"test_3dl_32_lut.azasset")
|
||||
color_grading_lut_asset = Asset.find_asset_by_path(color_grading_lut_path, False)
|
||||
look_modification_component.set_component_property_value(
|
||||
AtomComponentProperties.look_modification('Color Grading LUT'), color_grading_lut_asset.id)
|
||||
Report.result(
|
||||
Tests.color_grading_lut_set,
|
||||
color_grading_lut_asset.id == look_modification_component.get_component_property_value(
|
||||
AtomComponentProperties.look_modification('Color Grading LUT')))
|
||||
|
||||
# 10. Enter/Exit game mode.
|
||||
TestHelper.enter_game_mode(Tests.enter_game_mode)
|
||||
general.idle_wait_frames(1)
|
||||
TestHelper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
# 11. Test IsHidden.
|
||||
look_modification_entity.set_visibility_state(False)
|
||||
Report.result(Tests.is_hidden, look_modification_entity.is_hidden() is True)
|
||||
|
||||
# 12. Test IsVisible.
|
||||
look_modification_entity.set_visibility_state(True)
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.is_visible, look_modification_entity.is_visible() is True)
|
||||
|
||||
# 13. Delete Look Modification entity.
|
||||
look_modification_entity.delete()
|
||||
Report.result(Tests.entity_deleted, not look_modification_entity.exists())
|
||||
|
||||
# 14. UNDO deletion.
|
||||
general.undo()
|
||||
Report.result(Tests.deletion_undo, look_modification_entity.exists())
|
||||
|
||||
# 15. REDO deletion.
|
||||
general.redo()
|
||||
Report.result(Tests.deletion_redo, not look_modification_entity.exists())
|
||||
|
||||
# 16. Look for errors and asserts.
|
||||
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
|
||||
for error_info in error_tracer.errors:
|
||||
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
|
||||
for assert_info in error_tracer.asserts:
|
||||
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(AtomEditorComponents_LookModification_AddedToEntity)
|
||||
@@ -0,0 +1,182 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
class Tests:
|
||||
creation_undo = (
|
||||
"UNDO Entity creation success",
|
||||
"UNDO Entity creation failed")
|
||||
creation_redo = (
|
||||
"REDO Entity creation success",
|
||||
"REDO Entity creation failed")
|
||||
ssao_creation = (
|
||||
"SSAO Entity successfully created",
|
||||
"SSAO Entity failed to be created")
|
||||
ssao_component = (
|
||||
"Entity has a SSAO component",
|
||||
"Entity failed to find SSAO component")
|
||||
ssao_disabled = (
|
||||
"SSAO component disabled",
|
||||
"SSAO component was not disabled.")
|
||||
postfx_layer_component = (
|
||||
"Entity has a PostFX Layer component",
|
||||
"Entity did not have an PostFX Layer component")
|
||||
ssao_enabled = (
|
||||
"SSAO component enabled",
|
||||
"SSAO component was not enabled.")
|
||||
enter_game_mode = (
|
||||
"Entered game mode",
|
||||
"Failed to enter game mode")
|
||||
exit_game_mode = (
|
||||
"Exited game mode",
|
||||
"Couldn't exit game mode")
|
||||
is_visible = (
|
||||
"Entity is visible",
|
||||
"Entity was not visible")
|
||||
is_hidden = (
|
||||
"Entity is hidden",
|
||||
"Entity was not hidden")
|
||||
entity_deleted = (
|
||||
"Entity deleted",
|
||||
"Entity was not deleted")
|
||||
deletion_undo = (
|
||||
"UNDO deletion success",
|
||||
"UNDO deletion failed")
|
||||
deletion_redo = (
|
||||
"REDO deletion success",
|
||||
"REDO deletion failed")
|
||||
|
||||
|
||||
def AtomEditorComponents_SSAO_AddedToEntity():
|
||||
"""
|
||||
Summary:
|
||||
Tests the SSAO component can be added to an entity and has the expected functionality.
|
||||
Screen Space Ambient Occlusion (SSAO) is a PostFX shadow lighting effect.
|
||||
|
||||
Test setup:
|
||||
- Wait for Editor idle loop.
|
||||
- Open the "Base" level.
|
||||
|
||||
Expected Behavior:
|
||||
The component can be added, used in game mode, hidden/shown, deleted, and has accurate required components.
|
||||
Creation and deletion undo/redo should also work.
|
||||
|
||||
Test Steps:
|
||||
1) Create a SSAO entity with no components.
|
||||
2) Add SSAO component to SSAO entity.
|
||||
3) UNDO the entity creation and component addition.
|
||||
4) REDO the entity creation and component addition.
|
||||
5) Verify SSAO component not enabled.
|
||||
6) Add PostFX Layer component since it is required by the SSAO component.
|
||||
7) Verify SSAO component is enabled.
|
||||
8) Enter/Exit game mode.
|
||||
9) Test IsHidden.
|
||||
10) Test IsVisible.
|
||||
11) Delete SSAO entity.
|
||||
12) UNDO deletion.
|
||||
13) REDO deletion.
|
||||
14) Look for errors.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
from editor_python_test_tools.editor_entity_utils import EditorEntity
|
||||
from editor_python_test_tools.utils import Report, Tracer, TestHelper
|
||||
from Atom.atom_utils.atom_constants import AtomComponentProperties
|
||||
|
||||
with Tracer() as error_tracer:
|
||||
# Test setup begins.
|
||||
# Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level.
|
||||
TestHelper.init_idle()
|
||||
TestHelper.open_level("", "Base")
|
||||
|
||||
# Test steps begin.
|
||||
# 1. Create a SSAO entity with no components.
|
||||
ssao_entity = EditorEntity.create_editor_entity(AtomComponentProperties.ssao())
|
||||
Report.critical_result(Tests.ssao_creation, ssao_entity.exists())
|
||||
|
||||
# 2. Add SSAO component to SSAO entity.
|
||||
ssao_component = ssao_entity.add_component(AtomComponentProperties.ssao())
|
||||
Report.critical_result(
|
||||
Tests.ssao_component,
|
||||
ssao_entity.has_component(AtomComponentProperties.ssao()))
|
||||
ssao_component.get_property_tree()
|
||||
# 3. UNDO the entity creation and component addition.
|
||||
# -> UNDO component addition.
|
||||
general.undo()
|
||||
# -> UNDO naming entity.
|
||||
general.undo()
|
||||
# -> UNDO selecting entity.
|
||||
general.undo()
|
||||
# -> UNDO entity creation.
|
||||
general.undo()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.creation_undo, not ssao_entity.exists())
|
||||
|
||||
# 4. REDO the entity creation and component addition.
|
||||
# -> REDO entity creation.
|
||||
general.redo()
|
||||
# -> REDO selecting entity.
|
||||
general.redo()
|
||||
# -> REDO naming entity.
|
||||
general.redo()
|
||||
# -> REDO component addition.
|
||||
general.redo()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.creation_redo, ssao_entity.exists())
|
||||
|
||||
# 5. Verify SSAO component not enabled.
|
||||
Report.result(Tests.ssao_disabled, not ssao_component.is_enabled())
|
||||
|
||||
# 6. Add PostFX Layer component since it is required by the SSAO component.
|
||||
ssao_entity.add_component(AtomComponentProperties.postfx_layer())
|
||||
Report.result(
|
||||
Tests.postfx_layer_component,
|
||||
ssao_entity.has_component(AtomComponentProperties.postfx_layer()))
|
||||
|
||||
# 7. Verify SSAO component is enabled.
|
||||
Report.result(Tests.ssao_enabled, ssao_component.is_enabled())
|
||||
|
||||
# 8. Enter/Exit game mode.
|
||||
TestHelper.enter_game_mode(Tests.enter_game_mode)
|
||||
general.idle_wait_frames(1)
|
||||
TestHelper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
# 9. Test IsHidden.
|
||||
ssao_entity.set_visibility_state(False)
|
||||
Report.result(Tests.is_hidden, ssao_entity.is_hidden() is True)
|
||||
|
||||
# 10. Test IsVisible.
|
||||
ssao_entity.set_visibility_state(True)
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.is_visible, ssao_entity.is_visible() is True)
|
||||
|
||||
# 11. Delete SSAO entity.
|
||||
ssao_entity.delete()
|
||||
Report.result(Tests.entity_deleted, not ssao_entity.exists())
|
||||
|
||||
# 12. UNDO deletion.
|
||||
general.undo()
|
||||
Report.result(Tests.deletion_undo, ssao_entity.exists())
|
||||
|
||||
# 13. REDO deletion.
|
||||
general.redo()
|
||||
Report.result(Tests.deletion_redo, not ssao_entity.exists())
|
||||
|
||||
# 14. Look for errors and asserts.
|
||||
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
|
||||
for error_info in error_tracer.errors:
|
||||
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
|
||||
for assert_info in error_tracer.asserts:
|
||||
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(AtomEditorComponents_SSAO_AddedToEntity)
|
||||
@@ -6,30 +6,70 @@ SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests :
|
||||
camera_component_added = ("Camera component was added", "Camera component wasn't added")
|
||||
camera_fov_set = ("Camera component FOV property set", "Camera component FOV property wasn't set")
|
||||
directional_light_component_added = ("Directional Light component added", "Directional Light component wasn't added")
|
||||
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
|
||||
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
|
||||
global_skylight_component_added = ("Global Skylight (IBL) component added", "Global Skylight (IBL) component wasn't added")
|
||||
global_skylight_diffuse_image_set = ("Global Skylight Diffuse Image property set", "Global Skylight Diffuse Image property wasn't set")
|
||||
global_skylight_specular_image_set = ("Global Skylight Specular Image property set", "Global Skylight Specular Image property wasn't set")
|
||||
ground_plane_material_asset_set = ("Ground Plane Material Asset was set", "Ground Plane Material Asset wasn't set")
|
||||
ground_plane_material_component_added = ("Ground Plane Material component added", "Ground Plane Material component wasn't added")
|
||||
ground_plane_mesh_asset_set = ("Ground Plane Mesh Asset property was set", "Ground Plane Mesh Asset property wasn't set")
|
||||
hdri_skybox_component_added = ("HDRi Skybox component added", "HDRi Skybox component wasn't added")
|
||||
hdri_skybox_cubemap_texture_set = ("HDRi Skybox Cubemap Texture property set", "HDRi Skybox Cubemap Texture property wasn't set")
|
||||
mesh_component_added = ("Mesh component added", "Mesh component wasn't added")
|
||||
no_assert_occurred = ("No asserts detected", "Asserts were detected")
|
||||
no_error_occurred = ("No errors detected", "Errors were detected")
|
||||
secondary_grid_spacing = ("Secondary Grid Spacing set", "Secondary Grid Spacing not set")
|
||||
sphere_material_component_added = ("Sphere Material component added", "Sphere Material component wasn't added")
|
||||
sphere_material_set = ("Sphere Material Asset was set", "Sphere Material Asset wasn't set")
|
||||
sphere_mesh_asset_set = ("Sphere Mesh Asset was set", "Sphere Mesh Asset wasn't set")
|
||||
viewport_set = ("Viewport set to correct size", "Viewport not set to correct size")
|
||||
# fmt: on
|
||||
class Tests:
|
||||
camera_component_added = (
|
||||
"Camera component was added",
|
||||
"Camera component wasn't added")
|
||||
camera_fov_set = (
|
||||
"Camera component FOV property set",
|
||||
"Camera component FOV property wasn't set")
|
||||
directional_light_component_added = (
|
||||
"Directional Light component added",
|
||||
"Directional Light component wasn't added")
|
||||
enter_game_mode = (
|
||||
"Entered game mode",
|
||||
"Failed to enter game mode")
|
||||
exit_game_mode = (
|
||||
"Exited game mode",
|
||||
"Couldn't exit game mode")
|
||||
global_skylight_component_added = (
|
||||
"Global Skylight (IBL) component added",
|
||||
"Global Skylight (IBL) component wasn't added")
|
||||
global_skylight_diffuse_image_set = (
|
||||
"Global Skylight Diffuse Image property set",
|
||||
"Global Skylight Diffuse Image property wasn't set")
|
||||
global_skylight_specular_image_set = (
|
||||
"Global Skylight Specular Image property set",
|
||||
"Global Skylight Specular Image property wasn't set")
|
||||
ground_plane_material_asset_set = (
|
||||
"Ground Plane Material Asset was set",
|
||||
"Ground Plane Material Asset wasn't set")
|
||||
ground_plane_material_component_added = (
|
||||
"Ground Plane Material component added",
|
||||
"Ground Plane Material component wasn't added")
|
||||
ground_plane_mesh_asset_set = (
|
||||
"Ground Plane Mesh Asset property was set",
|
||||
"Ground Plane Mesh Asset property wasn't set")
|
||||
hdri_skybox_component_added = (
|
||||
"HDRi Skybox component added",
|
||||
"HDRi Skybox component wasn't added")
|
||||
hdri_skybox_cubemap_texture_set = (
|
||||
"HDRi Skybox Cubemap Texture property set",
|
||||
"HDRi Skybox Cubemap Texture property wasn't set")
|
||||
mesh_component_added = (
|
||||
"Mesh component added",
|
||||
"Mesh component wasn't added")
|
||||
no_assert_occurred = (
|
||||
"No asserts detected",
|
||||
"Asserts were detected")
|
||||
no_error_occurred = (
|
||||
"No errors detected",
|
||||
"Errors were detected")
|
||||
secondary_grid_spacing = (
|
||||
"Secondary Grid Spacing set",
|
||||
"Secondary Grid Spacing not set")
|
||||
sphere_material_component_added = (
|
||||
"Sphere Material component added",
|
||||
"Sphere Material component wasn't added")
|
||||
sphere_material_set = (
|
||||
"Sphere Material Asset was set",
|
||||
"Sphere Material Asset wasn't set")
|
||||
sphere_mesh_asset_set = (
|
||||
"Sphere Mesh Asset was set",
|
||||
"Sphere Mesh Asset wasn't set")
|
||||
viewport_set = (
|
||||
"Viewport set to correct size",
|
||||
"Viewport not set to correct size")
|
||||
|
||||
|
||||
def AtomGPU_BasicLevelSetup_SetsUpLevel():
|
||||
@@ -77,19 +117,17 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel():
|
||||
import os
|
||||
from math import isclose
|
||||
|
||||
import azlmbr.asset as asset
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.math as math
|
||||
import azlmbr.paths
|
||||
|
||||
from editor_python_test_tools.asset_utils import Asset
|
||||
from editor_python_test_tools.editor_entity_utils import EditorEntity
|
||||
from editor_python_test_tools.utils import Report, Tracer, TestHelper as helper
|
||||
from editor_python_test_tools.utils import Report, Tracer, TestHelper
|
||||
|
||||
from Atom.atom_utils.atom_constants import AtomComponentProperties
|
||||
from Atom.atom_utils.screenshot_utils import ScreenshotHelper
|
||||
|
||||
MATERIAL_COMPONENT_NAME = "Material"
|
||||
MESH_COMPONENT_NAME = "Mesh"
|
||||
SCREENSHOT_NAME = "AtomBasicLevelSetup"
|
||||
SCREEN_WIDTH = 1280
|
||||
SCREEN_HEIGHT = 720
|
||||
@@ -98,24 +136,24 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel():
|
||||
def initial_viewport_setup(screen_width, screen_height):
|
||||
general.set_viewport_size(screen_width, screen_height)
|
||||
general.update_viewport()
|
||||
result = isclose(
|
||||
a=general.get_viewport_size().x, b=SCREEN_WIDTH, rel_tol=0.1) and isclose(
|
||||
a=general.get_viewport_size().y, b=SCREEN_HEIGHT, rel_tol=0.1)
|
||||
|
||||
return result
|
||||
TestHelper.wait_for_condition(
|
||||
function=lambda: isclose(a=general.get_viewport_size().x, b=SCREEN_WIDTH, rel_tol=0.1)
|
||||
and isclose(a=general.get_viewport_size().y, b=SCREEN_HEIGHT, rel_tol=0.1),
|
||||
timeout_in_seconds=4.0
|
||||
)
|
||||
|
||||
with Tracer() as error_tracer:
|
||||
# Test setup begins.
|
||||
# Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level.
|
||||
helper.init_idle()
|
||||
helper.open_level("", "Base")
|
||||
TestHelper.init_idle()
|
||||
TestHelper.open_level("", "Base")
|
||||
|
||||
# Test steps begin.
|
||||
# 1. Close error windows and display helpers then update the viewport size.
|
||||
helper.close_error_windows()
|
||||
helper.close_display_helpers()
|
||||
TestHelper.close_error_windows()
|
||||
TestHelper.close_display_helpers()
|
||||
initial_viewport_setup(SCREEN_WIDTH, SCREEN_HEIGHT)
|
||||
general.update_viewport()
|
||||
Report.critical_result(Tests.viewport_set, initial_viewport_setup(SCREEN_WIDTH, SCREEN_HEIGHT))
|
||||
|
||||
# 2. Create Default Level Entity.
|
||||
default_level_entity_name = "Default Level"
|
||||
@@ -123,168 +161,167 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel():
|
||||
math.Vector3(0.0, 0.0, 0.0), default_level_entity_name)
|
||||
|
||||
# 3. Create Grid Entity as a child entity of the Default Level Entity.
|
||||
grid_name = "Grid"
|
||||
grid_entity = EditorEntity.create_editor_entity(grid_name, default_level_entity.id)
|
||||
grid_entity = EditorEntity.create_editor_entity(AtomComponentProperties.grid(), default_level_entity.id)
|
||||
|
||||
# 4. Add Grid component to Grid Entity and set Secondary Grid Spacing.
|
||||
grid_component = grid_entity.add_component(grid_name)
|
||||
secondary_grid_spacing_property = "Controller|Configuration|Secondary Grid Spacing"
|
||||
grid_component = grid_entity.add_component(AtomComponentProperties.grid())
|
||||
secondary_grid_spacing_value = 1.0
|
||||
grid_component.set_component_property_value(secondary_grid_spacing_property, secondary_grid_spacing_value)
|
||||
grid_component.set_component_property_value(
|
||||
AtomComponentProperties.grid('Secondary Grid Spacing'), secondary_grid_spacing_value)
|
||||
secondary_grid_spacing_set = grid_component.get_component_property_value(
|
||||
secondary_grid_spacing_property) == secondary_grid_spacing_value
|
||||
AtomComponentProperties.grid('Secondary Grid Spacing')) == secondary_grid_spacing_value
|
||||
Report.result(Tests.secondary_grid_spacing, secondary_grid_spacing_set)
|
||||
|
||||
# 5. Create Global Skylight (IBL) Entity as a child entity of the Default Level Entity.
|
||||
global_skylight_name = "Global Skylight (IBL)"
|
||||
global_skylight_entity = EditorEntity.create_editor_entity(global_skylight_name, default_level_entity.id)
|
||||
global_skylight_entity = EditorEntity.create_editor_entity(
|
||||
AtomComponentProperties.global_skylight(), default_level_entity.id)
|
||||
|
||||
# 6. Add HDRi Skybox component to the Global Skylight (IBL) Entity.
|
||||
hdri_skybox_name = "HDRi Skybox"
|
||||
hdri_skybox_component = global_skylight_entity.add_component(hdri_skybox_name)
|
||||
Report.result(Tests.hdri_skybox_component_added, global_skylight_entity.has_component(hdri_skybox_name))
|
||||
hdri_skybox_component = global_skylight_entity.add_component(AtomComponentProperties.hdri_skybox())
|
||||
Report.result(Tests.hdri_skybox_component_added, global_skylight_entity.has_component(
|
||||
AtomComponentProperties.hdri_skybox()))
|
||||
|
||||
# 7. Add Global Skylight (IBL) component to the Global Skylight (IBL) Entity.
|
||||
global_skylight_component = global_skylight_entity.add_component(global_skylight_name)
|
||||
Report.result(Tests.global_skylight_component_added, global_skylight_entity.has_component(global_skylight_name))
|
||||
global_skylight_component = global_skylight_entity.add_component(AtomComponentProperties.global_skylight())
|
||||
Report.result(Tests.global_skylight_component_added, global_skylight_entity.has_component(
|
||||
AtomComponentProperties.global_skylight()))
|
||||
|
||||
# 8. Set the Cubemap Texture property of the HDRi Skybox component.
|
||||
global_skylight_image_asset_path = os.path.join(
|
||||
"LightingPresets", "greenwich_park_02_4k_iblskyboxcm_iblspecular.exr.streamingimage")
|
||||
global_skylight_image_asset = asset.AssetCatalogRequestBus(
|
||||
bus.Broadcast, "GetAssetIdByPath", global_skylight_image_asset_path, math.Uuid(), False)
|
||||
hdri_skybox_cubemap_texture_property = "Controller|Configuration|Cubemap Texture"
|
||||
global_skylight_image_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage")
|
||||
global_skylight_image_asset = Asset.find_asset_by_path(global_skylight_image_asset_path, False)
|
||||
hdri_skybox_component.set_component_property_value(
|
||||
hdri_skybox_cubemap_texture_property, global_skylight_image_asset)
|
||||
AtomComponentProperties.hdri_skybox('Cubemap Texture'), global_skylight_image_asset.id)
|
||||
Report.result(
|
||||
Tests.hdri_skybox_cubemap_texture_set,
|
||||
hdri_skybox_component.get_component_property_value(
|
||||
hdri_skybox_cubemap_texture_property) == global_skylight_image_asset)
|
||||
AtomComponentProperties.hdri_skybox('Cubemap Texture')) == global_skylight_image_asset.id)
|
||||
|
||||
# 9. Set the Diffuse Image property of the Global Skylight (IBL) component.
|
||||
# Re-use the same image that was used in the previous test step.
|
||||
global_skylight_diffuse_image_property = "Controller|Configuration|Diffuse Image"
|
||||
global_skylight_diffuse_image_asset_path = os.path.join(
|
||||
"LightingPresets", "default_iblskyboxcm_ibldiffuse.exr.streamingimage")
|
||||
global_skylight_diffuse_image_asset = Asset.find_asset_by_path(global_skylight_diffuse_image_asset_path, False)
|
||||
global_skylight_component.set_component_property_value(
|
||||
global_skylight_diffuse_image_property, global_skylight_image_asset)
|
||||
AtomComponentProperties.global_skylight('Diffuse Image'), global_skylight_diffuse_image_asset.id)
|
||||
Report.result(
|
||||
Tests.global_skylight_diffuse_image_set,
|
||||
global_skylight_component.get_component_property_value(
|
||||
global_skylight_diffuse_image_property) == global_skylight_image_asset)
|
||||
AtomComponentProperties.global_skylight('Diffuse Image')) == global_skylight_diffuse_image_asset.id)
|
||||
|
||||
# 10. Set the Specular Image property of the Global Skylight (IBL) component.
|
||||
# Re-use the same image that was used in the previous test step.
|
||||
global_skylight_specular_image_property = "Controller|Configuration|Specular Image"
|
||||
global_skylight_specular_image_asset_path = os.path.join(
|
||||
"LightingPresets", "default_iblskyboxcm_iblspecular.exr.streamingimage")
|
||||
global_skylight_specular_image_asset = Asset.find_asset_by_path(
|
||||
global_skylight_specular_image_asset_path, False)
|
||||
global_skylight_component.set_component_property_value(
|
||||
global_skylight_specular_image_property, global_skylight_image_asset)
|
||||
AtomComponentProperties.global_skylight('Specular Image'), global_skylight_specular_image_asset.id)
|
||||
global_skylight_specular_image_set = global_skylight_component.get_component_property_value(
|
||||
global_skylight_specular_image_property)
|
||||
AtomComponentProperties.global_skylight('Specular Image'))
|
||||
Report.result(
|
||||
Tests.global_skylight_specular_image_set, global_skylight_specular_image_set == global_skylight_image_asset)
|
||||
Tests.global_skylight_specular_image_set,
|
||||
global_skylight_specular_image_set == global_skylight_specular_image_asset.id)
|
||||
|
||||
# 11. Create a Ground Plane Entity with a Material component that is a child entity of the Default Level Entity.
|
||||
ground_plane_name = "Ground Plane"
|
||||
ground_plane_entity = EditorEntity.create_editor_entity(ground_plane_name, default_level_entity.id)
|
||||
ground_plane_material_component = ground_plane_entity.add_component(MATERIAL_COMPONENT_NAME)
|
||||
ground_plane_material_component = ground_plane_entity.add_component(AtomComponentProperties.material())
|
||||
Report.result(
|
||||
Tests.ground_plane_material_component_added, ground_plane_entity.has_component(MATERIAL_COMPONENT_NAME))
|
||||
Tests.ground_plane_material_component_added,
|
||||
ground_plane_entity.has_component(AtomComponentProperties.material()))
|
||||
|
||||
# 12. Set the Material Asset property of the Material component for the Ground Plane Entity.
|
||||
ground_plane_entity.set_local_uniform_scale(32.0)
|
||||
ground_plane_material_asset_path = os.path.join("Materials", "Presets", "PBR", "metal_chrome.azmaterial")
|
||||
ground_plane_material_asset = asset.AssetCatalogRequestBus(
|
||||
bus.Broadcast, "GetAssetIdByPath", ground_plane_material_asset_path, math.Uuid(), False)
|
||||
ground_plane_material_asset_property = "Default Material|Material Asset"
|
||||
ground_plane_material_asset = Asset.find_asset_by_path(ground_plane_material_asset_path, False)
|
||||
ground_plane_material_component.set_component_property_value(
|
||||
ground_plane_material_asset_property, ground_plane_material_asset)
|
||||
AtomComponentProperties.material('Material Asset'), ground_plane_material_asset.id)
|
||||
Report.result(
|
||||
Tests.ground_plane_material_asset_set,
|
||||
ground_plane_material_component.get_component_property_value(
|
||||
ground_plane_material_asset_property) == ground_plane_material_asset)
|
||||
AtomComponentProperties.material('Material Asset')) == ground_plane_material_asset.id)
|
||||
|
||||
# 13. Add the Mesh component to the Ground Plane Entity and set the Mesh component Mesh Asset property.
|
||||
ground_plane_mesh_component = ground_plane_entity.add_component(MESH_COMPONENT_NAME)
|
||||
Report.result(Tests.mesh_component_added, ground_plane_entity.has_component(MESH_COMPONENT_NAME))
|
||||
ground_plane_mesh_asset_path = os.path.join("Objects", "plane.azmodel")
|
||||
ground_plane_mesh_asset = asset.AssetCatalogRequestBus(
|
||||
bus.Broadcast, "GetAssetIdByPath", ground_plane_mesh_asset_path, math.Uuid(), False)
|
||||
ground_plane_mesh_asset_property = "Controller|Configuration|Mesh Asset"
|
||||
ground_plane_mesh_component = ground_plane_entity.add_component(AtomComponentProperties.mesh())
|
||||
Report.result(Tests.mesh_component_added, ground_plane_entity.has_component(AtomComponentProperties.mesh()))
|
||||
ground_plane_mesh_asset_path = os.path.join("TestData", "Objects", "plane.azmodel")
|
||||
ground_plane_mesh_asset = Asset.find_asset_by_path(ground_plane_mesh_asset_path, False)
|
||||
ground_plane_mesh_component.set_component_property_value(
|
||||
ground_plane_mesh_asset_property, ground_plane_mesh_asset)
|
||||
AtomComponentProperties.mesh('Mesh Asset'), ground_plane_mesh_asset.id)
|
||||
Report.result(
|
||||
Tests.ground_plane_mesh_asset_set,
|
||||
ground_plane_mesh_component.get_component_property_value(
|
||||
ground_plane_mesh_asset_property) == ground_plane_mesh_asset)
|
||||
AtomComponentProperties.mesh('Mesh Asset')) == ground_plane_mesh_asset.id)
|
||||
|
||||
# 14. Create a Directional Light Entity as a child entity of the Default Level Entity.
|
||||
directional_light_name = "Directional Light"
|
||||
directional_light_entity = EditorEntity.create_editor_entity_at(
|
||||
math.Vector3(0.0, 0.0, 10.0), directional_light_name, default_level_entity.id)
|
||||
math.Vector3(0.0, 0.0, 10.0), AtomComponentProperties.directional_light(), default_level_entity.id)
|
||||
|
||||
# 15. Add Directional Light component to Directional Light Entity and set entity rotation.
|
||||
directional_light_entity.add_component(directional_light_name)
|
||||
directional_light_entity.add_component(AtomComponentProperties.directional_light())
|
||||
directional_light_entity_rotation = math.Vector3(DEGREE_RADIAN_FACTOR * -90.0, 0.0, 0.0)
|
||||
directional_light_entity.set_local_rotation(directional_light_entity_rotation)
|
||||
Report.result(
|
||||
Tests.directional_light_component_added, directional_light_entity.has_component(directional_light_name))
|
||||
Tests.directional_light_component_added, directional_light_entity.has_component(
|
||||
AtomComponentProperties.directional_light()))
|
||||
|
||||
# 16. Create a Sphere Entity as a child entity of the Default Level Entity then add a Material component.
|
||||
sphere_entity = EditorEntity.create_editor_entity_at(
|
||||
math.Vector3(0.0, 0.0, 1.0), "Sphere", default_level_entity.id)
|
||||
sphere_material_component = sphere_entity.add_component(MATERIAL_COMPONENT_NAME)
|
||||
Report.result(Tests.sphere_material_component_added, sphere_entity.has_component(MATERIAL_COMPONENT_NAME))
|
||||
sphere_material_component = sphere_entity.add_component(AtomComponentProperties.material())
|
||||
Report.result(Tests.sphere_material_component_added, sphere_entity.has_component(
|
||||
AtomComponentProperties.material()))
|
||||
|
||||
# 17. Set the Material Asset property of the Material component for the Sphere Entity.
|
||||
sphere_material_asset_path = os.path.join("Materials", "Presets", "PBR", "metal_brass_polished.azmaterial")
|
||||
sphere_material_asset = asset.AssetCatalogRequestBus(
|
||||
bus.Broadcast, "GetAssetIdByPath", sphere_material_asset_path, math.Uuid(), False)
|
||||
sphere_material_asset_property = "Default Material|Material Asset"
|
||||
sphere_material_component.set_component_property_value(sphere_material_asset_property, sphere_material_asset)
|
||||
sphere_material_asset = Asset.find_asset_by_path(sphere_material_asset_path, False)
|
||||
sphere_material_component.set_component_property_value(
|
||||
AtomComponentProperties.material('Material Asset'), sphere_material_asset.id)
|
||||
Report.result(Tests.sphere_material_set, sphere_material_component.get_component_property_value(
|
||||
sphere_material_asset_property) == sphere_material_asset)
|
||||
AtomComponentProperties.material('Material Asset')) == sphere_material_asset.id)
|
||||
|
||||
# 18. Add Mesh component to Sphere Entity and set the Mesh Asset property for the Mesh component.
|
||||
sphere_mesh_component = sphere_entity.add_component(MESH_COMPONENT_NAME)
|
||||
sphere_mesh_component = sphere_entity.add_component(AtomComponentProperties.mesh())
|
||||
sphere_mesh_asset_path = os.path.join("Models", "sphere.azmodel")
|
||||
sphere_mesh_asset = asset.AssetCatalogRequestBus(
|
||||
bus.Broadcast, "GetAssetIdByPath", sphere_mesh_asset_path, math.Uuid(), False)
|
||||
sphere_mesh_asset_property = "Controller|Configuration|Mesh Asset"
|
||||
sphere_mesh_component.set_component_property_value(sphere_mesh_asset_property, sphere_mesh_asset)
|
||||
sphere_mesh_asset = Asset.find_asset_by_path(sphere_mesh_asset_path, False)
|
||||
sphere_mesh_component.set_component_property_value(
|
||||
AtomComponentProperties.mesh('Mesh Asset'), sphere_mesh_asset.id)
|
||||
Report.result(Tests.sphere_mesh_asset_set, sphere_mesh_component.get_component_property_value(
|
||||
sphere_mesh_asset_property) == sphere_mesh_asset)
|
||||
AtomComponentProperties.mesh('Mesh Asset')) == sphere_mesh_asset.id)
|
||||
|
||||
# 19. Create a Camera Entity as a child entity of the Default Level Entity then add a Camera component.
|
||||
camera_name = "Camera"
|
||||
camera_entity = EditorEntity.create_editor_entity_at(
|
||||
math.Vector3(5.5, -12.0, 9.0), camera_name, default_level_entity.id)
|
||||
camera_component = camera_entity.add_component(camera_name)
|
||||
Report.result(Tests.camera_component_added, camera_entity.has_component(camera_name))
|
||||
math.Vector3(5.5, -12.0, 9.0), AtomComponentProperties.camera(), default_level_entity.id)
|
||||
camera_component = camera_entity.add_component(AtomComponentProperties.camera())
|
||||
Report.result(Tests.camera_component_added, camera_entity.has_component(AtomComponentProperties.camera()))
|
||||
|
||||
# 20. Set the Camera Entity rotation value and set the Camera component Field of View value.
|
||||
camera_entity_rotation = math.Vector3(
|
||||
DEGREE_RADIAN_FACTOR * -27.0, DEGREE_RADIAN_FACTOR * -12.0, DEGREE_RADIAN_FACTOR * 25.0)
|
||||
camera_entity.set_local_rotation(camera_entity_rotation)
|
||||
camera_fov_property = "Controller|Configuration|Field of view"
|
||||
camera_fov_value = 60.0
|
||||
camera_component.set_component_property_value(camera_fov_property, camera_fov_value)
|
||||
camera_component.set_component_property_value(AtomComponentProperties.camera('Field of view'), camera_fov_value)
|
||||
azlmbr.camera.EditorCameraViewRequestBus(azlmbr.bus.Event, "ToggleCameraAsActiveView", camera_entity.id)
|
||||
Report.result(Tests.camera_fov_set, camera_component.get_component_property_value(
|
||||
camera_fov_property) == camera_fov_value)
|
||||
AtomComponentProperties.camera('Field of view')) == camera_fov_value)
|
||||
|
||||
# 21. Enter game mode.
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
helper.wait_for_condition(function=lambda: general.is_in_game_mode(), timeout_in_seconds=4.0)
|
||||
TestHelper.enter_game_mode(Tests.enter_game_mode)
|
||||
TestHelper.wait_for_condition(function=lambda: general.is_in_game_mode(), timeout_in_seconds=4.0)
|
||||
|
||||
# 22. Take screenshot.
|
||||
ScreenshotHelper(general.idle_wait_frames).capture_screenshot_blocking(f"{SCREENSHOT_NAME}.ppm")
|
||||
|
||||
# 23. Exit game mode.
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
helper.wait_for_condition(function=lambda: not general.is_in_game_mode(), timeout_in_seconds=4.0)
|
||||
TestHelper.exit_game_mode(Tests.exit_game_mode)
|
||||
TestHelper.wait_for_condition(function=lambda: not general.is_in_game_mode(), timeout_in_seconds=4.0)
|
||||
|
||||
# 24. Look for errors.
|
||||
helper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
|
||||
Report.result(Tests.no_assert_occurred, not error_tracer.has_asserts)
|
||||
Report.result(Tests.no_error_occurred, not error_tracer.has_errors)
|
||||
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
|
||||
for error_info in error_tracer.errors:
|
||||
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
|
||||
for assert_info in error_tracer.asserts:
|
||||
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -106,8 +106,7 @@ def run():
|
||||
components=["HDRi Skybox", "Global Skylight (IBL)"],
|
||||
parent_id=default_level.id
|
||||
)
|
||||
global_skylight_image_asset_path = os.path.join(
|
||||
"LightingPresets", "greenwich_park_02_4k_iblskyboxcm_iblspecular.exr.streamingimage")
|
||||
global_skylight_image_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage")
|
||||
global_skylight_image_asset = asset.AssetCatalogRequestBus(
|
||||
bus.Broadcast, "GetAssetIdByPath", global_skylight_image_asset_path, math.Uuid(), False)
|
||||
global_skylight.get_set_test(0, "Controller|Configuration|Cubemap Texture", global_skylight_image_asset)
|
||||
|
||||
@@ -56,6 +56,9 @@ add_subdirectory(streaming)
|
||||
## Smoke ##
|
||||
add_subdirectory(smoke)
|
||||
|
||||
## Terrain ##
|
||||
add_subdirectory(Terrain)
|
||||
|
||||
## AWS ##
|
||||
add_subdirectory(AWS)
|
||||
|
||||
|
||||
+11
-8
@@ -50,6 +50,7 @@ def NvCloth_AddClothSimulationToActor():
|
||||
|
||||
# Constants
|
||||
FRAMES_IN_GAME_MODE = 200
|
||||
CLOTH_GEM_ERROR_WARNING_LIST = ["Cloth", "NvCloth", "ClothComponentMesh", "ActorClothSkinning", "ActorClothSkinning", "TangentSpaceHelper", "MeshAssetHelper", "ActorAssetHelper", "ClothDebugDisplay"]
|
||||
|
||||
helper.init_idle()
|
||||
# 1) Load the level
|
||||
@@ -64,14 +65,16 @@ def NvCloth_AddClothSimulationToActor():
|
||||
general.idle_wait_frames(FRAMES_IN_GAME_MODE)
|
||||
|
||||
# 5) Verify there are no errors and warnings in the logs
|
||||
success_condition = not (section_tracer.has_errors or section_tracer.has_warnings)
|
||||
Report.result(Tests.no_errors_and_warnings_found, success_condition)
|
||||
if not success_condition:
|
||||
if section_tracer.has_warnings:
|
||||
Report.info(f"Warnings found: {section_tracer.warnings}")
|
||||
if section_tracer.has_errors:
|
||||
Report.info(f"Errors found: {section_tracer.errors}")
|
||||
Report.failure(Tests.no_errors_and_warnings_found)
|
||||
has_errors_or_warnings = False
|
||||
for error_msg in section_tracer.errors:
|
||||
if error_msg.window in CLOTH_GEM_ERROR_WARNING_LIST:
|
||||
has_errors_or_warnings = True
|
||||
Report.info(f"Cloth error found: {error_msg}")
|
||||
for warning_msg in section_tracer.warnings:
|
||||
if warning_msg.window in CLOTH_GEM_ERROR_WARNING_LIST:
|
||||
has_errors_or_warnings = True
|
||||
Report.info(f"Cloth warning found: {warning_msg}")
|
||||
Report.result(Tests.no_errors_and_warnings_found, not has_errors_or_warnings)
|
||||
|
||||
# 6) Exit game mode
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
@@ -50,6 +50,7 @@ def NvCloth_AddClothSimulationToMesh():
|
||||
|
||||
# Constants
|
||||
FRAMES_IN_GAME_MODE = 200
|
||||
CLOTH_GEM_ERROR_WARNING_LIST = ["Cloth", "NvCloth", "ClothComponentMesh", "ActorClothSkinning", "ActorClothSkinning", "TangentSpaceHelper", "MeshAssetHelper", "ActorAssetHelper", "ClothDebugDisplay"]
|
||||
|
||||
helper.init_idle()
|
||||
# 1) Load the level
|
||||
@@ -64,14 +65,16 @@ def NvCloth_AddClothSimulationToMesh():
|
||||
general.idle_wait_frames(FRAMES_IN_GAME_MODE)
|
||||
|
||||
# 5) Verify there are no errors and warnings in the logs
|
||||
success_condition = not (section_tracer.has_errors or section_tracer.has_warnings)
|
||||
Report.result(Tests.no_errors_and_warnings_found, success_condition)
|
||||
if not success_condition:
|
||||
if section_tracer.has_warnings:
|
||||
Report.info(f"Warnings found: {section_tracer.warnings}")
|
||||
if section_tracer.has_errors:
|
||||
Report.info(f"Errors found: {section_tracer.errors}")
|
||||
Report.failure(Tests.no_errors_and_warnings_found)
|
||||
has_errors_or_warnings = False
|
||||
for error_msg in section_tracer.errors:
|
||||
if error_msg.window in CLOTH_GEM_ERROR_WARNING_LIST:
|
||||
has_errors_or_warnings = True
|
||||
Report.info(f"Cloth error found: {error_msg}")
|
||||
for warning_msg in section_tracer.warnings:
|
||||
if warning_msg.window in CLOTH_GEM_ERROR_WARNING_LIST:
|
||||
has_errors_or_warnings = True
|
||||
Report.info(f"Cloth warning found: {warning_msg}")
|
||||
Report.result(Tests.no_errors_and_warnings_found, not has_errors_or_warnings)
|
||||
|
||||
# 6) Exit game mode
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
@@ -91,4 +91,16 @@ class TestAutomation(TestAutomationBase):
|
||||
@revert_physics_config
|
||||
def test_C15425929_Undo_Redo(self, request, workspace, editor, launcher_platform):
|
||||
from .tests import Physics_UndoRedoWorksOnEntityWithPhysComponents as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.GROUP_tick
|
||||
@pytest.mark.xfail(reason="Test still under development.")
|
||||
def test_Tick_InterpolatedRigidBodyMotionIsSmooth(self, request, workspace, editor, launcher_platform):
|
||||
from .tests.tick import Tick_InterpolatedRigidBodyMotionIsSmooth as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.GROUP_tick
|
||||
@pytest.mark.xfail(reason="Test still under development.")
|
||||
def test_Tick_CharacterGameplayComponentMotionIsSmooth(self, request, workspace, editor, launcher_platform):
|
||||
from .tests.tick import Tick_CharacterGameplayComponentMotionIsSmooth as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
"""
|
||||
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
|
||||
|
||||
Test Case Title : Verify that an entity with a character gameplay component moves smoothly.
|
||||
"""
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
create_entity = ("Created test entity", "Failed to create test entity")
|
||||
character_controller_added = ("Added PhysX Character Controller component", "Failed to add PhysX Character Controller component")
|
||||
character_gameplay_added = ("Added PhysX Character Gameplay component", "Failed to add PhysX Character Gameplay component")
|
||||
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
|
||||
exit_game_mode = ("Exited game mode", "Failed to exit game mode")
|
||||
character_motion_smooth = ("Character motion passed smoothness threshold", "Failed to meet smoothness threshold for character motion")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Tick_CharacterGameplayComponentMotionIsSmooth():
|
||||
"""
|
||||
Summary:
|
||||
Create entity with PhysX Character Controller and PhysX Character Gameplay components.
|
||||
Verify that the motion of the character controller under gravity is smooth.
|
||||
|
||||
Expected Behavior:
|
||||
1) The motion of the character controller under gravity is a smooth curve, rather than an erratic/jittery movement.
|
||||
|
||||
Test Steps:
|
||||
1) Load the empty level
|
||||
2) Create an entity
|
||||
3) Add a PhysX Character Controller Component and PhysX Character Gameplay component
|
||||
4) Enter game mode and collect data for the character controller's z co-ordinate and the time values for a series of frames
|
||||
5) Check if the motion of the character controller was sufficiently smooth
|
||||
|
||||
:return: None
|
||||
"""
|
||||
# imports
|
||||
import os
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.math as math
|
||||
from editor_python_test_tools.editor_entity_utils import EditorEntity as Entity
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
from editor_python_test_tools.asset_utils import Asset
|
||||
import numpy as np
|
||||
|
||||
# constants
|
||||
COEFFICIENT_OF_DETERMINATION_THRESHOLD = 1 - 1e-4 # curves with values below this are not considered sufficiently smooth
|
||||
|
||||
helper.init_idle()
|
||||
# 1) Load the empty level
|
||||
helper.open_level("", "Base")
|
||||
|
||||
# 2) Create an entity
|
||||
test_entity = Entity.create_editor_entity("test_entity")
|
||||
Report.result(Tests.create_entity, test_entity.id.IsValid())
|
||||
|
||||
azlmbr.components.TransformBus(
|
||||
azlmbr.bus.Event, "SetWorldTranslation", test_entity.id, math.Vector3(0.0, 0.0, 0.0))
|
||||
|
||||
# 3) Add character controller and character gameplay components
|
||||
character_controller_component = test_entity.add_component("PhysX Character Controller")
|
||||
Report.result(Tests.character_controller_added, test_entity.has_component("PhysX Character Controller"))
|
||||
character_gameplay_component = test_entity.add_component("PhysX Character Gameplay")
|
||||
Report.result(Tests.character_gameplay_added, test_entity.has_component("PhysX Character Gameplay"))
|
||||
|
||||
# 4) Enter game mode and collect data for the rigid body's z co-ordinate and the time values for a series of frames
|
||||
t = []
|
||||
z = []
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
general.idle_wait_frames(1)
|
||||
game_entity_id = general.find_game_entity("test_entity")
|
||||
for frame in range(100):
|
||||
t.append(azlmbr.components.TickRequestBus(azlmbr.bus.Broadcast, "GetTimeAtCurrentTick").GetSeconds())
|
||||
z.append(azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldZ", game_entity_id))
|
||||
general.idle_wait_frames(1)
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
# 5) Test that the z vs t curve is sufficiently smooth (if the interpolation is not working well, the curve will be less smooth)
|
||||
# normalize the t and z data
|
||||
t = np.array(t) - np.mean(t)
|
||||
z = np.array(z) - np.mean(z)
|
||||
# fit a polynomial to the z vs t curve
|
||||
fit = np.poly1d(np.polyfit(t, z, 4))
|
||||
residual = fit(t) - z
|
||||
# calculate the coefficient of determination (a measure of how closely the polynomial curve fits the data)
|
||||
# if the coefficient is very close to 1, then the curve fits the data very well, suggesting that the rigid body motion is smooth
|
||||
# if the coefficient is significantly less than 1, then the z values vary more erratically relative to the smooth curve,
|
||||
# indicating that the motion of the rigid body is not smooth
|
||||
coefficient_of_determination = (1 - np.sum(residual * residual) / np.sum(z * z))
|
||||
Report.result(Tests.character_motion_smooth, bool(coefficient_of_determination > COEFFICIENT_OF_DETERMINATION_THRESHOLD))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(Tick_CharacterGameplayComponentMotionIsSmooth)
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
"""
|
||||
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
|
||||
|
||||
Test Case Title : Verify that a rigid body with "Interpolate motion" option selected moves smoothly.
|
||||
"""
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
create_entity = ("Created test entity", "Failed to create test entity")
|
||||
rigid_body_added = ("Added PhysX Rigid Body component", "Failed to add PhysX Rigid Body component")
|
||||
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
|
||||
exit_game_mode = ("Exited game mode", "Failed to exit game mode")
|
||||
rigid_body_smooth = ("Rigid body motion passed smoothness threshold", "Failed to meet smoothness threshold for rigid body motion")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Tick_InterpolatedRigidBodyMotionIsSmooth():
|
||||
"""
|
||||
Summary:
|
||||
Create entity with PhysX Rigid Body component and turn on the Interpolate motion setting.
|
||||
Verify that the position of the rigid body varies smoothly with time.
|
||||
|
||||
Expected Behavior:
|
||||
1) The motion of the rigid body under gravity is a smooth curve, rather than an erratic/jittery movement.
|
||||
|
||||
Test Steps:
|
||||
1) Load the empty level
|
||||
2) Create an entity
|
||||
3) Add rigid body component
|
||||
4) Enter game mode and collect data for the rigid body's z co-ordinate and the time values for a series of frames
|
||||
5) Check if the motion of the rigid body was sufficiently smooth
|
||||
|
||||
:return: None
|
||||
"""
|
||||
# imports
|
||||
import os
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.math as math
|
||||
from editor_python_test_tools.editor_entity_utils import EditorEntity as Entity
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
from editor_python_test_tools.asset_utils import Asset
|
||||
import numpy as np
|
||||
|
||||
# constants
|
||||
COEFFICIENT_OF_DETERMINATION_THRESHOLD = 1 - 1e-4 # curves with values below this are not considered sufficiently smooth
|
||||
|
||||
helper.init_idle()
|
||||
# 1) Load the empty level
|
||||
helper.open_level("", "Base")
|
||||
|
||||
# 2) Create an entity
|
||||
test_entity = Entity.create_editor_entity("test_entity")
|
||||
Report.result(Tests.create_entity, test_entity.id.IsValid())
|
||||
|
||||
azlmbr.components.TransformBus(
|
||||
azlmbr.bus.Event, "SetWorldTranslation", test_entity.id, math.Vector3(0.0, 0.0, 0.0))
|
||||
|
||||
# 3) Add rigid body component
|
||||
rigid_body_component = test_entity.add_component("PhysX Rigid Body")
|
||||
rigid_body_component.set_component_property_value("Configuration|Interpolate motion", True)
|
||||
azlmbr.physics.RigidBodyRequestBus(azlmbr.bus.Event, "SetLinearDamping", test_entity.id, 0.0)
|
||||
Report.result(Tests.rigid_body_added, test_entity.has_component("PhysX Rigid Body"))
|
||||
|
||||
# 4) Enter game mode and collect data for the rigid body's z co-ordinate and the time values for a series of frames
|
||||
t = []
|
||||
z = []
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
general.idle_wait_frames(1)
|
||||
game_entity_id = general.find_game_entity("test_entity")
|
||||
for frame in range(100):
|
||||
t.append(azlmbr.components.TickRequestBus(azlmbr.bus.Broadcast, "GetTimeAtCurrentTick").GetSeconds())
|
||||
z.append(azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldZ", game_entity_id))
|
||||
general.idle_wait_frames(1)
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
# 5) Test that the z vs t curve is sufficiently smooth (if the interpolation is not working well, the curve will be less smooth)
|
||||
# normalize the t and z data
|
||||
t = np.array(t) - np.mean(t)
|
||||
z = np.array(z) - np.mean(z)
|
||||
# fit a polynomial to the z vs t curve
|
||||
fit = np.poly1d(np.polyfit(t, z, 4))
|
||||
residual = fit(t) - z
|
||||
# calculate the coefficient of determination (a measure of how closely the polynomial curve fits the data)
|
||||
# if the coefficient is very close to 1, then the curve fits the data very well, suggesting that the rigid body motion is smooth
|
||||
# if the coefficient is significantly less than 1, then the z values vary more erratically relative to the smooth curve,
|
||||
# indicating that the motion of the rigid body is not smooth
|
||||
coefficient_of_determination = (1 - np.sum(residual * residual) / np.sum(z * z))
|
||||
Report.result(Tests.rigid_body_smooth, bool(coefficient_of_determination > COEFFICIENT_OF_DETERMINATION_THRESHOLD))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(Tick_InterpolatedRigidBodyMotionIsSmooth)
|
||||
@@ -218,6 +218,7 @@ class FileManagement:
|
||||
src_file_path = os.path.join(src_path, src_file)
|
||||
if os.path.exists(target_file_path):
|
||||
fs.unlock_file(target_file_path)
|
||||
os.makedirs(target_path, exist_ok=True)
|
||||
shutil.copyfile(src_file_path, target_file_path)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# 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
|
||||
#
|
||||
#
|
||||
|
||||
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
|
||||
ly_add_pytest(
|
||||
NAME AutomatedTesting::TerrainTests_Main
|
||||
TEST_SUITE main
|
||||
TEST_SERIAL
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main.py
|
||||
RUNTIME_DEPENDENCIES
|
||||
Legacy::Editor
|
||||
AZ::AssetProcessor
|
||||
AutomatedTesting.Assets
|
||||
COMPONENT
|
||||
Terrain
|
||||
)
|
||||
|
||||
endif()
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
#fmt: off
|
||||
class Tests():
|
||||
create_test_entity = ("Entity created successfully", "Failed to create Entity")
|
||||
add_axis_aligned_box_shape = ("Axis Aligned Box Shape component added", "Failed to add Axis Aligned Box Shape component")
|
||||
add_terrain_collider = ("Terrain Physics Heightfield Collider component added", "Failed to add a Terrain Physics Heightfield Collider component")
|
||||
box_dimensions_changed = ("Aabb dimensions changed successfully", "Failed change Aabb dimensions")
|
||||
configuration_changed = ("Terrain size changed successfully", "Failed terrain size change")
|
||||
no_errors_and_warnings_found = ("No errors and warnings found", "Found errors and warnings")
|
||||
#fmt: on
|
||||
|
||||
def TerrainPhysicsCollider_ChangesSizeWithAxisAlignedBoxShapeChanges():
|
||||
"""
|
||||
Summary:
|
||||
Test aspects of the TerrainHeightGradientList through the BehaviorContext and the Property Tree.
|
||||
|
||||
Test Steps:
|
||||
Expected Behavior:
|
||||
The Editor is stable there are no warnings or errors.
|
||||
|
||||
Test Steps:
|
||||
1) Load the base level
|
||||
2) Create test entity
|
||||
3) Start the Tracer to catch any errors and warnings
|
||||
4) Add the Axis Aligned Box Shape and Terrain Physics Heightfield Collider components
|
||||
5) Change the Axis Aligned Box Shape dimensions
|
||||
6) Check the Heightfield provider is returning the correct size
|
||||
7) Verify there are no errors and warnings in the logs
|
||||
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
from editor_python_test_tools.editor_entity_utils import EditorEntity
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
from editor_python_test_tools.utils import Report, Tracer
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.physics as physics
|
||||
import azlmbr.math as azmath
|
||||
import azlmbr.bus as bus
|
||||
import sys
|
||||
import math
|
||||
|
||||
SET_BOX_X_SIZE = 5.0
|
||||
SET_BOX_Y_SIZE = 6.0
|
||||
EXPECTED_COLUMN_SIZE = SET_BOX_X_SIZE + 1
|
||||
EXPECTED_ROW_SIZE = SET_BOX_Y_SIZE + 1
|
||||
helper.init_idle()
|
||||
|
||||
# 1) Load the level
|
||||
helper.open_level("", "Base")
|
||||
|
||||
# 2) Create test entity
|
||||
test_entity = EditorEntity.create_editor_entity("TestEntity")
|
||||
Report.result(Tests.create_test_entity, test_entity.id.IsValid())
|
||||
|
||||
# 3) Start the Tracer to catch any errors and warnings
|
||||
with Tracer() as section_tracer:
|
||||
# 4) Add the Axis Aligned Box Shape and Terrain Physics Heightfield Collider components
|
||||
aaBoxShape_component = test_entity.add_component("Axis Aligned Box Shape")
|
||||
Report.result(Tests.add_axis_aligned_box_shape, test_entity.has_component("Axis Aligned Box Shape"))
|
||||
terrainPhysics_component = test_entity.add_component("Terrain Physics Heightfield Collider")
|
||||
Report.result(Tests.add_terrain_collider, test_entity.has_component("Terrain Physics Heightfield Collider"))
|
||||
|
||||
# 5) Change the Axis Aligned Box Shape dimensions
|
||||
aaBoxShape_component.set_component_property_value("Axis Aligned Box Shape|Box Configuration|Dimensions", azmath.Vector3(SET_BOX_X_SIZE, SET_BOX_Y_SIZE, 1.0))
|
||||
add_check = aaBoxShape_component.get_component_property_value("Axis Aligned Box Shape|Box Configuration|Dimensions") == azmath.Vector3(SET_BOX_X_SIZE, SET_BOX_Y_SIZE, 1.0)
|
||||
Report.result(Tests.box_dimensions_changed, add_check)
|
||||
|
||||
# 6) Check the Heightfield provider is returning the correct size
|
||||
columns = physics.HeightfieldProviderRequestsBus(bus.Broadcast, "GetHeightfieldGridColumns")
|
||||
rows = physics.HeightfieldProviderRequestsBus(bus.Broadcast, "GetHeightfieldGridRows")
|
||||
Report.result(Tests.configuration_changed, math.isclose(columns, EXPECTED_COLUMN_SIZE) and math.isclose(rows, EXPECTED_ROW_SIZE))
|
||||
|
||||
helper.wait_for_condition(lambda: section_tracer.has_errors or section_tracer.has_asserts, 1.0)
|
||||
for error_info in section_tracer.errors:
|
||||
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
|
||||
for assert_info in section_tracer.asserts:
|
||||
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(TerrainPhysicsCollider_ChangesSizeWithAxisAlignedBoxShapeChanges)
|
||||
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
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
|
||||
|
||||
"""
|
||||
|
||||
# This suite consists of all test cases that are passing and have been verified.
|
||||
|
||||
import pytest
|
||||
import os
|
||||
import sys
|
||||
|
||||
from ly_test_tools import LAUNCHERS
|
||||
from ly_test_tools.o3de.editor_test import EditorTestSuite, EditorSingleTest
|
||||
|
||||
@pytest.mark.SUITE_main
|
||||
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
|
||||
@pytest.mark.parametrize("project", ["AutomatedTesting"])
|
||||
class TestAutomation(EditorTestSuite):
|
||||
#global_extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"]
|
||||
|
||||
class test_AxisAlignedBoxShape_ConfigurationWorks(EditorSingleTest):
|
||||
from .EditorScripts import TerrainPhysicsCollider_ChangesSizeWithAxisAlignedBoxShapeChanges as test_module
|
||||
@@ -0,0 +1,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
|
||||
"""
|
||||
+1
-1
@@ -158,7 +158,7 @@ def bundler_batch_setup_fixture(request, workspace, asset_processor, timeout) ->
|
||||
else:
|
||||
cmd.append(f"--{key}")
|
||||
if append_defaults:
|
||||
cmd.append(f"--project-path={workspace.project}")
|
||||
cmd.append(f"--project-path={os.path.join(workspace.paths.engine_root(), workspace.project)}")
|
||||
return cmd
|
||||
|
||||
# ******
|
||||
|
||||
@@ -165,7 +165,7 @@ class TestAutomationBase:
|
||||
for line in f.readlines():
|
||||
error_str += f"|{log_basename}| {line}"
|
||||
except Exception as ex:
|
||||
error_str += "-- No log available --"
|
||||
error_str += f"-- No log available ({ex})--"
|
||||
|
||||
pytest.fail(error_str)
|
||||
|
||||
|
||||
@@ -140,13 +140,13 @@ def Docking_BasicDockedTools():
|
||||
|
||||
# 2.5,6) Send a console command.
|
||||
console_line_edit = console.findChild(QtWidgets.QLineEdit, "lineEdit")
|
||||
console_line_edit.setText("t_Scale 2")
|
||||
console_line_edit.setText("t_simulationTickScale 2")
|
||||
QtTest.QTest.keyClick(console_line_edit, QtCore.Qt.Key_Enter)
|
||||
general.get_cvar("t_Scale")
|
||||
Report.result(Tests.docked_console_works, general.get_cvar("t_Scale") == "2")
|
||||
general.get_cvar("t_simulationTickScale")
|
||||
Report.result(Tests.docked_console_works, general.get_cvar("t_simulationTickScale") == "2")
|
||||
|
||||
# Reset the altered cvar
|
||||
console_line_edit.setText("t_Scale 1")
|
||||
console_line_edit.setText("t_simulationTickScale 1")
|
||||
QtTest.QTest.keyClick(console_line_edit, QtCore.Qt.Key_Enter)
|
||||
|
||||
run_test()
|
||||
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
class Tests:
|
||||
entities_sorted = (
|
||||
"Entities sorted in the expected order",
|
||||
"Entities sorted in an incorrect order",
|
||||
)
|
||||
|
||||
|
||||
def EntityOutliner_EntityOrdering():
|
||||
"""
|
||||
Summary:
|
||||
Verify that manual entity ordering in the entity outliner works and is stable.
|
||||
|
||||
Expected Behavior:
|
||||
Several entities are created, some are manually ordered, and their order
|
||||
is maintained, even when new entities are added.
|
||||
|
||||
Test Steps:
|
||||
1) Open the empty Prefab Base level
|
||||
2) Add 5 entities to the outliner
|
||||
3) Move "Entity1" to the top of the order
|
||||
4) Move "Entity4" to the bottom of the order
|
||||
5) Add another new entity, ensure the rest of the order is unchanged
|
||||
"""
|
||||
|
||||
import editor_python_test_tools.pyside_utils as pyside_utils
|
||||
import azlmbr.legacy.general as general
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
from PySide2 import QtCore, QtWidgets, QtGui, QtTest
|
||||
|
||||
# Grab the Editor, Entity Outliner, and Outliner Model
|
||||
editor_window = pyside_utils.get_editor_main_window()
|
||||
entity_outliner = pyside_utils.find_child_by_hierarchy(
|
||||
editor_window, ..., "EntityOutlinerWidgetUI", ..., "m_objectTree"
|
||||
)
|
||||
entity_outliner_model = entity_outliner.model()
|
||||
|
||||
# Get the outliner index for the root prefab container entity
|
||||
def get_root_prefab_container_index():
|
||||
return entity_outliner_model.index(0, 0)
|
||||
|
||||
# Get the outliner index for the top level entity of a given name
|
||||
def index_for_name(name):
|
||||
root_index = get_root_prefab_container_index()
|
||||
for row in range(entity_outliner_model.rowCount(root_index)):
|
||||
row_index = entity_outliner_model.index(row, 0, root_index)
|
||||
if row_index.data() == name:
|
||||
return row_index
|
||||
return None
|
||||
|
||||
# Validate that the outliner top level entity order matches the expected order
|
||||
def verify_entities_sorted(expected_order):
|
||||
actual_order = []
|
||||
root_index = get_root_prefab_container_index()
|
||||
for row in range(entity_outliner_model.rowCount(root_index)):
|
||||
row_index = entity_outliner_model.index(row, 0, root_index)
|
||||
actual_order.append(row_index.data())
|
||||
|
||||
sorted_correctly = actual_order == expected_order
|
||||
Report.result(Tests.entities_sorted, sorted_correctly)
|
||||
if not sorted_correctly:
|
||||
print(f"Expected entity order: {expected_order}")
|
||||
print(f"Actual entity order: {actual_order}")
|
||||
|
||||
# Creates an entity from the outliner context menu
|
||||
def create_entity():
|
||||
pyside_utils.trigger_context_menu_entry(
|
||||
entity_outliner, "Create entity", index=get_root_prefab_container_index()
|
||||
)
|
||||
# Wait a tick after entity creation to let events process
|
||||
general.idle_wait(0.0)
|
||||
|
||||
# Moves an entity (wrapped by move_entity_before and move_entity_after)
|
||||
def _move_entity(source_name, target_name, move_after=False):
|
||||
source_index = index_for_name(source_name)
|
||||
target_index = index_for_name(target_name)
|
||||
|
||||
target_row = target_index.row()
|
||||
if move_after:
|
||||
target_row += 1
|
||||
|
||||
# Generate MIME data and directly inject it into the model instead of
|
||||
# generating mouse click operations, as it's more reliable and we're
|
||||
# testing the underlying drag & drop logic as opposed to Qt's mouse
|
||||
# handling here
|
||||
mime_data = entity_outliner_model.mimeData([source_index])
|
||||
entity_outliner_model.dropMimeData(
|
||||
mime_data, QtCore.Qt.MoveAction, target_row, 0, target_index.parent()
|
||||
)
|
||||
QtWidgets.QApplication.processEvents()
|
||||
|
||||
# Move an entity before another entity in the order by dragging the source above the target
|
||||
move_entity_before = lambda source_name, target_name: _move_entity(
|
||||
source_name, target_name, move_after=False
|
||||
)
|
||||
# Move an entity after another entity in the order by dragging the source beloew the target
|
||||
move_entity_after = lambda source_name, target_name: _move_entity(
|
||||
source_name, target_name, move_after=True
|
||||
)
|
||||
|
||||
expected_order = []
|
||||
|
||||
# 1) Open the empty Prefab Base level
|
||||
helper.init_idle()
|
||||
helper.open_level("Prefab", "Base")
|
||||
|
||||
# 2) Add 5 entities to the outliner
|
||||
ENTITIES_TO_ADD = 5
|
||||
for i in range(ENTITIES_TO_ADD):
|
||||
create_entity()
|
||||
|
||||
# Our new entity should be given a name with a number automatically
|
||||
new_entity = f"Entity{i+1}"
|
||||
# The new entity should be added to the top of its parent entity
|
||||
expected_order = [new_entity] + expected_order
|
||||
|
||||
verify_entities_sorted(expected_order)
|
||||
|
||||
# 3) Move "Entity1" to the top of the order
|
||||
move_entity_before("Entity1", "Entity5")
|
||||
expected_order = ["Entity1", "Entity5", "Entity4", "Entity3", "Entity2"]
|
||||
verify_entities_sorted(expected_order)
|
||||
|
||||
# 4) Move "Entity4" to the bottom of the order
|
||||
move_entity_after("Entity4", "Entity2")
|
||||
expected_order = ["Entity1", "Entity5", "Entity3", "Entity2", "Entity4"]
|
||||
verify_entities_sorted(expected_order)
|
||||
|
||||
# 5) Add another new entity, ensure the rest of the order is unchanged
|
||||
create_entity()
|
||||
expected_order = ["Entity6", "Entity1", "Entity5", "Entity3", "Entity2", "Entity4"]
|
||||
verify_entities_sorted(expected_order)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
|
||||
Report.start_test(EntityOutliner_EntityOrdering)
|
||||
@@ -41,3 +41,15 @@ class TestAutomation(TestAutomationBase):
|
||||
from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module
|
||||
self._run_test(request, workspace, editor, test_module, batch_mode=False, autotest_mode=False,
|
||||
use_null_renderer=False)
|
||||
|
||||
def test_EntityOutlienr_EntityOrdering(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import EntityOutliner_EntityOrdering as test_module
|
||||
self._run_test(
|
||||
request,
|
||||
workspace,
|
||||
editor,
|
||||
test_module,
|
||||
batch_mode=False,
|
||||
autotest_mode=True,
|
||||
extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"]
|
||||
)
|
||||
|
||||
@@ -28,4 +28,4 @@ class TestAutomation(TestAutomationBase):
|
||||
|
||||
from . import Editor_NewExistingLevels_Works as test_module
|
||||
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
self._run_test(request, workspace, editor, test_module, extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=false"])
|
||||
|
||||
@@ -14,6 +14,7 @@ include(cmake/Version.cmake)
|
||||
include(cmake/OutputDirectory.cmake)
|
||||
|
||||
if(NOT PROJECT_NAME)
|
||||
include(cmake/CompilerSettings.cmake)
|
||||
project(O3DE
|
||||
LANGUAGES C CXX
|
||||
VERSION ${LY_VERSION_STRING}
|
||||
|
||||
@@ -64,7 +64,6 @@ public:
|
||||
|
||||
// ovverided from CViewport.
|
||||
float GetScreenScaleFactor(const Vec3& worldPoint) const override;
|
||||
float GetScreenScaleFactor([[maybe_unused]] const CCamera& camera, [[maybe_unused]] const Vec3& object_position) override { return 1; } //Eric@conffx
|
||||
|
||||
// Overrided from CViewport.
|
||||
void OnDragSelectRectangle(const QRect &rect, bool bNormalizeRect = false) override;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "Objects/EntityObject.h"
|
||||
|
||||
#include <AzCore/Time/ITime.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Movie Callback.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -499,25 +501,24 @@ void CAnimationContext::Update()
|
||||
return;
|
||||
}
|
||||
|
||||
ITimer* pTimer = GetIEditor()->GetSystem()->GetITimer();
|
||||
const AZ::TimeUs frameDeltaTimeUs = AZ::GetSimulationTickDeltaTimeUs();
|
||||
const float frameDeltaTime = AZ::TimeUsToSeconds(frameDeltaTimeUs);
|
||||
|
||||
if (!m_bAutoRecording)
|
||||
{
|
||||
AnimateActiveSequence();
|
||||
|
||||
float dt = pTimer->GetFrameTime();
|
||||
m_currTime += dt * m_fTimeScale;
|
||||
m_currTime += frameDeltaTime * m_fTimeScale;
|
||||
|
||||
if (!m_recording)
|
||||
{
|
||||
GetIEditor()->GetMovieSystem()->PreUpdate(dt);
|
||||
GetIEditor()->GetMovieSystem()->PostUpdate(dt);
|
||||
GetIEditor()->GetMovieSystem()->PreUpdate(frameDeltaTime);
|
||||
GetIEditor()->GetMovieSystem()->PostUpdate(frameDeltaTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float dt = pTimer->GetFrameTime();
|
||||
m_fRecordingCurrTime += dt * m_fTimeScale;
|
||||
m_fRecordingCurrTime += frameDeltaTime * m_fTimeScale;
|
||||
if (fabs(m_fRecordingCurrTime - m_currTime) > m_fRecordingTimeStep)
|
||||
{
|
||||
m_currTime += m_fRecordingTimeStep;
|
||||
@@ -644,7 +645,9 @@ void CAnimationContext::OnPostRender()
|
||||
{
|
||||
SAnimContext ac;
|
||||
ac.dt = 0;
|
||||
ac.fps = GetIEditor()->GetSystem()->GetITimer()->GetFrameRate();
|
||||
const AZ::TimeUs frameDeltaTimeUs = AZ::GetSimulationTickDeltaTimeUs();
|
||||
const float frameDeltaTime = AZ::TimeUsToSeconds(frameDeltaTimeUs);
|
||||
ac.fps = 1.0f / frameDeltaTime;
|
||||
ac.time = m_currTime;
|
||||
ac.singleFrame = true;
|
||||
ac.forcePlay = true;
|
||||
@@ -797,7 +800,9 @@ void CAnimationContext::AnimateActiveSequence()
|
||||
|
||||
SAnimContext ac;
|
||||
ac.dt = 0;
|
||||
ac.fps = GetIEditor()->GetSystem()->GetITimer()->GetFrameRate();
|
||||
const AZ::TimeUs frameDeltaTimeUs = AZ::GetSimulationTickDeltaTimeUs();
|
||||
const float frameDeltaTime = AZ::TimeUsToSeconds(frameDeltaTimeUs);
|
||||
ac.fps = 1.0f / frameDeltaTime;
|
||||
ac.time = m_currTime;
|
||||
ac.singleFrame = true;
|
||||
ac.forcePlay = true;
|
||||
|
||||
@@ -249,38 +249,9 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
RUNTIME_DEPENDENCIES
|
||||
Gem::LmbrCentral
|
||||
)
|
||||
|
||||
ly_add_googletest(
|
||||
NAME Legacy::EditorLib.Tests
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
NAME EditorLib.Camera.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
|
||||
NAMESPACE Legacy
|
||||
FILES_CMAKE
|
||||
Lib/Tests/Camera/editor_lib_camera_test_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PRIVATE
|
||||
.
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::AzCore
|
||||
AZ::AzTest
|
||||
AZ::AzToolsFramework
|
||||
AZ::AzTestShared
|
||||
Legacy::EditorLib
|
||||
Gem::Camera.Editor
|
||||
Gem::AtomToolsFramework.Static
|
||||
RUNTIME_DEPENDENCIES
|
||||
Legacy::EditorLib
|
||||
)
|
||||
|
||||
ly_add_source_properties(
|
||||
SOURCES Lib/Tests/Camera/test_EditorCamera.cpp
|
||||
PROPERTY COMPILE_DEFINITIONS
|
||||
VALUES CAMERA_EDITOR_MODULE="$<TARGET_FILE_BASE_NAME:Camera.Editor>"
|
||||
)
|
||||
|
||||
ly_add_googletest(
|
||||
NAME Legacy::EditorLib.Camera.Tests
|
||||
)
|
||||
endif()
|
||||
|
||||
+3
-15
@@ -80,7 +80,6 @@ AZ_POP_DISABLE_WARNING
|
||||
#include <AzQtComponents/Utilities/QtPluginPaths.h>
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/ITimer.h>
|
||||
#include <CryCommon/ILevelSystem.h>
|
||||
|
||||
// Editor
|
||||
@@ -1361,16 +1360,6 @@ void CCryEditApp::CompileCriticalAssets() const
|
||||
assetsInQueueNotifcation.BusDisconnect();
|
||||
CCryEditApp::OutputStartupMessage(QString("Asset Processor is now ready."));
|
||||
|
||||
// VERY early on, as soon as we can, request that the asset system make sure the following assets take priority over others,
|
||||
// so that by the time we ask for them there is a greater likelihood that they're already good to go.
|
||||
// these can be loaded later but are still important:
|
||||
AzFramework::AssetSystemRequestBus::Broadcast(&AzFramework::AssetSystem::AssetSystemRequests::EscalateAssetBySearchTerm, "/texturemsg/");
|
||||
AzFramework::AssetSystemRequestBus::Broadcast(&AzFramework::AssetSystem::AssetSystemRequests::EscalateAssetBySearchTerm, "engineassets/materials");
|
||||
AzFramework::AssetSystemRequestBus::Broadcast(&AzFramework::AssetSystem::AssetSystemRequests::EscalateAssetBySearchTerm, "engineassets/geomcaches");
|
||||
AzFramework::AssetSystemRequestBus::Broadcast(&AzFramework::AssetSystem::AssetSystemRequests::EscalateAssetBySearchTerm, "engineassets/objects");
|
||||
|
||||
// some are specifically extra important and will cause issues if missing completely:
|
||||
AzFramework::AssetSystemRequestBus::Broadcast(&AzFramework::AssetSystem::AssetSystemRequests::CompileAssetSync, "engineassets/objects/default.cgf");
|
||||
}
|
||||
|
||||
bool CCryEditApp::ConnectToAssetProcessor() const
|
||||
@@ -3974,9 +3963,8 @@ void CCryEditApp::OpenLUAEditor(const char* files)
|
||||
}
|
||||
}
|
||||
|
||||
const char* engineRoot = nullptr;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
|
||||
AZ_Assert(engineRoot != nullptr, "Unable to communicate to AzFramework::ApplicationRequests::Bus");
|
||||
AZ::IO::FixedMaxPathString engineRoot = AZ::Utils::GetEnginePath();
|
||||
AZ_Assert(!engineRoot.empty(), "Unable to query Engine Path");
|
||||
|
||||
AZStd::string_view exePath;
|
||||
AZ::ComponentApplicationBus::BroadcastResult(exePath, &AZ::ComponentApplicationRequests::GetExecutableFolder);
|
||||
@@ -3995,7 +3983,7 @@ void CCryEditApp::OpenLUAEditor(const char* files)
|
||||
#endif
|
||||
"%s", argumentQuoteString, aznumeric_cast<int>(exePath.size()), exePath.data(), argumentQuoteString);
|
||||
|
||||
AZStd::string processArgs = AZStd::string::format("%s -engine-path \"%s\"", args.c_str(), engineRoot);
|
||||
AZStd::string processArgs = AZStd::string::format("%s -engine-path \"%s\"", args.c_str(), engineRoot.c_str());
|
||||
StartProcessDetached(process.c_str(), processArgs.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <AzCore/Component/TransformBus.h>
|
||||
#include <AzCore/Asset/AssetManager.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzCore/Time/ITime.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <MathConversion.h>
|
||||
|
||||
@@ -749,7 +750,9 @@ bool CCryEditDoc::OnOpenDocument(const QString& lpszPathName)
|
||||
|
||||
bool CCryEditDoc::BeforeOpenDocument(const QString& lpszPathName, TOpenDocContext& context)
|
||||
{
|
||||
CTimeValue loading_start_time = gEnv->pTimer->GetAsyncTime();
|
||||
const AZ::TimeMs timeMs = AZ::GetRealElapsedTimeMs();
|
||||
const double timeSec = AZ::TimeMsToSecondsDouble(timeMs);
|
||||
const CTimeValue loading_start_time(timeSec);
|
||||
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
@@ -790,7 +793,7 @@ bool CCryEditDoc::BeforeOpenDocument(const QString& lpszPathName, TOpenDocContex
|
||||
|
||||
bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
|
||||
{
|
||||
CTimeValue& loading_start_time = context.loading_start_time;
|
||||
const CTimeValue& loading_start_time = context.loading_start_time;
|
||||
|
||||
bool isPrefabEnabled = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
@@ -860,7 +863,9 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
|
||||
|
||||
StartStreamingLoad();
|
||||
|
||||
CTimeValue loading_end_time = gEnv->pTimer->GetAsyncTime();
|
||||
const AZ::TimeMs timeMs = AZ::GetRealElapsedTimeMs();
|
||||
const double timeSec = AZ::TimeMsToSecondsDouble(timeMs);
|
||||
const CTimeValue loading_end_time(timeSec);
|
||||
|
||||
CLogFile::FormatLine("-----------------------------------------------------------");
|
||||
CLogFile::FormatLine("Successfully opened document %s", context.absoluteLevelPath.toUtf8().data());
|
||||
|
||||
@@ -105,7 +105,6 @@
|
||||
#include <CryFile.h>
|
||||
#include <ISystem.h>
|
||||
#include <IIndexedMesh.h>
|
||||
#include <ITimer.h>
|
||||
#include <IXml.h>
|
||||
#include <IMovieSystem.h>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ void SetEditorEnvironment(SSystemGlobalEnvironment* pEnv)
|
||||
|
||||
void AttachEditorAZEnvironment(AZ::EnvironmentInstance azEnv)
|
||||
{
|
||||
AZ::Environment::Attach(azEnv, true);
|
||||
AZ::Environment::Attach(azEnv);
|
||||
}
|
||||
|
||||
void DetachEditorAZEnvironment()
|
||||
|
||||
@@ -13,9 +13,32 @@
|
||||
#include <AzCore/std/smart_ptr/make_shared.h>
|
||||
#include <AzFramework/Render/IntersectorInterface.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportMessages.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorTransformComponentSelectionRequestBus.h>
|
||||
#include <EditorViewportSettings.h>
|
||||
|
||||
AZ_CVAR(
|
||||
bool,
|
||||
ed_cameraPinDefaultOrbit,
|
||||
true,
|
||||
nullptr,
|
||||
AZ::ConsoleFunctorFlags::Null,
|
||||
"Sets whether the default orbit point moves with the camera or not");
|
||||
AZ_CVAR(
|
||||
bool,
|
||||
ed_cameraDefaultOrbitAxesOrtho,
|
||||
true,
|
||||
nullptr,
|
||||
AZ::ConsoleFunctorFlags::Null,
|
||||
"Sets whether to draw the default orbit point as orthographic or not");
|
||||
AZ_CVAR(
|
||||
float,
|
||||
ed_cameraDefaultOrbitFadeDuration,
|
||||
0.5f,
|
||||
nullptr,
|
||||
AZ::ConsoleFunctorFlags::Null,
|
||||
"Sets how long the default orbit point should take to appear and disappear");
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
static AzFramework::TranslateCameraInputChannelIds BuildTranslateCameraInputChannelIds()
|
||||
@@ -174,7 +197,7 @@ namespace SandboxEditor
|
||||
return SandboxEditor::CameraScrollSpeed();
|
||||
};
|
||||
|
||||
const auto pivotFn = []
|
||||
const auto pivotFn = []() -> AZStd::optional<AZ::Vector3>
|
||||
{
|
||||
// use the manipulator transform as the pivot point
|
||||
AZStd::optional<AZ::Transform> entityPivot;
|
||||
@@ -187,8 +210,7 @@ namespace SandboxEditor
|
||||
return entityPivot->GetTranslation();
|
||||
}
|
||||
|
||||
// otherwise just use the identity
|
||||
return AZ::Vector3::CreateZero();
|
||||
return AZStd::nullopt;
|
||||
};
|
||||
|
||||
m_firstPersonFocusCamera =
|
||||
@@ -199,9 +221,26 @@ namespace SandboxEditor
|
||||
m_orbitCamera = AZStd::make_shared<AzFramework::OrbitCameraInput>(SandboxEditor::CameraOrbitChannelId());
|
||||
|
||||
m_orbitCamera->SetPivotFn(
|
||||
[pivotFn]([[maybe_unused]] const AZ::Vector3& position, [[maybe_unused]] const AZ::Vector3& direction)
|
||||
[this, pivotFn](const AZ::Vector3& position, const AZ::Vector3& direction)
|
||||
{
|
||||
return pivotFn();
|
||||
// return the pivot
|
||||
if (auto pivot = pivotFn())
|
||||
{
|
||||
return pivot.value();
|
||||
}
|
||||
|
||||
// start ticking and drawing (for the default pivot)
|
||||
AZ::TickBus::Handler::BusConnect();
|
||||
AzFramework::ViewportDebugDisplayEventBus::Handler::BusConnect(AzToolsFramework::GetEntityContextId());
|
||||
|
||||
m_defaultOrbiting = true;
|
||||
// calculate the default orbit point
|
||||
if (!ed_cameraPinDefaultOrbit || m_orbitCamera->Beginning())
|
||||
{
|
||||
m_defaultOrbitPoint = position + direction * SandboxEditor::CameraDefaultOrbitDistance();
|
||||
}
|
||||
|
||||
return m_defaultOrbitPoint;
|
||||
});
|
||||
|
||||
m_orbitRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(SandboxEditor::CameraOrbitLookChannelId());
|
||||
@@ -306,4 +345,67 @@ namespace SandboxEditor
|
||||
m_viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::ClearReferenceFrame);
|
||||
}
|
||||
}
|
||||
|
||||
void EditorModularViewportCameraComposer::OnTick(const float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
|
||||
{
|
||||
const float delta = [duration = &ed_cameraDefaultOrbitFadeDuration, deltaTime] {
|
||||
if (*duration == 0.0f) {
|
||||
return 1.0f;
|
||||
}
|
||||
return deltaTime / *duration;
|
||||
}();
|
||||
|
||||
if (m_defaultOrbiting)
|
||||
{
|
||||
m_defaultOrbitOpacity = AZStd::min(m_defaultOrbitOpacity + delta, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_defaultOrbitOpacity = AZStd::max(m_defaultOrbitOpacity - delta, 0.0f);
|
||||
if (m_defaultOrbitOpacity == 0.0f)
|
||||
{
|
||||
AZ::TickBus::Handler::BusDisconnect();
|
||||
AzFramework::ViewportDebugDisplayEventBus::Handler::BusDisconnect();
|
||||
}
|
||||
}
|
||||
|
||||
m_defaultOrbiting = false;
|
||||
}
|
||||
|
||||
static void DrawTransformAxis(
|
||||
AzFramework::DebugDisplayRequests& display,
|
||||
const AzFramework::CameraState& cameraState,
|
||||
const AZ::Vector3& pivot,
|
||||
const float axisLength,
|
||||
const float alpha)
|
||||
{
|
||||
const int prevState = display.GetState();
|
||||
|
||||
display.DepthWriteOff();
|
||||
display.DepthTestOff();
|
||||
display.CullOff();
|
||||
|
||||
const float orthoScale =
|
||||
ed_cameraDefaultOrbitAxesOrtho ? AzToolsFramework::CalculateScreenToWorldMultiplier(pivot, cameraState) : 1.0f;
|
||||
|
||||
display.SetColor(AZ::Color::CreateFromVector3AndFloat(AZ::Colors::Red.GetAsVector3(), alpha));
|
||||
display.DrawLine(pivot, pivot + AZ::Vector3::CreateAxisX() * axisLength * orthoScale);
|
||||
display.SetColor(AZ::Color::CreateFromVector3AndFloat(AZ::Colors::LawnGreen.GetAsVector3(), alpha));
|
||||
display.DrawLine(pivot, pivot + AZ::Vector3::CreateAxisY() * axisLength * orthoScale);
|
||||
display.SetColor(AZ::Color::CreateFromVector3AndFloat(AZ::Colors::Blue.GetAsVector3(), alpha));
|
||||
display.DrawLine(pivot, pivot + AZ::Vector3::CreateAxisZ() * axisLength * orthoScale);
|
||||
|
||||
display.DepthWriteOn();
|
||||
display.DepthTestOn();
|
||||
display.CullOn();
|
||||
|
||||
display.SetState(prevState);
|
||||
}
|
||||
|
||||
void EditorModularViewportCameraComposer::DisplayViewport(
|
||||
[[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay)
|
||||
{
|
||||
DrawTransformAxis(
|
||||
debugDisplay, AzToolsFramework::GetCameraState(viewportInfo.m_viewportId), m_defaultOrbitPoint, 1.0f, m_defaultOrbitOpacity);
|
||||
}
|
||||
} // namespace SandboxEditor
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <AtomToolsFramework/Viewport/ModularViewportCameraController.h>
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
|
||||
#include <AzFramework/Viewport/CameraInput.h>
|
||||
#include <AzToolsFramework/API/EditorCameraBus.h>
|
||||
#include <EditorModularViewportCameraComposerBus.h>
|
||||
@@ -20,6 +22,8 @@ namespace SandboxEditor
|
||||
class EditorModularViewportCameraComposer
|
||||
: private EditorModularViewportCameraComposerNotificationBus::Handler
|
||||
, private Camera::EditorCameraNotificationBus::Handler
|
||||
, private AzFramework::ViewportDebugDisplayEventBus::Handler
|
||||
, private AZ::TickBus::Handler
|
||||
{
|
||||
public:
|
||||
SANDBOX_API explicit EditorModularViewportCameraComposer(AzFramework::ViewportId viewportId);
|
||||
@@ -29,6 +33,12 @@ namespace SandboxEditor
|
||||
SANDBOX_API AZStd::shared_ptr<AtomToolsFramework::ModularViewportCameraController> CreateModularViewportCameraController();
|
||||
|
||||
private:
|
||||
// AzFramework::ViewportDebugDisplayEventBus overrides ...
|
||||
void DisplayViewport(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) override;
|
||||
|
||||
// AZ::TickBus overrides ...
|
||||
void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
|
||||
|
||||
//! Setup all internal camera inputs.
|
||||
void SetupCameras();
|
||||
|
||||
@@ -52,5 +62,9 @@ namespace SandboxEditor
|
||||
AZStd::shared_ptr<AzFramework::FocusCameraInput> m_orbitFocusCamera;
|
||||
|
||||
AzFramework::ViewportId m_viewportId;
|
||||
|
||||
float m_defaultOrbitOpacity = 0.0f; //!< The default orbit axes opacity (to fade in and out).
|
||||
AZ::Vector3 m_defaultOrbitPoint = AZ::Vector3::CreateZero(); //!< The orbit point to use when no entity is selected.
|
||||
bool m_defaultOrbiting = false; //!< Is the camera default orbiting (orbiting when there's no selected entity).
|
||||
};
|
||||
} // namespace SandboxEditor
|
||||
|
||||
@@ -61,7 +61,7 @@ static AZStd::vector<AZStd::string> GetEditorInputNames()
|
||||
void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serialize)
|
||||
{
|
||||
serialize.Class<CameraMovementSettings>()
|
||||
->Version(3)
|
||||
->Version(4)
|
||||
->Field("TranslateSpeed", &CameraMovementSettings::m_translateSpeed)
|
||||
->Field("RotateSpeed", &CameraMovementSettings::m_rotateSpeed)
|
||||
->Field("BoostMultiplier", &CameraMovementSettings::m_boostMultiplier)
|
||||
@@ -76,9 +76,8 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
|
||||
->Field("OrbitYawRotationInverted", &CameraMovementSettings::m_orbitYawRotationInverted)
|
||||
->Field("PanInvertedX", &CameraMovementSettings::m_panInvertedX)
|
||||
->Field("PanInvertedY", &CameraMovementSettings::m_panInvertedY)
|
||||
->Field("DefaultPositionX", &CameraMovementSettings::m_defaultCameraPositionX)
|
||||
->Field("DefaultPositionY", &CameraMovementSettings::m_defaultCameraPositionY)
|
||||
->Field("DefaultPositionZ", &CameraMovementSettings::m_defaultCameraPositionZ);
|
||||
->Field("DefaultPosition", &CameraMovementSettings::m_defaultPosition)
|
||||
->Field("DefaultOrbitDistance", &CameraMovementSettings::m_defaultOrbitDistance);
|
||||
|
||||
serialize.Class<CameraInputSettings>()
|
||||
->Version(2)
|
||||
@@ -159,14 +158,12 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
|
||||
AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_captureCursorLook, "Camera Capture Look Cursor",
|
||||
"Should the cursor be captured (hidden) while performing free look")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_defaultCameraPositionX, "Default X Camera Position",
|
||||
"Default X Camera Position when a level is opened")
|
||||
AZ::Edit::UIHandlers::Vector3, &CameraMovementSettings::m_defaultPosition, "Default Camera Position",
|
||||
"Default Camera Position when a level is first opened")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_defaultCameraPositionY, "Default Y Camera Position",
|
||||
"Default Y Camera Position when a level is opened")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_defaultCameraPositionZ, "Default Z Camera Position",
|
||||
"Default Z Camera Position when a level is opened");
|
||||
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_defaultOrbitDistance, "Default Orbit Distance",
|
||||
"The default distance to orbit about when there is no entity selected")
|
||||
->Attribute(AZ::Edit::Attributes::Min, minValue);
|
||||
|
||||
editContext->Class<CameraInputSettings>("Camera Input Settings", "")
|
||||
->DataElement(
|
||||
@@ -283,12 +280,8 @@ void CEditorPreferencesPage_ViewportCamera::OnApply()
|
||||
SandboxEditor::SetCameraOrbitYawRotationInverted(m_cameraMovementSettings.m_orbitYawRotationInverted);
|
||||
SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_panInvertedX);
|
||||
SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_panInvertedY);
|
||||
SandboxEditor::SetDefaultCameraEditorPosition(
|
||||
AZ::Vector3(
|
||||
m_cameraMovementSettings.m_defaultCameraPositionX,
|
||||
m_cameraMovementSettings.m_defaultCameraPositionY,
|
||||
m_cameraMovementSettings.m_defaultCameraPositionZ
|
||||
));
|
||||
SandboxEditor::SetCameraDefaultEditorPosition(m_cameraMovementSettings.m_defaultPosition);
|
||||
SandboxEditor::SetCameraDefaultOrbitDistance(m_cameraMovementSettings.m_defaultOrbitDistance);
|
||||
|
||||
SandboxEditor::SetCameraTranslateForwardChannelId(m_cameraInputSettings.m_translateForwardChannelId);
|
||||
SandboxEditor::SetCameraTranslateBackwardChannelId(m_cameraInputSettings.m_translateBackwardChannelId);
|
||||
@@ -325,11 +318,8 @@ void CEditorPreferencesPage_ViewportCamera::InitializeSettings()
|
||||
m_cameraMovementSettings.m_orbitYawRotationInverted = SandboxEditor::CameraOrbitYawRotationInverted();
|
||||
m_cameraMovementSettings.m_panInvertedX = SandboxEditor::CameraPanInvertedX();
|
||||
m_cameraMovementSettings.m_panInvertedY = SandboxEditor::CameraPanInvertedY();
|
||||
|
||||
AZ::Vector3 defaultCameraPosition = SandboxEditor::DefaultEditorCameraPosition();
|
||||
m_cameraMovementSettings.m_defaultCameraPositionX = defaultCameraPosition.GetX();
|
||||
m_cameraMovementSettings.m_defaultCameraPositionY = defaultCameraPosition.GetY();
|
||||
m_cameraMovementSettings.m_defaultCameraPositionZ = defaultCameraPosition.GetZ();
|
||||
m_cameraMovementSettings.m_defaultPosition = SandboxEditor::CameraDefaultEditorPosition();
|
||||
m_cameraMovementSettings.m_defaultOrbitDistance = SandboxEditor::CameraDefaultOrbitDistance();
|
||||
|
||||
m_cameraInputSettings.m_translateForwardChannelId = SandboxEditor::CameraTranslateForwardChannelId().GetName();
|
||||
m_cameraInputSettings.m_translateBackwardChannelId = SandboxEditor::CameraTranslateBackwardChannelId().GetName();
|
||||
|
||||
@@ -9,9 +9,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "Include/IPreferencesPage.h"
|
||||
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
inline AZ::Crc32 EditorPropertyVisibility(const bool enabled)
|
||||
@@ -43,6 +46,7 @@ private:
|
||||
{
|
||||
AZ_TYPE_INFO(CameraMovementSettings, "{60B8C07E-5F48-4171-A50B-F45558B5CCA1}")
|
||||
|
||||
AZ::Vector3 m_defaultPosition;
|
||||
float m_translateSpeed;
|
||||
float m_rotateSpeed;
|
||||
float m_scrollSpeed;
|
||||
@@ -50,16 +54,14 @@ private:
|
||||
float m_panSpeed;
|
||||
float m_boostMultiplier;
|
||||
float m_rotateSmoothness;
|
||||
bool m_rotateSmoothing;
|
||||
float m_translateSmoothness;
|
||||
bool m_translateSmoothing;
|
||||
float m_defaultOrbitDistance;
|
||||
bool m_captureCursorLook;
|
||||
bool m_orbitYawRotationInverted;
|
||||
bool m_panInvertedX;
|
||||
bool m_panInvertedY;
|
||||
float m_defaultCameraPositionX;
|
||||
float m_defaultCameraPositionY;
|
||||
float m_defaultCameraPositionZ;
|
||||
bool m_rotateSmoothing;
|
||||
bool m_translateSmoothing;
|
||||
|
||||
AZ::Crc32 RotateSmoothingVisibility() const
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace SandboxEditor
|
||||
constexpr AZStd::string_view CameraTranslateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/TranslateSmoothing";
|
||||
constexpr AZStd::string_view CameraRotateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/RotateSmoothing";
|
||||
constexpr AZStd::string_view CameraCaptureCursorLookSetting = "/Amazon/Preferences/Editor/Camera/CaptureCursorLook";
|
||||
constexpr AZStd::string_view CameraDefaultOrbitDistanceSetting = "/Amazon/Preferences/Editor/Camera/DefaultOrbitDistance";
|
||||
constexpr AZStd::string_view CameraTranslateForwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateForwardId";
|
||||
constexpr AZStd::string_view CameraTranslateBackwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateBackwardId";
|
||||
constexpr AZStd::string_view CameraTranslateLeftIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateLeftId";
|
||||
@@ -114,15 +115,15 @@ namespace SandboxEditor
|
||||
return AZStd::make_unique<EditorViewportSettingsCallbacksImpl>();
|
||||
}
|
||||
|
||||
AZ::Vector3 DefaultEditorCameraPosition()
|
||||
AZ::Vector3 CameraDefaultEditorPosition()
|
||||
{
|
||||
float xPosition = aznumeric_cast<float>(GetRegistry(CameraDefaultStartingPositionX, 0.0));
|
||||
float yPosition = aznumeric_cast<float>(GetRegistry(CameraDefaultStartingPositionY, -10.0));
|
||||
float zPosition = aznumeric_cast<float>(GetRegistry(CameraDefaultStartingPositionZ, 4.0));
|
||||
return AZ::Vector3(xPosition, yPosition, zPosition);
|
||||
return AZ::Vector3(
|
||||
aznumeric_cast<float>(GetRegistry(CameraDefaultStartingPositionX, 0.0)),
|
||||
aznumeric_cast<float>(GetRegistry(CameraDefaultStartingPositionY, -10.0)),
|
||||
aznumeric_cast<float>(GetRegistry(CameraDefaultStartingPositionZ, 4.0)));
|
||||
}
|
||||
|
||||
void SetDefaultCameraEditorPosition(const AZ::Vector3 defaultCameraPosition)
|
||||
void SetCameraDefaultEditorPosition(const AZ::Vector3& defaultCameraPosition)
|
||||
{
|
||||
SetRegistry(CameraDefaultStartingPositionX, defaultCameraPosition.GetX());
|
||||
SetRegistry(CameraDefaultStartingPositionY, defaultCameraPosition.GetY());
|
||||
@@ -359,6 +360,16 @@ namespace SandboxEditor
|
||||
SetRegistry(CameraCaptureCursorLookSetting, capture);
|
||||
}
|
||||
|
||||
float CameraDefaultOrbitDistance()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(CameraDefaultOrbitDistanceSetting, 20.0));
|
||||
}
|
||||
|
||||
void SetCameraDefaultOrbitDistance(const float distance)
|
||||
{
|
||||
SetRegistry(CameraDefaultOrbitDistanceSetting, distance);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraTranslateForwardChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(
|
||||
|
||||
@@ -33,9 +33,6 @@ namespace SandboxEditor
|
||||
//! event will fire when a value in the settings registry (editorpreferences.setreg) is modified.
|
||||
SANDBOX_API AZStd::unique_ptr<EditorViewportSettingsCallbacks> CreateEditorViewportSettingsCallbacks();
|
||||
|
||||
SANDBOX_API AZ::Vector3 DefaultEditorCameraPosition();
|
||||
SANDBOX_API void SetDefaultCameraEditorPosition(AZ::Vector3 defaultCameraPosition);
|
||||
|
||||
SANDBOX_API AZ::u64 MaxItemsShownInAssetBrowserSearch();
|
||||
SANDBOX_API void SetMaxItemsShownInAssetBrowserSearch(AZ::u64 numberOfItemsShown);
|
||||
|
||||
@@ -105,6 +102,12 @@ namespace SandboxEditor
|
||||
SANDBOX_API bool CameraCaptureCursorForLook();
|
||||
SANDBOX_API void SetCameraCaptureCursorForLook(bool capture);
|
||||
|
||||
SANDBOX_API AZ::Vector3 CameraDefaultEditorPosition();
|
||||
SANDBOX_API void SetCameraDefaultEditorPosition(const AZ::Vector3& position);
|
||||
|
||||
SANDBOX_API float CameraDefaultOrbitDistance();
|
||||
SANDBOX_API void SetCameraDefaultOrbitDistance(float distance);
|
||||
|
||||
SANDBOX_API AzFramework::InputChannelId CameraTranslateForwardChannelId();
|
||||
SANDBOX_API void SetCameraTranslateForwardChannelId(AZStd::string_view cameraTranslateForwardId);
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
#include <AtomToolsFramework/Viewport/RenderViewportWidget.h>
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/HMDBus.h>
|
||||
#include <CryCommon/IRenderAuxGeom.h>
|
||||
|
||||
// AzFramework
|
||||
@@ -556,22 +555,6 @@ void EditorViewportWidget::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
// 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)
|
||||
{
|
||||
// Note: This may also need to adjust the viewport size
|
||||
SetActiveWindow();
|
||||
SetFocus();
|
||||
SetSelected(true);
|
||||
}
|
||||
}
|
||||
SetCurrentCursor(STD_CURSOR_GAME);
|
||||
|
||||
if (ShouldPreviewFullscreen())
|
||||
@@ -620,9 +603,9 @@ void EditorViewportWidget::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
break;
|
||||
|
||||
case eNotify_OnEndNewScene:
|
||||
PopDisableRendering();
|
||||
|
||||
{
|
||||
PopDisableRendering();
|
||||
|
||||
Matrix34 viewTM;
|
||||
viewTM.SetIdentity();
|
||||
|
||||
@@ -638,9 +621,9 @@ void EditorViewportWidget::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
break;
|
||||
|
||||
case eNotify_OnEndTerrainCreate:
|
||||
PopDisableRendering();
|
||||
|
||||
{
|
||||
PopDisableRendering();
|
||||
|
||||
Matrix34 viewTM;
|
||||
viewTM.SetIdentity();
|
||||
|
||||
@@ -1815,13 +1798,6 @@ float EditorViewportWidget::GetScreenScaleFactor([[maybe_unused]] const Vec3& wo
|
||||
AZ_Error("CryLegacy", false, "EditorViewportWidget::GetScreenScaleFactor not implemented");
|
||||
return 1.f;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float EditorViewportWidget::GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position)
|
||||
{
|
||||
Vec3 camPos = camera.GetPosition();
|
||||
float dist = camPos.GetDistance(object_position);
|
||||
return dist;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool EditorViewportWidget::CheckRespondToInput() const
|
||||
@@ -1842,7 +1818,6 @@ bool EditorViewportWidget::CheckRespondToInput() const
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool EditorViewportWidget::HitTest(const QPoint& point, HitContext& hitInfo)
|
||||
{
|
||||
hitInfo.camera = nullptr;
|
||||
hitInfo.pExcludedObject = GetCameraObject();
|
||||
return QtViewport::HitTest(point, hitInfo);
|
||||
}
|
||||
@@ -2021,10 +1996,6 @@ void EditorViewportWidget::SetDefaultCamera()
|
||||
GetViewManager()->SetCameraObjectId(GUID_NULL);
|
||||
SetName(m_defaultViewName);
|
||||
|
||||
// Set the default Editor Camera position.
|
||||
m_defaultViewTM.SetTranslation(Vec3(m_editorViewportSettings.DefaultEditorCameraPosition()));
|
||||
SetViewTM(m_defaultViewTM);
|
||||
|
||||
// Synchronize the configured editor viewport FOV to the default camera
|
||||
if (m_viewPane)
|
||||
{
|
||||
@@ -2041,6 +2012,10 @@ void EditorViewportWidget::SetDefaultCamera()
|
||||
atomViewportRequests->PushView(contextName, m_defaultView);
|
||||
}
|
||||
|
||||
// Set the default Editor Camera position.
|
||||
m_defaultViewTM.SetTranslation(Vec3(m_editorViewportSettings.DefaultEditorCameraPosition()));
|
||||
SetViewTM(m_defaultViewTM);
|
||||
|
||||
PostCameraSet();
|
||||
}
|
||||
|
||||
@@ -2527,7 +2502,7 @@ bool EditorViewportSettings::StickySelectEnabled() const
|
||||
|
||||
AZ::Vector3 EditorViewportSettings::DefaultEditorCameraPosition() const
|
||||
{
|
||||
return SandboxEditor::DefaultEditorCameraPosition();
|
||||
return SandboxEditor::CameraDefaultEditorPosition();
|
||||
}
|
||||
|
||||
AZ_CVAR_EXTERNED(bool, ed_previewGameInFullscreen_once);
|
||||
@@ -2547,12 +2522,6 @@ bool EditorViewportWidget::ShouldPreviewFullscreen() const
|
||||
return false;
|
||||
}
|
||||
|
||||
// Not supported in VR
|
||||
if (gSettings.bEnableGameModeVR)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If level not loaded, don't preview in fullscreen (preview shouldn't work at all without a level, but it does)
|
||||
if (auto ge = GetIEditor()->GetGameEngine())
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <Cry_Camera.h>
|
||||
|
||||
#include <QSet>
|
||||
|
||||
@@ -172,7 +171,6 @@ private:
|
||||
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;
|
||||
|
||||
+11
-22
@@ -49,9 +49,6 @@
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "ActionManager.h"
|
||||
|
||||
// Including this too early will result in a linker error
|
||||
#include <CryCommon/CryLibrary.h>
|
||||
|
||||
// Implementation of System Callback structure.
|
||||
struct SSystemUserCallback
|
||||
: public ISystemUserCallback
|
||||
@@ -242,8 +239,7 @@ private:
|
||||
|
||||
AZ_PUSH_DISABLE_WARNING(4273, "-Wunknown-warning-option")
|
||||
CGameEngine::CGameEngine()
|
||||
: m_gameDll(nullptr)
|
||||
, m_bIgnoreUpdates(false)
|
||||
: m_bIgnoreUpdates(false)
|
||||
, m_ePendingGameMode(ePGM_NotPending)
|
||||
, m_modalWindowDismisser(nullptr)
|
||||
AZ_POP_DISABLE_WARNING
|
||||
@@ -253,7 +249,7 @@ AZ_POP_DISABLE_WARNING
|
||||
m_bInGameMode = false;
|
||||
m_bSimulationMode = false;
|
||||
m_bSyncPlayerPosition = true;
|
||||
m_hSystemHandle = nullptr;
|
||||
m_hSystemHandle.reset(nullptr);
|
||||
m_bJustCreated = false;
|
||||
m_levelName = "Untitled";
|
||||
m_levelExtension = EditorUtils::LevelFile::GetDefaultFileExtension();
|
||||
@@ -268,18 +264,10 @@ AZ_POP_DISABLE_WARNING
|
||||
GetIEditor()->UnregisterNotifyListener(this);
|
||||
m_pISystem->GetIMovieSystem()->SetCallback(nullptr);
|
||||
|
||||
if (m_gameDll)
|
||||
{
|
||||
CryFreeLibrary(m_gameDll);
|
||||
}
|
||||
|
||||
delete m_pISystem;
|
||||
m_pISystem = nullptr;
|
||||
|
||||
if (m_hSystemHandle)
|
||||
{
|
||||
CryFreeLibrary(m_hSystemHandle);
|
||||
}
|
||||
m_hSystemHandle.reset(nullptr);
|
||||
|
||||
delete m_pSystemUserCallback;
|
||||
}
|
||||
@@ -347,18 +335,19 @@ AZ::Outcome<void, AZStd::string> CGameEngine::Init(
|
||||
HWND hwndForInputSystem)
|
||||
{
|
||||
m_pSystemUserCallback = new SSystemUserCallback(logo);
|
||||
m_hSystemHandle = CryLoadLibraryDefName("CrySystem");
|
||||
|
||||
if (!m_hSystemHandle)
|
||||
constexpr const char* crySystemLibraryName = AZ_TRAIT_OS_DYNAMIC_LIBRARY_PREFIX "CrySystem" AZ_TRAIT_OS_DYNAMIC_LIBRARY_EXTENSION;
|
||||
|
||||
m_hSystemHandle = AZ::DynamicModuleHandle::Create(crySystemLibraryName);
|
||||
if (!m_hSystemHandle->Load(true))
|
||||
{
|
||||
auto errorMessage = AZStd::string::format("%s Loading Failed", CryLibraryDefName("CrySystem"));
|
||||
auto errorMessage = AZStd::string::format("%s Loading Failed", crySystemLibraryName);
|
||||
Error(errorMessage.c_str());
|
||||
return AZ::Failure(errorMessage);
|
||||
}
|
||||
|
||||
PFNCREATESYSTEMINTERFACE pfnCreateSystemInterface =
|
||||
(PFNCREATESYSTEMINTERFACE)CryGetProcAddress(m_hSystemHandle, "CreateSystemInterface");
|
||||
|
||||
m_hSystemHandle->GetFunction<PFNCREATESYSTEMINTERFACE>("CreateSystemInterface");
|
||||
|
||||
SSystemInitParams sip;
|
||||
|
||||
@@ -833,7 +822,7 @@ void CGameEngine::Update()
|
||||
if (gEnv->pSystem)
|
||||
{
|
||||
gEnv->pSystem->UpdatePreTickBus();
|
||||
componentApplication->Tick(gEnv->pTimer->GetFrameTime(ITimer::ETIMER_GAME));
|
||||
componentApplication->Tick();
|
||||
gEnv->pSystem->UpdatePostTickBus();
|
||||
}
|
||||
|
||||
@@ -849,7 +838,7 @@ void CGameEngine::Update()
|
||||
unsigned int updateFlags = ESYSUPDATE_EDITOR;
|
||||
GetIEditor()->GetAnimation()->Update();
|
||||
GetIEditor()->GetSystem()->UpdatePreTickBus(updateFlags);
|
||||
componentApplication->Tick(gEnv->pTimer->GetFrameTime(ITimer::ETIMER_GAME));
|
||||
componentApplication->Tick();
|
||||
GetIEditor()->GetSystem()->UpdatePostTickBus(updateFlags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ struct IInitializeUIInfo;
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
|
||||
#include <AzCore/Module/DynamicModuleHandle.h>
|
||||
|
||||
class ThreadedOnErrorHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -124,11 +126,6 @@ public:
|
||||
return s_pakModifyMutex;
|
||||
}
|
||||
|
||||
inline HMODULE GetGameModule() const
|
||||
{
|
||||
return m_gameDll;
|
||||
}
|
||||
|
||||
private:
|
||||
void SetGameMode(bool inGame);
|
||||
void SwitchToInGame();
|
||||
@@ -150,8 +147,7 @@ private:
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
Matrix34 m_playerViewTM;
|
||||
struct SSystemUserCallback* m_pSystemUserCallback;
|
||||
HMODULE m_hSystemHandle;
|
||||
HMODULE m_gameDll;
|
||||
AZStd::unique_ptr<AZ::DynamicModuleHandle> m_hSystemHandle;
|
||||
enum EPendingGameMode
|
||||
{
|
||||
ePGM_NotPending,
|
||||
|
||||
@@ -19,7 +19,6 @@ class CBaseObject;
|
||||
struct IDisplayViewport;
|
||||
class CDeepSelection;
|
||||
struct AABB;
|
||||
class CCamera;
|
||||
|
||||
#include <QRect>
|
||||
#include <platform.h>
|
||||
@@ -68,8 +67,6 @@ struct HitContext
|
||||
QRect rect;
|
||||
//! Optional limiting bounding box for hit testing.
|
||||
AABB* bounds;
|
||||
//! Optional camera for culling perspective viewports.
|
||||
CCamera* camera;
|
||||
|
||||
//! Testing performed in 2D viewport.
|
||||
bool b2DViewport;
|
||||
@@ -120,7 +117,6 @@ struct HitContext
|
||||
rect = QRect();
|
||||
b2DViewport = false;
|
||||
view = 0;
|
||||
camera = 0;
|
||||
point2d = QPoint();
|
||||
axis = 0;
|
||||
distanceTolerance = 0;
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
struct DisplayContext;
|
||||
class CBaseObjectsCache;
|
||||
class QPoint;
|
||||
class CCamera;
|
||||
struct AABB;
|
||||
class CViewport;
|
||||
|
||||
@@ -23,7 +22,6 @@ struct IDisplayViewport
|
||||
{
|
||||
virtual void Update() = 0;
|
||||
virtual float GetScreenScaleFactor(const Vec3& position) const = 0;
|
||||
virtual float GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position) = 0;
|
||||
virtual bool HitTestLine(const Vec3& lineP1, const Vec3& lineP2, const QPoint& hitpoint, int pixelRadius, float* pToCameraDistance = 0) const = 0;
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,7 +60,6 @@ struct IFileUtil
|
||||
EFILE_TYPE_GEOMETRY,
|
||||
EFILE_TYPE_TEXTURE,
|
||||
EFILE_TYPE_SOUND,
|
||||
EFILE_TYPE_GEOMCACHE,
|
||||
EFILE_TYPE_LAST,
|
||||
};
|
||||
|
||||
@@ -114,9 +113,7 @@ struct IFileUtil
|
||||
|
||||
virtual void ShowInExplorer(const QString& path) = 0;
|
||||
|
||||
virtual bool CompileLuaFile(const char* luaFilename) = 0;
|
||||
virtual bool ExtractFile(QString& file, bool bMsgBoxAskForExtraction = true, const char* pDestinationFilename = nullptr) = 0;
|
||||
virtual void EditTextFile(const char* txtFile, int line = 0, ETextFileType fileType = FILE_TYPE_SCRIPT) = 0;
|
||||
virtual void EditTextureFile(const char* txtureFile, bool bUseGameFolder) = 0;
|
||||
|
||||
//! dcc filename calculation and extraction sub-routines
|
||||
|
||||
@@ -17,43 +17,33 @@
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
class EditorCameraTestEnvironment : public AZ::Test::GemTestEnvironment
|
||||
{
|
||||
// AZ::Test::GemTestEnvironment overrides ...
|
||||
void AddGemsAndComponents() override;
|
||||
};
|
||||
|
||||
void EditorCameraTestEnvironment::AddGemsAndComponents()
|
||||
{
|
||||
AddDynamicModulePaths({ CAMERA_EDITOR_MODULE });
|
||||
AddComponentDescriptors({ AzToolsFramework::Components::TransformComponent::CreateDescriptor() });
|
||||
}
|
||||
|
||||
class EditorCameraFixture : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
AZ::ComponentApplication* m_application = nullptr;
|
||||
AtomToolsFramework::ModularCameraViewportContext* m_cameraViewportContextView = nullptr;
|
||||
AZStd::unique_ptr<SandboxEditor::EditorModularViewportCameraComposer> m_editorModularViewportCameraComposer;
|
||||
AZStd::unique_ptr<AZ::DynamicModuleHandle> m_editorLibHandle;
|
||||
AzFramework::ViewportControllerListPtr m_controllerList;
|
||||
AZStd::unique_ptr<AZ::Entity> m_entity;
|
||||
AZ::Entity* m_entity = nullptr;
|
||||
AZ::ComponentDescriptor* m_transformComponent = nullptr;
|
||||
|
||||
static const AzFramework::ViewportId TestViewportId;
|
||||
|
||||
void SetUp() override
|
||||
{
|
||||
m_editorLibHandle = AZ::DynamicModuleHandle::Create("EditorLib");
|
||||
[[maybe_unused]] const bool loaded = m_editorLibHandle->Load(true);
|
||||
AZ_Assert(loaded, "EditorLib could not be loaded");
|
||||
m_application = aznew AZ::ComponentApplication;
|
||||
AZ::ComponentApplication::Descriptor appDesc;
|
||||
m_entity = m_application->Create(appDesc);
|
||||
m_transformComponent = AzToolsFramework::Components::TransformComponent::CreateDescriptor();
|
||||
m_application->RegisterComponentDescriptor(m_transformComponent);
|
||||
|
||||
m_controllerList = AZStd::make_shared<AzFramework::ViewportControllerList>();
|
||||
m_controllerList->RegisterViewportContext(TestViewportId);
|
||||
|
||||
m_entity = AZStd::make_unique<AZ::Entity>();
|
||||
m_entity->Init();
|
||||
m_entity->CreateComponent<AzToolsFramework::Components::TransformComponent>();
|
||||
m_entity->Activate();
|
||||
|
||||
m_controllerList = AZStd::make_shared<AzFramework::ViewportControllerList>();
|
||||
m_controllerList->RegisterViewportContext(TestViewportId);
|
||||
|
||||
m_editorModularViewportCameraComposer = AZStd::make_unique<SandboxEditor::EditorModularViewportCameraComposer>(TestViewportId);
|
||||
|
||||
auto controller = m_editorModularViewportCameraComposer->CreateModularViewportCameraController();
|
||||
@@ -72,8 +62,17 @@ namespace UnitTest
|
||||
{
|
||||
m_editorModularViewportCameraComposer.reset();
|
||||
m_cameraViewportContextView = nullptr;
|
||||
m_entity.reset();
|
||||
m_editorLibHandle = {};
|
||||
|
||||
if (m_application)
|
||||
{
|
||||
m_application->UnregisterComponentDescriptor(m_transformComponent);
|
||||
delete m_transformComponent;
|
||||
m_transformComponent = nullptr;
|
||||
|
||||
m_application->Destroy();
|
||||
delete m_application;
|
||||
m_application = nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -211,15 +210,3 @@ namespace UnitTest
|
||||
EXPECT_THAT(currentReferenceFrame, IsClose(AZ::Transform::CreateIdentity()));
|
||||
}
|
||||
} // namespace UnitTest
|
||||
|
||||
// required to support running integration tests with the Camera Gem
|
||||
AZTEST_EXPORT int AZ_UNIT_TEST_HOOK_NAME(int argc, char** argv)
|
||||
{
|
||||
::testing::InitGoogleMock(&argc, argv);
|
||||
AZ::Test::printUnusedParametersWarning(argc, argv);
|
||||
AZ::Test::addTestEnvironments({ new UnitTest::EditorCameraTestEnvironment() });
|
||||
int result = RUN_ALL_TESTS();
|
||||
return result;
|
||||
}
|
||||
|
||||
IMPLEMENT_TEST_EXECUTABLE_MAIN();
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <Mocks/ISystemMock.h>
|
||||
#include <Mocks/IConsoleMock.h>
|
||||
#include <Mocks/ILogMock.h>
|
||||
#include <Mocks/ITimerMock.h>
|
||||
#include <Mocks/IConsoleMock.h>
|
||||
#include "IEditorMock.h"
|
||||
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
#include "EditorDefs.h"
|
||||
#include <AzTest/AzTest.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/UnitTest/UnitTest.h>
|
||||
#include <EditorEnvironment.h>
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
class EditorLibTestEnvironment
|
||||
: public AZ::Test::ITestEnvironment
|
||||
: public ::UnitTest::TraceBusHook
|
||||
{
|
||||
public:
|
||||
~EditorLibTestEnvironment() override = default;
|
||||
@@ -22,16 +23,20 @@ public:
|
||||
protected:
|
||||
void SetupEnvironment() override
|
||||
{
|
||||
::UnitTest::TraceBusHook::SetupEnvironment();
|
||||
|
||||
AZ::Environment::Create(nullptr);
|
||||
AttachEditorAZEnvironment(AZ::Environment::GetInstance());
|
||||
AZ::AllocatorInstance<AZ::SystemAllocator>::Create();
|
||||
AttachEditorAZEnvironment(AZ::Environment::GetInstance());
|
||||
}
|
||||
|
||||
void TeardownEnvironment() override
|
||||
{
|
||||
AZ::AllocatorInstance<AZ::SystemAllocator>::Destroy();
|
||||
DetachEditorAZEnvironment();
|
||||
AZ::AllocatorInstance<AZ::SystemAllocator>::Destroy();
|
||||
AZ::Environment::Destroy();
|
||||
|
||||
::UnitTest::TraceBusHook::TeardownEnvironment();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -94,6 +94,9 @@ namespace TrackViewPythonBindingsUnitTests
|
||||
|
||||
m_app.Start(appDesc);
|
||||
m_app.RegisterComponentDescriptor(AzToolsFramework::TrackViewComponent::CreateDescriptor());
|
||||
|
||||
// Disable saving global user settings to prevent failure due to detecting file updates
|
||||
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace LyViewPane
|
||||
static const char* const SubstanceEditor = "Substance Editor";
|
||||
static const char* const VegetationEditor = "Vegetation Editor";
|
||||
static const char* const LandscapeCanvas = "Landscape Canvas";
|
||||
static const char* const AnimationEditor = "EMotion FX Animation Editor (PREVIEW)";
|
||||
static const char* const AnimationEditor = "EMotion FX Animation Editor";
|
||||
static const char* const PhysXConfigurationEditor = "PhysX Configuration (PREVIEW)";
|
||||
|
||||
static const char* const SliceRelationships = "Slice Relationship View (PREVIEW)";
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
// Editor
|
||||
#include "MainStatusBarItems.h"
|
||||
#include "CryLibrary.h"
|
||||
#include "ProcessInfo.h"
|
||||
|
||||
|
||||
|
||||
@@ -1061,7 +1061,7 @@ void MainWindow::InitActions()
|
||||
if (emfxEnabled.value)
|
||||
{
|
||||
QAction* action = am->AddAction(ID_OPEN_EMOTIONFX_EDITOR, tr("Animation Editor"))
|
||||
.SetToolTip(tr("Open Animation Editor (PREVIEW)"))
|
||||
.SetToolTip(tr("Open Animation Editor"))
|
||||
.SetIcon(QIcon(":/EMotionFX/EMFX_icon_32x32.png"))
|
||||
.SetApplyHoverEffect();
|
||||
QObject::connect(action, &QAction::triggered, this, []() {
|
||||
|
||||
@@ -953,14 +953,8 @@ void CBaseObject::DrawTextureIcon(DisplayContext& dc, [[maybe_unused]] const Vec
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseObject::DrawWarningIcons(DisplayContext& dc, const Vec3& pos)
|
||||
void CBaseObject::DrawWarningIcons(DisplayContext& dc, const Vec3&)
|
||||
{
|
||||
// Don't draw warning icons if they are beyond draw distance
|
||||
if ((dc.camera->GetPosition() - pos).GetLength() > gSettings.viewports.fWarningIconsDrawDistance)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (gSettings.viewports.bShowIcons || gSettings.viewports.bShowSizeBasedIcons)
|
||||
{
|
||||
const int warningIconSizeX = OBJECT_TEXTURE_ICON_SIZEX / 2;
|
||||
@@ -1010,11 +1004,8 @@ void CBaseObject::DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& l
|
||||
labelColor = QColor(0, 0, 0);
|
||||
}
|
||||
|
||||
float camDist = dc.camera->GetPosition().GetDistance(pos);
|
||||
float maxDist = dc.settings->GetLabelsDistance();
|
||||
if (camDist < dc.settings->GetLabelsDistance() || (dc.flags & DISPLAY_SELECTION_HELPERS))
|
||||
if (dc.flags & DISPLAY_SELECTION_HELPERS)
|
||||
{
|
||||
float range = maxDist / 2.0f;
|
||||
Vec3 c(static_cast<f32>(labelColor.redF()), static_cast<f32>(labelColor.greenF()), static_cast<f32>(labelColor.redF()));
|
||||
if (IsSelected())
|
||||
{
|
||||
@@ -1032,10 +1023,6 @@ void CBaseObject::DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& l
|
||||
col[1] = c.y;
|
||||
col[2] = c.z;
|
||||
}
|
||||
else if (camDist > range)
|
||||
{
|
||||
col[3] = col[3] * (1.0f - (camDist - range) / range);
|
||||
}
|
||||
|
||||
dc.SetColor(col[0], col[1], col[2], col[3] * alpha);
|
||||
dc.DrawTextLabel(pos, size, GetName().toUtf8().data());
|
||||
@@ -1196,33 +1183,6 @@ bool CBaseObject::CanBeDrawn(const DisplayContext& dc, bool& outDisplaySelection
|
||||
return bResult;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CBaseObject::IsInCameraView(const CCamera& camera)
|
||||
{
|
||||
AABB bbox;
|
||||
GetBoundBox(bbox);
|
||||
return (camera.IsAABBVisible_F(AABB(bbox.min, bbox.max)));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float CBaseObject::GetCameraVisRatio(const CCamera& camera)
|
||||
{
|
||||
AABB bbox;
|
||||
GetBoundBox(bbox);
|
||||
|
||||
static const float defaultVisRatio = 1000.0f;
|
||||
|
||||
const float objectHeightSq = max(1.0f, (bbox.max - bbox.min).GetLengthSquared());
|
||||
const float camdistSq = (bbox.min - camera.GetPosition()).GetLengthSquared();
|
||||
float visRatio = defaultVisRatio;
|
||||
if (camdistSq > FLT_EPSILON)
|
||||
{
|
||||
visRatio = objectHeightSq / camdistSq;
|
||||
}
|
||||
|
||||
return visRatio;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CBaseObject::MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags)
|
||||
{
|
||||
|
||||
@@ -674,11 +674,6 @@ protected:
|
||||
//! Returns if the object can be drawn, and if its selection helper should also be drawn.
|
||||
bool CanBeDrawn(const DisplayContext& dc, bool& outDisplaySelectionHelper) const;
|
||||
|
||||
//! Returns if object is in the camera view.
|
||||
virtual bool IsInCameraView(const CCamera& camera);
|
||||
//! Returns vis ratio of object in camera
|
||||
virtual float GetCameraVisRatio(const CCamera& camera);
|
||||
|
||||
// Do basic intersection tests
|
||||
virtual bool IntersectRectBounds(const AABB& bbox);
|
||||
virtual bool IntersectRayBounds(const Ray& ray);
|
||||
|
||||
@@ -31,7 +31,6 @@ struct IRenderer;
|
||||
struct IRenderAuxGeom;
|
||||
struct IIconManager;
|
||||
class CDisplaySettings;
|
||||
class CCamera;
|
||||
class QPoint;
|
||||
|
||||
enum DisplayFlags
|
||||
@@ -66,7 +65,6 @@ struct SANDBOX_API DisplayContext
|
||||
IDisplayViewport* view;
|
||||
IRenderAuxGeom* pRenderAuxGeom;
|
||||
IIconManager* pIconManager;
|
||||
CCamera* camera;
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AABB box; // Bounding box of volume that need to be repainted.
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
@@ -1138,10 +1138,6 @@ bool DisplayContext::IsVisible(const AABB& bounds)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return camera->IsAABBVisible_F(AABB(bounds.min, bounds.max));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -956,11 +956,7 @@ void CEntityObject::Serialize(CObjectArchive& ar)
|
||||
QString attachmentType;
|
||||
xmlNode->getAttr("AttachmentType", attachmentType);
|
||||
|
||||
if (attachmentType == "GeomCacheNode")
|
||||
{
|
||||
m_attachmentType = eAT_GeomCacheNode;
|
||||
}
|
||||
else if (attachmentType == "CharacterBone")
|
||||
if (attachmentType == "CharacterBone")
|
||||
{
|
||||
m_attachmentType = eAT_CharacterBone;
|
||||
}
|
||||
@@ -987,11 +983,7 @@ void CEntityObject::Serialize(CObjectArchive& ar)
|
||||
{
|
||||
if (m_attachmentType != eAT_Pivot)
|
||||
{
|
||||
if (m_attachmentType == eAT_GeomCacheNode)
|
||||
{
|
||||
xmlNode->setAttr("AttachmentType", "GeomCacheNode");
|
||||
}
|
||||
else if (m_attachmentType == eAT_CharacterBone)
|
||||
if (m_attachmentType == eAT_CharacterBone)
|
||||
{
|
||||
xmlNode->setAttr("AttachmentType", "CharacterBone");
|
||||
}
|
||||
@@ -1091,11 +1083,7 @@ XmlNodeRef CEntityObject::Export([[maybe_unused]] const QString& levelPath, XmlN
|
||||
objNode->setAttr("ParentId", parentEntity->GetEntityId());
|
||||
if (m_attachmentType != eAT_Pivot)
|
||||
{
|
||||
if (m_attachmentType == eAT_GeomCacheNode)
|
||||
{
|
||||
objNode->setAttr("AttachmentType", "GeomCacheNode");
|
||||
}
|
||||
else if (m_attachmentType == eAT_CharacterBone)
|
||||
if (m_attachmentType == eAT_CharacterBone)
|
||||
{
|
||||
objNode->setAttr("AttachmentType", "CharacterBone");
|
||||
}
|
||||
|
||||
@@ -131,7 +131,6 @@ public:
|
||||
enum EAttachmentType
|
||||
{
|
||||
eAT_Pivot,
|
||||
eAT_GeomCacheNode,
|
||||
eAT_CharacterBone,
|
||||
};
|
||||
|
||||
|
||||
@@ -98,16 +98,8 @@ void CLineGizmo::Display(DisplayContext& dc)
|
||||
Vec3 pos = 0.5f * (m_point[0] + m_point[1]);
|
||||
//dc.renderer->DrawLabelEx( p3+Vec3(0,0,0.3f),1.2f,col,true,true,m_name );
|
||||
|
||||
float camDist = dc.camera->GetPosition().GetDistance(pos);
|
||||
float maxDist = dc.settings->GetLabelsDistance();
|
||||
if (camDist < dc.settings->GetLabelsDistance())
|
||||
{
|
||||
float range = maxDist / 2.0f;
|
||||
float col[4] = { m_color[0].r, m_color[0].g, m_color[0].b, m_color[0].a };
|
||||
if (camDist > range)
|
||||
{
|
||||
col[3] = col[3] * (1.0f - (camDist - range) / range);
|
||||
}
|
||||
dc.SetColor(col[0], col[1], col[2], col[3]);
|
||||
dc.DrawTextLabel(pos + Vec3(0, 0, 0.2f), 1.2f, m_name.toUtf8().data());
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ bool CObjectManager::AddObject(CBaseObject* obj)
|
||||
if (CEntityObject* entityObj = qobject_cast<CEntityObject*>(obj))
|
||||
{
|
||||
CEntityObject::EAttachmentType attachType = entityObj->GetAttachType();
|
||||
if (attachType == CEntityObject::EAttachmentType::eAT_GeomCacheNode || attachType == CEntityObject::EAttachmentType::eAT_CharacterBone)
|
||||
if (attachType == CEntityObject::EAttachmentType::eAT_CharacterBone)
|
||||
{
|
||||
m_animatedAttachedEntities.insert(entityObj);
|
||||
}
|
||||
@@ -1488,11 +1488,7 @@ bool CObjectManager::HitTestObject(CBaseObject* obj, HitContext& hc)
|
||||
if (!bSelectionHelperHit)
|
||||
{
|
||||
// Fast checking.
|
||||
if (hc.camera && !obj->IsInCameraView(*hc.camera))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (hc.bounds && !obj->IntersectRectBounds(*hc.bounds))
|
||||
if (hc.bounds && !obj->IntersectRectBounds(*hc.bounds))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -112,8 +112,6 @@ SEditorSettings::SEditorSettings()
|
||||
m_showCircularDependencyError = true;
|
||||
bAutoloadLastLevelAtStartup = false;
|
||||
bMuteAudio = false;
|
||||
bEnableGameModeVR = false;
|
||||
|
||||
|
||||
objectHideMask = 0;
|
||||
objectSelectMask = 0xFFFFFFFF; // Initially all selectable.
|
||||
|
||||
@@ -305,7 +305,6 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
bool m_showCircularDependencyError;
|
||||
bool bAutoloadLastLevelAtStartup;
|
||||
bool bMuteAudio;
|
||||
bool bEnableGameModeVR;
|
||||
|
||||
//! Speed of camera movement.
|
||||
float cameraMoveSpeed;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <Atom/RPI.Public/Scene.h>
|
||||
#include <Atom/RPI.Public/View.h>
|
||||
#include <Atom/RPI.Reflect/System/RenderPipelineDescriptor.h>
|
||||
#include <PostProcess/PostProcessFeatureProcessor.h>
|
||||
#include <AzCore/Component/TransformBus.h>
|
||||
#include <AzCore/Math/MatrixUtils.h>
|
||||
#include <AzCore/Name/Name.h>
|
||||
@@ -47,18 +48,42 @@ namespace TrackView
|
||||
AZ::Name viewName = AZ::Name("MainCamera");
|
||||
m_view = AZ::RPI::View::CreateView(viewName, AZ::RPI::View::UsageCamera);
|
||||
m_renderPipeline->SetDefaultView(m_view);
|
||||
m_targetView = scene.GetDefaultRenderPipeline()->GetDefaultView();
|
||||
if (AZ::Render::PostProcessFeatureProcessor* fp = scene.GetFeatureProcessor<AZ::Render::PostProcessFeatureProcessor>())
|
||||
{
|
||||
// This will be set again to mimic the active camera in UpdateView
|
||||
fp->SetViewAlias(m_view, m_targetView);
|
||||
}
|
||||
}
|
||||
|
||||
void AtomOutputFrameCapture::DestroyPipeline(AZ::RPI::Scene& scene)
|
||||
{
|
||||
if (AZ::Render::PostProcessFeatureProcessor* fp = scene.GetFeatureProcessor<AZ::Render::PostProcessFeatureProcessor>())
|
||||
{
|
||||
// Remove view alias introduced in CreatePipeline and UpdateView
|
||||
fp->RemoveViewAlias(m_view);
|
||||
}
|
||||
scene.RemoveRenderPipeline(m_renderPipeline->GetId());
|
||||
m_passHierarchy.clear();
|
||||
m_renderPipeline.reset();
|
||||
m_view.reset();
|
||||
m_targetView.reset();
|
||||
}
|
||||
|
||||
void AtomOutputFrameCapture::UpdateView(const AZ::Matrix3x4& cameraTransform, const AZ::Matrix4x4& cameraProjection)
|
||||
void AtomOutputFrameCapture::UpdateView(const AZ::Matrix3x4& cameraTransform, const AZ::Matrix4x4& cameraProjection, const AZ::RPI::ViewPtr targetView)
|
||||
{
|
||||
if (targetView && targetView != m_targetView)
|
||||
{
|
||||
if (AZ::RPI::Scene* scene = SceneFromGameEntityContext())
|
||||
{
|
||||
if (AZ::Render::PostProcessFeatureProcessor* fp = scene->GetFeatureProcessor<AZ::Render::PostProcessFeatureProcessor>())
|
||||
{
|
||||
fp->SetViewAlias(m_view, targetView);
|
||||
m_targetView = targetView;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_view->SetCameraTransform(cameraTransform);
|
||||
m_view->SetViewToClipMatrix(cameraProjection);
|
||||
}
|
||||
|
||||
@@ -39,11 +39,12 @@ namespace TrackView
|
||||
CaptureFinishedCallback captureFinishedCallback);
|
||||
|
||||
//! Update the internal view that is associated with the created pipeline.
|
||||
void UpdateView(const AZ::Matrix3x4& cameraTransform, const AZ::Matrix4x4& cameraProjection);
|
||||
void UpdateView(const AZ::Matrix3x4& cameraTransform, const AZ::Matrix4x4& cameraProjection, const AZ::RPI::ViewPtr targetView = nullptr);
|
||||
|
||||
private:
|
||||
AZ::RPI::RenderPipelinePtr m_renderPipeline; //!< The internal render pipeline.
|
||||
AZ::RPI::ViewPtr m_view; //!< The view associated with the render pipeline.
|
||||
AZ::RPI::ViewPtr m_targetView; //!< The view that this render pipeline will mimic.
|
||||
AZStd::vector<AZStd::string> m_passHierarchy; //!< Pass hierarchy (includes pipelineName and CopyToSwapChain).
|
||||
CaptureFinishedCallback m_captureFinishedCallback; //!< Stored callback called from OnCaptureFinished.
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <AzCore/Component/ComponentApplication.h>
|
||||
#include <AzFramework/Windowing/WindowBus.h>
|
||||
#include <Atom/RPI.Public/ViewProviderBus.h>
|
||||
|
||||
// Qt
|
||||
#include <QAction>
|
||||
@@ -91,9 +92,12 @@ namespace
|
||||
static void UpdateAtomOutputFrameCaptureView(TrackView::AtomOutputFrameCapture& atomOutputFrameCapture, const int width, const int height)
|
||||
{
|
||||
const AZ::EntityId activeCameraEntityId = TrackView::ActiveCameraEntityId();
|
||||
AZ::RPI::ViewPtr view = nullptr;
|
||||
AZ::RPI::ViewProviderBus::EventResult(view, activeCameraEntityId, &AZ::RPI::ViewProvider::GetView);
|
||||
atomOutputFrameCapture.UpdateView(
|
||||
TrackView::TransformFromEntityId(activeCameraEntityId),
|
||||
TrackView::ProjectionFromCameraEntityId(activeCameraEntityId, static_cast<float>(width), static_cast<float>(height)));
|
||||
TrackView::ProjectionFromCameraEntityId(activeCameraEntityId, aznumeric_cast<float>(width), aznumeric_cast<float>(height)),
|
||||
view);
|
||||
}
|
||||
|
||||
CSequenceBatchRenderDialog::CSequenceBatchRenderDialog(float fps, QWidget* pParent /* = nullptr */)
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
// AzCore
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
|
||||
// AzFramework
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
|
||||
// AzQtComponents
|
||||
#include <AzQtComponents/Utilities/DesktopUtilities.h>
|
||||
@@ -54,92 +54,14 @@
|
||||
#include <Shellapi.h>
|
||||
#endif
|
||||
|
||||
bool CFileUtil::s_singleFileDlgPref[IFileUtil::EFILE_TYPE_LAST] = { true, true, true, true, true };
|
||||
bool CFileUtil::s_multiFileDlgPref[IFileUtil::EFILE_TYPE_LAST] = { true, true, true, true, true };
|
||||
bool CFileUtil::s_singleFileDlgPref[IFileUtil::EFILE_TYPE_LAST] = { true, true, true, true };
|
||||
bool CFileUtil::s_multiFileDlgPref[IFileUtil::EFILE_TYPE_LAST] = { true, true, true, true };
|
||||
|
||||
CAutoRestorePrimaryCDRoot::~CAutoRestorePrimaryCDRoot()
|
||||
{
|
||||
QDir::setCurrent(GetIEditor()->GetPrimaryCDFolder());
|
||||
}
|
||||
|
||||
bool CFileUtil::CompileLuaFile(const char* luaFilename)
|
||||
{
|
||||
QString luaFile = luaFilename;
|
||||
|
||||
if (luaFile.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if this file is in Archive.
|
||||
{
|
||||
CCryFile file;
|
||||
if (file.Open(luaFilename, "rb"))
|
||||
{
|
||||
// Check if in pack.
|
||||
if (file.IsInPak())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
luaFile = Path::GamePathToFullPath(luaFilename);
|
||||
|
||||
// First try compiling script and see if it have any errors.
|
||||
QString LuaCompiler;
|
||||
QString CompilerOutput;
|
||||
|
||||
// Create the filepath of the lua compiler
|
||||
QString szExeFileName = qApp->applicationFilePath();
|
||||
QString exePath = Path::GetPath(szExeFileName);
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
const char* luaCompiler = "LuaCompiler.exe";
|
||||
#else
|
||||
const char* luaCompiler = "lua";
|
||||
#endif
|
||||
LuaCompiler = Path::AddPathSlash(exePath) + luaCompiler + " ";
|
||||
|
||||
AZStd::string path = luaFile.toUtf8().data();
|
||||
EBUS_EVENT(AzFramework::ApplicationRequests::Bus, NormalizePath, path);
|
||||
|
||||
QString finalPath = path.c_str();
|
||||
finalPath = "\"" + finalPath + "\"";
|
||||
|
||||
// Add the name of the Lua file
|
||||
QString cmdLine = LuaCompiler + finalPath;
|
||||
|
||||
// Execute the compiler and capture the output
|
||||
if (!GetIEditor()->ExecuteConsoleApp(cmdLine, CompilerOutput))
|
||||
{
|
||||
QMessageBox::critical(QApplication::activeWindow(), QString(), QObject::tr("Error while executing '%1', make sure the file is in" \
|
||||
" your Primary CD folder !").arg(luaCompiler));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check return string
|
||||
if (!CompilerOutput.isEmpty())
|
||||
{
|
||||
// Errors while compiling file.
|
||||
|
||||
// Show output from Lua compiler
|
||||
if (QMessageBox::critical(QApplication::activeWindow(), QObject::tr("Lua Compiler"),
|
||||
QObject::tr("Error output from Lua compiler:\r\n%1\r\nDo you want to edit the file ?").arg(CompilerOutput), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
|
||||
{
|
||||
int line = 0;
|
||||
int index = CompilerOutput.indexOf("at line");
|
||||
if (index >= 0)
|
||||
{
|
||||
azsscanf(CompilerOutput.mid(index).toUtf8().data(), "at line %d", &line);
|
||||
}
|
||||
// Open the Lua file for editing
|
||||
EditTextFile(luaFile.toUtf8().data(), line);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CFileUtil::ExtractFile(QString& file, bool bMsgBoxAskForExtraction, const char* pDestinationFilename)
|
||||
{
|
||||
@@ -205,7 +127,7 @@ void CFileUtil::EditTextFile(const char* txtFile, int line, IFileUtil::ETextFile
|
||||
{
|
||||
QString file = txtFile;
|
||||
|
||||
QString fullPathName = Path::GamePathToFullPath(file);
|
||||
QString fullPathName = Path::GamePathToFullPath(file);
|
||||
ExtractFile(fullPathName);
|
||||
QString cmd(fullPathName);
|
||||
#if defined (AZ_PLATFORM_WINDOWS)
|
||||
@@ -301,64 +223,6 @@ void CFileUtil::EditTextureFile(const char* textureFile, [[maybe_unused]] bool b
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CFileUtil::EditMayaFile(const char* filepath, const bool bExtractFromPak, const bool bUseGameFolder)
|
||||
{
|
||||
QString dosFilepath = PathUtil::ToDosPath(filepath).c_str();
|
||||
if (bExtractFromPak)
|
||||
{
|
||||
ExtractFile(dosFilepath);
|
||||
}
|
||||
|
||||
if (bUseGameFolder)
|
||||
{
|
||||
const QString sGameFolder = Path::GetEditingGameDataFolder().c_str();
|
||||
int nLength = sGameFolder.toUtf8().count();
|
||||
if (azstrnicmp(filepath, sGameFolder.toUtf8().data(), nLength) != 0)
|
||||
{
|
||||
dosFilepath = sGameFolder + '\\' + filepath;
|
||||
}
|
||||
|
||||
dosFilepath = PathUtil::ToDosPath(dosFilepath.toUtf8().data()).c_str();
|
||||
}
|
||||
|
||||
const char* engineRoot;
|
||||
EBUS_EVENT_RESULT(engineRoot, AzFramework::ApplicationRequests::Bus, GetEngineRoot);
|
||||
|
||||
const QString fullPath = QString(engineRoot) + '\\' + dosFilepath;
|
||||
|
||||
if (gSettings.animEditor.isEmpty())
|
||||
{
|
||||
AzQtComponents::ShowFileOnDesktop(fullPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!QProcess::startDetached(gSettings.animEditor, { fullPath }))
|
||||
{
|
||||
CryMessageBox("Can't open the file. You can specify a source editor in Sandbox Preferences or create an association in Windows.", "Cannot open file!", MB_OK | MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CFileUtil::EditFile(const char* filePath, const bool bExtrackFromPak, const bool bUseGameFolder)
|
||||
{
|
||||
QString extension = filePath;
|
||||
extension.remove(0, extension.lastIndexOf('.'));
|
||||
|
||||
if (extension.compare(".ma") == 0)
|
||||
{
|
||||
return EditMayaFile(filePath, bExtrackFromPak, bUseGameFolder);
|
||||
}
|
||||
else if ((extension.compare(".bspace") == 0) || (extension.compare(".comb") == 0))
|
||||
{
|
||||
EditTextFile(filePath, 0, IFileUtil::FILE_TYPE_BSPACE);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CFileUtil::CalculateDccFilename(const QString& assetFilename, QString& dccFilename)
|
||||
|
||||
@@ -25,14 +25,9 @@ public:
|
||||
|
||||
static void ShowInExplorer(const QString& path);
|
||||
|
||||
// Try to compile the given lua file: returns true if compilation succeeded, false on failure.
|
||||
static bool CompileLuaFile(const char* luaFilename);
|
||||
|
||||
static bool ExtractFile(QString& file, bool bMsgBoxAskForExtraction = true, const char* pDestinationFilename = nullptr);
|
||||
static void EditTextFile(const char* txtFile, int line = 0, IFileUtil::ETextFileType fileType = IFileUtil::FILE_TYPE_SCRIPT);
|
||||
static void EditTextureFile(const char* txtureFile, bool bUseGameFolder);
|
||||
static bool EditMayaFile(const char* mayaFile, const bool bExtractFromPak, const bool bUseGameFolder);
|
||||
static bool EditFile(const char* filePath, const bool bExtrackFromPak, const bool bUseGameFolder);
|
||||
|
||||
//! dcc filename calculation and extraction sub-routines
|
||||
static bool CalculateDccFilename(const QString& assetFilename, QString& dccFilename);
|
||||
|
||||
@@ -20,21 +20,11 @@ void CFileUtil_impl::ShowInExplorer(const QString& path)
|
||||
CFileUtil::ShowInExplorer(path);
|
||||
}
|
||||
|
||||
bool CFileUtil_impl::CompileLuaFile(const char* luaFilename)
|
||||
{
|
||||
return CFileUtil::CompileLuaFile(luaFilename);
|
||||
}
|
||||
|
||||
bool CFileUtil_impl::ExtractFile(QString& file, bool bMsgBoxAskForExtraction, const char* pDestinationFilename)
|
||||
{
|
||||
return CFileUtil::ExtractFile(file, bMsgBoxAskForExtraction, pDestinationFilename);
|
||||
}
|
||||
|
||||
void CFileUtil_impl::EditTextFile(const char* txtFile, int line, ETextFileType fileType)
|
||||
{
|
||||
CFileUtil::EditTextFile(txtFile, line, fileType);
|
||||
}
|
||||
|
||||
void CFileUtil_impl::EditTextureFile(const char* txtureFile, bool bUseGameFolder)
|
||||
{
|
||||
CFileUtil::EditTextureFile(txtureFile, bUseGameFolder);
|
||||
|
||||
@@ -36,9 +36,7 @@ public:
|
||||
|
||||
void ShowInExplorer(const QString& path) override;
|
||||
|
||||
bool CompileLuaFile(const char* luaFilename) override;
|
||||
bool ExtractFile(QString& file, bool bMsgBoxAskForExtraction = true, const char* pDestinationFilename = nullptr) override;
|
||||
void EditTextFile(const char* txtFile, int line = 0, ETextFileType fileType = FILE_TYPE_SCRIPT) override;
|
||||
void EditTextureFile(const char* txtureFile, bool bUseGameFolder) override;
|
||||
|
||||
//! dcc filename calculation and extraction sub-routines
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h> // for ebus events
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
#include <AzFramework/IO/LocalFileIO.h>
|
||||
|
||||
@@ -175,9 +174,8 @@ namespace Path
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QString GetEngineRootPath()
|
||||
{
|
||||
const char* engineRoot;
|
||||
EBUS_EVENT_RESULT(engineRoot, AzFramework::ApplicationRequests::Bus, GetEngineRoot);
|
||||
return QString(engineRoot);
|
||||
const AZ::IO::FixedMaxPathString engineRoot = AZ::Utils::GetEnginePath();
|
||||
return QString::fromUtf8(engineRoot.c_str(), static_cast<int>(engineRoot.size()));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1407,6 +1407,69 @@ void QtViewport::ProcessRenderLisneters(DisplayContext& rstDisplayContext)
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
// Note: Both CreateAnglesYPR and CreateOrientationYPR were copied verbatim from Cry_Camera.h which has been removed.
|
||||
//
|
||||
// Description
|
||||
// <PRE>
|
||||
// x-YAW
|
||||
// y-PITCH (negative=looking down / positive=looking up)
|
||||
// z-ROLL
|
||||
// </PRE>
|
||||
// Note: If we are looking along the z-axis, its not possible to specify the x and z-angle
|
||||
inline Ang3 CreateAnglesYPR(const Matrix33& m)
|
||||
{
|
||||
assert(m.IsOrthonormal());
|
||||
float l = Vec3(m.m01, m.m11, 0.0f).GetLength();
|
||||
if (l > 0.0001)
|
||||
{
|
||||
return Ang3(atan2f(-m.m01 / l, m.m11 / l), atan2f(m.m21, l), atan2f(-m.m20 / l, m.m22 / l));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ang3(0, atan2f(m.m21, l), 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Description
|
||||
// This function builds a 3x3 orientation matrix using YPR-angles
|
||||
// Rotation order for the orientation-matrix is Z-X-Y. (Zaxis=YAW / Xaxis=PITCH / Yaxis=ROLL)
|
||||
//
|
||||
// <PRE>
|
||||
// COORDINATE-SYSTEM
|
||||
//
|
||||
// z-axis
|
||||
// ^
|
||||
// |
|
||||
// | y-axis
|
||||
// | /
|
||||
// | /
|
||||
// |/
|
||||
// +---------------> x-axis
|
||||
// </PRE>
|
||||
//
|
||||
// Example:
|
||||
// Matrix33 orientation=CreateOrientationYPR( Ang3(1,2,3) );
|
||||
inline Matrix33 CreateOrientationYPR(const Ang3& ypr)
|
||||
{
|
||||
f32 sz, cz;
|
||||
sincos_tpl(ypr.x, &sz, &cz); //Zaxis = YAW
|
||||
f32 sx, cx;
|
||||
sincos_tpl(ypr.y, &sx, &cx); //Xaxis = PITCH
|
||||
f32 sy, cy;
|
||||
sincos_tpl(ypr.z, &sy, &cy); //Yaxis = ROLL
|
||||
Matrix33 c;
|
||||
c.m00 = cy * cz - sy * sz * sx;
|
||||
c.m01 = -sz * cx;
|
||||
c.m02 = sy * cz + cy * sz * sx;
|
||||
c.m10 = cy * sz + sy * sx * cz;
|
||||
c.m11 = cz * cx;
|
||||
c.m12 = sy * sz - cy * sx * cz;
|
||||
c.m20 = -sy * cx;
|
||||
c.m21 = sx;
|
||||
c.m22 = cy * cx;
|
||||
return c;
|
||||
}
|
||||
|
||||
void QtViewport::OnRawInput([[maybe_unused]] UINT wParam, HRAWINPUT lParam)
|
||||
{
|
||||
static C3DConnexionDriver* p3DConnexionDriver = 0;
|
||||
@@ -1450,12 +1513,12 @@ void QtViewport::OnRawInput([[maybe_unused]] UINT wParam, HRAWINPUT lParam)
|
||||
t *= sys_scale3DMouseTranslation->GetFVal();
|
||||
|
||||
float as = 0.001f * gSettings.cameraMoveSpeed;
|
||||
Ang3 ypr = CCamera::CreateAnglesYPR(Matrix33(viewTM));
|
||||
Ang3 ypr = CreateAnglesYPR(Matrix33(viewTM));
|
||||
ypr.x += -all6DOFs[5] * as * fScaleYPR;
|
||||
ypr.y = AZStd::clamp(ypr.y + all6DOFs[3] * as * fScaleYPR, -1.5f, 1.5f); // to keep rotation in reasonable range
|
||||
ypr.z = 0; // to have camera always upward
|
||||
|
||||
viewTM = Matrix34(CCamera::CreateOrientationYPR(ypr), viewTM.GetTranslation());
|
||||
viewTM = Matrix34(CreateOrientationYPR(ypr), viewTM.GetTranslation());
|
||||
viewTM = viewTM * Matrix34::CreateTranslationMat(t);
|
||||
|
||||
SetViewTM(viewTM);
|
||||
|
||||
@@ -138,14 +138,11 @@ CViewportTitleDlg::CViewportTitleDlg(QWidget* pParent)
|
||||
|
||||
connect(this, &CViewportTitleDlg::ActionTriggered, MainWindow::instance()->GetActionManager(), &ActionManager::ActionTriggered);
|
||||
|
||||
AZ::VR::VREventBus::Handler::BusConnect();
|
||||
|
||||
OnInitDialog();
|
||||
}
|
||||
|
||||
CViewportTitleDlg::~CViewportTitleDlg()
|
||||
{
|
||||
AZ::VR::VREventBus::Handler::BusDisconnect();
|
||||
GetISystem()->GetISystemEventDispatcher()->RemoveListener(this);
|
||||
GetIEditor()->UnregisterNotifyListener(this);
|
||||
|
||||
@@ -236,10 +233,6 @@ void CViewportTitleDlg::SetupOverflowMenu()
|
||||
connect(m_audioMuteAction, &QAction::triggered, this, &CViewportTitleDlg::OnBnClickedMuteAudio);
|
||||
overFlowMenu->addAction(m_audioMuteAction);
|
||||
|
||||
m_enableVRAction = new QAction("Enable VR Preview", overFlowMenu);
|
||||
connect(m_enableVRAction, &QAction::triggered, this, &CViewportTitleDlg::OnBnClickedEnableVR);
|
||||
overFlowMenu->addAction(m_enableVRAction);
|
||||
|
||||
overFlowMenu->addSeparator();
|
||||
|
||||
m_enableGridSnappingAction = new QAction("Enable Grid Snapping", overFlowMenu);
|
||||
@@ -305,16 +298,6 @@ void CViewportTitleDlg::OnInitDialog()
|
||||
connect(displayInfoHelper, &CViewportTitleDlgDisplayInfoHelper::ViewportInfoStatusUpdated, this, &CViewportTitleDlg::UpdateDisplayInfo);
|
||||
UpdateDisplayInfo();
|
||||
|
||||
// This is here just in case this class hasn't been created before
|
||||
// a VR headset was initialized
|
||||
m_enableVRAction->setEnabled(false);
|
||||
if (AZ::VR::HMDDeviceRequestBus::GetTotalNumOfEventHandlers() != 0)
|
||||
{
|
||||
m_enableVRAction->setEnabled(true);
|
||||
}
|
||||
|
||||
AZ::VR::VREventBus::Handler::BusConnect();
|
||||
|
||||
QFontMetrics metrics({});
|
||||
int width = static_cast<int>(metrics.boundingRect("-9999.99").width() * m_fieldWidthMultiplier);
|
||||
|
||||
@@ -931,23 +914,6 @@ void CViewportTitleDlg::UpdateMuteActionText()
|
||||
}
|
||||
}
|
||||
|
||||
void CViewportTitleDlg::OnHMDInitialized()
|
||||
{
|
||||
m_enableVRAction->setEnabled(true);
|
||||
}
|
||||
|
||||
void CViewportTitleDlg::OnHMDShutdown()
|
||||
{
|
||||
m_enableVRAction->setEnabled(false);
|
||||
}
|
||||
|
||||
void CViewportTitleDlg::OnBnClickedEnableVR()
|
||||
{
|
||||
gSettings.bEnableGameModeVR = !gSettings.bEnableGameModeVR;
|
||||
|
||||
m_enableVRAction->setText(gSettings.bEnableGameModeVR ? tr("Disable VR Preview") : tr("Enable VR Preview"));
|
||||
}
|
||||
|
||||
inline double Round(double fVal, double fStep)
|
||||
{
|
||||
if (fStep > 0.f)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <AzToolsFramework/UI/Prefab/PrefabViewportFocusPathHandler.h>
|
||||
#include <AzQtComponents/Components/Widgets/SpinBox.h>
|
||||
|
||||
#include <HMDBus.h>
|
||||
#endif
|
||||
|
||||
// CViewportTitleDlg dialog
|
||||
@@ -44,7 +43,6 @@ class CViewportTitleDlg
|
||||
: public QWidget
|
||||
, public IEditorNotifyListener
|
||||
, public ISystemEventListener
|
||||
, public AZ::VR::VREventBus::Handler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -85,13 +83,6 @@ protected:
|
||||
void OnToggleHelpers();
|
||||
void UpdateDisplayInfo();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// VR Event Bus Implementation
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void OnHMDInitialized() override;
|
||||
void OnHMDShutdown() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SetupCameraDropdownMenu();
|
||||
void SetupResolutionDropdownMenu();
|
||||
void SetupViewportInformationMenu();
|
||||
@@ -140,7 +131,6 @@ protected:
|
||||
|
||||
void OnBnClickedGotoPosition();
|
||||
void OnBnClickedMuteAudio();
|
||||
void OnBnClickedEnableVR();
|
||||
|
||||
void UpdateMuteActionText();
|
||||
|
||||
@@ -168,7 +158,6 @@ protected:
|
||||
QAction* m_fullInformationAction = nullptr;
|
||||
QAction* m_compactInformationAction = nullptr;
|
||||
QAction* m_audioMuteAction = nullptr;
|
||||
QAction* m_enableVRAction = nullptr;
|
||||
QAction* m_enableGridSnappingAction = nullptr;
|
||||
QAction* m_enableAngleSnappingAction = nullptr;
|
||||
QComboBox* m_cameraSpeed = nullptr;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user