Merge branch 'development' into scripting/text_updates_pass3

monroegm-disable-blank-issue-2
lsemp3d 4 years ago
commit 2e733b4950

@ -61,6 +61,10 @@ class TestAutomation(EditorTestSuite):
class AtomEditorComponents_HDRColorGradingAdded(EditorSharedTest):
from Atom.tests import hydra_AtomEditorComponents_HDRColorGradingAdded as test_module
@pytest.mark.test_case_id("C32078116")
class AtomEditorComponents_HDRiSkyboxAdded(EditorSharedTest):
from Atom.tests import hydra_AtomEditorComponents_HDRiSkyboxAdded as test_module
@pytest.mark.test_case_id("C32078117")
class AtomEditorComponents_LightAdded(EditorSharedTest):
from Atom.tests import hydra_AtomEditorComponents_LightAdded as test_module

@ -0,0 +1,177 @@
"""
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")
hdri_skybox_entity_creation = (
"HDRi Skybox successfully created",
"HDRi Skybox failed to be created")
hdri_skybox_component = (
"Entity has an HDRi Skybox component",
"Entity failed to find HDRi Skybox component")
cubemap_property_set = (
"Cubemap property set on HDRi Skybox component",
"Couldn't set Cubemap property on HDRi Skybox 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_HDRiSkybox_AddedToEntity():
"""
Summary:
Tests the HDRi Skybox 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 HDRi Skybox with no components.
2) Add an HDRi Skybox component to HDRi Skybox.
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 HDRi Skybox.
9) UNDO deletion.
10) REDO deletion.
11) 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 HDRi Skybox with no components.
hdri_skybox_entity = EditorEntity.create_editor_entity(
AtomComponentProperties.hdri_skybox())
Report.critical_result(Tests.hdri_skybox_entity_creation,
hdri_skybox_entity.exists())
# 2. Add an HDRi Skybox component to HDRi Skybox.
hdri_skybox_component = hdri_skybox_entity.add_component(
AtomComponentProperties.hdri_skybox())
Report.critical_result(
Tests.hdri_skybox_component,
hdri_skybox_entity.has_component(AtomComponentProperties.hdri_skybox()))
# 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 hdri_skybox_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, hdri_skybox_entity.exists())
# 5. Set Cubemap Texture on HDRi Skybox component.
skybox_cubemap_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage")
skybox_cubemap_material_asset = Asset.find_asset_by_path(skybox_cubemap_asset_path, False)
hdri_skybox_component.set_component_property_value(
AtomComponentProperties.hdri_skybox('Cubemap Texture'), skybox_cubemap_material_asset.id)
get_cubemap_property = hdri_skybox_component.get_component_property_value(
AtomComponentProperties.hdri_skybox('Cubemap Texture'))
Report.result(Tests.cubemap_property_set, get_cubemap_property == skybox_cubemap_material_asset.id)
# 6. 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)
# 7. Test IsHidden.
hdri_skybox_entity.set_visibility_state(False)
Report.result(Tests.is_hidden, hdri_skybox_entity.is_hidden() is True)
# 8. Test IsVisible.
hdri_skybox_entity.set_visibility_state(True)
general.idle_wait_frames(1)
Report.result(Tests.is_visible, hdri_skybox_entity.is_visible() is True)
# 9. Delete hdri_skybox entity.
hdri_skybox_entity.delete()
Report.result(Tests.entity_deleted, not hdri_skybox_entity.exists())
# 10. UNDO deletion.
general.undo()
Report.result(Tests.deletion_undo, hdri_skybox_entity.exists())
# 11. REDO deletion.
general.redo()
Report.result(Tests.deletion_redo, not hdri_skybox_entity.exists())
# 12. 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_HDRiSkybox_AddedToEntity)

@ -132,6 +132,7 @@ class EditorEntity:
def __init__(self, id: azlmbr.entity.EntityId):
self.id: azlmbr.entity.EntityId = id
self.components: List[EditorComponent] = []
# Creation functions
@classmethod
@ -279,7 +280,7 @@ class EditorEntity:
), f"Failure: Could not add component: '{new_comp.get_component_name()}' to entity: '{self.get_name()}'"
new_comp.id = add_component_outcome.GetValue()[0]
components.append(new_comp)
self.components.append(new_comp)
return components
def get_components_of_type(self, component_names: list) -> List[EditorComponent]:

@ -60,7 +60,7 @@ class EditorSingleTest_WithFileOverrides(EditorSingleTest):
class TestAutomationWithPrefabSystemEnabled(EditorTestSuite):
global_extra_cmdline_args = ['-BatchMode', '-autotest_mode',
'extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"]']
'--regset=/Amazon/Preferences/EnablePrefabSystem=true']
@staticmethod
def get_number_parallel_editors():

@ -24,7 +24,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
LargeWorlds
)
ly_add_pytest(
NAME AutomatedTesting::DynamicVegetationTests_Periodic
TEST_SERIAL
@ -39,6 +38,20 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
LargeWorlds
)
ly_add_pytest(
NAME AutomatedTesting::DynamicVegetationTests_Periodic_Optimized
TEST_SERIAL
TEST_SUITE periodic
PATH ${CMAKE_CURRENT_LIST_DIR}/dyn_veg/TestSuite_Periodic_Optimized.py
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
Legacy::Editor
AutomatedTesting.Assets
AutomatedTesting.GameLauncher
COMPONENT
LargeWorlds
)
ly_add_pytest(
NAME AutomatedTesting::DynamicVegetationTests_Main_Optimized
TEST_SERIAL

@ -0,0 +1,85 @@
"""
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
"""
def DynVegUtils_TempPrefabCreationWorks():
"""
Summary:
An existing level is opened. Each Prefab setup to be spawned by Dynamic Vegetation tests is created in memory and
validated against existing test slice components/mesh assignments.
Expected Behavior:
Temporary prefabs contain the expected components/assets.
Test Steps:
1) Open an existing level
2) Create each of the necessary temporary Mesh prefabs, and validate the component/mesh setups
3) Create the necessary temporary PhysX Collider, and validate the component setup
4) Report errors/asserts
:return: None
"""
import os
import azlmbr.asset as asset
import azlmbr.bus as bus
import azlmbr.math as math
from Prefab.tests import PrefabTestUtils as prefab_test_utils
from largeworlds.large_worlds_utils import editor_dynveg_test_helper as dynveg
from editor_python_test_tools.utils import Report, Tracer
from editor_python_test_tools.utils import TestHelper as helper
from editor_python_test_tools.prefab_utils import PrefabInstance
with Tracer() as error_tracer:
# Create dictionary for prefab filenames and paths to create using helper function
mesh_prefabs = {
"PinkFlower": os.path.join("assets", "objects", "foliage", "grass_flower_pink.azmodel"),
"PurpleFlower": os.path.join("assets", "objects", "foliage", "grass_flower_purple.azmodel"),
"1m_Cube": os.path.join("objects", "_primitives", "_box_1x1.azmodel"),
"CedarTree": os.path.join("assets", "objects", "foliage", "cedar.azmodel"),
"Bush": os.path.join("assets", "objects", "foliage", "bush_privet_01.azmodel"),
}
# 1) Open an existing simple level
prefab_test_utils.open_base_tests_level()
# 2) Create each of the Mesh asset prefabs and validate that the prefab created successfully
for prefab_filename, asset_path in mesh_prefabs.items():
mesh_prefab_created = (
f"Temporary mesh prefab: {prefab_filename} created successfully",
f"Failed to create temporary mesh prefab: {prefab_filename}"
)
prefab = dynveg.create_temp_mesh_prefab(asset_path, prefab_filename)
Report.result(mesh_prefab_created, helper.wait_for_condition(lambda:
PrefabInstance.is_valid(prefab[1]), 3.0))
# 3) Create temp PhysX Collider prefab and validate that the prefab created successfully
physx_prefab_filename = "CedarTree_Collision"
physx_collider_prefab_created = (
f"Temporary mesh prefab: {physx_prefab_filename} created successfully",
f"Failed to create temporary mesh prefab: {physx_prefab_filename}"
)
test_physx_mesh_asset_id = asset.AssetCatalogRequestBus(bus.Broadcast, "GetAssetIdByPath", os.path.join(
"assets", "objects", "foliage", "cedar.pxmesh"), math.Uuid(), False)
dynveg.create_temp_physx_mesh_collider(test_physx_mesh_asset_id, physx_prefab_filename)
Report.result(physx_collider_prefab_created, helper.wait_for_condition(lambda:
PrefabInstance.is_valid(prefab[1]), 3.0))
# 4) Report errors/asserts
helper.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(DynVegUtils_TempPrefabCreationWorks)

@ -0,0 +1,23 @@
"""
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
"""
import os
import pytest
import ly_test_tools.environment.file_system as file_system
from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite
@pytest.mark.SUITE_main
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
@pytest.mark.parametrize("project", ["AutomatedTesting"])
class TestAutomation(EditorTestSuite):
global_extra_cmdline_args = ["-BatchMode", "-autotest_mode", "--regset=/Amazon/Preferences/EnablePrefabSystem=true"]
class test_DynVegUtils_TempPrefabCreationWorks(EditorSharedTest):
from .EditorScripts import DynVegUtils_TempPrefabCreationWorks as test_module

@ -19,6 +19,45 @@ import azlmbr.paths
sys.path.append(os.path.join(azlmbr.paths.projectroot, 'Gem', 'PythonTests'))
import editor_python_test_tools.hydra_editor_utils as hydra
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.prefab_utils import Prefab
def create_temp_mesh_prefab(mesh_asset_path, prefab_filename):
# Create initial entity
root = EditorEntity.create_editor_entity(name=prefab_filename)
assert root.exists(), "Failed to create entity"
# Add mesh component
mesh_component = root.add_component("Mesh")
assert root.has_component("Mesh") and mesh_component.is_enabled(), "Failed to add/activate Mesh component"
# Assign the specified mesh asset
mesh_asset = asset.AssetCatalogRequestBus(bus.Broadcast, "GetAssetIdByPath", mesh_asset_path, math.Uuid(), False)
mesh_component.set_component_property_value("Controller|Configuration|Mesh Asset", mesh_asset)
assert mesh_component.get_component_property_value("Controller|Configuration|Mesh Asset") == mesh_asset, \
"Failed to set Mesh asset"
# Create and return the temporary/in-memory prefab
temp_prefab = Prefab.create_prefab([root], prefab_filename)
return temp_prefab
def create_temp_physx_mesh_collider(physx_mesh_id, prefab_filename):
# Create initial entity
root = EditorEntity.create_editor_entity(name=prefab_filename)
assert root.exists(), "Failed to create entity"
# Add PhysX Collider component
collider_component = root.add_component("PhysX Collider")
assert root.has_component("PhysX Collider") and collider_component.is_enabled(), \
"Failed to add/activate PhysX Collider component"
# Set the Collider's Shape Configuration field to PhysicsAsset, and assign the specified PhysX Mesh asset
collider_component.set_component_property_value("Shape Configuration|Shape", 7)
assert collider_component.get_component_property_value("Shape Configuration|Shape") == 7, \
"Failed to set Collider Shape to PhysicsAsset"
collider_component.set_component_property_value("Shape Configuration|Asset|PhysX Mesh", physx_mesh_id)
assert collider_component.get_component_property_value("Shape Configuration|Asset|PhysX Mesh") == physx_mesh_id, \
"Failed to assign PhysX Mesh asset"
# Create and return the temporary/in-memory prefab
temp_prefab = Prefab.create_prefab([root], prefab_filename)
return temp_prefab
def create_surface_entity(name, center_point, box_size_x, box_size_y, box_size_z):

@ -13,7 +13,10 @@ import os
import pytest
import subprocess
import ly_test_tools
@pytest.mark.skipif(not ly_test_tools.WINDOWS, reason="Only succeeds on windows https://github.com/o3de/o3de/issues/5539")
@pytest.mark.SUITE_smoke
class TestCLIToolSerializeContextToolsWorks(object):
def test_CLITool_SerializeContextTools_Works(self, build_directory):

@ -11,10 +11,13 @@ Test should run in both gpu and non gpu
import pytest
import os
from automatedtesting_shared.base import TestAutomationBase
import ly_test_tools
import ly_test_tools.environment.file_system as file_system
@pytest.mark.SUITE_smoke
@pytest.mark.skipif(not ly_test_tools.WINDOWS, reason="Only succeeds on windows https://github.com/o3de/o3de/issues/5539")
@pytest.mark.parametrize("launcher_platform", ["windows_editor"])
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("level", ["temp_level"])

@ -125,7 +125,7 @@
</size>
</property>
<property name="text">
<string>General Availability</string>
<string>development</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>

@ -103,7 +103,7 @@
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>General Availability</string>
<string>development</string>
</property>
</widget>
</item>

@ -1225,20 +1225,6 @@ static AZStd::string ConcatPath(const char* szPart1, const char* szPart2)
return ret;
}
// Helper to maintain backwards compatibility with our CVar but not force our new code to
// pull in CryCommon by routing through an environment variable
void CmdSetAwsLogLevel(IConsoleCmdArgs* pArgs)
{
static const char* const logLevelEnvVar = "sys_SetLogLevel";
static AZ::EnvironmentVariable<int> logVar = AZ::Environment::CreateVariable<int>(logLevelEnvVar);
if (pArgs->GetArgCount() > 1)
{
int logLevel = atoi(pArgs->GetArg(1));
*logVar = logLevel;
AZ_TracePrintf("AWSLogging", "Log level set to %d", *logVar);
}
}
//////////////////////////////////////////////////////////////////////////
void CSystem::CreateSystemVars()
{
@ -1601,8 +1587,6 @@ void CSystem::CreateSystemVars()
// Since the UI Canvas Editor is incomplete, we have a variable to enable it.
// By default it is now enabled. Modify system.cfg or game.cfg to disable it
REGISTER_INT("sys_enableCanvasEditor", 1, VF_NULL, "Enables the UI Canvas Editor");
REGISTER_COMMAND("sys_SetLogLevel", CmdSetAwsLogLevel, 0, "Set AWS log level [0 - 6].");
}
//////////////////////////////////////////////////////////////////////////

@ -24,3 +24,30 @@ ly_add_target(
3rdParty::AWSNativeSDK::Core
AZ::AzCore
)
################################################################################
# Tests
################################################################################
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
ly_add_target(
NAME AWSNativeSDKInit.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
NAMESPACE AZ
FILES_CMAKE
aws_native_sdk_init_tests_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
include
tests
source
BUILD_DEPENDENCIES
PRIVATE
AZ::AzCore
AZ::AzFramework
AZ::AzTest
AZ::AWSNativeSDKInit
3rdParty::AWSNativeSDK::Core
)
ly_add_googletest(
NAME AZ::AWSNativeSDKInit.Tests
)
endif()

@ -0,0 +1,12 @@
#
# 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
#
#
set(FILES
tests/AWSLogSystemInterfaceTest.cpp
tests/AWSNativeSDKInitTest.cpp
)

@ -10,6 +10,8 @@
#include <AWSNativeSDKInit/AWSLogSystemInterface.h>
#include <AzCore/base.h>
#include <AzCore/Console/IConsole.h>
#include <AzCore/Interface/Interface.h>
#include <AzCore/Module/Environment.h>
#include <stdarg.h>
@ -24,6 +26,9 @@ AZ_POP_DISABLE_WARNING
namespace AWSNativeSDKInit
{
AZ_CVAR(int, bg_awsLogLevel, -1, nullptr, AZ::ConsoleFunctorFlags::Null,
"AWSLogLevel used to control verbosity of logging system. Off = 0, Fatal = 1, Error = 2, Warn = 3, Info = 4, Debug = 5, Trace = 6");
const char* AWSLogSystemInterface::AWS_API_LOG_PREFIX = "AwsApi-";
const int AWSLogSystemInterface::MAX_MESSAGE_LENGTH = 4096;
const char* AWSLogSystemInterface::MESSAGE_FORMAT = "[AWS] %s - %s";
@ -40,15 +45,16 @@ namespace AWSNativeSDKInit
Aws::Utils::Logging::LogLevel AWSLogSystemInterface::GetLogLevel() const
{
Aws::Utils::Logging::LogLevel newLevel = m_logLevel;
static const char* const logLevelEnvVar = "sys_SetLogLevel";
auto logVar = AZ::Environment::FindVariable<int>(logLevelEnvVar);
if (logVar)
if (auto console = AZ::Interface<AZ::IConsole>::Get(); console != nullptr)
{
newLevel = (Aws::Utils::Logging::LogLevel) *logVar;
int awsLogLevel = -1;
console->GetCvarValue("bg_awsLogLevel", awsLogLevel);
if (awsLogLevel >= 0)
{
newLevel = static_cast<Aws::Utils::Logging::LogLevel>(awsLogLevel);
}
}
return newLevel != m_logLevel ? newLevel : m_logLevel;
return newLevel;
}
/**
@ -78,14 +84,12 @@ namespace AWSNativeSDKInit
*/
void AWSLogSystemInterface::LogStream(Aws::Utils::Logging::LogLevel logLevel, const char* tag, const Aws::OStringStream &messageStream)
{
if(!ShouldLog(logLevel))
{
return;
}
ForwardAwsApiLogMessage(logLevel, tag, messageStream.str().c_str());
}
bool AWSLogSystemInterface::ShouldLog(Aws::Utils::Logging::LogLevel logLevel)
@ -93,7 +97,7 @@ namespace AWSNativeSDKInit
#if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
Aws::Utils::Logging::LogLevel newLevel = GetLogLevel();
if (newLevel > Aws::Utils::Logging::LogLevel::Info && newLevel <= Aws::Utils::Logging::LogLevel::Trace && newLevel != m_logLevel)
if (newLevel != m_logLevel)
{
SetLogLevel(newLevel);
}
@ -124,7 +128,7 @@ namespace AWSNativeSDKInit
break;
case Aws::Utils::Logging::LogLevel::Error:
AZ::Debug::Trace::Instance().Warning(__FILE__, __LINE__, AZ_FUNCTION_SIGNATURE, AWSLogSystemInterface::ERROR_WINDOW_NAME, MESSAGE_FORMAT, tag, message);
AZ::Debug::Trace::Instance().Error(__FILE__, __LINE__, AZ_FUNCTION_SIGNATURE, AWSLogSystemInterface::ERROR_WINDOW_NAME, MESSAGE_FORMAT, tag, message);
break;
case Aws::Utils::Logging::LogLevel::Warn:

@ -64,10 +64,10 @@ namespace AWSNativeSDKInit
{
#if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
Aws::Utils::Logging::LogLevel logLevel;
#ifdef _DEBUG
#if defined(AZ_DEBUG_BUILD) || defined(AZ_PROFILE_BUILD)
logLevel = Aws::Utils::Logging::LogLevel::Warn;
#else
logLevel = Aws::Utils::Logging::LogLevel::Warn;
logLevel = Aws::Utils::Logging::LogLevel::Error;
#endif
m_awsSDKOptions.loggingOptions.logLevel = logLevel;
m_awsSDKOptions.loggingOptions.logger_create_fn = [logLevel]()

@ -0,0 +1,169 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AzCore/Console/Console.h>
#include <AzCore/Console/IConsole.h>
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/smart_ptr/unique_ptr.h>
#include <AzCore/UnitTest/TestTypes.h>
#include <AWSNativeSDKInit/AWSLogSystemInterface.h>
#include <aws/core/utils/logging/LogLevel.h>
using namespace AWSNativeSDKInit;
class AWSLogSystemInterfaceTest
: public UnitTest::ScopedAllocatorSetupFixture
, public AZ::Debug::TraceMessageBus::Handler
{
public:
bool OnPreAssert(const char*, int, const char*, const char*) override
{
return true;
}
bool OnPreError(const char*, const char*, int, const char*, const char*) override
{
m_error = true;
return true;
}
bool OnPreWarning(const char*, const char*, int, const char*, const char*) override
{
m_warning = true;
return true;
}
bool OnPrintf(const char*, const char*) override
{
m_printf = true;
return true;
}
void SetUp() override
{
BusConnect();
if (!AZ::Interface<AZ::IConsole>::Get())
{
m_console = AZStd::make_unique<AZ::Console>();
m_console->LinkDeferredFunctors(AZ::ConsoleFunctorBase::GetDeferredHead());
AZ::Interface<AZ::IConsole>::Register(m_console.get());
}
}
void TearDown() override
{
if (m_console)
{
AZ::Interface<AZ::IConsole>::Unregister(m_console.get());
m_console.reset();
}
BusDisconnect();
}
bool m_error = false;
bool m_warning = false;
bool m_printf = false;
private:
AZStd::unique_ptr<AZ::Console> m_console;
};
TEST_F(AWSLogSystemInterfaceTest, LogStream_LogFatalMessage_GetExpectedNotification)
{
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
Aws::OStringStream testString;
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Fatal, "test", testString);
ASSERT_TRUE(m_error);
ASSERT_FALSE(m_warning);
ASSERT_FALSE(m_printf);
}
TEST_F(AWSLogSystemInterfaceTest, LogStream_LogErrorMessage_GetExpectedNotification)
{
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
Aws::OStringStream testString;
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Error, "test", testString);
ASSERT_TRUE(m_error);
ASSERT_FALSE(m_warning);
ASSERT_FALSE(m_printf);
}
TEST_F(AWSLogSystemInterfaceTest, LogStream_LogWarningMessage_GetExpectedNotification)
{
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
Aws::OStringStream testString;
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Warn, "test", testString);
ASSERT_FALSE(m_error);
ASSERT_TRUE(m_warning);
ASSERT_FALSE(m_printf);
}
TEST_F(AWSLogSystemInterfaceTest, LogStream_LogInfoMessage_GetExpectedNotification)
{
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
Aws::OStringStream testString;
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Info, "test", testString);
ASSERT_FALSE(m_error);
ASSERT_FALSE(m_warning);
ASSERT_TRUE(m_printf);
}
TEST_F(AWSLogSystemInterfaceTest, LogStream_LogDebugMessage_GetExpectedNotification)
{
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
Aws::OStringStream testString;
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Debug, "test", testString);
ASSERT_FALSE(m_error);
ASSERT_FALSE(m_warning);
ASSERT_TRUE(m_printf);
}
TEST_F(AWSLogSystemInterfaceTest, LogStream_LogTraceMessage_GetExpectedNotification)
{
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
Aws::OStringStream testString;
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Trace, "test", testString);
ASSERT_FALSE(m_error);
ASSERT_FALSE(m_warning);
ASSERT_TRUE(m_printf);
}
TEST_F(AWSLogSystemInterfaceTest, LogStream_OverrideWarnAndLogInfoMessage_GetExpectedNotification)
{
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
Aws::OStringStream testString;
AZ::Interface<AZ::IConsole>::Get()->PerformCommand("bg_awsLogLevel 3");
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Info, "test", testString);
ASSERT_FALSE(m_error);
ASSERT_FALSE(m_warning);
ASSERT_FALSE(m_printf);
}
TEST_F(AWSLogSystemInterfaceTest, LogStream_OverrideWarnAndLogeErrorMessage_GetExpectedNotification)
{
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
Aws::OStringStream testString;
AZ::Interface<AZ::IConsole>::Get()->PerformCommand("bg_awsLogLevel 3");
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Error, "test", testString);
ASSERT_TRUE(m_error);
ASSERT_FALSE(m_warning);
ASSERT_FALSE(m_printf);
}
TEST_F(AWSLogSystemInterfaceTest, LogStream_OverrideOffAndLogInfoMessage_GetExpectedNotification)
{
AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace);
Aws::OStringStream testString;
AZ::Interface<AZ::IConsole>::Get()->PerformCommand("bg_awsLogLevel 0");
logSystem.LogStream(Aws::Utils::Logging::LogLevel::Info, "test", testString);
ASSERT_FALSE(m_error);
ASSERT_FALSE(m_warning);
ASSERT_FALSE(m_printf);
}

@ -0,0 +1,11 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AzTest/AzTest.h>
AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);

@ -140,7 +140,9 @@ TEST_F(AWSCognitoAuthorizationControllerTest, RequestAWSCredentials_Fail_GetIdEr
EXPECT_CALL(*m_cognitoIdentityClientMock, GetCredentialsForIdentity(testing::_)).Times(0);
EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsSuccess(testing::_)).Times(0);
EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsFail(testing::_)).Times(1);
AZ_TEST_START_TRACE_SUPPRESSION;
m_mockController->RequestAWSCredentialsAsync();
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT;
}
TEST_F(AWSCognitoAuthorizationControllerTest, RequestAWSCredentials_Fail_GetCredentialsForIdentityError)
@ -174,7 +176,9 @@ TEST_F(AWSCognitoAuthorizationControllerTest, RequestAWSCredentials_Fail_GetCred
EXPECT_CALL(*m_cognitoIdentityClientMock, GetCredentialsForIdentity(testing::_)).Times(1).WillOnce(testing::Return(outcome));
EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsSuccess(testing::_)).Times(0);
EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsFail(testing::_)).Times(1);
AZ_TEST_START_TRACE_SUPPRESSION;
m_mockController->RequestAWSCredentialsAsync();
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT;
}
TEST_F(AWSCognitoAuthorizationControllerTest, AddRemoveLogins_Succuess)
@ -331,8 +335,10 @@ TEST_F(AWSCognitoAuthorizationControllerTest, GetCredentialsProvider_NoPersisted
EXPECT_CALL(*m_cognitoIdentityClientMock, GetCredentialsForIdentity(testing::_)).Times(0);
std::shared_ptr<Aws::Auth::AWSCredentialsProvider> actualCredentialsProvider;
AZ_TEST_START_TRACE_SUPPRESSION;
AWSCore::AWSCredentialRequestBus::BroadcastResult(
actualCredentialsProvider, &AWSCore::AWSCredentialRequests::GetCredentialsProvider);
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT;
EXPECT_TRUE(actualCredentialsProvider == nullptr);
}

@ -6,8 +6,6 @@
#
#
set(awsgameliftclient_compile_definition $<IF:$<CONFIG:release>,AWSGAMELIFT_RELEASE,AWSGAMELIFT_DEV>)
ly_add_target(
NAME AWSGameLift.Client.Static STATIC
NAMESPACE Gem

@ -33,7 +33,7 @@
namespace AWSGameLift
{
#if defined(AWSGAMELIFT_DEV)
#if defined(AZ_DEBUG_BUILD) || defined(AZ_PROFILE_BUILD)
AZ_CVAR(AZ::CVarFixedString, cl_gameliftLocalEndpoint, "", nullptr, AZ::ConsoleFunctorFlags::Null, "The local endpoint to test with GameLiftLocal SDK.");
#endif
@ -87,7 +87,7 @@ namespace AWSGameLift
// Set up client endpoint or region
AZStd::string localEndpoint = "";
#if defined(AWSGAMELIFT_DEV)
#if defined(AZ_DEBUG_BUILD) || defined(AZ_PROFILE_BUILD)
localEndpoint = static_cast<AZ::CVarFixedString>(cl_gameliftLocalEndpoint);
#endif
if (!localEndpoint.empty())
@ -139,7 +139,7 @@ namespace AWSGameLift
{
const AWSGameLiftAcceptMatchRequest& gameliftStartMatchmakingRequest =
static_cast<const AWSGameLiftAcceptMatchRequest&>(acceptMatchRequest);
AcceptMatchHelper(gameliftStartMatchmakingRequest);
AcceptMatchActivity::AcceptMatch(gameliftStartMatchmakingRequest);
}
}
@ -157,9 +157,9 @@ namespace AWSGameLift
AZ::JobContext* jobContext = nullptr;
AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext);
AZ::Job* acceptMatchJob = AZ::CreateJobFunction(
[this, gameliftStartMatchmakingRequest]()
[gameliftStartMatchmakingRequest]()
{
AcceptMatchHelper(gameliftStartMatchmakingRequest);
AcceptMatchActivity::AcceptMatch(gameliftStartMatchmakingRequest);
AzFramework::MatchmakingAsyncRequestNotificationBus::Broadcast(
&AzFramework::MatchmakingAsyncRequestNotifications::OnAcceptMatchAsyncComplete);
@ -169,21 +169,6 @@ namespace AWSGameLift
acceptMatchJob->Start();
}
void AWSGameLiftClientManager::AcceptMatchHelper(const AWSGameLiftAcceptMatchRequest& acceptMatchRequest)
{
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
AZStd::string response;
if (!gameliftClient)
{
AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage);
}
else
{
AcceptMatchActivity::AcceptMatch(*gameliftClient, acceptMatchRequest);
}
}
AZStd::string AWSGameLiftClientManager::CreateSession(const AzFramework::CreateSessionRequest& createSessionRequest)
{
AZStd::string result = "";
@ -191,13 +176,13 @@ namespace AWSGameLift
{
const AWSGameLiftCreateSessionRequest& gameliftCreateSessionRequest =
static_cast<const AWSGameLiftCreateSessionRequest&>(createSessionRequest);
result = CreateSessionHelper(gameliftCreateSessionRequest);
result = CreateSessionActivity::CreateSession(gameliftCreateSessionRequest);
}
else if (CreateSessionOnQueueActivity::ValidateCreateSessionOnQueueRequest(createSessionRequest))
{
const AWSGameLiftCreateSessionOnQueueRequest& gameliftCreateSessionOnQueueRequest =
static_cast<const AWSGameLiftCreateSessionOnQueueRequest&>(createSessionRequest);
result = CreateSessionOnQueueHelper(gameliftCreateSessionOnQueueRequest);
result = CreateSessionOnQueueActivity::CreateSessionOnQueue(gameliftCreateSessionOnQueueRequest);
}
else
{
@ -217,9 +202,9 @@ namespace AWSGameLift
AZ::JobContext* jobContext = nullptr;
AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext);
AZ::Job* createSessionJob = AZ::CreateJobFunction(
[this, gameliftCreateSessionRequest]()
[gameliftCreateSessionRequest]()
{
AZStd::string result = CreateSessionHelper(gameliftCreateSessionRequest);
AZStd::string result = CreateSessionActivity::CreateSession(gameliftCreateSessionRequest);
AzFramework::SessionAsyncRequestNotificationBus::Broadcast(
&AzFramework::SessionAsyncRequestNotifications::OnCreateSessionAsyncComplete, result);
@ -235,9 +220,9 @@ namespace AWSGameLift
AZ::JobContext* jobContext = nullptr;
AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext);
AZ::Job* createSessionOnQueueJob = AZ::CreateJobFunction(
[this, gameliftCreateSessionOnQueueRequest]()
[gameliftCreateSessionOnQueueRequest]()
{
AZStd::string result = CreateSessionOnQueueHelper(gameliftCreateSessionOnQueueRequest);
AZStd::string result = CreateSessionOnQueueActivity::CreateSessionOnQueue(gameliftCreateSessionOnQueueRequest);
AzFramework::SessionAsyncRequestNotificationBus::Broadcast(
&AzFramework::SessionAsyncRequestNotifications::OnCreateSessionAsyncComplete, result);
@ -253,38 +238,6 @@ namespace AWSGameLift
}
}
AZStd::string AWSGameLiftClientManager::CreateSessionHelper(
const AWSGameLiftCreateSessionRequest& createSessionRequest)
{
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
AZStd::string result = "";
if (!gameliftClient)
{
AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage);
}
else
{
result = CreateSessionActivity::CreateSession(*gameliftClient, createSessionRequest);
}
return result;
}
AZStd::string AWSGameLiftClientManager::CreateSessionOnQueueHelper(
const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest)
{
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
AZStd::string result;
if (!gameliftClient)
{
AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage);
}
else
{
result = CreateSessionOnQueueActivity::CreateSessionOnQueue(*gameliftClient, createSessionOnQueueRequest);
}
return result;
}
bool AWSGameLiftClientManager::JoinSession(const AzFramework::JoinSessionRequest& joinSessionRequest)
{
bool result = false;
@ -292,7 +245,8 @@ namespace AWSGameLift
{
const AWSGameLiftJoinSessionRequest& gameliftJoinSessionRequest =
static_cast<const AWSGameLiftJoinSessionRequest&>(joinSessionRequest);
result = JoinSessionHelper(gameliftJoinSessionRequest);
auto createPlayerSessionOutcome = JoinSessionActivity::CreatePlayerSession(gameliftJoinSessionRequest);
result = JoinSessionActivity::RequestPlayerJoinSession(createPlayerSessionOutcome);
}
return result;
@ -313,9 +267,10 @@ namespace AWSGameLift
AZ::JobContext* jobContext = nullptr;
AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext);
AZ::Job* joinSessionJob = AZ::CreateJobFunction(
[this, gameliftJoinSessionRequest]()
[gameliftJoinSessionRequest]()
{
bool result = JoinSessionHelper(gameliftJoinSessionRequest);
auto createPlayerSessionOutcome = JoinSessionActivity::CreatePlayerSession(gameliftJoinSessionRequest);
bool result = JoinSessionActivity::RequestPlayerJoinSession(createPlayerSessionOutcome);
AzFramework::SessionAsyncRequestNotificationBus::Broadcast(
&AzFramework::SessionAsyncRequestNotifications::OnJoinSessionAsyncComplete, result);
@ -325,23 +280,6 @@ namespace AWSGameLift
joinSessionJob->Start();
}
bool AWSGameLiftClientManager::JoinSessionHelper(const AWSGameLiftJoinSessionRequest& joinSessionRequest)
{
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
bool result = false;
if (!gameliftClient)
{
AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage);
}
else
{
auto createPlayerSessionOutcome = JoinSessionActivity::CreatePlayerSession(*gameliftClient, joinSessionRequest);
result = JoinSessionActivity::RequestPlayerJoinSession(createPlayerSessionOutcome);
}
return result;
}
void AWSGameLiftClientManager::LeaveSession()
{
AWSGameLift::LeaveSessionActivity::LeaveSession();
@ -371,7 +309,7 @@ namespace AWSGameLift
{
const AWSGameLiftSearchSessionsRequest& gameliftSearchSessionsRequest =
static_cast<const AWSGameLiftSearchSessionsRequest&>(searchSessionsRequest);
response = SearchSessionsHelper(gameliftSearchSessionsRequest);
response = SearchSessionsActivity::SearchSessions(gameliftSearchSessionsRequest);
}
return response;
@ -392,9 +330,9 @@ namespace AWSGameLift
AZ::JobContext* jobContext = nullptr;
AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext);
AZ::Job* searchSessionsJob = AZ::CreateJobFunction(
[this, gameliftSearchSessionsRequest]()
[gameliftSearchSessionsRequest]()
{
AzFramework::SearchSessionsResponse response = SearchSessionsHelper(gameliftSearchSessionsRequest);
AzFramework::SearchSessionsResponse response = SearchSessionsActivity::SearchSessions(gameliftSearchSessionsRequest);
AzFramework::SessionAsyncRequestNotificationBus::Broadcast(
&AzFramework::SessionAsyncRequestNotifications::OnSearchSessionsAsyncComplete, response);
@ -404,22 +342,6 @@ namespace AWSGameLift
searchSessionsJob->Start();
}
AzFramework::SearchSessionsResponse AWSGameLiftClientManager::SearchSessionsHelper(
const AWSGameLiftSearchSessionsRequest& searchSessionsRequest) const
{
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
AzFramework::SearchSessionsResponse response;
if (!gameliftClient)
{
AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage);
}
else
{
response = SearchSessionsActivity::SearchSessions(*gameliftClient, searchSessionsRequest);
}
return response;
}
AZStd::string AWSGameLiftClientManager::StartMatchmaking(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest)
{
AZStd::string response;
@ -427,7 +349,7 @@ namespace AWSGameLift
{
const AWSGameLiftStartMatchmakingRequest& gameliftStartMatchmakingRequest =
static_cast<const AWSGameLiftStartMatchmakingRequest&>(startMatchmakingRequest);
response = StartMatchmakingHelper(gameliftStartMatchmakingRequest);
response = StartMatchmakingActivity::StartMatchmaking(gameliftStartMatchmakingRequest);
}
return response;
@ -448,9 +370,9 @@ namespace AWSGameLift
AZ::JobContext* jobContext = nullptr;
AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext);
AZ::Job* startMatchmakingJob = AZ::CreateJobFunction(
[this, gameliftStartMatchmakingRequest]()
[gameliftStartMatchmakingRequest]()
{
AZStd::string response = StartMatchmakingHelper(gameliftStartMatchmakingRequest);
AZStd::string response = StartMatchmakingActivity::StartMatchmaking(gameliftStartMatchmakingRequest);
AzFramework::MatchmakingAsyncRequestNotificationBus::Broadcast(
&AzFramework::MatchmakingAsyncRequestNotifications::OnStartMatchmakingAsyncComplete, response);
@ -460,29 +382,14 @@ namespace AWSGameLift
startMatchmakingJob->Start();
}
AZStd::string AWSGameLiftClientManager::StartMatchmakingHelper(const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest)
{
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
AZStd::string response;
if (!gameliftClient)
{
AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage);
}
else
{
response = StartMatchmakingActivity::StartMatchmaking(*gameliftClient, startMatchmakingRequest);
}
return response;
}
void AWSGameLiftClientManager::StopMatchmaking(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest)
{
if (StopMatchmakingActivity::ValidateStopMatchmakingRequest(stopMatchmakingRequest))
{
const AWSGameLiftStopMatchmakingRequest& gameliftStopMatchmakingRequest =
static_cast<const AWSGameLiftStopMatchmakingRequest&>(stopMatchmakingRequest);
StopMatchmakingHelper(gameliftStopMatchmakingRequest);
StopMatchmakingActivity::StopMatchmaking(gameliftStopMatchmakingRequest);
}
}
@ -501,9 +408,9 @@ namespace AWSGameLift
AZ::JobContext* jobContext = nullptr;
AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext);
AZ::Job* stopMatchmakingJob = AZ::CreateJobFunction(
[this, gameliftStopMatchmakingRequest]()
[gameliftStopMatchmakingRequest]()
{
StopMatchmakingHelper(gameliftStopMatchmakingRequest);
StopMatchmakingActivity::StopMatchmaking(gameliftStopMatchmakingRequest);
AzFramework::MatchmakingAsyncRequestNotificationBus::Broadcast(
&AzFramework::MatchmakingAsyncRequestNotifications::OnStopMatchmakingAsyncComplete);
@ -512,18 +419,4 @@ namespace AWSGameLift
stopMatchmakingJob->Start();
}
void AWSGameLiftClientManager::StopMatchmakingHelper(const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest)
{
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
if (!gameliftClient)
{
AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage);
}
else
{
StopMatchmakingActivity::StopMatchmaking(*gameliftClient, stopMatchmakingRequest);
}
}
} // namespace AWSGameLift

@ -175,14 +175,5 @@ namespace AWSGameLift
bool JoinSession(const AzFramework::JoinSessionRequest& joinSessionRequest) override;
AzFramework::SearchSessionsResponse SearchSessions(const AzFramework::SearchSessionsRequest& searchSessionsRequest) const override;
void LeaveSession() override;
private:
void AcceptMatchHelper(const AWSGameLiftAcceptMatchRequest& createSessionRequest);
AZStd::string CreateSessionHelper(const AWSGameLiftCreateSessionRequest& createSessionRequest);
AZStd::string CreateSessionOnQueueHelper(const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest);
bool JoinSessionHelper(const AWSGameLiftJoinSessionRequest& joinSessionRequest);
AzFramework::SearchSessionsResponse SearchSessionsHelper(const AWSGameLiftSearchSessionsRequest& searchSessionsRequest) const;
AZStd::string StartMatchmakingHelper(const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest);
void StopMatchmakingHelper(const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest);
};
} // namespace AWSGameLift

@ -7,9 +7,11 @@
*/
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <Activity/AWSGameLiftAcceptMatchActivity.h>
#include <AWSGameLiftSessionConstants.h>
#include <Request/IAWSGameLiftInternalRequests.h>
#include <aws/core/utils/Outcome.h>
#include <aws/gamelift/model/AcceptMatchRequest.h>
@ -42,13 +44,19 @@ namespace AWSGameLift
return request;
}
void AcceptMatch(const Aws::GameLift::GameLiftClient& gameliftClient,
const AWSGameLiftAcceptMatchRequest& AcceptMatchRequest)
void AcceptMatch(const AWSGameLiftAcceptMatchRequest& AcceptMatchRequest)
{
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
if (!gameliftClient)
{
AZ_Error(AWSGameLiftAcceptMatchActivityName, false, AWSGameLiftClientMissingErrorMessage);
return;
}
AZ_TracePrintf(AWSGameLiftAcceptMatchActivityName, "Requesting AcceptMatch against Amazon GameLift service ...");
Aws::GameLift::Model::AcceptMatchRequest request = BuildAWSGameLiftAcceptMatchRequest(AcceptMatchRequest);
auto AcceptMatchOutcome = gameliftClient.AcceptMatch(request);
auto AcceptMatchOutcome = gameliftClient->AcceptMatch(request);
if (AcceptMatchOutcome.IsSuccess())
{

@ -23,7 +23,7 @@ namespace AWSGameLift
Aws::GameLift::Model::AcceptMatchRequest BuildAWSGameLiftAcceptMatchRequest(const AWSGameLiftAcceptMatchRequest& AcceptMatchRequest);
// Create AcceptMatchRequest and make a AcceptMatch call through GameLift client
void AcceptMatch(const Aws::GameLift::GameLiftClient& gameliftClient, const AWSGameLiftAcceptMatchRequest& AcceptMatchRequest);
void AcceptMatch(const AWSGameLiftAcceptMatchRequest& AcceptMatchRequest);
// Validate AcceptMatchRequest and check required request parameters
bool ValidateAcceptMatchRequest(const AzFramework::AcceptMatchRequest& AcceptMatchRequest);

@ -6,9 +6,16 @@
*
*/
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <Activity/AWSGameLiftActivityUtils.h>
#include <Activity/AWSGameLiftCreateSessionActivity.h>
#include <AWSGameLiftSessionConstants.h>
#include <Request/IAWSGameLiftInternalRequests.h>
#include <aws/core/utils/Outcome.h>
#include <aws/gamelift/model/CreateGameSessionRequest.h>
namespace AWSGameLift
{
@ -63,15 +70,21 @@ namespace AWSGameLift
return request;
}
AZStd::string CreateSession(
const Aws::GameLift::GameLiftClient& gameliftClient,
const AWSGameLiftCreateSessionRequest& createSessionRequest)
AZStd::string CreateSession(const AWSGameLiftCreateSessionRequest& createSessionRequest)
{
AZStd::string result = "";
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
if (!gameliftClient)
{
AZ_Error(AWSGameLiftCreateSessionActivityName, false, AWSGameLiftClientMissingErrorMessage);
return result;
}
AZ_TracePrintf(AWSGameLiftCreateSessionActivityName, "Requesting CreateGameSession against Amazon GameLift service ...");
AZStd::string result = "";
Aws::GameLift::Model::CreateGameSessionRequest request = BuildAWSGameLiftCreateGameSessionRequest(createSessionRequest);
auto createSessionOutcome = gameliftClient.CreateGameSession(request);
auto createSessionOutcome = gameliftClient->CreateGameSession(request);
AZ_TracePrintf(AWSGameLiftCreateSessionActivityName, "CreateGameSession request against Amazon GameLift service is complete");
if (createSessionOutcome.IsSuccess())

@ -10,9 +10,7 @@
#include <Request/AWSGameLiftCreateSessionRequest.h>
#include <aws/core/utils/Outcome.h>
#include <aws/gamelift/GameLiftClient.h>
#include <aws/gamelift/model/CreateGameSessionRequest.h>
namespace AWSGameLift
{
@ -24,9 +22,7 @@ namespace AWSGameLift
Aws::GameLift::Model::CreateGameSessionRequest BuildAWSGameLiftCreateGameSessionRequest(const AWSGameLiftCreateSessionRequest& createSessionRequest);
// Create CreateGameSessionRequest and make a CreateGameSession call through GameLift client
AZStd::string CreateSession(
const Aws::GameLift::GameLiftClient& gameliftClient,
const AWSGameLiftCreateSessionRequest& createSessionRequest);
AZStd::string CreateSession(const AWSGameLiftCreateSessionRequest& createSessionRequest);
// Validate CreateSessionRequest and check required request parameters
bool ValidateCreateSessionRequest(const AzFramework::CreateSessionRequest& createSessionRequest);

@ -6,9 +6,16 @@
*
*/
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <AWSGameLiftSessionConstants.h>
#include <Activity/AWSGameLiftActivityUtils.h>
#include <Activity/AWSGameLiftCreateSessionOnQueueActivity.h>
#include <Request/IAWSGameLiftInternalRequests.h>
#include <aws/core/utils/Outcome.h>
#include <aws/gamelift/model/StartGameSessionPlacementRequest.h>
namespace AWSGameLift
{
@ -47,17 +54,23 @@ namespace AWSGameLift
return request;
}
AZStd::string CreateSessionOnQueue(
const Aws::GameLift::GameLiftClient& gameliftClient,
const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest)
AZStd::string CreateSessionOnQueue(const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest)
{
AZStd::string result = "";
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
if (!gameliftClient)
{
AZ_Error(AWSGameLiftCreateSessionOnQueueActivityName, false, AWSGameLiftClientMissingErrorMessage);
return result;
}
AZ_TracePrintf(AWSGameLiftCreateSessionOnQueueActivityName,
"Requesting StartGameSessionPlacement against Amazon GameLift service ...");
AZStd::string result = "";
Aws::GameLift::Model::StartGameSessionPlacementRequest request =
BuildAWSGameLiftStartGameSessionPlacementRequest(createSessionOnQueueRequest);
auto createSessionOnQueueOutcome = gameliftClient.StartGameSessionPlacement(request);
auto createSessionOnQueueOutcome = gameliftClient->StartGameSessionPlacement(request);
AZ_TracePrintf(AWSGameLiftCreateSessionOnQueueActivityName,
"StartGameSessionPlacement request against Amazon GameLift service is complete.");

@ -10,9 +10,7 @@
#include <Request/AWSGameLiftCreateSessionOnQueueRequest.h>
#include <aws/core/utils/Outcome.h>
#include <aws/gamelift/GameLiftClient.h>
#include <aws/gamelift/model/StartGameSessionPlacementRequest.h>
namespace AWSGameLift
{
@ -25,9 +23,7 @@ namespace AWSGameLift
const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest);
// Create StartGameSessionPlacementRequest and make a CreateGameSession call through GameLift client
AZStd::string CreateSessionOnQueue(
const Aws::GameLift::GameLiftClient& gameliftClient,
const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest);
AZStd::string CreateSessionOnQueue(const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest);
// Validate CreateSessionOnQueueRequest and check required request parameters
bool ValidateCreateSessionOnQueueRequest(const AzFramework::CreateSessionRequest& createSessionRequest);

@ -7,10 +7,11 @@
*/
#include <AzCore/Interface/Interface.h>
#include <AzFramework/Session/ISessionHandlingRequests.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <Activity/AWSGameLiftJoinSessionActivity.h>
#include <AWSGameLiftSessionConstants.h>
#include <Request/IAWSGameLiftInternalRequests.h>
namespace AWSGameLift
{
@ -59,16 +60,24 @@ namespace AWSGameLift
}
Aws::GameLift::Model::CreatePlayerSessionOutcome CreatePlayerSession(
const Aws::GameLift::GameLiftClient& gameliftClient,
const AWSGameLiftJoinSessionRequest& joinSessionRequest)
{
Aws::GameLift::Model::CreatePlayerSessionOutcome createPlayerSessionOutcome;
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
if (!gameliftClient)
{
AZ_Error(AWSGameLiftJoinSessionActivityName, false, AWSGameLiftClientMissingErrorMessage);
return createPlayerSessionOutcome;
}
AZ_TracePrintf(AWSGameLiftJoinSessionActivityName,
"Requesting CreatePlayerSession for player %s against Amazon GameLift service ...",
joinSessionRequest.m_playerId.c_str());
Aws::GameLift::Model::CreatePlayerSessionRequest request =
BuildAWSGameLiftCreatePlayerSessionRequest(joinSessionRequest);
auto createPlayerSessionOutcome = gameliftClient.CreatePlayerSession(request);
createPlayerSessionOutcome = gameliftClient->CreatePlayerSession(request);
AZ_TracePrintf(AWSGameLiftJoinSessionActivityName,
"CreatePlayerSession request for player %s against Amazon GameLift service is complete", joinSessionRequest.m_playerId.c_str());

@ -36,7 +36,6 @@ namespace AWSGameLift
// Create CreatePlayerSessionRequest and make a CreatePlayerSession call through GameLift client
Aws::GameLift::Model::CreatePlayerSessionOutcome CreatePlayerSession(
const Aws::GameLift::GameLiftClient& gameliftClient,
const AWSGameLiftJoinSessionRequest& joinSessionRequest);
// Request to setup networking connection for player

@ -6,11 +6,12 @@
*
*/
#include <Activity/AWSGameLiftLeaveSessionActivity.h>
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <AzFramework/Session/ISessionHandlingRequests.h>
#include <Activity/AWSGameLiftLeaveSessionActivity.h>
namespace AWSGameLift
{
namespace LeaveSessionActivity

@ -6,10 +6,16 @@
*
*/
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <AzFramework/Session/SessionConfig.h>
#include <Activity/AWSGameLiftSearchSessionsActivity.h>
#include <AWSGameLiftSessionConstants.h>
#include <Request/IAWSGameLiftInternalRequests.h>
#include <aws/core/utils/Outcome.h>
#include <aws/gamelift/model/SearchGameSessionsRequest.h>
namespace AWSGameLift
{
@ -62,14 +68,21 @@ namespace AWSGameLift
}
AzFramework::SearchSessionsResponse SearchSessions(
const Aws::GameLift::GameLiftClient& gameliftClient,
const AWSGameLiftSearchSessionsRequest& searchSessionsRequest)
{
AzFramework::SearchSessionsResponse response;
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
if (!gameliftClient)
{
AZ_Error(AWSGameLiftSearchSessionsActivityName, false, AWSGameLiftClientMissingErrorMessage);
return response;
}
AZ_TracePrintf(AWSGameLiftSearchSessionsActivityName, "Requesting SearchGameSessions against Amazon GameLift service ...");
AzFramework::SearchSessionsResponse response;
Aws::GameLift::Model::SearchGameSessionsRequest request = BuildAWSGameLiftSearchGameSessionsRequest(searchSessionsRequest);
Aws::GameLift::Model::SearchGameSessionsOutcome outcome = gameliftClient.SearchGameSessions(request);
Aws::GameLift::Model::SearchGameSessionsOutcome outcome = gameliftClient->SearchGameSessions(request);
AZ_TracePrintf(AWSGameLiftSearchSessionsActivityName, "SearchGameSessions request against Amazon GameLift service is complete");
if (outcome.IsSuccess())

@ -10,9 +10,7 @@
#include <Request/AWSGameLiftSearchSessionsRequest.h>
#include <aws/core/utils/Outcome.h>
#include <aws/gamelift/GameLiftClient.h>
#include <aws/gamelift/model/SearchGameSessionsRequest.h>
namespace AWSGameLift
{
@ -28,7 +26,6 @@ namespace AWSGameLift
// Create SearchGameSessionsRequest and make a SeachGameSessions call through GameLift client
AzFramework::SearchSessionsResponse SearchSessions(
const Aws::GameLift::GameLiftClient& gameliftClient,
const AWSGameLiftSearchSessionsRequest& searchSessionsRequest);
// Convert from Aws::GameLift::Model::SearchGameSessionsResult to AzFramework::SearchSessionsResponse.

@ -7,11 +7,13 @@
*/
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <Activity/AWSGameLiftActivityUtils.h>
#include <Activity/AWSGameLiftStartMatchmakingActivity.h>
#include <AWSGameLiftPlayer.h>
#include <AWSGameLiftSessionConstants.h>
#include <Request/IAWSGameLiftInternalRequests.h>
#include <aws/core/utils/Outcome.h>
#include <aws/gamelift/model/StartMatchmakingRequest.h>
@ -78,14 +80,21 @@ namespace AWSGameLift
}
AZStd::string StartMatchmaking(
const Aws::GameLift::GameLiftClient& gameliftClient,
const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest)
{
AZStd::string result = "";
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
if (!gameliftClient)
{
AZ_Error(AWSGameLiftStartMatchmakingActivityName, false, AWSGameLiftClientMissingErrorMessage);
return result;
}
AZ_TracePrintf(AWSGameLiftStartMatchmakingActivityName, "Requesting StartMatchmaking against Amazon GameLift service ...");
AZStd::string result = "";
Aws::GameLift::Model::StartMatchmakingRequest request = BuildAWSGameLiftStartMatchmakingRequest(startMatchmakingRequest);
auto startMatchmakingOutcome = gameliftClient.StartMatchmaking(request);
auto startMatchmakingOutcome = gameliftClient->StartMatchmaking(request);
if (startMatchmakingOutcome.IsSuccess())
{
result = AZStd::string(startMatchmakingOutcome.GetResult().GetMatchmakingTicket().GetTicketId().c_str());

@ -23,7 +23,7 @@ namespace AWSGameLift
Aws::GameLift::Model::StartMatchmakingRequest BuildAWSGameLiftStartMatchmakingRequest(const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest);
// Create StartMatchmakingRequest and make a StartMatchmaking call through GameLift client
AZStd::string StartMatchmaking(const Aws::GameLift::GameLiftClient& gameliftClient, const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest);
AZStd::string StartMatchmaking(const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest);
// Validate StartMatchmakingRequest and check required request parameters
bool ValidateStartMatchmakingRequest(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest);

@ -7,9 +7,11 @@
*/
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <Activity/AWSGameLiftStopMatchmakingActivity.h>
#include <AWSGameLiftSessionConstants.h>
#include <Request/IAWSGameLiftInternalRequests.h>
#include <aws/core/utils/Outcome.h>
#include <aws/gamelift/model/StopMatchmakingRequest.h>
@ -32,13 +34,19 @@ namespace AWSGameLift
return request;
}
void StopMatchmaking(const Aws::GameLift::GameLiftClient& gameliftClient,
const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest)
void StopMatchmaking(const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest)
{
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
if (!gameliftClient)
{
AZ_Error(AWSGameLiftStopMatchmakingActivityName, false, AWSGameLiftClientMissingErrorMessage);
return;
}
AZ_TracePrintf(AWSGameLiftStopMatchmakingActivityName, "Requesting StopMatchmaking against Amazon GameLift service ...");
Aws::GameLift::Model::StopMatchmakingRequest request = BuildAWSGameLiftStopMatchmakingRequest(stopMatchmakingRequest);
auto stopMatchmakingOutcome = gameliftClient.StopMatchmaking(request);
auto stopMatchmakingOutcome = gameliftClient->StopMatchmaking(request);
if (stopMatchmakingOutcome.IsSuccess())
{

@ -23,7 +23,7 @@ namespace AWSGameLift
Aws::GameLift::Model::StopMatchmakingRequest BuildAWSGameLiftStopMatchmakingRequest(const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest);
// Create StopMatchmakingRequest and make a StopMatchmaking call through GameLift client
void StopMatchmaking(const Aws::GameLift::GameLiftClient& gameliftClient, const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest);
void StopMatchmaking(const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest);
// Validate StopMatchmakingRequest and check required request parameters
bool ValidateStopMatchmakingRequest(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest);

@ -9,6 +9,8 @@
#include <Activity/AWSGameLiftCreateSessionActivity.h>
#include <AWSGameLiftClientFixture.h>
#include <aws/gamelift/model/CreateGameSessionRequest.h>
using namespace AWSGameLift;
using AWSGameLiftCreateSessionActivityTest = AWSGameLiftClientFixture;

@ -9,6 +9,8 @@
#include <AWSGameLiftClientFixture.h>
#include <Activity/AWSGameLiftCreateSessionOnQueueActivity.h>
#include <aws/gamelift/model/StartGameSessionPlacementRequest.h>
using namespace AWSGameLift;
using AWSGameLiftCreateSessionOnQueueActivityTest = AWSGameLiftClientFixture;

@ -6,6 +6,8 @@
*
*/
#include <AzFramework/Session/ISessionHandlingRequests.h>
#include <AWSGameLiftClientFixture.h>
#include <Activity/AWSGameLiftJoinSessionActivity.h>

@ -12,6 +12,9 @@
#include <AWSGameLiftClientFixture.h>
#include <AWSGameLiftSessionConstants.h>
#include <aws/core/utils/Outcome.h>
#include <aws/gamelift/model/SearchGameSessionsRequest.h>
using namespace AWSGameLift;
using AWSGameLiftSearchSessionsActivityTest = AWSGameLiftClientFixture;

@ -329,15 +329,15 @@ namespace AZ::Render
m_auxVertices.emplace_back(position);
m_auxVertices.emplace_back(position + normal);
}
}
RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs;
lineArgs.m_verts = m_auxVertices.data();
lineArgs.m_vertCount = static_cast<uint32_t>(m_auxVertices.size());
lineArgs.m_colors = &vertexNormalsColor;
lineArgs.m_colorCount = 1;
lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off;
auxGeom->DrawLines(lineArgs);
RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs;
lineArgs.m_verts = m_auxVertices.data();
lineArgs.m_vertCount = static_cast<uint32_t>(m_auxVertices.size());
lineArgs.m_colors = &vertexNormalsColor;
lineArgs.m_colorCount = 1;
lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off;
auxGeom->DrawLines(lineArgs);
}
}
}

@ -642,6 +642,8 @@ namespace EMotionFX
void AnimGraphReferenceNode::OnAnimGraphAssetChanged()
{
AnimGraphNotificationBus::Broadcast(&AnimGraphNotificationBus::Events::OnReferenceAnimGraphAboutToBeChanged, this);
ReleaseAnimGraphInstances();
AnimGraphNotificationBus::Broadcast(&AnimGraphNotificationBus::Events::OnReferenceAnimGraphChanged, this);

@ -119,6 +119,11 @@ namespace GraphCanvas
m_nodePalette->setProperty("HasNoWindowDecorations", true);
m_nodePalette->SetupNodePalette(config);
if (m_userNodePaletteWidth > 0)
{
m_nodePalette->setFixedWidth(m_userNodePaletteWidth);
}
QWidgetAction* actionWidget = new QWidgetAction(this);
actionWidget->setDefaultWidget(m_nodePalette);

@ -63,34 +63,34 @@ namespace GraphCanvas
void ResetSourceSlotFilter();
void FilterForSourceSlot(const GraphId& graphId, const AZ::EntityId& sourceSlotId);
protected slots:
protected Q_SLOTS:
virtual void SetupDisplay();
virtual void HandleContextMenuSelection();
protected:
virtual void OnRefreshActions(const GraphId& graphId, const AZ::EntityId& targetMemberId);
void keyPressEvent(QKeyEvent* keyEvent) override;
NodePaletteWidget* m_nodePalette = nullptr;
private:
void ConstructMenu();
void AddUnprocessedActions(AZStd::vector<QAction*>& actions);
bool m_finalized;
bool m_isToolBarMenu;
NodePaletteWidget* m_nodePalette = nullptr;
bool m_finalized;
bool m_isToolBarMenu;
AZ::u32 m_userNodePaletteWidth = 300;
EditorId m_editorId;
AZStd::vector< ActionGroupId > m_actionGroupOrdering;
AZStd::unordered_set< ActionGroupId > m_actionGroups;
AZStd::vector<ActionGroupId> m_actionGroupOrdering;
AZStd::unordered_set<ActionGroupId> m_actionGroups;
AZStd::vector<QAction*> m_unprocessedFrontActions;
AZStd::vector<QAction*> m_unprocessedActions;
AZStd::vector<QAction*> m_unprocessedBackActions;
AZStd::unordered_map< AZStd::string, QMenu* > m_subMenuMap;
AZStd::unordered_map<AZStd::string, QMenu*> m_subMenuMap;
};
}

@ -395,6 +395,7 @@ namespace ScriptCanvasEditor
->Field("ShowUpgradeDialog", &ScriptCanvasEditorSettings::m_showUpgradeDialog)
->Field("ZoomSettings", &ScriptCanvasEditorSettings::m_zoomSettings)
->Field("ExperimentalSettings", &ScriptCanvasEditorSettings::m_experimentalSettings)
->Field("SceneContextMenuNodePaletteWidth", &ScriptCanvasEditorSettings::m_sceneContextMenuNodePaletteWidth)
;
AZ::EditContext* editContext = serialize->GetEditContext();
@ -467,13 +468,13 @@ namespace ScriptCanvasEditor
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_snapDistance, "Connection Snap Distance", "The distance from a slot under which connections will snap to it.")
->Attribute(AZ::Edit::Attributes::Min, 10.0)
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_enableGroupDoubleClickCollapse, "Double Click to Collapse/Uncollapse Group", "Enables the user to decide whether you can double click on a group to collapse/uncollapse a group.")
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_enableGroupDoubleClickCollapse, "Double Click to Collapse/Expand Group", "Enables the user to decide whether you can double click on a group to collapse/expand a group.")
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_allowBookmarkViewpointControl, "Bookmark Zooming", "Will cause the bookmarks to force the viewport into the state determined by the bookmark type\nBookmark Anchors - The viewport that exists when the bookmark is created.\nNode Groups - The area the Node Group covers")
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_dragNodeCouplingConfig, "Node Coupling Configuration", "Controls for managing Node Coupling.\nNode Coupling is when you are dragging a node and leave it hovered over another Node, we will try to connect the sides you overlapped with each other.")
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_dragNodeSplicingConfig, "Drag Node Splicing Configuration", "Controls for managing Node Splicing on a Drag.\nNode Splicing on a Drag will let you drag a node onto a connection, and splice that node onto the specified connection.")
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_dropNodeSplicingConfig, "Drop Node Splicing Configuration", "Controls for managing Node Splicing on a Drag.\nNode Splicing on a drop will let you drop a node onto a connection from the Node Palette, and splice that node onto the specified connection.")
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_autoSaveConfig, "AutoSave Configuration", "Controls for managing Auto Saving.\nAuto Saving will occur after the specified time of inactivity on a graph.")
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_shakeDespliceConfig, "Shake To Desplice", "Settings that controls various parameters of the Shake to Desplice feature")
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_shakeDespliceConfig, "Shake To De-splice", "Settings that controls various parameters of the Shake to De-splice feature")
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_allowNodeNudging, "Allow Node Nudging", "Controls whether or not nodes will attempt to nudge each other out of the way under various interactions.")
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_alignmentTimeMS, "Alignment Time", "Controls the amount of time nodes will take to slide into place when performing alignment commands")
->Attribute(AZ::Edit::Attributes::Min, 0)
@ -485,8 +486,10 @@ namespace ScriptCanvasEditor
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_experimentalSettings, "Experimental Settings", "Settings that will control elements that are under development and may not work as expected")
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_saveRawTranslationOuputToFile, "Save Translation File", "Save out the raw result of translation for debug purposes")
->Attribute(AZ::Edit::Attributes::ChangeNotify, &SettingsCpp::UpdateProcessingSettings)
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_printAbstractCodeModel, "Print Abstract Modeld", "Print out the Abstract Code Model to the console at the end of parsing for debug purposes")
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_printAbstractCodeModel, "Print Abstract Model", "Print out the Abstract Code Model to the console at the end of parsing for debug purposes")
->Attribute(AZ::Edit::Attributes::ChangeNotify, &SettingsCpp::UpdateProcessingSettings)
->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_sceneContextMenuNodePaletteWidth, "Context Menu Width", "Allows you to configure the width of the context menu that opens on a Script Canvas graph")
->Attribute(AZ::Edit::Attributes::Min, 120)
;
editContext->Class<ExperimentalSettings>("Experimental", "Settings for features under development that may not behave as expected yet.")

@ -357,6 +357,8 @@ namespace ScriptCanvasEditor
AZ::u32 m_alignmentTimeMS;
StylingSettings m_stylingSettings;
AZ::u32 m_sceneContextMenuNodePaletteWidth = 300;
};
}
}

@ -12,6 +12,8 @@
#include <QMimeData>
#include <QInputDialog>
#include <AzCore/UserSettings/UserSettings.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <Editor/Nodes/NodeUtils.h>
@ -41,6 +43,8 @@
#include <Editor/View/Widgets/NodePalette/VariableNodePaletteTreeItemTypes.h>
#include "ScriptCanvasContextMenus.h"
#include "Settings.h"
#include <ScriptCanvas/Core/NodeBus.h>
#include <ScriptCanvas/Core/Slot.h>
#include <GraphCanvas/Editor/EditorTypes.h>
@ -53,6 +57,7 @@
#include <GraphCanvas/Components/Nodes/NodeTitleBus.h>
#include <GraphCanvas/Components/NodeDescriptors/FunctionDefinitionNodeDescriptorComponent.h>
namespace ScriptCanvasEditor
{
////////////////////////////
@ -805,6 +810,13 @@ namespace ScriptCanvasEditor
SceneContextMenu::SceneContextMenu(const NodePaletteModel& paletteModel, AzToolsFramework::AssetBrowser::AssetBrowserFilterModel* assetModel)
: GraphCanvas::SceneContextMenu(ScriptCanvasEditor::AssetEditorId)
{
auto userSettings = AZ::UserSettings::CreateFind<EditorSettings::ScriptCanvasEditorSettings>(AZ_CRC("ScriptCanvasPreviewSettings", 0x1c5a2965), AZ::UserSettings::CT_LOCAL);
if (userSettings)
{
m_userNodePaletteWidth = userSettings->m_sceneContextMenuNodePaletteWidth;
}
const bool inContextMenu = true;
Widget::ScriptCanvasNodePaletteConfig paletteConfig(paletteModel, assetModel, inContextMenu);
AddNodePaletteMenuAction(paletteConfig);

@ -20,6 +20,7 @@ _PROCESS_OUTPUT_ENCODING = 'utf-8'
# Default list of processes names to kill
LY_PROCESS_KILL_LIST = [
'AssetBuilder', 'AssetProcessor', 'AssetProcessorBatch',
'CrySCompileServer', 'Editor',
'Profiler', 'RemoteConsole',
'rc' # Resource Compiler
@ -376,18 +377,18 @@ def _safe_kill_processes(processes):
logger.info(f"Terminating process '{proc.name()}' with id '{proc.pid}'")
proc.kill()
except psutil.AccessDenied:
logger.warning("Termination failed, Access Denied", exc_info=True)
logger.warning("Termination failed, Access Denied with stacktrace:", exc_info=True)
except psutil.NoSuchProcess:
logger.debug("Termination request ignored, process was already terminated during iteration", exc_info=True)
logger.debug("Termination request ignored, process was already terminated during iteration with stacktrace:", exc_info=True)
except Exception: # purposefully broad
logger.warning("Unexpected exception ignored while terminating process", exc_info=True)
logger.debug("Unexpected exception ignored while terminating process, with stacktrace:", exc_info=True)
def on_terminate(proc):
logger.info(f"process '{proc.name()}' with id '{proc.pid}' terminated with exit code {proc.returncode}")
try:
psutil.wait_procs(processes, timeout=30, callback=on_terminate)
except Exception: # purposefully broad
logger.warning("Unexpected exception while waiting for processes to terminate", exc_info=True)
logger.debug("Unexpected exception while waiting for processes to terminate, with stacktrace:", exc_info=True)
def _terminate_and_confirm_dead(proc):

@ -74,9 +74,9 @@ class TestEditorTestUtils(unittest.TestCase):
def test_RetrieveCrashOutput_CrashLogNotExists_ReturnsError(self, mock_retrieve_log_path):
mock_retrieve_log_path.return_value = 'mock_log_path'
mock_workspace = mock.MagicMock()
expected = "-- No crash log available --\n[Errno 2] No such file or directory: 'mock_log_path\\\\error.log'"
error_message = "No crash log available"
assert expected == editor_test_utils.retrieve_crash_output(0, mock_workspace, 0)
assert error_message in editor_test_utils.retrieve_crash_output(0, mock_workspace, 0)
@mock.patch('os.path.getmtime', mock.MagicMock())
@mock.patch('os.rename')

@ -371,15 +371,15 @@ class TestProcessMatching(unittest.TestCase):
mock_log_warn.assert_called()
@mock.patch('psutil.wait_procs')
@mock.patch('logging.Logger.warning')
def test_SafeKillProcList_RaisesError_NoRaiseAndLogsError(self, mock_log_warn, mock_wait_procs):
@mock.patch('logging.Logger.debug')
def test_SafeKillProcList_RaisesError_NoRaiseAndLogsError(self, mock_log, mock_wait_procs):
mock_wait_procs.side_effect = psutil.PermissionError()
proc_mock = mock.MagicMock()
process_utils._safe_kill_processes(proc_mock)
mock_wait_procs.assert_called()
mock_log_warn.assert_called()
mock_log.assert_called()
@mock.patch('psutil.process_iter')
@mock.patch('logging.Logger.debug')

@ -23,7 +23,7 @@ ly_set(PAL_TRAIT_PROF_PIX_SUPPORTED FALSE)
# Test library support
ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED TRUE)
ly_set(PAL_TRAIT_TEST_GOOGLE_BENCHMARK_SUPPORTED TRUE)
ly_set(PAL_TRAIT_TEST_LYTESTTOOLS_SUPPORTED FALSE)
ly_set(PAL_TRAIT_TEST_LYTESTTOOLS_SUPPORTED TRUE)
ly_set(PAL_TRAIT_TEST_PYTEST_SUPPORTED TRUE)
ly_set(PAL_TRAIT_TEST_TARGET_TYPE MODULE)

@ -83,7 +83,7 @@
"CMAKE_OPTIONS": "-G 'Ninja Multi-Config' -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 -DLY_PARALLEL_LINK_JOBS=4",
"CMAKE_LY_PROJECTS": "AutomatedTesting",
"CMAKE_TARGET": "all",
"CTEST_OPTIONS": "-E Gem::EMotionFX.Editor.Tests -LE (SUITE_sandbox|SUITE_awsi) -L FRAMEWORK_googletest --no-tests=error",
"CTEST_OPTIONS": "-E (AutomatedTesting::Atom_TestSuite_Main|AutomatedTesting::PhysicsTests_Main|AutomatedTesting::PrefabTests|AutomatedTesting::TerrainTests_Main|Gem::EMotionFX.Editor.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error",
"TEST_RESULTS": "True"
}
},
@ -96,7 +96,7 @@
"CMAKE_OPTIONS": "-G 'Ninja Multi-Config' -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 -DLY_UNITY_BUILD=FALSE -DLY_PARALLEL_LINK_JOBS=4",
"CMAKE_LY_PROJECTS": "AutomatedTesting",
"CMAKE_TARGET": "all",
"CTEST_OPTIONS": "-E Gem::EMotionFX.Editor.Tests -LE (SUITE_sandbox|SUITE_awsi) -L FRAMEWORK_googletest --no-tests=error",
"CTEST_OPTIONS": "-E (AutomatedTesting::Atom_TestSuite_Main|AutomatedTesting::PhysicsTests_Main|AutomatedTesting::PrefabTests|AutomatedTesting::TerrainTests_Main|Gem::EMotionFX.Editor.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error",
"TEST_RESULTS": "True"
}
},

Loading…
Cancel
Save