Merge remote-tracking branch 'upstream/development' into Atom/santorac/RemixableMaterialTypes4_FlatMaterialFiles

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
monroegm-disable-blank-issue-2
santorac 4 years ago
commit b05d4bdf36

@ -248,12 +248,14 @@ class AtomComponentProperties:
def grid(property: str = 'name') -> str:
"""
Grid component properties.
- 'Grid Size': The size of the grid, default value is 32
- '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',
'Grid Size': 'Controller|Configuration|Grid Size',
'Secondary Grid Spacing': 'Controller|Configuration|Secondary Grid Spacing',
}
return properties[property]
@ -384,11 +386,13 @@ class AtomComponentProperties:
def physical_sky(property: str = 'name') -> str:
"""
Physical Sky component properties.
- 'Sky Intensity' float that determines sky intensity value, default value is 4.
: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': 'Physical Sky',
'Sky Intensity': 'Controller|Configuration|Sky Intensity',
}
return properties[property]

@ -114,11 +114,11 @@ def get_property(document_id, property_name):
"""
:return: property value or invalid value if the document is not open or the property_name can't be found
"""
return azlmbr.atomtools.AtomToolsDocumentRequestBus(bus.Event, "GetPropertyValue", document_id, property_name)
return azlmbr.materialeditor.MaterialDocumentRequestBus(bus.Event, "GetPropertyValue", document_id, property_name)
def set_property(document_id, property_name, value):
azlmbr.atomtools.AtomToolsDocumentRequestBus(bus.Event, "SetPropertyValue", document_id, property_name, value)
azlmbr.materialeditor.MaterialDocumentRequestBus(bus.Event, "SetPropertyValue", document_id, property_name, value)
def is_pane_visible(pane_name):

@ -18,6 +18,9 @@ class Tests:
grid_component_added = (
"Entity has a Grid component",
"Entity failed to find Grid component")
grid_size = (
"Grid Size value set successfully",
"Grid Size value could not be set")
enter_game_mode = (
"Entered game mode",
"Failed to enter game mode")
@ -59,13 +62,14 @@ def AtomEditorComponents_Grid_AddedToEntity():
2) Add a Grid component to Grid 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 Grid entity.
9) UNDO deletion.
10) REDO deletion.
11) Look for errors.
5) Grid Size changed.
6) Enter/Exit game mode.
7) Test IsHidden.
8) Test IsVisible.
9) Delete Grid entity.
10) UNDO deletion.
11) REDO deletion.
12) Look for errors.
:return: None
"""
@ -119,35 +123,42 @@ def AtomEditorComponents_Grid_AddedToEntity():
general.idle_wait_frames(1)
Report.result(Tests.creation_redo, grid_entity.exists())
# 5. Enter/Exit game mode.
# 5. Grid Size changed
grid_component.set_component_property_value(
AtomComponentProperties.grid('Grid Size'), value=64)
current_grid_size = grid_component.get_component_property_value(
AtomComponentProperties.grid('Grid Size'))
Report.result(Tests.grid_size, current_grid_size == 64)
# 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)
# 6. Test IsHidden.
# 7. Test IsHidden.
grid_entity.set_visibility_state(False)
Report.result(Tests.is_hidden, grid_entity.is_hidden() is True)
# 7. Test IsVisible.
# 8. Test IsVisible.
grid_entity.set_visibility_state(True)
general.idle_wait_frames(1)
Report.result(Tests.is_visible, grid_entity.is_visible() is True)
# 8. Delete Grid entity.
# 9. Delete Grid entity.
grid_entity.delete()
Report.result(Tests.entity_deleted, not grid_entity.exists())
# 9. UNDO deletion.
# 10. UNDO deletion.
general.undo()
general.idle_wait_frames(1)
Report.result(Tests.deletion_undo, grid_entity.exists())
# 10. REDO deletion.
# 11. REDO deletion.
general.redo()
general.idle_wait_frames(1)
Report.result(Tests.deletion_redo, not grid_entity.exists())
# 11. Look for errors or asserts.
# 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}")

@ -68,13 +68,14 @@ def AtomEditorComponents_Light_AddedToEntity():
2) Add Light component to the Light 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 Light entity.
9) UNDO deletion.
10) REDO deletion.
11) Look for errors.
5) Cycle through all light types.
6) Enter/Exit game mode.
7) Test IsHidden.
8) Test IsVisible.
9) Delete Light entity.
10) UNDO deletion.
11) REDO deletion.
12) Look for errors.
:return: None
"""
@ -83,7 +84,7 @@ def AtomEditorComponents_Light_AddedToEntity():
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
from Atom.atom_utils.atom_constants import AtomComponentProperties, LIGHT_TYPES
with Tracer() as error_tracer:
# Test setup begins.
@ -124,35 +125,46 @@ def AtomEditorComponents_Light_AddedToEntity():
general.idle_wait_frames(1)
Report.result(Tests.creation_redo, light_entity.exists())
# 5. Enter/Exit game mode.
# 5. Cycle through all light types.
for light_type in LIGHT_TYPES.keys():
light_component.set_component_property_value(
AtomComponentProperties.light('Light type'), LIGHT_TYPES[light_type])
current_light_type = light_component.get_component_property_value(
AtomComponentProperties.light('Light type'))
test_light_type = (
f"Light component has {light_type} type set",
f"Light component failed to set {light_type} type")
Report.result(test_light_type, current_light_type == LIGHT_TYPES[light_type])
# 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)
# 6. Test IsHidden.
# 7. Test IsHidden.
light_entity.set_visibility_state(False)
Report.result(Tests.is_hidden, light_entity.is_hidden() is True)
# 7. Test IsVisible.
# 8. Test IsVisible.
light_entity.set_visibility_state(True)
general.idle_wait_frames(1)
Report.result(Tests.is_visible, light_entity.is_visible() is True)
# 8. Delete Light entity.
# 9. Delete Light entity.
light_entity.delete()
Report.result(Tests.entity_deleted, not light_entity.exists())
# 9. UNDO deletion.
# 10. UNDO deletion.
general.undo()
general.idle_wait_frames(1)
Report.result(Tests.deletion_undo, light_entity.exists())
# 10. REDO deletion.
# 11. REDO deletion.
general.redo()
general.idle_wait_frames(1)
Report.result(Tests.deletion_redo, not light_entity.exists())
# 11. Look for errors asserts.
# 12. Look for errors 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}")

@ -27,6 +27,9 @@ class Tests:
physical_sky_component = (
"Entity has a Physical Sky component",
"Entity failed to find Physical Sky component")
sky_intensity = (
"Sky Intensity value updated successfully",
"Sky Intensity value could not be set")
enter_game_mode = (
"Entered game mode",
"Failed to enter game mode")
@ -68,13 +71,14 @@ def AtomEditorComponents_PhysicalSky_AddedToEntity():
2) Add Physical Sky component to Physical Sky 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 Physical Sky entity.
9) UNDO deletion.
10) REDO deletion.
11) Look for errors and asserts.
5) Update Sky Intensity value.
6) Enter/Exit game mode.
7) Test IsHidden.
8) Test IsVisible.
9) Delete Physical Sky entity.
10) UNDO deletion.
11) REDO deletion.
12) Look for errors and asserts.
:return: None
"""
@ -126,35 +130,42 @@ def AtomEditorComponents_PhysicalSky_AddedToEntity():
general.idle_wait_frames(1)
Report.result(Tests.creation_redo, physical_sky_entity.exists())
# 5. Enter/Exit game mode.
# 5. Set Sky Intensity value
physical_sky_component.set_component_property_value(
AtomComponentProperties.physical_sky('Sky Intensity'), value=2)
current_sky_intensity = physical_sky_component.get_component_property_value(
AtomComponentProperties.physical_sky('Sky Intensity'))
Report.result(Tests.sky_intensity, current_sky_intensity == 2)
# 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)
# 6. Test IsHidden.
# 7. Test IsHidden.
physical_sky_entity.set_visibility_state(False)
Report.result(Tests.is_hidden, physical_sky_entity.is_hidden() is True)
# 7. Test IsVisible.
# 8. Test IsVisible.
physical_sky_entity.set_visibility_state(True)
general.idle_wait_frames(1)
Report.result(Tests.is_visible, physical_sky_entity.is_visible() is True)
# 8. Delete Physical Sky entity.
# 9. Delete Physical Sky entity.
physical_sky_entity.delete()
Report.result(Tests.entity_deleted, not physical_sky_entity.exists())
# 9. UNDO deletion.
# 10. UNDO deletion.
general.undo()
general.idle_wait_frames(1)
Report.result(Tests.deletion_undo, physical_sky_entity.exists())
# 10. REDO deletion.
# 11. REDO deletion.
general.redo()
general.idle_wait_frames(1)
Report.result(Tests.deletion_redo, not physical_sky_entity.exists())
# 11. Look for errors and asserts.
# 12. 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}")

@ -165,10 +165,6 @@ set(FILES
Logging/MissingAssetLogger.cpp
Logging/MissingAssetLogger.h
Logging/MissingAssetNotificationBus.h
Matchmaking/IMatchmakingRequests.h
Matchmaking/MatchmakingRequests.cpp
Matchmaking/MatchmakingRequests.h
Matchmaking/MatchmakingNotifications.h
Scene/Scene.h
Scene/Scene.inl
Scene/Scene.cpp
@ -182,13 +178,6 @@ set(FILES
Script/ScriptDebugMsgReflection.h
Script/ScriptRemoteDebugging.cpp
Script/ScriptRemoteDebugging.h
Session/ISessionHandlingRequests.h
Session/ISessionRequests.h
Session/SessionRequests.cpp
Session/SessionRequests.h
Session/SessionConfig.cpp
Session/SessionConfig.h
Session/SessionNotifications.h
StreamingInstall/StreamingInstall.h
StreamingInstall/StreamingInstall.cpp
StreamingInstall/StreamingInstallRequests.h

@ -19,45 +19,69 @@
namespace AzToolsFramework
{
namespace Prefab
{
//! A RootAliasPath can be used to store an alias path that starts from the Prefab EOS root instance.
//! The root instance itself is included in the path. These can be used as Instance handles across systems
//! that do not have visibility over InstanceOptionalReferences, or that need to store Instance handles
//! for longer than just the span of a function without the risk of them going out of scope.
using RootAliasPath = AliasPath;
}
class PrefabEditorEntityOwnershipInterface
{
public:
AZ_RTTI(PrefabEditorEntityOwnershipInterface,"{38E764BA-A089-49F3-848F-46018822CE2E}");
AZ_RTTI(PrefabEditorEntityOwnershipInterface, "{38E764BA-A089-49F3-848F-46018822CE2E}");
//! Returns whether the system has a root instance assigned.
//! @return True if a root prefab is assigned, false otherwise.
virtual bool IsRootPrefabAssigned() const = 0;
//! Returns an optional reference to the root prefab instance.
virtual Prefab::InstanceOptionalReference GetRootPrefabInstance() = 0;
//! Returns the template id for the root prefab instance.
virtual Prefab::TemplateId GetRootPrefabTemplateId() = 0;
virtual void CreateNewLevelPrefab(AZStd::string_view filename, const AZStd::string& templateFilename) = 0;
//! Creates a prefab instance with the provided entities and nestedPrefabInstances.
//! /param entities The entities to put under the new prefab.
//! /param nestedPrefabInstances The nested prefab instances to put under the new prefab.
//! /param filePath The filepath corresponding to the prefab file to be created.
//! /param instanceToParentUnder The instance the newly created prefab instance is parented under.
//! /return The optional reference to the prefab created.
//! @param entities The entities to put under the new prefab.
//! @param nestedPrefabInstances The nested prefab instances to put under the new prefab.
//! @param filePath The filepath corresponding to the prefab file to be created.
//! @param instanceToParentUnder The instance the newly created prefab instance is parented under.
//! @return The optional reference to the prefab created.
virtual Prefab::InstanceOptionalReference CreatePrefab(
const AZStd::vector<AZ::Entity*>& entities, AZStd::vector<AZStd::unique_ptr<Prefab::Instance>>&& nestedPrefabInstances,
AZ::IO::PathView filePath, Prefab::InstanceOptionalReference instanceToParentUnder = AZStd::nullopt) = 0;
//! Instantiate the prefab file provided.
//! /param filePath The filepath for the prefab file the instance should be created from.
//! /param instanceToParentUnder The instance the newly instantiated prefab instance is parented under.
//! /return The optional reference to the prefab instance.
//! @param filePath The filepath for the prefab file the instance should be created from.
//! @param instanceToParentUnder The instance the newly instantiated prefab instance is parented under.
//! @return The optional reference to the prefab instance.
virtual Prefab::InstanceOptionalReference InstantiatePrefab(
AZ::IO::PathView filePath, Prefab::InstanceOptionalReference instanceToParentUnder = AZStd::nullopt) = 0;
virtual Prefab::InstanceOptionalReference GetRootPrefabInstance() = 0;
virtual Prefab::TemplateId GetRootPrefabTemplateId() = 0;
virtual void StartPlayInEditor() = 0;
virtual void StopPlayInEditor() = 0;
//! Get all Assets generated by Prefab processing when entering Play-In Editor mode (Ctrl+G)
//! /return The vector of Assets generated by Prefab processing
//! @return The vector of Assets generated by Prefab processing
virtual const Prefab::PrefabConversionUtils::InMemorySpawnableAssetContainer::SpawnableAssets& GetPlayInEditorAssetData() const = 0;
virtual bool LoadFromStream(AZ::IO::GenericStream& stream, AZStd::string_view filename) = 0;
virtual bool SaveToStream(AZ::IO::GenericStream& stream, AZStd::string_view filename) = 0;
virtual void StartPlayInEditor() = 0;
virtual void StopPlayInEditor() = 0;
virtual void CreateNewLevelPrefab(AZStd::string_view filename, const AZStd::string& templateFilename) = 0;
//! Returns the reference to the instance corresponding to the RootAliasPath provided.
//! @param rootAliasPath The RootAliasPath to be queried.
//! @return A reference to the instance if valid, AZStd::nullopt otherwise.
virtual Prefab::InstanceOptionalReference GetInstanceReferenceFromRootAliasPath(Prefab::RootAliasPath rootAliasPath) const = 0;
virtual bool IsRootPrefabAssigned() const = 0;
//! Allows to iterate through all instances referenced in the path, from the root down.
//! @param rootAliasPath The RootAliasPath to iterate through. If invalid, callback will not be called.
//! @param callback The function to call on each instance. If it returns true, it prevents the rest of the path from being called.
//! @return True if the iteration was halted by a callback returning true, false otherwise. Also returns false if the path is invalid.
virtual bool GetInstancesInRootAliasPath(
Prefab::RootAliasPath rootAliasPath, const AZStd::function<bool(const Prefab::InstanceOptionalReference)>& callback) const = 0;
};
}

@ -510,6 +510,70 @@ namespace AzToolsFramework
m_playInEditorData.m_isEnabled = false;
}
bool PrefabEditorEntityOwnershipService::IsValidRootAliasPath(Prefab::RootAliasPath rootAliasPath) const
{
return GetInstanceReferenceFromRootAliasPath(rootAliasPath) != AZStd::nullopt;
}
Prefab::InstanceOptionalReference PrefabEditorEntityOwnershipService::GetInstanceReferenceFromRootAliasPath(
Prefab::RootAliasPath rootAliasPath) const
{
Prefab::InstanceOptionalReference instance = *m_rootInstance;
for (const auto& pathElement : rootAliasPath)
{
if (pathElement.Native() == rootAliasPath.begin()->Native())
{
// If the root is not the root Instance, the rootAliasPath is invalid.
if (pathElement.Native() != instance->get().GetInstanceAlias())
{
return Prefab::InstanceOptionalReference();
}
}
else
{
// If the instance alias can't be found, the rootAliasPath is invalid.
instance = instance->get().FindNestedInstance(pathElement.Native());
if (!instance.has_value())
{
return Prefab::InstanceOptionalReference();
}
}
}
return instance;
}
bool PrefabEditorEntityOwnershipService::GetInstancesInRootAliasPath(
Prefab::RootAliasPath rootAliasPath, const AZStd::function<bool(const Prefab::InstanceOptionalReference)>& callback) const
{
if (!IsValidRootAliasPath(rootAliasPath))
{
return false;
}
Prefab::InstanceOptionalReference instance;
for (const auto& pathElement : rootAliasPath)
{
if (!instance.has_value())
{
instance = *m_rootInstance;
}
else
{
instance = instance->get().FindNestedInstance(pathElement.Native());
}
if(callback(instance))
{
return true;
}
}
return false;
}
//////////////////////////////////////////////////////////////////////////
// Slice Buses implementation with Assert(false), this will exist only during Slice->Prefab
// development to pinpoint and replace specific calls to Slice system

@ -169,11 +169,17 @@ namespace AzToolsFramework
void CreateNewLevelPrefab(AZStd::string_view filename, const AZStd::string& templateFilename) override;
bool IsRootPrefabAssigned() const override;
Prefab::InstanceOptionalReference GetInstanceReferenceFromRootAliasPath(Prefab::RootAliasPath rootAliasPath) const override;
bool GetInstancesInRootAliasPath(
Prefab::RootAliasPath rootAliasPath, const AZStd::function<bool(const Prefab::InstanceOptionalReference)>& callback) const override;
protected:
AZ::SliceComponent::SliceInstanceAddress GetOwningSlice() override;
private:
bool IsValidRootAliasPath(Prefab::RootAliasPath rootAliasPath) const;
struct PlayInEditorData
{
AzToolsFramework::Prefab::PrefabConversionUtils::InMemorySpawnableAssetContainer m_assetsCache;

@ -37,7 +37,6 @@ namespace AzToolsFramework
using AliasPath = AZ::IO::Path;
using AliasPathView = AZ::IO::PathView;
using RootAliasPath = AliasPath;
using EntityAlias = AZStd::string;
using EntityAliasView = AZStd::string_view;
using InstanceAlias = AZStd::string;

@ -11,7 +11,6 @@
#include <AzToolsFramework/Commands/SelectionCommand.h>
#include <AzToolsFramework/ContainerEntity/ContainerEntityInterface.h>
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h>
#include <AzToolsFramework/Entity/ReadOnly/ReadOnlyEntityInterface.h>
#include <AzToolsFramework/Prefab/Instance/Instance.h>
#include <AzToolsFramework/Prefab/Instance/InstanceEntityMapperInterface.h>
@ -112,15 +111,24 @@ namespace AzToolsFramework::Prefab
[[maybe_unused]] AzFramework::EntityContextId entityContextId)
{
// If only one instance is in the hierarchy, this operation is invalid
size_t hierarchySize = m_instanceFocusHierarchy.size();
if (hierarchySize <= 1)
if (m_rootAliasFocusPathLength <= 1)
{
return AZ::Failure(
AZStd::string("Prefab Focus Handler: Could not complete FocusOnParentOfFocusedPrefab operation while focusing on the root."));
return AZ::Failure(AZStd::string(
"Prefab Focus Handler: Could not complete FocusOnParentOfFocusedPrefab operation while focusing on the root."));
}
RootAliasPath parentPath = m_rootAliasFocusPath;
parentPath.RemoveFilename();
// Retrieve parent of currently focused prefab.
InstanceOptionalReference parentInstance = GetInstanceReferenceFromRootAliasPath(m_instanceFocusHierarchy[hierarchySize - 2]);
InstanceOptionalReference parentInstance = GetInstanceReference(parentPath);
// If only one instance is in the hierarchy, this operation is invalid
if (!parentInstance.has_value())
{
return AZ::Failure(AZStd::string(
"Prefab Focus Handler: Could not retrieve parent of current focus in FocusOnParentOfFocusedPrefab."));
}
// Use container entity of parent Instance for focus operations.
AZ::EntityId entityId = parentInstance->get().GetContainerEntityId();
@ -149,12 +157,26 @@ namespace AzToolsFramework::Prefab
PrefabFocusOperationResult PrefabFocusHandler::FocusOnPathIndex([[maybe_unused]] AzFramework::EntityContextId entityContextId, int index)
{
if (index < 0 || index >= m_instanceFocusHierarchy.size())
if (index < 0 || index >= m_rootAliasFocusPathLength)
{
return AZ::Failure(AZStd::string("Prefab Focus Handler: Invalid index on FocusOnPathIndex."));
}
InstanceOptionalReference focusedInstance = GetInstanceReferenceFromRootAliasPath(m_instanceFocusHierarchy[index]);
int i = 0;
RootAliasPath indexedPath;
for (const auto& pathElement : m_rootAliasFocusPath)
{
indexedPath.Append(pathElement);
if (i == index)
{
break;
}
++i;
}
InstanceOptionalReference focusedInstance = GetInstanceReference(indexedPath);
if (!focusedInstance.has_value())
{
@ -197,13 +219,14 @@ namespace AzToolsFramework::Prefab
}
// Close all container entities in the old path.
SetInstanceContainersOpenState(m_instanceFocusHierarchy, false);
SetInstanceContainersOpenState(m_rootAliasFocusPath, false);
const RootAliasPath previousContainerRootAliasPath = m_focusedInstanceRootAliasPath;
const InstanceOptionalConstReference previousFocusedInstance = GetInstanceReferenceFromRootAliasPath(previousContainerRootAliasPath);
const RootAliasPath previousContainerRootAliasPath = m_rootAliasFocusPath;
const InstanceOptionalConstReference previousFocusedInstance = GetInstanceReference(previousContainerRootAliasPath);
m_focusedInstanceRootAliasPath = focusedInstance->get().GetAbsoluteInstanceAliasPath();
m_rootAliasFocusPath = focusedInstance->get().GetAbsoluteInstanceAliasPath();
m_focusedTemplateId = focusedInstance->get().GetTemplateId();
m_rootAliasFocusPathLength = aznumeric_cast<int>(AZStd::distance(m_rootAliasFocusPath.begin(), m_rootAliasFocusPath.end()));
// Focus on the descendants of the container entity in the Editor, if the interface is initialized.
if (m_focusModeInterface)
@ -231,11 +254,10 @@ namespace AzToolsFramework::Prefab
}
// Refresh path variables.
RefreshInstanceFocusList();
RefreshInstanceFocusPath();
// Open all container entities in the new path.
SetInstanceContainersOpenState(m_instanceFocusHierarchy, true);
SetInstanceContainersOpenState(m_rootAliasFocusPath, true);
PrefabFocusNotificationBus::Broadcast(&PrefabFocusNotifications::OnPrefabFocusChanged);
@ -250,12 +272,12 @@ namespace AzToolsFramework::Prefab
InstanceOptionalReference PrefabFocusHandler::GetFocusedPrefabInstance(
[[maybe_unused]] AzFramework::EntityContextId entityContextId) const
{
return GetInstanceReferenceFromRootAliasPath(m_focusedInstanceRootAliasPath);
return GetInstanceReference(m_rootAliasFocusPath);
}
AZ::EntityId PrefabFocusHandler::GetFocusedPrefabContainerEntityId([[maybe_unused]] AzFramework::EntityContextId entityContextId) const
{
if (const InstanceOptionalConstReference instance = GetInstanceReferenceFromRootAliasPath(m_focusedInstanceRootAliasPath); instance.has_value())
if (const InstanceOptionalConstReference instance = GetInstanceReference(m_rootAliasFocusPath); instance.has_value())
{
return instance->get().GetContainerEntityId();
}
@ -276,7 +298,7 @@ namespace AzToolsFramework::Prefab
return false;
}
return (instance->get().GetAbsoluteInstanceAliasPath() == m_focusedInstanceRootAliasPath);
return (instance->get().GetAbsoluteInstanceAliasPath() == m_rootAliasFocusPath);
}
bool PrefabFocusHandler::IsOwningPrefabInFocusHierarchy(AZ::EntityId entityId) const
@ -289,7 +311,7 @@ namespace AzToolsFramework::Prefab
InstanceOptionalConstReference instance = m_instanceEntityMapperInterface->FindOwningInstance(entityId);
while (instance.has_value())
{
if (instance->get().GetAbsoluteInstanceAliasPath() == m_focusedInstanceRootAliasPath)
if (instance->get().GetAbsoluteInstanceAliasPath() == m_rootAliasFocusPath)
{
return true;
}
@ -302,40 +324,47 @@ namespace AzToolsFramework::Prefab
const AZ::IO::Path& PrefabFocusHandler::GetPrefabFocusPath([[maybe_unused]] AzFramework::EntityContextId entityContextId) const
{
return m_instanceFocusPath;
return m_filenameFocusPath;
}
const int PrefabFocusHandler::GetPrefabFocusPathLength([[maybe_unused]] AzFramework::EntityContextId entityContextId) const
{
return aznumeric_cast<int>(m_instanceFocusHierarchy.size());
return m_rootAliasFocusPathLength;
}
void PrefabFocusHandler::OnContextReset()
{
// Clear the old focus vector
m_instanceFocusHierarchy.clear();
// Focus on the root prefab (AZ::EntityId() will default to it)
FocusOnPrefabInstanceOwningEntityId(AZ::EntityId());
}
void PrefabFocusHandler::OnEntityInfoUpdatedName(AZ::EntityId entityId, [[maybe_unused]]const AZStd::string& name)
{
// Determine if the entityId is the container for any of the instances in the vector.
auto result = AZStd::find_if(
m_instanceFocusHierarchy.begin(), m_instanceFocusHierarchy.end(),
[&, entityId](const RootAliasPath& rootAliasPath)
{
InstanceOptionalReference instance = GetInstanceReferenceFromRootAliasPath(rootAliasPath);
return (instance->get().GetContainerEntityId() == entityId);
}
);
PrefabEditorEntityOwnershipInterface* prefabEditorEntityOwnershipInterface =
AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
if (result != m_instanceFocusHierarchy.end())
if (prefabEditorEntityOwnershipInterface)
{
// Refresh the path and notify changes.
RefreshInstanceFocusPath();
PrefabFocusNotificationBus::Broadcast(&PrefabFocusNotifications::OnPrefabFocusChanged);
// Determine if the entityId is the container for any of the instances in the vector.
bool match = prefabEditorEntityOwnershipInterface->GetInstancesInRootAliasPath(
m_rootAliasFocusPath,
[&](const Prefab::InstanceOptionalReference instance)
{
if (instance->get().GetContainerEntityId() == entityId)
{
return true;
}
return false;
}
);
if (match)
{
// Refresh the path and notify changes.
RefreshInstanceFocusPath();
PrefabFocusNotificationBus::Broadcast(&PrefabFocusNotifications::OnPrefabFocusChanged);
}
}
}
@ -348,79 +377,81 @@ namespace AzToolsFramework::Prefab
void PrefabFocusHandler::OnPrefabTemplateDirtyFlagUpdated(TemplateId templateId, [[maybe_unused]] bool status)
{
// Determine if the templateId matches any of the instances in the vector.
auto result = AZStd::find_if(
m_instanceFocusHierarchy.begin(), m_instanceFocusHierarchy.end(),
[&, templateId](const RootAliasPath& rootAliasPath)
{
InstanceOptionalReference instance = GetInstanceReferenceFromRootAliasPath(rootAliasPath);
return (instance->get().GetTemplateId() == templateId);
}
);
PrefabEditorEntityOwnershipInterface* prefabEditorEntityOwnershipInterface =
AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
if (result != m_instanceFocusHierarchy.end())
if (prefabEditorEntityOwnershipInterface)
{
// Refresh the path and notify changes.
RefreshInstanceFocusPath();
PrefabFocusNotificationBus::Broadcast(&PrefabFocusNotifications::OnPrefabFocusChanged);
}
}
// Determine if the templateId matches any of the instances in the vector.
bool match = prefabEditorEntityOwnershipInterface->GetInstancesInRootAliasPath(
m_rootAliasFocusPath,
[&](const Prefab::InstanceOptionalReference instance)
{
if (instance->get().GetTemplateId() == templateId)
{
return true;
}
void PrefabFocusHandler::RefreshInstanceFocusList()
{
m_instanceFocusHierarchy.clear();
return false;
}
);
InstanceOptionalConstReference currentInstance = GetInstanceReferenceFromRootAliasPath(m_focusedInstanceRootAliasPath);
while (currentInstance.has_value())
{
m_instanceFocusHierarchy.emplace_back(currentInstance->get().GetAbsoluteInstanceAliasPath());
currentInstance = currentInstance->get().GetParentInstance();
if (match)
{
// Refresh the path and notify changes.
RefreshInstanceFocusPath();
PrefabFocusNotificationBus::Broadcast(&PrefabFocusNotifications::OnPrefabFocusChanged);
}
}
// Invert the vector, since we need the top instance to be at index 0.
AZStd::reverse(m_instanceFocusHierarchy.begin(), m_instanceFocusHierarchy.end());
}
void PrefabFocusHandler::RefreshInstanceFocusPath()
{
auto prefabSystemComponentInterface = AZ::Interface<PrefabSystemComponentInterface>::Get();
m_instanceFocusPath.clear();
m_filenameFocusPath.clear();
size_t index = 0;
size_t maxIndex = m_instanceFocusHierarchy.size() - 1;
PrefabEditorEntityOwnershipInterface* prefabEditorEntityOwnershipInterface =
AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
PrefabSystemComponentInterface* prefabSystemComponentInterface = AZ::Interface<PrefabSystemComponentInterface>::Get();
for (const RootAliasPath& rootAliasPath : m_instanceFocusHierarchy)
if (prefabEditorEntityOwnershipInterface && prefabSystemComponentInterface)
{
const InstanceOptionalConstReference instance = GetInstanceReferenceFromRootAliasPath(rootAliasPath);
if (instance.has_value())
{
AZStd::string prefabName;
int i = 0;
if (index < maxIndex)
{
// Get the filename without the extension (stem).
prefabName = instance->get().GetTemplateSourcePath().Stem().Native();
}
else
prefabEditorEntityOwnershipInterface->GetInstancesInRootAliasPath(
m_rootAliasFocusPath,
[&](const Prefab::InstanceOptionalReference instance)
{
// Get the full filename.
prefabName = instance->get().GetTemplateSourcePath().Filename().Native();
}
if (instance.has_value())
{
AZStd::string prefabName;
if (i == m_rootAliasFocusPathLength - 1)
{
// Get the full filename.
prefabName = instance->get().GetTemplateSourcePath().Filename().Native();
}
else
{
// Get the filename without the extension (stem).
prefabName = instance->get().GetTemplateSourcePath().Stem().Native();
}
if (prefabSystemComponentInterface->IsTemplateDirty(instance->get().GetTemplateId()))
{
prefabName += "*";
}
m_filenameFocusPath.Append(prefabName);
}
if (prefabSystemComponentInterface->IsTemplateDirty(instance->get().GetTemplateId()))
{
prefabName += "*";
++i;
return false;
}
m_instanceFocusPath.Append(prefabName);
}
++index;
);
}
}
void PrefabFocusHandler::SetInstanceContainersOpenState(const AZStd::vector<RootAliasPath>& instances, bool openState) const
void PrefabFocusHandler::SetInstanceContainersOpenState(const RootAliasPath& rootAliasPath, bool openState) const
{
// If this is called outside the Editor, this interface won't be initialized.
if (!m_containerEntityInterface)
@ -428,51 +459,34 @@ namespace AzToolsFramework::Prefab
return;
}
for (const RootAliasPath& rootAliasPath : instances)
PrefabEditorEntityOwnershipInterface* prefabEditorEntityOwnershipInterface =
AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
if (prefabEditorEntityOwnershipInterface)
{
InstanceOptionalReference instance = GetInstanceReferenceFromRootAliasPath(rootAliasPath);
prefabEditorEntityOwnershipInterface->GetInstancesInRootAliasPath(
rootAliasPath,
[&](const Prefab::InstanceOptionalReference instance)
{
m_containerEntityInterface->SetContainerOpen(instance->get().GetContainerEntityId(), openState);
if (instance.has_value())
{
m_containerEntityInterface->SetContainerOpen(instance->get().GetContainerEntityId(), openState);
}
return false;
}
);
}
}
InstanceOptionalReference PrefabFocusHandler::GetInstanceReferenceFromRootAliasPath(RootAliasPath rootAliasPath) const
InstanceOptionalReference PrefabFocusHandler::GetInstanceReference(RootAliasPath rootAliasPath) const
{
PrefabEditorEntityOwnershipInterface* prefabEditorEntityOwnershipInterface =
AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
if (prefabEditorEntityOwnershipInterface)
{
InstanceOptionalReference instance = prefabEditorEntityOwnershipInterface->GetRootPrefabInstance();
for (const auto& pathElement : rootAliasPath)
{
if (pathElement.Native() == rootAliasPath.begin()->Native())
{
// If the root is not the root Instance, the rootAliasPath is invalid.
if (pathElement.Native() != instance->get().GetInstanceAlias())
{
return InstanceOptionalReference();
}
}
else
{
// If the instance alias can't be found, the rootAliasPath is invalid.
instance = instance->get().FindNestedInstance(pathElement.Native());
if (!instance.has_value())
{
return InstanceOptionalReference();
}
}
}
return instance;
return prefabEditorEntityOwnershipInterface->GetInstanceReferenceFromRootAliasPath(rootAliasPath);
}
return InstanceOptionalReference();
return AZStd::nullopt;
}
} // namespace AzToolsFramework::Prefab

@ -12,6 +12,7 @@
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
#include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h>
#include <AzToolsFramework/FocusMode/FocusModeInterface.h>
#include <AzToolsFramework/Prefab/PrefabFocusInterface.h>
#include <AzToolsFramework/Prefab/PrefabFocusPublicInterface.h>
@ -28,6 +29,7 @@ namespace AzToolsFramework
namespace AzToolsFramework::Prefab
{
class InstanceEntityMapperInterface;
class PrefabSystemComponentInterface;
//! Handles Prefab Focus mode, determining which prefab file entity changes will target.
class PrefabFocusHandler final
@ -73,22 +75,20 @@ namespace AzToolsFramework::Prefab
private:
PrefabFocusOperationResult FocusOnPrefabInstance(InstanceOptionalReference focusedInstance);
void RefreshInstanceFocusList();
void RefreshInstanceFocusPath();
void SetInstanceContainersOpenState(const AZStd::vector<RootAliasPath>& instances, bool openState) const;
void SetInstanceContainersOpenState(const RootAliasPath& rootAliasPath, bool openState) const;
InstanceOptionalReference GetInstanceReferenceFromRootAliasPath(RootAliasPath rootAliasPath) const;
InstanceOptionalReference GetInstanceReference(RootAliasPath rootAliasPath) const;
//! The alias path for the instance the editor is currently focusing on, starting from the root instance.
RootAliasPath m_focusedInstanceRootAliasPath = RootAliasPath();
RootAliasPath m_rootAliasFocusPath = RootAliasPath();
//! The templateId of the focused instance.
TemplateId m_focusedTemplateId;
//! The list of instances going from the root (index 0) to the focused instance,
//! referenced by their alias path from the root instance.
AZStd::vector<RootAliasPath> m_instanceFocusHierarchy;
//! A path containing the filenames of the instances in the focus hierarchy, separated with a /.
AZ::IO::Path m_instanceFocusPath;
AZ::IO::Path m_filenameFocusPath;
//! The length of the current focus path. Stored to simplify internal checks.
int m_rootAliasFocusPathLength = 0;
ContainerEntityInterface* m_containerEntityInterface = nullptr;
FocusModeInterface* m_focusModeInterface = nullptr;

@ -815,7 +815,8 @@ namespace AzToolsFramework
if (templateRef.has_value())
{
return templateRef->get().IsDirty();
return !templateRef->get().IsProcedural() && // all procedural prefabs are read-only
templateRef->get().IsDirty();
}
return false;

@ -108,7 +108,7 @@ namespace LUAEditor
m_settingsDialog = aznew LUAEditorSettingsDialog(this);
actionTabForwards = new QAction(tr("Next Document Tab"), this);
actionTabBackwards = new QAction(tr("Prev Document Tab"), this);
actionTabBackwards = new QAction(tr("Previous Document Tab"), this);
actionTabForwards->setShortcut(QKeySequence("Ctrl+Tab"));
connect(actionTabForwards, SIGNAL(triggered(bool)), this, SLOT(OnTabForwards()));

@ -29,6 +29,7 @@ namespace AZ
if (behaviorContext)
{
behaviorContext->Class<SceneAPI::DataTypes::IAnimationData>()
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::ListOnly)
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "scene")
->Method("GetKeyFrameCount", &SceneAPI::DataTypes::IAnimationData::GetKeyFrameCount)
@ -97,6 +98,7 @@ namespace AZ
if (behaviorContext)
{
behaviorContext->Class<SceneAPI::DataTypes::IBlendShapeAnimationData>()
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::ListOnly)
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "scene")
->Method("GetBlendShapeName", &SceneAPI::DataTypes::IBlendShapeAnimationData::GetBlendShapeName)

@ -37,6 +37,7 @@ namespace AZ
if (behaviorContext)
{
behaviorContext->Class<SceneAPI::DataTypes::IBlendShapeData>()
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::ListOnly)
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "scene")
->Method("GetUsedControlPointCount", &SceneAPI::DataTypes::IBlendShapeData::GetUsedControlPointCount)

@ -47,6 +47,7 @@ namespace AZ
if (behaviorContext)
{
behaviorContext->Class<SceneAPI::DataTypes::IBoneData>()
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::ListOnly)
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "scene");
behaviorContext->Class<AZ::SceneData::GraphData::BoneData>()

@ -304,6 +304,7 @@ namespace AZ
if (behaviorContext)
{
behaviorContext->Class<SceneAPI::DataTypes::IMaterialData>()
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::ListOnly)
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "scene");

@ -33,6 +33,7 @@ namespace AZ
if (behaviorContext)
{
behaviorContext->Class<SceneAPI::DataTypes::IMeshData>()
->Attribute(Script::Attributes::ExcludeFrom, Script::Attributes::ExcludeFlags::ListOnly)
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "scene")
->Method("GetUnitSizeInMeters", &MeshData::GetUnitSizeInMeters)

@ -24,8 +24,8 @@ ly_add_target(
BUILD_DEPENDENCIES
PRIVATE
AZ::AzCore
AZ::AzFramework
Gem::AWSCore
Gem::Multiplayer.Static
3rdParty::AWSNativeSDK::GameLiftClient
)
@ -85,10 +85,10 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
BUILD_DEPENDENCIES
PRIVATE
AZ::AzCore
AZ::AzFramework
AZ::AzTest
Gem::AWSCore
Gem::AWSGameLift.Client.Static
Gem::Multiplayer.Static
3rdParty::AWSNativeSDK::GameLiftClient
AZ::AWSNativeSDKTestLibs
)

@ -8,7 +8,7 @@
#pragma once
#include <AzFramework/Matchmaking/MatchmakingRequests.h>
#include <Multiplayer/Session/MatchmakingRequests.h>
namespace AWSGameLift
{
@ -17,10 +17,10 @@ namespace AWSGameLift
//! Registers a player's acceptance or rejection of a proposed FlexMatch match.
//! AcceptMatchRequest
struct AWSGameLiftAcceptMatchRequest
: public AzFramework::AcceptMatchRequest
: public Multiplayer::AcceptMatchRequest
{
public:
AZ_RTTI(AWSGameLiftAcceptMatchRequest, "{8372B297-88E8-4C13-B31D-BE87236CA416}", AzFramework::AcceptMatchRequest);
AZ_RTTI(AWSGameLiftAcceptMatchRequest, "{8372B297-88E8-4C13-B31D-BE87236CA416}", Multiplayer::AcceptMatchRequest);
static void Reflect(AZ::ReflectContext* context);
AWSGameLiftAcceptMatchRequest() = default;

@ -8,7 +8,7 @@
#pragma once
#include <AzFramework/Session/SessionRequests.h>
#include <Multiplayer/Session/SessionRequests.h>
namespace AWSGameLift
{
@ -16,10 +16,10 @@ namespace AWSGameLift
//! GameLift create session on queue request which corresponds to Amazon GameLift
//! StartGameSessionPlacement
struct AWSGameLiftCreateSessionOnQueueRequest
: public AzFramework::CreateSessionRequest
: public Multiplayer::CreateSessionRequest
{
public:
AZ_RTTI(AWSGameLiftCreateSessionOnQueueRequest, "{2B99E594-CE81-4EB0-8888-74EF4242B59F}", AzFramework::CreateSessionRequest);
AZ_RTTI(AWSGameLiftCreateSessionOnQueueRequest, "{2B99E594-CE81-4EB0-8888-74EF4242B59F}", Multiplayer::CreateSessionRequest);
static void Reflect(AZ::ReflectContext* context);
AWSGameLiftCreateSessionOnQueueRequest() = default;

@ -8,7 +8,7 @@
#pragma once
#include <AzFramework/Session/SessionRequests.h>
#include <Multiplayer/Session/SessionRequests.h>
namespace AWSGameLift
{
@ -16,10 +16,10 @@ namespace AWSGameLift
//! GameLift create session on fleet request which corresponds to Amazon GameLift
//! CreateGameSessionRequest
struct AWSGameLiftCreateSessionRequest
: public AzFramework::CreateSessionRequest
: public Multiplayer::CreateSessionRequest
{
public:
AZ_RTTI(AWSGameLiftCreateSessionRequest, "{69612D5D-F899-4DEB-AD63-4C497ABC5C0D}", AzFramework::CreateSessionRequest);
AZ_RTTI(AWSGameLiftCreateSessionRequest, "{69612D5D-F899-4DEB-AD63-4C497ABC5C0D}", Multiplayer::CreateSessionRequest);
static void Reflect(AZ::ReflectContext* context);
AWSGameLiftCreateSessionRequest() = default;

@ -8,7 +8,7 @@
#pragma once
#include <AzFramework/Session/SessionRequests.h>
#include <Multiplayer/Session/SessionRequests.h>
namespace AWSGameLift
{
@ -17,10 +17,10 @@ namespace AWSGameLift
//! Once player session has been created successfully in game session, gamelift client manager will
//! signal Multiplayer Gem to setup networking connection.
struct AWSGameLiftJoinSessionRequest
: public AzFramework::JoinSessionRequest
: public Multiplayer::JoinSessionRequest
{
public:
AZ_RTTI(AWSGameLiftJoinSessionRequest, "{6EED6D15-531A-4956-90D0-2EDA31AC9CBA}", AzFramework::JoinSessionRequest);
AZ_RTTI(AWSGameLiftJoinSessionRequest, "{6EED6D15-531A-4956-90D0-2EDA31AC9CBA}", Multiplayer::JoinSessionRequest);
static void Reflect(AZ::ReflectContext* context);
AWSGameLiftJoinSessionRequest() = default;

@ -10,7 +10,7 @@
#include <AzCore/EBus/EBus.h>
#include <AzCore/std/string/string.h>
#include <AzFramework/Matchmaking/IMatchmakingRequests.h>
#include <Multiplayer/Session/IMatchmakingRequests.h>
namespace AWSGameLift
{
@ -23,7 +23,7 @@ namespace AWSGameLift
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
};
using AWSGameLiftMatchmakingAsyncRequestBus = AZ::EBus<AzFramework::IMatchmakingAsyncRequests, AWSGameLiftMatchmakingAsyncRequests>;
using AWSGameLiftMatchmakingAsyncRequestBus = AZ::EBus<Multiplayer::IMatchmakingAsyncRequests, AWSGameLiftMatchmakingAsyncRequests>;
// IMatchmakingRequests EBus wrapper
class AWSGameLiftMatchmakingRequests
@ -34,7 +34,7 @@ namespace AWSGameLift
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
};
using AWSGameLiftMatchmakingRequestBus = AZ::EBus<AzFramework::IMatchmakingRequests, AWSGameLiftMatchmakingRequests>;
using AWSGameLiftMatchmakingRequestBus = AZ::EBus<Multiplayer::IMatchmakingRequests, AWSGameLiftMatchmakingRequests>;
//! IAWSGameLiftMatchmakingEventRequests
//! GameLift Gem matchmaking event interfaces which is used to track matchmaking ticket event

@ -8,7 +8,7 @@
#pragma once
#include <AzFramework/Session/SessionRequests.h>
#include <Multiplayer/Session/SessionRequests.h>
namespace AWSGameLift
{
@ -16,10 +16,10 @@ namespace AWSGameLift
//! GameLift search sessions request which corresponds to Amazon GameLift
//! SearchSessionsRequest
struct AWSGameLiftSearchSessionsRequest
: public AzFramework::SearchSessionsRequest
: public Multiplayer::SearchSessionsRequest
{
public:
AZ_RTTI(AWSGameLiftSearchSessionsRequest, "{864C91C0-CA53-4585-BF07-066C0DF3E198}", AzFramework::SearchSessionsRequest);
AZ_RTTI(AWSGameLiftSearchSessionsRequest, "{864C91C0-CA53-4585-BF07-066C0DF3E198}", Multiplayer::SearchSessionsRequest);
static void Reflect(AZ::ReflectContext* context);
AWSGameLiftSearchSessionsRequest() = default;

@ -10,7 +10,7 @@
#include <AzCore/EBus/EBus.h>
#include <AzCore/std/string/string.h>
#include <AzFramework/Session/ISessionRequests.h>
#include <Multiplayer/Session/ISessionRequests.h>
namespace AWSGameLift
{
@ -23,7 +23,7 @@ namespace AWSGameLift
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
};
using AWSGameLiftSessionAsyncRequestBus = AZ::EBus<AzFramework::ISessionAsyncRequests, AWSGameLiftSessionAsyncRequests>;
using AWSGameLiftSessionAsyncRequestBus = AZ::EBus<Multiplayer::ISessionAsyncRequests, AWSGameLiftSessionAsyncRequests>;
// ISessionRequests EBus wrapper
class AWSGameLiftSessionRequests
@ -34,5 +34,5 @@ namespace AWSGameLift
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
};
using AWSGameLiftSessionRequestBus = AZ::EBus<AzFramework::ISessionRequests, AWSGameLiftSessionRequests>;
using AWSGameLiftSessionRequestBus = AZ::EBus<Multiplayer::ISessionRequests, AWSGameLiftSessionRequests>;
} // namespace AWSGameLift

@ -10,7 +10,7 @@
#include <AzCore/std/containers/unordered_map.h>
#include <AzCore/std/string/string.h>
#include <AzFramework/Matchmaking/MatchmakingRequests.h>
#include <Multiplayer/Session/MatchmakingRequests.h>
#include <AWSGameLiftPlayer.h>
@ -21,10 +21,10 @@ namespace AWSGameLift
//! Uses FlexMatch to create a game match for a group of players based on custom matchmaking rules
//! StartMatchmakingRequest
struct AWSGameLiftStartMatchmakingRequest
: public AzFramework::StartMatchmakingRequest
: public Multiplayer::StartMatchmakingRequest
{
public:
AZ_RTTI(AWSGameLiftStartMatchmakingRequest, "{D273DF71-9C55-48C1-95F9-8D7B66B9CF3E}", AzFramework::StartMatchmakingRequest);
AZ_RTTI(AWSGameLiftStartMatchmakingRequest, "{D273DF71-9C55-48C1-95F9-8D7B66B9CF3E}", Multiplayer::StartMatchmakingRequest);
static void Reflect(AZ::ReflectContext* context);
AWSGameLiftStartMatchmakingRequest() = default;

@ -8,7 +8,7 @@
#pragma once
#include <AzFramework/Matchmaking/MatchmakingRequests.h>
#include <Multiplayer/Session/MatchmakingRequests.h>
namespace AWSGameLift
{
@ -17,10 +17,10 @@ namespace AWSGameLift
//! Cancels a matchmaking ticket or match backfill ticket that is currently being processed.
//! StopMatchmakingRequest
struct AWSGameLiftStopMatchmakingRequest
: public AzFramework::StopMatchmakingRequest
: public Multiplayer::StopMatchmakingRequest
{
public:
AZ_RTTI(AWSGameLiftStopMatchmakingRequest, "{2766BC03-9F84-4346-A52B-49129BBAF38B}", AzFramework::StopMatchmakingRequest);
AZ_RTTI(AWSGameLiftStopMatchmakingRequest, "{2766BC03-9F84-4346-A52B-49129BBAF38B}", Multiplayer::StopMatchmakingRequest);
static void Reflect(AZ::ReflectContext* context);
AWSGameLiftStopMatchmakingRequest() = default;

@ -9,8 +9,8 @@
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/bind/bind.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <AzFramework/Session/ISessionHandlingRequests.h>
#include <AzFramework/Matchmaking/MatchmakingNotifications.h>
#include <Multiplayer/Session/ISessionHandlingRequests.h>
#include <Multiplayer/Session/MatchmakingNotifications.h>
#include <AWSGameLiftClientLocalTicketTracker.h>
#include <AWSGameLiftSessionConstants.h>
@ -97,7 +97,7 @@ namespace AWSGameLift
AZ_TracePrintf(AWSGameLiftClientLocalTicketTrackerName,
"Matchmaking ticket %s is complete.", ticket.GetTicketId().c_str());
RequestPlayerJoinMatch(ticket, playerId);
AzFramework::MatchmakingNotificationBus::Broadcast(&AzFramework::MatchmakingNotifications::OnMatchComplete);
Multiplayer::MatchmakingNotificationBus::Broadcast(&Multiplayer::MatchmakingNotifications::OnMatchComplete);
m_status = TicketTrackerStatus::Idle;
return;
}
@ -107,7 +107,7 @@ namespace AWSGameLift
{
AZ_Warning(AWSGameLiftClientLocalTicketTrackerName, false, "Matchmaking ticket %s is not complete, %s",
ticket.GetTicketId().c_str(), ticket.GetStatusMessage().c_str());
AzFramework::MatchmakingNotificationBus::Broadcast(&AzFramework::MatchmakingNotifications::OnMatchFailure);
Multiplayer::MatchmakingNotificationBus::Broadcast(&Multiplayer::MatchmakingNotifications::OnMatchFailure);
m_status = TicketTrackerStatus::Idle;
return;
}
@ -115,7 +115,7 @@ namespace AWSGameLift
{
AZ_TracePrintf(AWSGameLiftClientLocalTicketTrackerName, "Matchmaking ticket %s is pending on acceptance, %s.",
ticket.GetTicketId().c_str(), ticket.GetStatusMessage().c_str());
AzFramework::MatchmakingNotificationBus::Broadcast(&AzFramework::MatchmakingNotifications::OnMatchAcceptance);
Multiplayer::MatchmakingNotificationBus::Broadcast(&Multiplayer::MatchmakingNotifications::OnMatchAcceptance);
}
else
{
@ -126,7 +126,7 @@ namespace AWSGameLift
else
{
AZ_Error(AWSGameLiftClientLocalTicketTrackerName, false, "Unable to find expected ticket with id %s", ticketId.c_str());
AzFramework::MatchmakingNotificationBus::Broadcast(&AzFramework::MatchmakingNotifications::OnMatchError);
Multiplayer::MatchmakingNotificationBus::Broadcast(&Multiplayer::MatchmakingNotifications::OnMatchError);
}
}
else
@ -134,13 +134,13 @@ namespace AWSGameLift
AZ_Error(AWSGameLiftClientLocalTicketTrackerName, false, AWSGameLiftErrorMessageTemplate,
describeMatchmakingOutcome.GetError().GetExceptionName().c_str(),
describeMatchmakingOutcome.GetError().GetMessage().c_str());
AzFramework::MatchmakingNotificationBus::Broadcast(&AzFramework::MatchmakingNotifications::OnMatchError);
Multiplayer::MatchmakingNotificationBus::Broadcast(&Multiplayer::MatchmakingNotifications::OnMatchError);
}
}
else
{
AZ_Error(AWSGameLiftClientLocalTicketTrackerName, false, AWSGameLiftClientMissingErrorMessage);
AzFramework::MatchmakingNotificationBus::Broadcast(&AzFramework::MatchmakingNotifications::OnMatchError);
Multiplayer::MatchmakingNotificationBus::Broadcast(&Multiplayer::MatchmakingNotifications::OnMatchError);
}
m_waitEvent.try_acquire_for(AZStd::chrono::milliseconds(m_pollingPeriodInMS));
}
@ -150,7 +150,7 @@ namespace AWSGameLift
const Aws::GameLift::Model::MatchmakingTicket& ticket, const AZStd::string& playerId)
{
auto connectionInfo = ticket.GetGameSessionConnectionInfo();
AzFramework::SessionConnectionConfig sessionConnectionConfig;
Multiplayer::SessionConnectionConfig sessionConnectionConfig;
sessionConnectionConfig.m_ipAddress = connectionInfo.GetIpAddress().c_str();
for (auto matchedPlayer : connectionInfo.GetMatchedPlayerSessions())
{
@ -168,7 +168,7 @@ namespace AWSGameLift
"Requesting and validating player session %s to connect to the match ...",
sessionConnectionConfig.m_playerSessionId.c_str());
bool result =
AZ::Interface<AzFramework::ISessionHandlingClientRequests>::Get()->RequestPlayerJoinSession(sessionConnectionConfig);
AZ::Interface<Multiplayer::ISessionHandlingClientRequests>::Get()->RequestPlayerJoinSession(sessionConnectionConfig);
if (result)
{
AZ_TracePrintf(AWSGameLiftClientLocalTicketTrackerName,

@ -10,7 +10,7 @@
#include <AzCore/Interface/Interface.h>
#include <AzCore/Jobs/JobFunction.h>
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzFramework/Session/SessionConfig.h>
#include <Multiplayer/Session/SessionConfig.h>
#include <AWSCoreBus.h>
#include <Credential/AWSCredentialBus.h>
@ -42,32 +42,32 @@ namespace AWSGameLift
AZ::Interface<IAWSGameLiftRequests>::Register(this);
AWSGameLiftRequestBus::Handler::BusConnect();
AZ::Interface<AzFramework::ISessionAsyncRequests>::Register(this);
AZ::Interface<Multiplayer::ISessionAsyncRequests>::Register(this);
AWSGameLiftSessionAsyncRequestBus::Handler::BusConnect();
AZ::Interface<AzFramework::ISessionRequests>::Register(this);
AZ::Interface<Multiplayer::ISessionRequests>::Register(this);
AWSGameLiftSessionRequestBus::Handler::BusConnect();
AZ::Interface<AzFramework::IMatchmakingAsyncRequests>::Register(this);
AZ::Interface<Multiplayer::IMatchmakingAsyncRequests>::Register(this);
AWSGameLiftMatchmakingAsyncRequestBus::Handler::BusConnect();
AZ::Interface<AzFramework::IMatchmakingRequests>::Register(this);
AZ::Interface<Multiplayer::IMatchmakingRequests>::Register(this);
AWSGameLiftMatchmakingRequestBus::Handler::BusConnect();
}
void AWSGameLiftClientManager::DeactivateManager()
{
AWSGameLiftMatchmakingRequestBus::Handler::BusDisconnect();
AZ::Interface<AzFramework::IMatchmakingRequests>::Unregister(this);
AZ::Interface<Multiplayer::IMatchmakingRequests>::Unregister(this);
AWSGameLiftMatchmakingAsyncRequestBus::Handler::BusDisconnect();
AZ::Interface<AzFramework::IMatchmakingAsyncRequests>::Unregister(this);
AZ::Interface<Multiplayer::IMatchmakingAsyncRequests>::Unregister(this);
AWSGameLiftSessionRequestBus::Handler::BusDisconnect();
AZ::Interface<AzFramework::ISessionRequests>::Unregister(this);
AZ::Interface<Multiplayer::ISessionRequests>::Unregister(this);
AWSGameLiftSessionAsyncRequestBus::Handler::BusDisconnect();
AZ::Interface<AzFramework::ISessionAsyncRequests>::Unregister(this);
AZ::Interface<Multiplayer::ISessionAsyncRequests>::Unregister(this);
AWSGameLiftRequestBus::Handler::BusDisconnect();
AZ::Interface<IAWSGameLiftRequests>::Unregister(this);
@ -133,7 +133,7 @@ namespace AWSGameLift
return AZ::Uuid::CreateRandom().ToString<AZStd::string>(includeBrackets, includeDashes);
}
void AWSGameLiftClientManager::AcceptMatch(const AzFramework::AcceptMatchRequest& acceptMatchRequest)
void AWSGameLiftClientManager::AcceptMatch(const Multiplayer::AcceptMatchRequest& acceptMatchRequest)
{
if (AcceptMatchActivity::ValidateAcceptMatchRequest(acceptMatchRequest))
{
@ -143,12 +143,12 @@ namespace AWSGameLift
}
}
void AWSGameLiftClientManager::AcceptMatchAsync(const AzFramework::AcceptMatchRequest& acceptMatchRequest)
void AWSGameLiftClientManager::AcceptMatchAsync(const Multiplayer::AcceptMatchRequest& acceptMatchRequest)
{
if (!AcceptMatchActivity::ValidateAcceptMatchRequest(acceptMatchRequest))
{
AzFramework::MatchmakingAsyncRequestNotificationBus::Broadcast(
&AzFramework::MatchmakingAsyncRequestNotifications::OnAcceptMatchAsyncComplete);
Multiplayer::MatchmakingAsyncRequestNotificationBus::Broadcast(
&Multiplayer::MatchmakingAsyncRequestNotifications::OnAcceptMatchAsyncComplete);
return;
}
@ -161,15 +161,15 @@ namespace AWSGameLift
{
AcceptMatchActivity::AcceptMatch(gameliftStartMatchmakingRequest);
AzFramework::MatchmakingAsyncRequestNotificationBus::Broadcast(
&AzFramework::MatchmakingAsyncRequestNotifications::OnAcceptMatchAsyncComplete);
Multiplayer::MatchmakingAsyncRequestNotificationBus::Broadcast(
&Multiplayer::MatchmakingAsyncRequestNotifications::OnAcceptMatchAsyncComplete);
},
true, jobContext);
acceptMatchJob->Start();
}
AZStd::string AWSGameLiftClientManager::CreateSession(const AzFramework::CreateSessionRequest& createSessionRequest)
AZStd::string AWSGameLiftClientManager::CreateSession(const Multiplayer::CreateSessionRequest& createSessionRequest)
{
AZStd::string result = "";
if (CreateSessionActivity::ValidateCreateSessionRequest(createSessionRequest))
@ -192,7 +192,7 @@ namespace AWSGameLift
return result;
}
void AWSGameLiftClientManager::CreateSessionAsync(const AzFramework::CreateSessionRequest& createSessionRequest)
void AWSGameLiftClientManager::CreateSessionAsync(const Multiplayer::CreateSessionRequest& createSessionRequest)
{
if (CreateSessionActivity::ValidateCreateSessionRequest(createSessionRequest))
{
@ -206,8 +206,8 @@ namespace AWSGameLift
{
AZStd::string result = CreateSessionActivity::CreateSession(gameliftCreateSessionRequest);
AzFramework::SessionAsyncRequestNotificationBus::Broadcast(
&AzFramework::SessionAsyncRequestNotifications::OnCreateSessionAsyncComplete, result);
Multiplayer::SessionAsyncRequestNotificationBus::Broadcast(
&Multiplayer::SessionAsyncRequestNotifications::OnCreateSessionAsyncComplete, result);
},
true, jobContext);
createSessionJob->Start();
@ -224,8 +224,8 @@ namespace AWSGameLift
{
AZStd::string result = CreateSessionOnQueueActivity::CreateSessionOnQueue(gameliftCreateSessionOnQueueRequest);
AzFramework::SessionAsyncRequestNotificationBus::Broadcast(
&AzFramework::SessionAsyncRequestNotifications::OnCreateSessionAsyncComplete, result);
Multiplayer::SessionAsyncRequestNotificationBus::Broadcast(
&Multiplayer::SessionAsyncRequestNotifications::OnCreateSessionAsyncComplete, result);
},
true, jobContext);
createSessionOnQueueJob->Start();
@ -233,12 +233,12 @@ namespace AWSGameLift
else
{
AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftCreateSessionRequestInvalidErrorMessage);
AzFramework::SessionAsyncRequestNotificationBus::Broadcast(
&AzFramework::SessionAsyncRequestNotifications::OnCreateSessionAsyncComplete, "");
Multiplayer::SessionAsyncRequestNotificationBus::Broadcast(
&Multiplayer::SessionAsyncRequestNotifications::OnCreateSessionAsyncComplete, "");
}
}
bool AWSGameLiftClientManager::JoinSession(const AzFramework::JoinSessionRequest& joinSessionRequest)
bool AWSGameLiftClientManager::JoinSession(const Multiplayer::JoinSessionRequest& joinSessionRequest)
{
bool result = false;
if (JoinSessionActivity::ValidateJoinSessionRequest(joinSessionRequest))
@ -252,12 +252,12 @@ namespace AWSGameLift
return result;
}
void AWSGameLiftClientManager::JoinSessionAsync(const AzFramework::JoinSessionRequest& joinSessionRequest)
void AWSGameLiftClientManager::JoinSessionAsync(const Multiplayer::JoinSessionRequest& joinSessionRequest)
{
if (!JoinSessionActivity::ValidateJoinSessionRequest(joinSessionRequest))
{
AzFramework::SessionAsyncRequestNotificationBus::Broadcast(
&AzFramework::SessionAsyncRequestNotifications::OnJoinSessionAsyncComplete, false);
Multiplayer::SessionAsyncRequestNotificationBus::Broadcast(
&Multiplayer::SessionAsyncRequestNotifications::OnJoinSessionAsyncComplete, false);
return;
}
@ -272,8 +272,8 @@ namespace AWSGameLift
auto createPlayerSessionOutcome = JoinSessionActivity::CreatePlayerSession(gameliftJoinSessionRequest);
bool result = JoinSessionActivity::RequestPlayerJoinSession(createPlayerSessionOutcome);
AzFramework::SessionAsyncRequestNotificationBus::Broadcast(
&AzFramework::SessionAsyncRequestNotifications::OnJoinSessionAsyncComplete, result);
Multiplayer::SessionAsyncRequestNotificationBus::Broadcast(
&Multiplayer::SessionAsyncRequestNotifications::OnJoinSessionAsyncComplete, result);
},
true, jobContext);
@ -293,18 +293,18 @@ namespace AWSGameLift
[this]()
{
LeaveSession();
AzFramework::SessionAsyncRequestNotificationBus::Broadcast(
&AzFramework::SessionAsyncRequestNotifications::OnLeaveSessionAsyncComplete);
Multiplayer::SessionAsyncRequestNotificationBus::Broadcast(
&Multiplayer::SessionAsyncRequestNotifications::OnLeaveSessionAsyncComplete);
},
true, jobContext);
leaveSessionJob->Start();
}
AzFramework::SearchSessionsResponse AWSGameLiftClientManager::SearchSessions(
const AzFramework::SearchSessionsRequest& searchSessionsRequest) const
Multiplayer::SearchSessionsResponse AWSGameLiftClientManager::SearchSessions(
const Multiplayer::SearchSessionsRequest& searchSessionsRequest) const
{
AzFramework::SearchSessionsResponse response;
Multiplayer::SearchSessionsResponse response;
if (SearchSessionsActivity::ValidateSearchSessionsRequest(searchSessionsRequest))
{
const AWSGameLiftSearchSessionsRequest& gameliftSearchSessionsRequest =
@ -315,12 +315,12 @@ namespace AWSGameLift
return response;
}
void AWSGameLiftClientManager::SearchSessionsAsync(const AzFramework::SearchSessionsRequest& searchSessionsRequest) const
void AWSGameLiftClientManager::SearchSessionsAsync(const Multiplayer::SearchSessionsRequest& searchSessionsRequest) const
{
if (!SearchSessionsActivity::ValidateSearchSessionsRequest(searchSessionsRequest))
{
AzFramework::SessionAsyncRequestNotificationBus::Broadcast(
&AzFramework::SessionAsyncRequestNotifications::OnSearchSessionsAsyncComplete, AzFramework::SearchSessionsResponse());
Multiplayer::SessionAsyncRequestNotificationBus::Broadcast(
&Multiplayer::SessionAsyncRequestNotifications::OnSearchSessionsAsyncComplete, Multiplayer::SearchSessionsResponse());
return;
}
@ -332,17 +332,17 @@ namespace AWSGameLift
AZ::Job* searchSessionsJob = AZ::CreateJobFunction(
[gameliftSearchSessionsRequest]()
{
AzFramework::SearchSessionsResponse response = SearchSessionsActivity::SearchSessions(gameliftSearchSessionsRequest);
Multiplayer::SearchSessionsResponse response = SearchSessionsActivity::SearchSessions(gameliftSearchSessionsRequest);
AzFramework::SessionAsyncRequestNotificationBus::Broadcast(
&AzFramework::SessionAsyncRequestNotifications::OnSearchSessionsAsyncComplete, response);
Multiplayer::SessionAsyncRequestNotificationBus::Broadcast(
&Multiplayer::SessionAsyncRequestNotifications::OnSearchSessionsAsyncComplete, response);
},
true, jobContext);
searchSessionsJob->Start();
}
AZStd::string AWSGameLiftClientManager::StartMatchmaking(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest)
AZStd::string AWSGameLiftClientManager::StartMatchmaking(const Multiplayer::StartMatchmakingRequest& startMatchmakingRequest)
{
AZStd::string response;
if (StartMatchmakingActivity::ValidateStartMatchmakingRequest(startMatchmakingRequest))
@ -355,12 +355,12 @@ namespace AWSGameLift
return response;
}
void AWSGameLiftClientManager::StartMatchmakingAsync(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest)
void AWSGameLiftClientManager::StartMatchmakingAsync(const Multiplayer::StartMatchmakingRequest& startMatchmakingRequest)
{
if (!StartMatchmakingActivity::ValidateStartMatchmakingRequest(startMatchmakingRequest))
{
AzFramework::MatchmakingAsyncRequestNotificationBus::Broadcast(
&AzFramework::MatchmakingAsyncRequestNotifications::OnStartMatchmakingAsyncComplete, AZStd::string{});
Multiplayer::MatchmakingAsyncRequestNotificationBus::Broadcast(
&Multiplayer::MatchmakingAsyncRequestNotifications::OnStartMatchmakingAsyncComplete, AZStd::string{});
return;
}
@ -374,15 +374,15 @@ namespace AWSGameLift
{
AZStd::string response = StartMatchmakingActivity::StartMatchmaking(gameliftStartMatchmakingRequest);
AzFramework::MatchmakingAsyncRequestNotificationBus::Broadcast(
&AzFramework::MatchmakingAsyncRequestNotifications::OnStartMatchmakingAsyncComplete, response);
Multiplayer::MatchmakingAsyncRequestNotificationBus::Broadcast(
&Multiplayer::MatchmakingAsyncRequestNotifications::OnStartMatchmakingAsyncComplete, response);
},
true, jobContext);
startMatchmakingJob->Start();
}
void AWSGameLiftClientManager::StopMatchmaking(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest)
void AWSGameLiftClientManager::StopMatchmaking(const Multiplayer::StopMatchmakingRequest& stopMatchmakingRequest)
{
if (StopMatchmakingActivity::ValidateStopMatchmakingRequest(stopMatchmakingRequest))
{
@ -393,12 +393,12 @@ namespace AWSGameLift
}
}
void AWSGameLiftClientManager::StopMatchmakingAsync(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest)
void AWSGameLiftClientManager::StopMatchmakingAsync(const Multiplayer::StopMatchmakingRequest& stopMatchmakingRequest)
{
if (!StopMatchmakingActivity::ValidateStopMatchmakingRequest(stopMatchmakingRequest))
{
AzFramework::MatchmakingAsyncRequestNotificationBus::Broadcast(
&AzFramework::MatchmakingAsyncRequestNotifications::OnStopMatchmakingAsyncComplete);
Multiplayer::MatchmakingAsyncRequestNotificationBus::Broadcast(
&Multiplayer::MatchmakingAsyncRequestNotifications::OnStopMatchmakingAsyncComplete);
return;
}
@ -412,8 +412,8 @@ namespace AWSGameLift
{
StopMatchmakingActivity::StopMatchmaking(gameliftStopMatchmakingRequest);
AzFramework::MatchmakingAsyncRequestNotificationBus::Broadcast(
&AzFramework::MatchmakingAsyncRequestNotifications::OnStopMatchmakingAsyncComplete);
Multiplayer::MatchmakingAsyncRequestNotificationBus::Broadcast(
&Multiplayer::MatchmakingAsyncRequestNotifications::OnStopMatchmakingAsyncComplete);
},
true, jobContext);

@ -10,7 +10,7 @@
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <AzFramework/Matchmaking/MatchmakingNotifications.h>
#include <Multiplayer/Session/MatchmakingNotifications.h>
#include <Request/AWSGameLiftRequestBus.h>
#include <Request/AWSGameLiftSessionRequestBus.h>
@ -28,7 +28,7 @@ namespace AWSGameLift
// MatchmakingNotificationBus EBus handler for scripting
class AWSGameLiftMatchmakingNotificationBusHandler
: public AzFramework::MatchmakingNotificationBus::Handler
: public Multiplayer::MatchmakingNotificationBus::Handler
, public AZ::BehaviorEBusHandler
{
public:
@ -61,7 +61,7 @@ namespace AWSGameLift
// MatchmakingAsyncRequestNotificationBus EBus handler for scripting
class AWSGameLiftMatchmakingAsyncRequestNotificationBusHandler
: public AzFramework::MatchmakingAsyncRequestNotificationBus::Handler
: public Multiplayer::MatchmakingAsyncRequestNotificationBus::Handler
, public AZ::BehaviorEBusHandler
{
public:
@ -91,7 +91,7 @@ namespace AWSGameLift
// SessionAsyncRequestNotificationBus EBus handler for scripting
class AWSGameLiftSessionAsyncRequestNotificationBusHandler
: public AzFramework::SessionAsyncRequestNotificationBus::Handler
: public Multiplayer::SessionAsyncRequestNotificationBus::Handler
, public AZ::BehaviorEBusHandler
{
public:
@ -109,7 +109,7 @@ namespace AWSGameLift
Call(FN_OnCreateSessionAsyncComplete, createSessionReponse);
}
void OnSearchSessionsAsyncComplete(const AzFramework::SearchSessionsResponse& searchSessionsResponse) override
void OnSearchSessionsAsyncComplete(const Multiplayer::SearchSessionsResponse& searchSessionsResponse) override
{
Call(FN_OnSearchSessionsAsyncComplete, searchSessionsResponse);
}
@ -155,25 +155,25 @@ namespace AWSGameLift
AZStd::string CreatePlayerId(bool includeBrackets, bool includeDashes) override;
// AWSGameLiftMatchmakingAsyncRequestBus interface implementation
void AcceptMatchAsync(const AzFramework::AcceptMatchRequest& acceptMatchRequest) override;
void StartMatchmakingAsync(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest) override;
void StopMatchmakingAsync(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest) override;
void AcceptMatchAsync(const Multiplayer::AcceptMatchRequest& acceptMatchRequest) override;
void StartMatchmakingAsync(const Multiplayer::StartMatchmakingRequest& startMatchmakingRequest) override;
void StopMatchmakingAsync(const Multiplayer::StopMatchmakingRequest& stopMatchmakingRequest) override;
// AWSGameLiftSessionAsyncRequestBus interface implementation
void CreateSessionAsync(const AzFramework::CreateSessionRequest& createSessionRequest) override;
void JoinSessionAsync(const AzFramework::JoinSessionRequest& joinSessionRequest) override;
void SearchSessionsAsync(const AzFramework::SearchSessionsRequest& searchSessionsRequest) const override;
void CreateSessionAsync(const Multiplayer::CreateSessionRequest& createSessionRequest) override;
void JoinSessionAsync(const Multiplayer::JoinSessionRequest& joinSessionRequest) override;
void SearchSessionsAsync(const Multiplayer::SearchSessionsRequest& searchSessionsRequest) const override;
void LeaveSessionAsync() override;
// AWSGameLiftMatchmakingRequestBus interface implementation
void AcceptMatch(const AzFramework::AcceptMatchRequest& acceptMatchRequest) override;
AZStd::string StartMatchmaking(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest) override;
void StopMatchmaking(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest) override;
void AcceptMatch(const Multiplayer::AcceptMatchRequest& acceptMatchRequest) override;
AZStd::string StartMatchmaking(const Multiplayer::StartMatchmakingRequest& startMatchmakingRequest) override;
void StopMatchmaking(const Multiplayer::StopMatchmakingRequest& stopMatchmakingRequest) override;
// AWSGameLiftSessionRequestBus interface implementation
AZStd::string CreateSession(const AzFramework::CreateSessionRequest& createSessionRequest) override;
bool JoinSession(const AzFramework::JoinSessionRequest& joinSessionRequest) override;
AzFramework::SearchSessionsResponse SearchSessions(const AzFramework::SearchSessionsRequest& searchSessionsRequest) const override;
AZStd::string CreateSession(const Multiplayer::CreateSessionRequest& createSessionRequest) override;
bool JoinSession(const Multiplayer::JoinSessionRequest& joinSessionRequest) override;
Multiplayer::SearchSessionsResponse SearchSessions(const Multiplayer::SearchSessionsRequest& searchSessionsRequest) const override;
void LeaveSession() override;
};
} // namespace AWSGameLift

@ -10,7 +10,7 @@
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/EditContextConstants.inl>
#include <AzFramework/Session/SessionConfig.h>
#include <Multiplayer/Session/SessionConfig.h>
#include <AWSGameLiftClientLocalTicketTracker.h>
#include <AWSCoreBus.h>
@ -129,7 +129,7 @@ namespace AWSGameLift
->Event("StopMatchmakingAsync", &AWSGameLiftMatchmakingAsyncRequestBus::Events::StopMatchmakingAsync,
{ { { "StopMatchmakingRequest", "" } } });
behaviorContext->EBus<AzFramework::MatchmakingAsyncRequestNotificationBus>("AWSGameLiftMatchmakingAsyncRequestNotificationBus")
behaviorContext->EBus<Multiplayer::MatchmakingAsyncRequestNotificationBus>("AWSGameLiftMatchmakingAsyncRequestNotificationBus")
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift/Matchmaking")
->Handler<AWSGameLiftMatchmakingAsyncRequestNotificationBusHandler>();
@ -149,7 +149,7 @@ namespace AWSGameLift
{ "PlayerId", "" } } })
->Event("StopPolling", &AWSGameLiftMatchmakingEventRequestBus::Events::StopPolling);
behaviorContext->EBus<AzFramework::MatchmakingNotificationBus>("AWSGameLiftMatchmakingNotificationBus")
behaviorContext->EBus<Multiplayer::MatchmakingNotificationBus>("AWSGameLiftMatchmakingNotificationBus")
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift/Matchmaking")
->Handler<AWSGameLiftMatchmakingNotificationBusHandler>();
}
@ -175,7 +175,7 @@ namespace AWSGameLift
{ { { "SearchSessionsRequest", "" } } })
->Event("LeaveSessionAsync", &AWSGameLiftSessionAsyncRequestBus::Events::LeaveSessionAsync);
behaviorContext->EBus<AzFramework::SessionAsyncRequestNotificationBus>("AWSGameLiftSessionAsyncRequestNotificationBus")
behaviorContext->EBus<Multiplayer::SessionAsyncRequestNotificationBus>("AWSGameLiftSessionAsyncRequestNotificationBus")
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift/Session")
->Handler<AWSGameLiftSessionAsyncRequestNotificationBusHandler>();
@ -190,10 +190,10 @@ namespace AWSGameLift
void AWSGameLiftClientSystemComponent::ReflectCreateSessionRequest(AZ::ReflectContext* context)
{
AzFramework::CreateSessionRequest::Reflect(context);
Multiplayer::CreateSessionRequest::Reflect(context);
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->Class<AzFramework::CreateSessionRequest>("CreateSessionRequest")
behaviorContext->Class<Multiplayer::CreateSessionRequest>("CreateSessionRequest")
->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
// Expose base type to BehaviorContext, but hide it to be used directly
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
@ -204,34 +204,34 @@ namespace AWSGameLift
void AWSGameLiftClientSystemComponent::ReflectSearchSessionsResponse(AZ::ReflectContext* context)
{
// As it is a common response type, reflection could be moved to AzFramework to avoid duplication
AzFramework::SessionConfig::Reflect(context);
AzFramework::SearchSessionsResponse::Reflect(context);
Multiplayer::SessionConfig::Reflect(context);
Multiplayer::SearchSessionsResponse::Reflect(context);
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->Class<AzFramework::SessionConfig>("SessionConfig")
behaviorContext->Class<Multiplayer::SessionConfig>("SessionConfig")
->Attribute(AZ::Script::Attributes::Category, "Session")
->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
->Property("CreationTime", BehaviorValueProperty(&AzFramework::SessionConfig::m_creationTime))
->Property("CreatorId", BehaviorValueProperty(&AzFramework::SessionConfig::m_creatorId))
->Property("CurrentPlayer", BehaviorValueProperty(&AzFramework::SessionConfig::m_currentPlayer))
->Property("DnsName", BehaviorValueProperty(&AzFramework::SessionConfig::m_dnsName))
->Property("IpAddress", BehaviorValueProperty(&AzFramework::SessionConfig::m_ipAddress))
->Property("MaxPlayer", BehaviorValueProperty(&AzFramework::SessionConfig::m_maxPlayer))
->Property("Port", BehaviorValueProperty(&AzFramework::SessionConfig::m_port))
->Property("SessionId", BehaviorValueProperty(&AzFramework::SessionConfig::m_sessionId))
->Property("SessionName", BehaviorValueProperty(&AzFramework::SessionConfig::m_sessionName))
->Property("SessionProperties", BehaviorValueProperty(&AzFramework::SessionConfig::m_sessionProperties))
->Property("MatchmakingData", BehaviorValueProperty(&AzFramework::SessionConfig::m_matchmakingData))
->Property("Status", BehaviorValueProperty(&AzFramework::SessionConfig::m_status))
->Property("StatusReason", BehaviorValueProperty(&AzFramework::SessionConfig::m_statusReason))
->Property("TerminationTime", BehaviorValueProperty(&AzFramework::SessionConfig::m_terminationTime))
->Property("CreationTime", BehaviorValueProperty(&Multiplayer::SessionConfig::m_creationTime))
->Property("CreatorId", BehaviorValueProperty(&Multiplayer::SessionConfig::m_creatorId))
->Property("CurrentPlayer", BehaviorValueProperty(&Multiplayer::SessionConfig::m_currentPlayer))
->Property("DnsName", BehaviorValueProperty(&Multiplayer::SessionConfig::m_dnsName))
->Property("IpAddress", BehaviorValueProperty(&Multiplayer::SessionConfig::m_ipAddress))
->Property("MaxPlayer", BehaviorValueProperty(&Multiplayer::SessionConfig::m_maxPlayer))
->Property("Port", BehaviorValueProperty(&Multiplayer::SessionConfig::m_port))
->Property("SessionId", BehaviorValueProperty(&Multiplayer::SessionConfig::m_sessionId))
->Property("SessionName", BehaviorValueProperty(&Multiplayer::SessionConfig::m_sessionName))
->Property("SessionProperties", BehaviorValueProperty(&Multiplayer::SessionConfig::m_sessionProperties))
->Property("MatchmakingData", BehaviorValueProperty(&Multiplayer::SessionConfig::m_matchmakingData))
->Property("Status", BehaviorValueProperty(&Multiplayer::SessionConfig::m_status))
->Property("StatusReason", BehaviorValueProperty(&Multiplayer::SessionConfig::m_statusReason))
->Property("TerminationTime", BehaviorValueProperty(&Multiplayer::SessionConfig::m_terminationTime))
;
behaviorContext->Class<AzFramework::SearchSessionsResponse>("SearchSessionsResponse")
behaviorContext->Class<Multiplayer::SearchSessionsResponse>("SearchSessionsResponse")
->Attribute(AZ::Script::Attributes::Category, "Session")
->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
->Property("NextToken", BehaviorValueProperty(&AzFramework::SearchSessionsResponse::m_nextToken))
->Property("SessionConfigs", BehaviorValueProperty(&AzFramework::SearchSessionsResponse::m_sessionConfigs))
->Property("NextToken", BehaviorValueProperty(&Multiplayer::SearchSessionsResponse::m_nextToken))
->Property("SessionConfigs", BehaviorValueProperty(&Multiplayer::SearchSessionsResponse::m_sessionConfigs))
;
}
}

@ -69,7 +69,7 @@ namespace AWSGameLift
}
}
bool ValidateAcceptMatchRequest(const AzFramework::AcceptMatchRequest& AcceptMatchRequest)
bool ValidateAcceptMatchRequest(const Multiplayer::AcceptMatchRequest& AcceptMatchRequest)
{
auto gameliftAcceptMatchRequest = azrtti_cast<const AWSGameLiftAcceptMatchRequest*>(&AcceptMatchRequest);
bool isValid = gameliftAcceptMatchRequest &&

@ -26,6 +26,6 @@ namespace AWSGameLift
void AcceptMatch(const AWSGameLiftAcceptMatchRequest& AcceptMatchRequest);
// Validate AcceptMatchRequest and check required request parameters
bool ValidateAcceptMatchRequest(const AzFramework::AcceptMatchRequest& AcceptMatchRequest);
bool ValidateAcceptMatchRequest(const Multiplayer::AcceptMatchRequest& AcceptMatchRequest);
} // namespace AcceptMatchActivity
} // namespace AWSGameLift

@ -99,7 +99,7 @@ namespace AWSGameLift
return result;
}
bool ValidateCreateSessionRequest(const AzFramework::CreateSessionRequest& createSessionRequest)
bool ValidateCreateSessionRequest(const Multiplayer::CreateSessionRequest& createSessionRequest)
{
auto gameliftCreateSessionRequest = azrtti_cast<const AWSGameLiftCreateSessionRequest*>(&createSessionRequest);

@ -25,7 +25,7 @@ namespace AWSGameLift
AZStd::string CreateSession(const AWSGameLiftCreateSessionRequest& createSessionRequest);
// Validate CreateSessionRequest and check required request parameters
bool ValidateCreateSessionRequest(const AzFramework::CreateSessionRequest& createSessionRequest);
bool ValidateCreateSessionRequest(const Multiplayer::CreateSessionRequest& createSessionRequest);
} // namespace CreateSessionActivity
} // namespace AWSGameLift

@ -87,7 +87,7 @@ namespace AWSGameLift
return result;
}
bool ValidateCreateSessionOnQueueRequest(const AzFramework::CreateSessionRequest& createSessionRequest)
bool ValidateCreateSessionOnQueueRequest(const Multiplayer::CreateSessionRequest& createSessionRequest)
{
auto gameliftCreateSessionOnQueueRequest =
azrtti_cast<const AWSGameLiftCreateSessionOnQueueRequest*>(&createSessionRequest);

@ -26,7 +26,7 @@ namespace AWSGameLift
AZStd::string CreateSessionOnQueue(const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest);
// Validate CreateSessionOnQueueRequest and check required request parameters
bool ValidateCreateSessionOnQueueRequest(const AzFramework::CreateSessionRequest& createSessionRequest);
bool ValidateCreateSessionOnQueueRequest(const Multiplayer::CreateSessionRequest& createSessionRequest);
} // namespace CreateSessionOnQueueActivity
} // namespace AWSGameLift

@ -39,10 +39,10 @@ namespace AWSGameLift
return request;
}
AzFramework::SessionConnectionConfig BuildSessionConnectionConfig(
Multiplayer::SessionConnectionConfig BuildSessionConnectionConfig(
const Aws::GameLift::Model::CreatePlayerSessionOutcome& createPlayerSessionOutcome)
{
AzFramework::SessionConnectionConfig sessionConnectionConfig;
Multiplayer::SessionConnectionConfig sessionConnectionConfig;
auto createPlayerSessionResult = createPlayerSessionOutcome.GetResult();
// TODO: AWSNativeSDK needs to be updated to support this attribute, and it is a must have for TLS certificate enabled fleet
//sessionConnectionConfig.m_dnsName = createPlayerSessionResult.GetPlayerSession().GetDnsName().c_str();
@ -95,10 +95,10 @@ namespace AWSGameLift
bool result = false;
if (createPlayerSessionOutcome.IsSuccess())
{
auto clientRequestHandler = AZ::Interface<AzFramework::ISessionHandlingClientRequests>::Get();
auto clientRequestHandler = AZ::Interface<Multiplayer::ISessionHandlingClientRequests>::Get();
if (clientRequestHandler)
{
AzFramework::SessionConnectionConfig sessionConnectionConfig =
Multiplayer::SessionConnectionConfig sessionConnectionConfig =
BuildSessionConnectionConfig(createPlayerSessionOutcome);
AZ_TracePrintf(AWSGameLiftJoinSessionActivityName,
@ -114,7 +114,7 @@ namespace AWSGameLift
return result;
}
bool ValidateJoinSessionRequest(const AzFramework::JoinSessionRequest& joinSessionRequest)
bool ValidateJoinSessionRequest(const Multiplayer::JoinSessionRequest& joinSessionRequest)
{
auto gameliftJoinSessionRequest = azrtti_cast<const AWSGameLiftJoinSessionRequest*>(&joinSessionRequest);

@ -8,7 +8,7 @@
#pragma once
#include <AzFramework/Session/ISessionHandlingRequests.h>
#include <Multiplayer/Session/ISessionHandlingRequests.h>
#include <Request/AWSGameLiftJoinSessionRequest.h>
@ -31,7 +31,7 @@ namespace AWSGameLift
const AWSGameLiftJoinSessionRequest& joinSessionRequest);
// Build session connection config by using CreatePlayerSessionOutcome
AzFramework::SessionConnectionConfig BuildSessionConnectionConfig(
Multiplayer::SessionConnectionConfig BuildSessionConnectionConfig(
const Aws::GameLift::Model::CreatePlayerSessionOutcome& createPlayerSessionOutcome);
// Create CreatePlayerSessionRequest and make a CreatePlayerSession call through GameLift client
@ -43,7 +43,7 @@ namespace AWSGameLift
const Aws::GameLift::Model::CreatePlayerSessionOutcome& createPlayerSessionOutcome);
// Validate JoinSessionRequest and check required request parameters
bool ValidateJoinSessionRequest(const AzFramework::JoinSessionRequest& joinSessionRequest);
bool ValidateJoinSessionRequest(const Multiplayer::JoinSessionRequest& joinSessionRequest);
} // namespace JoinSessionActivity
} // namespace AWSGameLift

@ -8,7 +8,7 @@
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <AzFramework/Session/ISessionHandlingRequests.h>
#include <Multiplayer/Session/ISessionHandlingRequests.h>
#include <Activity/AWSGameLiftLeaveSessionActivity.h>
@ -18,7 +18,7 @@ namespace AWSGameLift
{
void LeaveSession()
{
auto clientRequestHandler = AZ::Interface<AzFramework::ISessionHandlingClientRequests>::Get();
auto clientRequestHandler = AZ::Interface<Multiplayer::ISessionHandlingClientRequests>::Get();
if (clientRequestHandler)
{
AZ_TracePrintf(AWSGameLiftLeaveSessionActivityName, "Requesting player to leave the current session ...");

@ -8,7 +8,7 @@
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <AzFramework/Session/SessionConfig.h>
#include <Multiplayer/Session/SessionConfig.h>
#include <Activity/AWSGameLiftSearchSessionsActivity.h>
#include <AWSGameLiftSessionConstants.h>
@ -67,10 +67,10 @@ namespace AWSGameLift
return request;
}
AzFramework::SearchSessionsResponse SearchSessions(
Multiplayer::SearchSessionsResponse SearchSessions(
const AWSGameLiftSearchSessionsRequest& searchSessionsRequest)
{
AzFramework::SearchSessionsResponse response;
Multiplayer::SearchSessionsResponse response;
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
if (!gameliftClient)
@ -98,15 +98,15 @@ namespace AWSGameLift
return response;
}
AzFramework::SearchSessionsResponse ParseResponse(
Multiplayer::SearchSessionsResponse ParseResponse(
const Aws::GameLift::Model::SearchGameSessionsResult& gameLiftSearchSessionsResult)
{
AzFramework::SearchSessionsResponse response;
Multiplayer::SearchSessionsResponse response;
response.m_nextToken = gameLiftSearchSessionsResult.GetNextToken().c_str();
for (const Aws::GameLift::Model::GameSession& gameSession : gameLiftSearchSessionsResult.GetGameSessions())
{
AzFramework::SessionConfig session;
Multiplayer::SessionConfig session;
session.m_creationTime = gameSession.GetCreationTime().Millis();
session.m_creatorId = gameSession.GetCreatorId().c_str();
session.m_currentPlayer = gameSession.GetCurrentPlayerSessionCount();
@ -133,7 +133,7 @@ namespace AWSGameLift
return response;
};
bool ValidateSearchSessionsRequest(const AzFramework::SearchSessionsRequest& searchSessionsRequest)
bool ValidateSearchSessionsRequest(const Multiplayer::SearchSessionsRequest& searchSessionsRequest)
{
auto gameliftSearchSessionsRequest = azrtti_cast<const AWSGameLiftSearchSessionsRequest*>(&searchSessionsRequest);
if (gameliftSearchSessionsRequest &&

@ -25,14 +25,14 @@ namespace AWSGameLift
const AWSGameLiftSearchSessionsRequest& searchSessionsRequest);
// Create SearchGameSessionsRequest and make a SeachGameSessions call through GameLift client
AzFramework::SearchSessionsResponse SearchSessions(
Multiplayer::SearchSessionsResponse SearchSessions(
const AWSGameLiftSearchSessionsRequest& searchSessionsRequest);
// Convert from Aws::GameLift::Model::SearchGameSessionsResult to AzFramework::SearchSessionsResponse.
AzFramework::SearchSessionsResponse ParseResponse(
// Convert from Aws::GameLift::Model::SearchGameSessionsResult to Multiplayer::SearchSessionsResponse.
Multiplayer::SearchSessionsResponse ParseResponse(
const Aws::GameLift::Model::SearchGameSessionsResult& gameLiftSearchSessionsResult);
// Validate SearchSessionsRequest and check required request parameters
bool ValidateSearchSessionsRequest(const AzFramework::SearchSessionsRequest& searchSessionsRequest);
bool ValidateSearchSessionsRequest(const Multiplayer::SearchSessionsRequest& searchSessionsRequest);
} // namespace SearchSessionsActivity
} // namespace AWSGameLift

@ -110,7 +110,7 @@ namespace AWSGameLift
return result;
}
bool ValidateStartMatchmakingRequest(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest)
bool ValidateStartMatchmakingRequest(const Multiplayer::StartMatchmakingRequest& startMatchmakingRequest)
{
auto gameliftStartMatchmakingRequest = azrtti_cast<const AWSGameLiftStartMatchmakingRequest*>(&startMatchmakingRequest);
bool isValid = gameliftStartMatchmakingRequest &&

@ -26,6 +26,6 @@ namespace AWSGameLift
AZStd::string StartMatchmaking(const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest);
// Validate StartMatchmakingRequest and check required request parameters
bool ValidateStartMatchmakingRequest(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest);
bool ValidateStartMatchmakingRequest(const Multiplayer::StartMatchmakingRequest& startMatchmakingRequest);
} // namespace StartMatchmakingActivity
} // namespace AWSGameLift

@ -59,7 +59,7 @@ namespace AWSGameLift
}
}
bool ValidateStopMatchmakingRequest(const AzFramework::StopMatchmakingRequest& StopMatchmakingRequest)
bool ValidateStopMatchmakingRequest(const Multiplayer::StopMatchmakingRequest& StopMatchmakingRequest)
{
auto gameliftStopMatchmakingRequest = azrtti_cast<const AWSGameLiftStopMatchmakingRequest*>(&StopMatchmakingRequest);
bool isValid = gameliftStopMatchmakingRequest && (!gameliftStopMatchmakingRequest->m_ticketId.empty());

@ -26,6 +26,6 @@ namespace AWSGameLift
void StopMatchmaking(const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest);
// Validate StopMatchmakingRequest and check required request parameters
bool ValidateStopMatchmakingRequest(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest);
bool ValidateStopMatchmakingRequest(const Multiplayer::StopMatchmakingRequest& stopMatchmakingRequest);
} // namespace StopMatchmakingActivity
} // namespace AWSGameLift

@ -16,11 +16,11 @@ namespace AWSGameLift
{
void AWSGameLiftAcceptMatchRequest::Reflect(AZ::ReflectContext* context)
{
AzFramework::AcceptMatchRequest::Reflect(context);
Multiplayer::AcceptMatchRequest::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<AWSGameLiftAcceptMatchRequest, AzFramework::AcceptMatchRequest>()
serializeContext->Class<AWSGameLiftAcceptMatchRequest, Multiplayer::AcceptMatchRequest>()
->Version(0);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
@ -33,7 +33,7 @@ namespace AWSGameLift
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->Class<AzFramework::AcceptMatchRequest>("AcceptMatchRequest")
behaviorContext->Class<Multiplayer::AcceptMatchRequest>("AcceptMatchRequest")
->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
// Expose base type to BehaviorContext, but hide it to be used directly
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All);

@ -18,7 +18,7 @@ namespace AWSGameLift
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<AWSGameLiftCreateSessionOnQueueRequest, AzFramework::CreateSessionRequest>()
serializeContext->Class<AWSGameLiftCreateSessionOnQueueRequest, Multiplayer::CreateSessionRequest>()
->Version(0)
->Field("queueName", &AWSGameLiftCreateSessionOnQueueRequest::m_queueName)
->Field("placementId", &AWSGameLiftCreateSessionOnQueueRequest::m_placementId)

@ -18,7 +18,7 @@ namespace AWSGameLift
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<AWSGameLiftCreateSessionRequest, AzFramework::CreateSessionRequest>()
serializeContext->Class<AWSGameLiftCreateSessionRequest, Multiplayer::CreateSessionRequest>()
->Version(0)
->Field("aliasId", &AWSGameLiftCreateSessionRequest::m_aliasId)
->Field("fleetId", &AWSGameLiftCreateSessionRequest::m_fleetId)

@ -15,11 +15,11 @@ namespace AWSGameLift
{
void AWSGameLiftJoinSessionRequest::Reflect(AZ::ReflectContext* context)
{
AzFramework::JoinSessionRequest::Reflect(context);
Multiplayer::JoinSessionRequest::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<AWSGameLiftJoinSessionRequest, AzFramework::JoinSessionRequest>()
serializeContext->Class<AWSGameLiftJoinSessionRequest, Multiplayer::JoinSessionRequest>()
->Version(0)
;
@ -34,7 +34,7 @@ namespace AWSGameLift
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->Class<AzFramework::JoinSessionRequest>("JoinSessionRequest")
behaviorContext->Class<Multiplayer::JoinSessionRequest>("JoinSessionRequest")
->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
// Expose base type to BehaviorContext, but hide it to be used directly
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)

@ -12,17 +12,17 @@
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzFramework/Session/SessionConfig.h>
#include <Multiplayer/Session/SessionConfig.h>
namespace AWSGameLift
{
void AWSGameLiftSearchSessionsRequest::Reflect(AZ::ReflectContext* context)
{
AzFramework::SearchSessionsRequest::Reflect(context);
Multiplayer::SearchSessionsRequest::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<AWSGameLiftSearchSessionsRequest, AzFramework::SearchSessionsRequest>()
serializeContext->Class<AWSGameLiftSearchSessionsRequest, Multiplayer::SearchSessionsRequest>()
->Version(0)
->Field("aliasId", &AWSGameLiftSearchSessionsRequest::m_aliasId)
->Field("fleetId", &AWSGameLiftSearchSessionsRequest::m_fleetId)
@ -47,7 +47,7 @@ namespace AWSGameLift
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->Class<AzFramework::SearchSessionsRequest>("SearchSessionsRequest")
behaviorContext->Class<Multiplayer::SearchSessionsRequest>("SearchSessionsRequest")
->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
// Expose base type to BehaviorContext, but hide it to be used directly
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All);

@ -16,12 +16,12 @@ namespace AWSGameLift
{
void AWSGameLiftStartMatchmakingRequest::Reflect(AZ::ReflectContext* context)
{
AzFramework::StartMatchmakingRequest::Reflect(context);
Multiplayer::StartMatchmakingRequest::Reflect(context);
AWSGameLiftPlayer::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<AWSGameLiftStartMatchmakingRequest, AzFramework::StartMatchmakingRequest>()
serializeContext->Class<AWSGameLiftStartMatchmakingRequest, Multiplayer::StartMatchmakingRequest>()
->Version(0)
->Field("configurationName", &AWSGameLiftStartMatchmakingRequest::m_configurationName)
->Field("players", &AWSGameLiftStartMatchmakingRequest::m_players);
@ -40,7 +40,7 @@ namespace AWSGameLift
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->Class<AzFramework::StartMatchmakingRequest>("StartMatchmakingRequest")
behaviorContext->Class<Multiplayer::StartMatchmakingRequest>("StartMatchmakingRequest")
->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
// Expose base type to BehaviorContext, but hide it to be used directly
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All);

@ -16,11 +16,11 @@ namespace AWSGameLift
{
void AWSGameLiftStopMatchmakingRequest::Reflect(AZ::ReflectContext* context)
{
AzFramework::StopMatchmakingRequest::Reflect(context);
Multiplayer::StopMatchmakingRequest::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<AWSGameLiftStopMatchmakingRequest, AzFramework::StopMatchmakingRequest>()
serializeContext->Class<AWSGameLiftStopMatchmakingRequest, Multiplayer::StopMatchmakingRequest>()
->Version(0);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
@ -33,7 +33,7 @@ namespace AWSGameLift
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->Class<AzFramework::StopMatchmakingRequest>("StopMatchmakingRequest")
behaviorContext->Class<Multiplayer::StopMatchmakingRequest>("StopMatchmakingRequest")
->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
// Expose base type to BehaviorContext, but hide it to be used directly
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All);

@ -10,7 +10,7 @@
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzFramework/Session/SessionConfig.h>
#include <Multiplayer/Session/SessionConfig.h>
#include <Credential/AWSCredentialBus.h>
#include <ResourceMapping/AWSResourceMappingBus.h>
@ -201,9 +201,9 @@ protected:
return Aws::GameLift::Model::SearchGameSessionsOutcome(result);
}
AzFramework::SearchSessionsResponse GetValidSearchSessionsResponse()
Multiplayer::SearchSessionsResponse GetValidSearchSessionsResponse()
{
AzFramework::SessionConfig sessionConfig;
Multiplayer::SessionConfig sessionConfig;
sessionConfig.m_creationTime = 0;
sessionConfig.m_terminationTime = 0;
sessionConfig.m_creatorId = "dummyCreatorId";
@ -220,7 +220,7 @@ protected:
// TODO: Update the AWS Native SDK to set the new game session attributes.
// sessionConfig.m_dnsName = "dummyDnsName";
AzFramework::SearchSessionsResponse response;
Multiplayer::SearchSessionsResponse response;
response.m_nextToken = "dummyNextToken";
response.m_sessionConfigs = { sessionConfig };
@ -344,7 +344,7 @@ TEST_F(AWSGameLiftClientManagerTest, CreateSession_CallWithoutClientSetup_GetEmp
TEST_F(AWSGameLiftClientManagerTest, CreateSession_CallWithInvalidRequest_GetEmptyResponse)
{
AZ_TEST_START_TRACE_SUPPRESSION;
auto response = m_gameliftClientManager->CreateSession(AzFramework::CreateSessionRequest());
auto response = m_gameliftClientManager->CreateSession(Multiplayer::CreateSessionRequest());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // capture 1 error message
EXPECT_TRUE(response == "");
}
@ -381,7 +381,7 @@ TEST_F(AWSGameLiftClientManagerTest, CreateSessionAsync_CallWithInvalidRequest_G
AZ_TEST_START_TRACE_SUPPRESSION;
SessionAsyncRequestNotificationsHandlerMock sessionHandlerMock;
EXPECT_CALL(sessionHandlerMock, OnCreateSessionAsyncComplete(AZStd::string())).Times(1);
m_gameliftClientManager->CreateSessionAsync(AzFramework::CreateSessionRequest());
m_gameliftClientManager->CreateSessionAsync(Multiplayer::CreateSessionRequest());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // capture 1 error message
}
@ -513,7 +513,7 @@ TEST_F(AWSGameLiftClientManagerTest, JoinSession_CallWithoutClientSetup_GetFalse
TEST_F(AWSGameLiftClientManagerTest, JoinSession_CallWithInvalidRequest_GetFalseResponse)
{
AZ_TEST_START_TRACE_SUPPRESSION;
auto response = m_gameliftClientManager->JoinSession(AzFramework::JoinSessionRequest());
auto response = m_gameliftClientManager->JoinSession(Multiplayer::JoinSessionRequest());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // capture 1 error message
EXPECT_FALSE(response);
}
@ -590,7 +590,7 @@ TEST_F(AWSGameLiftClientManagerTest, JoinSessionAsync_CallWithInvalidRequest_Get
AZ_TEST_START_TRACE_SUPPRESSION;
SessionAsyncRequestNotificationsHandlerMock sessionHandlerMock;
EXPECT_CALL(sessionHandlerMock, OnJoinSessionAsyncComplete(false)).Times(1);
m_gameliftClientManager->JoinSessionAsync(AzFramework::JoinSessionRequest());
m_gameliftClientManager->JoinSessionAsync(Multiplayer::JoinSessionRequest());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // capture 1 error message
}
@ -698,7 +698,7 @@ TEST_F(AWSGameLiftClientManagerTest, SearchSessions_CallWithValidRequestAndSucce
.Times(1)
.WillOnce(::testing::Return(outcome));
AzFramework::SearchSessionsResponse expectedResponse = GetValidSearchSessionsResponse();
Multiplayer::SearchSessionsResponse expectedResponse = GetValidSearchSessionsResponse();
auto result = m_gameliftClientManager->SearchSessions(request);
EXPECT_TRUE(result.m_sessionConfigs.size() != 0);
}
@ -713,7 +713,7 @@ TEST_F(AWSGameLiftClientManagerTest, SearchSessionsAsync_CallWithoutClientSetup_
SessionAsyncRequestNotificationsHandlerMock sessionHandlerMock;
EXPECT_CALL(sessionHandlerMock,
OnSearchSessionsAsyncComplete(SearchSessionsResponseMatcher(AzFramework::SearchSessionsResponse()))).Times(1);
OnSearchSessionsAsyncComplete(SearchSessionsResponseMatcher(Multiplayer::SearchSessionsResponse()))).Times(1);
AZ_TEST_START_TRACE_SUPPRESSION;
m_gameliftClientManager->SearchSessionsAsync(request);
@ -725,9 +725,9 @@ TEST_F(AWSGameLiftClientManagerTest, SearchSessionsAsync_CallWithInvalidRequest_
AZ_TEST_START_TRACE_SUPPRESSION;
SessionAsyncRequestNotificationsHandlerMock sessionHandlerMock;
EXPECT_CALL(sessionHandlerMock,
OnSearchSessionsAsyncComplete(SearchSessionsResponseMatcher(AzFramework::SearchSessionsResponse()))).Times(1);
OnSearchSessionsAsyncComplete(SearchSessionsResponseMatcher(Multiplayer::SearchSessionsResponse()))).Times(1);
m_gameliftClientManager->SearchSessionsAsync(AzFramework::SearchSessionsRequest());
m_gameliftClientManager->SearchSessionsAsync(Multiplayer::SearchSessionsRequest());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // capture 1 error message
}
@ -746,7 +746,7 @@ TEST_F(AWSGameLiftClientManagerTest, SearchSessionsAsync_CallWithValidRequestAnd
SessionAsyncRequestNotificationsHandlerMock sessionHandlerMock;
EXPECT_CALL(sessionHandlerMock,
OnSearchSessionsAsyncComplete(SearchSessionsResponseMatcher(AzFramework::SearchSessionsResponse()))).Times(1);
OnSearchSessionsAsyncComplete(SearchSessionsResponseMatcher(Multiplayer::SearchSessionsResponse()))).Times(1);
AZ_TEST_START_TRACE_SUPPRESSION;
m_gameliftClientManager->SearchSessionsAsync(request);
@ -765,7 +765,7 @@ TEST_F(AWSGameLiftClientManagerTest, SearchSessionsAsync_CallWithValidRequestAnd
.Times(1)
.WillOnce(::testing::Return(outcome));
AzFramework::SearchSessionsResponse expectedResponse = GetValidSearchSessionsResponse();
Multiplayer::SearchSessionsResponse expectedResponse = GetValidSearchSessionsResponse();
SessionAsyncRequestNotificationsHandlerMock sessionHandlerMock;
EXPECT_CALL(sessionHandlerMock,
OnSearchSessionsAsyncComplete(SearchSessionsResponseMatcher(expectedResponse))).Times(1);
@ -926,7 +926,7 @@ TEST_F(AWSGameLiftClientManagerTest, StopMatchmaking_CallWithoutClientSetup_GetE
TEST_F(AWSGameLiftClientManagerTest, StopMatchmaking_CallWithInvalidRequest_GetError)
{
AZ_TEST_START_TRACE_SUPPRESSION;
m_gameliftClientManager->StopMatchmaking(AzFramework::StopMatchmakingRequest());
m_gameliftClientManager->StopMatchmaking(Multiplayer::StopMatchmakingRequest());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // capture 1 error message
}
@ -1029,7 +1029,7 @@ TEST_F(AWSGameLiftClientManagerTest, AcceptMatch_CallWithoutClientSetup_GetError
TEST_F(AWSGameLiftClientManagerTest, AcceptMatch_CallWithInvalidRequest_GetError)
{
AZ_TEST_START_TRACE_SUPPRESSION;
m_gameliftClientManager->AcceptMatch(AzFramework::AcceptMatchRequest());
m_gameliftClientManager->AcceptMatch(Multiplayer::AcceptMatchRequest());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // capture 1 error message
}

@ -9,10 +9,10 @@
#pragma once
#include <AzCore/Interface/Interface.h>
#include <AzFramework/Session/ISessionRequests.h>
#include <AzFramework/Session/ISessionHandlingRequests.h>
#include <AzFramework/Matchmaking/IMatchmakingRequests.h>
#include <AzFramework/Matchmaking/MatchmakingNotifications.h>
#include <Multiplayer/Session/ISessionRequests.h>
#include <Multiplayer/Session/ISessionHandlingRequests.h>
#include <Multiplayer/Session/IMatchmakingRequests.h>
#include <Multiplayer/Session/MatchmakingNotifications.h>
#include <AzTest/AzTest.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
@ -58,17 +58,17 @@ public:
};
class MatchmakingAsyncRequestNotificationsHandlerMock
: public AzFramework::MatchmakingAsyncRequestNotificationBus::Handler
: public Multiplayer::MatchmakingAsyncRequestNotificationBus::Handler
{
public:
MatchmakingAsyncRequestNotificationsHandlerMock()
{
AzFramework::MatchmakingAsyncRequestNotificationBus::Handler::BusConnect();
Multiplayer::MatchmakingAsyncRequestNotificationBus::Handler::BusConnect();
}
~MatchmakingAsyncRequestNotificationsHandlerMock()
{
AzFramework::MatchmakingAsyncRequestNotificationBus::Handler::BusDisconnect();
Multiplayer::MatchmakingAsyncRequestNotificationBus::Handler::BusDisconnect();
}
MOCK_METHOD0(OnAcceptMatchAsyncComplete, void());
@ -77,17 +77,17 @@ public:
};
class MatchmakingNotificationsHandlerMock
: public AzFramework::MatchmakingNotificationBus::Handler
: public Multiplayer::MatchmakingNotificationBus::Handler
{
public:
MatchmakingNotificationsHandlerMock()
{
AzFramework::MatchmakingNotificationBus::Handler::BusConnect();
Multiplayer::MatchmakingNotificationBus::Handler::BusConnect();
}
~MatchmakingNotificationsHandlerMock()
{
AzFramework::MatchmakingNotificationBus::Handler::BusDisconnect();
Multiplayer::MatchmakingNotificationBus::Handler::BusDisconnect();
}
void OnMatchAcceptance() override
@ -117,39 +117,39 @@ public:
};
class SessionAsyncRequestNotificationsHandlerMock
: public AzFramework::SessionAsyncRequestNotificationBus::Handler
: public Multiplayer::SessionAsyncRequestNotificationBus::Handler
{
public:
SessionAsyncRequestNotificationsHandlerMock()
{
AzFramework::SessionAsyncRequestNotificationBus::Handler::BusConnect();
Multiplayer::SessionAsyncRequestNotificationBus::Handler::BusConnect();
}
~SessionAsyncRequestNotificationsHandlerMock()
{
AzFramework::SessionAsyncRequestNotificationBus::Handler::BusDisconnect();
Multiplayer::SessionAsyncRequestNotificationBus::Handler::BusDisconnect();
}
MOCK_METHOD1(OnCreateSessionAsyncComplete, void(const AZStd::string&));
MOCK_METHOD1(OnSearchSessionsAsyncComplete, void(const AzFramework::SearchSessionsResponse&));
MOCK_METHOD1(OnSearchSessionsAsyncComplete, void(const Multiplayer::SearchSessionsResponse&));
MOCK_METHOD1(OnJoinSessionAsyncComplete, void(bool));
MOCK_METHOD0(OnLeaveSessionAsyncComplete, void());
};
class SessionHandlingClientRequestsMock
: public AzFramework::ISessionHandlingClientRequests
: public Multiplayer::ISessionHandlingClientRequests
{
public:
SessionHandlingClientRequestsMock()
{
AZ::Interface<AzFramework::ISessionHandlingClientRequests>::Register(this);
AZ::Interface<Multiplayer::ISessionHandlingClientRequests>::Register(this);
}
virtual ~SessionHandlingClientRequestsMock()
{
AZ::Interface<AzFramework::ISessionHandlingClientRequests>::Unregister(this);
AZ::Interface<Multiplayer::ISessionHandlingClientRequests>::Unregister(this);
}
MOCK_METHOD1(RequestPlayerJoinSession, bool(const AzFramework::SessionConnectionConfig&));
MOCK_METHOD1(RequestPlayerJoinSession, bool(const Multiplayer::SessionConnectionConfig&));
MOCK_METHOD0(RequestPlayerLeaveSession, void());
};

@ -35,7 +35,7 @@ TEST_F(AWSGameLiftAcceptMatchActivityTest, BuildAWSGameLiftAcceptMatchRequest_Ca
TEST_F(AWSGameLiftAcceptMatchActivityTest, ValidateAcceptMatchRequest_CallWithBaseType_GetFalseResult)
{
AZ_TEST_START_TRACE_SUPPRESSION;
auto result = AcceptMatchActivity::ValidateAcceptMatchRequest(AzFramework::AcceptMatchRequest());
auto result = AcceptMatchActivity::ValidateAcceptMatchRequest(Multiplayer::AcceptMatchRequest());
EXPECT_FALSE(result);
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // capture 1 error message
}

@ -39,7 +39,7 @@ TEST_F(AWSGameLiftCreateSessionActivityTest, BuildAWSGameLiftCreateGameSessionRe
TEST_F(AWSGameLiftCreateSessionActivityTest, ValidateCreateSessionRequest_CallWithBaseType_GetFalseResult)
{
auto result = CreateSessionActivity::ValidateCreateSessionRequest(AzFramework::CreateSessionRequest());
auto result = CreateSessionActivity::ValidateCreateSessionRequest(Multiplayer::CreateSessionRequest());
EXPECT_FALSE(result);
}

@ -35,7 +35,7 @@ TEST_F(AWSGameLiftCreateSessionOnQueueActivityTest, BuildAWSGameLiftCreateGameSe
TEST_F(AWSGameLiftCreateSessionOnQueueActivityTest, ValidateCreateSessionOnQueueRequest_CallWithBaseType_GetFalseResult)
{
auto result = CreateSessionOnQueueActivity::ValidateCreateSessionOnQueueRequest(AzFramework::CreateSessionRequest());
auto result = CreateSessionOnQueueActivity::ValidateCreateSessionOnQueueRequest(Multiplayer::CreateSessionRequest());
EXPECT_FALSE(result);
}

@ -6,7 +6,7 @@
*
*/
#include <AzFramework/Session/ISessionHandlingRequests.h>
#include <Multiplayer/Session/ISessionHandlingRequests.h>
#include <AWSGameLiftClientFixture.h>
#include <Activity/AWSGameLiftJoinSessionActivity.h>
@ -47,7 +47,7 @@ TEST_F(AWSGameLiftJoinSessionActivityTest, BuildSessionConnectionConfig_Call_Get
TEST_F(AWSGameLiftJoinSessionActivityTest, ValidateJoinSessionRequest_CallWithBaseType_GetFalseResult)
{
AZ_TEST_START_TRACE_SUPPRESSION;
auto result = JoinSessionActivity::ValidateJoinSessionRequest(AzFramework::JoinSessionRequest());
auto result = JoinSessionActivity::ValidateJoinSessionRequest(Multiplayer::JoinSessionRequest());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // capture 1 error message
EXPECT_FALSE(result);
}

@ -6,7 +6,7 @@
*
*/
#include <AzFramework/Session/SessionConfig.h>
#include <Multiplayer/Session/SessionConfig.h>
#include <Activity/AWSGameLiftSearchSessionsActivity.h>
#include <AWSGameLiftClientFixture.h>
@ -45,7 +45,7 @@ TEST_F(AWSGameLiftSearchSessionsActivityTest, BuildAWSGameLiftSearchGameSessions
TEST_F(AWSGameLiftSearchSessionsActivityTest, ValidateSearchSessionsRequest_CallWithBaseType_GetFalseResult)
{
AZ_TEST_START_TRACE_SUPPRESSION;
auto result = SearchSessionsActivity::ValidateSearchSessionsRequest(AzFramework::SearchSessionsRequest());
auto result = SearchSessionsActivity::ValidateSearchSessionsRequest(Multiplayer::SearchSessionsRequest());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // capture 1 error message
EXPECT_FALSE(result);
}

@ -49,7 +49,7 @@ TEST_F(AWSGameLiftStartMatchmakingActivityTest, BuildAWSGameLiftStartMatchmaking
TEST_F(AWSGameLiftStartMatchmakingActivityTest, ValidateStartMatchmakingRequest_CallWithBaseType_GetFalseResult)
{
AZ_TEST_START_TRACE_SUPPRESSION;
auto result = StartMatchmakingActivity::ValidateStartMatchmakingRequest(AzFramework::StartMatchmakingRequest());
auto result = StartMatchmakingActivity::ValidateStartMatchmakingRequest(Multiplayer::StartMatchmakingRequest());
EXPECT_FALSE(result);
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // capture 1 error message
}

@ -26,7 +26,7 @@ TEST_F(AWSGameLiftStopMatchmakingActivityTest, BuildAWSGameLiftStopMatchmakingRe
TEST_F(AWSGameLiftStopMatchmakingActivityTest, ValidateStopMatchmakingRequest_CallWithoutTicketId_GetFalseResult)
{
AZ_TEST_START_TRACE_SUPPRESSION;
auto result = StopMatchmakingActivity::ValidateStopMatchmakingRequest(AzFramework::StopMatchmakingRequest());
auto result = StopMatchmakingActivity::ValidateStopMatchmakingRequest(Multiplayer::StopMatchmakingRequest());
EXPECT_FALSE(result);
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // capture 1 error message
}

@ -25,7 +25,7 @@ ly_add_target(
BUILD_DEPENDENCIES
PRIVATE
AZ::AzCore
AZ::AzFramework
Gem::Multiplayer.Static
3rdParty::AWSGameLiftServerSDK
)
@ -62,8 +62,8 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
BUILD_DEPENDENCIES
PRIVATE
AZ::AzCore
AZ::AzFramework
AZ::AzTest
Gem::Multiplayer.Static
Gem::AWSGameLift.Server.Static
3rdParty::AWSGameLiftServerSDK
)

@ -21,7 +21,7 @@
#include <AzCore/JSON/stringbuffer.h>
#include <AzCore/JSON/writer.h>
#include <AzCore/std/bind/bind.h>
#include <AzFramework/Session/SessionNotifications.h>
#include <Multiplayer/Session/SessionNotifications.h>
namespace AWSGameLift
{
@ -50,7 +50,7 @@ namespace AWSGameLift
AZ::Interface<IAWSGameLiftServerRequests>::Unregister(this);
}
bool AWSGameLiftServerManager::AddConnectedPlayer(const AzFramework::PlayerConnectionConfig& playerConnectionConfig)
bool AWSGameLiftServerManager::AddConnectedPlayer(const Multiplayer::PlayerConnectionConfig& playerConnectionConfig)
{
AZStd::lock_guard<AZStd::mutex> lock(m_gameliftMutex);
if (m_connectedPlayers.contains(playerConnectionConfig.m_playerConnectionId))
@ -100,9 +100,9 @@ namespace AWSGameLift
return serverProcessDesc;
}
AzFramework::SessionConfig AWSGameLiftServerManager::BuildSessionConfig(const Aws::GameLift::Server::Model::GameSession& gameSession)
Multiplayer::SessionConfig AWSGameLiftServerManager::BuildSessionConfig(const Aws::GameLift::Server::Model::GameSession& gameSession)
{
AzFramework::SessionConfig sessionConfig;
Multiplayer::SessionConfig sessionConfig;
sessionConfig.m_dnsName = gameSession.GetDnsName().c_str();
AZStd::string propertiesOutput = "";
@ -437,9 +437,9 @@ namespace AWSGameLift
void AWSGameLiftServerManager::HandleDestroySession()
{
// No further request should be handled by GameLift server manager at this point
if (AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Get())
if (AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Get())
{
AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Unregister(this);
AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Unregister(this);
}
AZ_TracePrintf(AWSGameLiftServerManagerName, "Server process is scheduled to be shut down at %s",
@ -448,7 +448,7 @@ namespace AWSGameLift
// Send notifications to handler(s) to gracefully shut down the server process.
bool destroySessionResult = true;
AZ::EBusReduceResult<bool&, AZStd::logical_and<bool>> result(destroySessionResult);
AzFramework::SessionNotificationBus::BroadcastResult(result, &AzFramework::SessionNotifications::OnDestroySessionBegin);
Multiplayer::SessionNotificationBus::BroadcastResult(result, &Multiplayer::SessionNotifications::OnDestroySessionBegin);
if (!destroySessionResult)
{
@ -461,7 +461,7 @@ namespace AWSGameLift
if (processEndingOutcome.IsSuccess())
{
AZ_TracePrintf(AWSGameLiftServerManagerName, "ProcessEnding request against Amazon GameLift service succeeded.");
AzFramework::SessionNotificationBus::Broadcast(&AzFramework::SessionNotifications::OnDestroySessionEnd);
Multiplayer::SessionNotificationBus::Broadcast(&Multiplayer::SessionNotifications::OnDestroySessionEnd);
}
else
{
@ -470,7 +470,7 @@ namespace AWSGameLift
}
}
void AWSGameLiftServerManager::HandlePlayerLeaveSession(const AzFramework::PlayerConnectionConfig& playerConnectionConfig)
void AWSGameLiftServerManager::HandlePlayerLeaveSession(const Multiplayer::PlayerConnectionConfig& playerConnectionConfig)
{
AZStd::string playerSessionId = "";
RemoveConnectedPlayer(playerConnectionConfig.m_playerConnectionId, playerSessionId);
@ -536,12 +536,12 @@ namespace AWSGameLift
void AWSGameLiftServerManager::OnStartGameSession(const Aws::GameLift::Server::Model::GameSession& gameSession)
{
UpdateGameSessionData(gameSession);
AzFramework::SessionConfig sessionConfig = BuildSessionConfig(gameSession);
Multiplayer::SessionConfig sessionConfig = BuildSessionConfig(gameSession);
bool createSessionResult = true;
AZ::EBusReduceResult<bool&, AZStd::logical_and<bool>> result(createSessionResult);
AzFramework::SessionNotificationBus::BroadcastResult(
result, &AzFramework::SessionNotifications::OnCreateSessionBegin, sessionConfig);
Multiplayer::SessionNotificationBus::BroadcastResult(
result, &Multiplayer::SessionNotifications::OnCreateSessionBegin, sessionConfig);
if (createSessionResult)
{
@ -552,11 +552,11 @@ namespace AWSGameLift
{
AZ_TracePrintf(AWSGameLiftServerManagerName, "ActivateGameSession request against Amazon GameLift service succeeded.");
// Register server manager as handler once game session has been activated
if (!AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Get())
if (!AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Get())
{
AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Register(this);
AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Register(this);
}
AzFramework::SessionNotificationBus::Broadcast(&AzFramework::SessionNotifications::OnCreateSessionEnd);
Multiplayer::SessionNotificationBus::Broadcast(&Multiplayer::SessionNotifications::OnCreateSessionEnd);
}
else
{
@ -583,16 +583,16 @@ namespace AWSGameLift
{
bool healthCheckResult = true;
AZ::EBusReduceResult<bool&, AZStd::logical_and<bool>> result(healthCheckResult);
AzFramework::SessionNotificationBus::BroadcastResult(result, &AzFramework::SessionNotifications::OnSessionHealthCheck);
Multiplayer::SessionNotificationBus::BroadcastResult(result, &Multiplayer::SessionNotifications::OnSessionHealthCheck);
return m_serverSDKInitialized && healthCheckResult;
}
void AWSGameLiftServerManager::OnUpdateGameSession(const Aws::GameLift::Server::Model::UpdateGameSession& updateGameSession)
{
AzFramework::SessionConfig sessionConfig = BuildSessionConfig(updateGameSession.GetGameSession());
Multiplayer::SessionConfig sessionConfig = BuildSessionConfig(updateGameSession.GetGameSession());
Aws::GameLift::Server::Model::UpdateReason updateReason = updateGameSession.GetUpdateReason();
AzFramework::SessionNotificationBus::Broadcast(&AzFramework::SessionNotifications::OnUpdateSessionBegin,
Multiplayer::SessionNotificationBus::Broadcast(&Multiplayer::SessionNotifications::OnUpdateSessionBegin,
sessionConfig, Aws::GameLift::Server::Model::UpdateReasonMapper::GetNameForUpdateReason(updateReason).c_str());
// Update game session data locally
@ -601,7 +601,7 @@ namespace AWSGameLift
UpdateGameSessionData(updateGameSession.GetGameSession());
}
AzFramework::SessionNotificationBus::Broadcast(&AzFramework::SessionNotifications::OnUpdateSessionEnd);
Multiplayer::SessionNotificationBus::Broadcast(&Multiplayer::SessionNotifications::OnUpdateSessionEnd);
}
bool AWSGameLiftServerManager::RemoveConnectedPlayer(uint32_t playerConnectionId, AZStd::string& outPlayerSessionId)
@ -713,7 +713,7 @@ namespace AWSGameLift
}
}
bool AWSGameLiftServerManager::ValidatePlayerJoinSession(const AzFramework::PlayerConnectionConfig& playerConnectionConfig)
bool AWSGameLiftServerManager::ValidatePlayerJoinSession(const Multiplayer::PlayerConnectionConfig& playerConnectionConfig)
{
uint32_t playerConnectionId = playerConnectionConfig.m_playerConnectionId;
AZStd::string playerSessionId = playerConnectionConfig.m_playerSessionId;

@ -16,8 +16,8 @@
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/string/string.h>
#include <AzCore/std/smart_ptr/unique_ptr.h>
#include <AzFramework/Session/ISessionHandlingRequests.h>
#include <AzFramework/Session/SessionConfig.h>
#include <Multiplayer/Session/ISessionHandlingRequests.h>
#include <Multiplayer/Session/SessionConfig.h>
#include <AWSGameLiftPlayer.h>
#include <Request/AWSGameLiftServerRequestBus.h>
@ -37,7 +37,7 @@ namespace AWSGameLift
//! Manage the server process for hosting game sessions via GameLiftServerSDK.
class AWSGameLiftServerManager
: public AWSGameLiftServerRequestBus::Handler
, public AzFramework::ISessionHandlingProviderRequests
, public Multiplayer::ISessionHandlingProviderRequests
{
public:
static constexpr const char AWSGameLiftServerManagerName[] = "AWSGameLiftServerManager";
@ -117,8 +117,8 @@ namespace AWSGameLift
// ISessionHandlingProviderRequests interface implementation
void HandleDestroySession() override;
bool ValidatePlayerJoinSession(const AzFramework::PlayerConnectionConfig& playerConnectionConfig) override;
void HandlePlayerLeaveSession(const AzFramework::PlayerConnectionConfig& playerConnectionConfig) override;
bool ValidatePlayerJoinSession(const Multiplayer::PlayerConnectionConfig& playerConnectionConfig) override;
void HandlePlayerLeaveSession(const Multiplayer::PlayerConnectionConfig& playerConnectionConfig) override;
AZ::IO::Path GetExternalSessionCertificate() override;
AZ::IO::Path GetInternalSessionCertificate() override;
@ -126,7 +126,7 @@ namespace AWSGameLift
void SetGameLiftServerSDKWrapper(AZStd::unique_ptr<GameLiftServerSDKWrapper> gameLiftServerSDKWrapper);
//! Add connected player session id.
bool AddConnectedPlayer(const AzFramework::PlayerConnectionConfig& playerConnectionConfig);
bool AddConnectedPlayer(const Multiplayer::PlayerConnectionConfig& playerConnectionConfig);
//! Get active server player data from lazy loaded game session for server match backfill
AZStd::vector<AWSGameLiftPlayer> GetActiveServerMatchBackfillPlayers();
@ -157,7 +157,7 @@ namespace AWSGameLift
void BuildStopMatchBackfillRequest(const AZStd::string& ticketId, Aws::GameLift::Server::Model::StopMatchBackfillRequest& outRequest);
//! Build session config by using AWS GameLift Server GameSession Model.
AzFramework::SessionConfig BuildSessionConfig(const Aws::GameLift::Server::Model::GameSession& gameSession);
Multiplayer::SessionConfig BuildSessionConfig(const Aws::GameLift::Server::Model::GameSession& gameSession);
//! Check whether matchmaking data is in proper format
bool IsMatchmakingDataValid();

@ -11,8 +11,8 @@
#include <AzCore/Interface/Interface.h>
#include <AzFramework/IO/LocalFileIO.h>
#include <AzFramework/Session/SessionConfig.h>
#include <AzFramework/Session/SessionNotifications.h>
#include <Multiplayer/Session/SessionConfig.h>
#include <Multiplayer/Session/SessionNotifications.h>
namespace UnitTest
{
@ -154,25 +154,25 @@ R"({
}
class SessionNotificationsHandlerMock
: public AzFramework::SessionNotificationBus::Handler
: public Multiplayer::SessionNotificationBus::Handler
{
public:
SessionNotificationsHandlerMock()
{
AzFramework::SessionNotificationBus::Handler::BusConnect();
Multiplayer::SessionNotificationBus::Handler::BusConnect();
}
~SessionNotificationsHandlerMock()
{
AzFramework::SessionNotificationBus::Handler::BusDisconnect();
Multiplayer::SessionNotificationBus::Handler::BusDisconnect();
}
MOCK_METHOD0(OnSessionHealthCheck, bool());
MOCK_METHOD1(OnCreateSessionBegin, bool(const AzFramework::SessionConfig&));
MOCK_METHOD1(OnCreateSessionBegin, bool(const Multiplayer::SessionConfig&));
MOCK_METHOD0(OnCreateSessionEnd, void());
MOCK_METHOD0(OnDestroySessionBegin, bool());
MOCK_METHOD0(OnDestroySessionEnd, void());
MOCK_METHOD2(OnUpdateSessionBegin, void(const AzFramework::SessionConfig&, const AZStd::string&));
MOCK_METHOD2(OnUpdateSessionBegin, void(const Multiplayer::SessionConfig&, const AZStd::string&));
MOCK_METHOD0(OnUpdateSessionEnd, void());
};
@ -255,9 +255,9 @@ R"({
{
m_serverManager->InitializeGameLiftServerSDK();
m_serverManager->NotifyGameLiftProcessReady();
if (!AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Get())
if (!AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Get())
{
AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Register(m_serverManager.get());
AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Register(m_serverManager.get());
}
SessionNotificationsHandlerMock handlerMock;
@ -270,16 +270,16 @@ R"({
m_serverManager->m_gameLiftServerSDKWrapperMockPtr->m_onProcessTerminateFunc();
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
EXPECT_FALSE(AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Get());
EXPECT_FALSE(AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Get());
}
TEST_F(GameLiftServerManagerTest, OnProcessTerminate_OnDestroySessionBeginReturnsTrue_TerminationNotificationSent)
{
m_serverManager->InitializeGameLiftServerSDK();
m_serverManager->NotifyGameLiftProcessReady();
if (!AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Get())
if (!AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Get())
{
AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Register(m_serverManager.get());
AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Register(m_serverManager.get());
}
SessionNotificationsHandlerMock handlerMock;
@ -292,16 +292,16 @@ R"({
m_serverManager->m_gameLiftServerSDKWrapperMockPtr->m_onProcessTerminateFunc();
EXPECT_FALSE(AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Get());
EXPECT_FALSE(AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Get());
}
TEST_F(GameLiftServerManagerTest, OnProcessTerminate_OnDestroySessionBeginReturnsTrue_TerminationNotificationSentButFail)
{
m_serverManager->InitializeGameLiftServerSDK();
m_serverManager->NotifyGameLiftProcessReady();
if (!AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Get())
if (!AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Get())
{
AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Register(m_serverManager.get());
AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Register(m_serverManager.get());
}
SessionNotificationsHandlerMock handlerMock;
@ -316,7 +316,7 @@ R"({
m_serverManager->m_gameLiftServerSDKWrapperMockPtr->m_onProcessTerminateFunc();
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
EXPECT_FALSE(AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Get());
EXPECT_FALSE(AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Get());
}
TEST_F(GameLiftServerManagerTest, OnHealthCheck_OnSessionHealthCheckReturnsTrue_CallbackFunctionReturnsTrue)
@ -379,7 +379,7 @@ R"({
testProperty.SetValue("testValue");
testSession.AddGameProperties(testProperty);
m_serverManager->m_gameLiftServerSDKWrapperMockPtr->m_onStartGameSessionFunc(testSession);
EXPECT_TRUE(AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Get());
EXPECT_TRUE(AZ::Interface<Multiplayer::ISessionHandlingProviderRequests>::Get());
m_serverManager->HandleDestroySession();
}
@ -465,14 +465,14 @@ R"({
TEST_F(GameLiftServerManagerTest, ValidatePlayerJoinSession_CallWithInvalidConnectionConfig_GetFalseResultAndExpectedErrorLog)
{
AZ_TEST_START_TRACE_SUPPRESSION;
auto result = m_serverManager->ValidatePlayerJoinSession(AzFramework::PlayerConnectionConfig());
auto result = m_serverManager->ValidatePlayerJoinSession(Multiplayer::PlayerConnectionConfig());
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
EXPECT_FALSE(result);
}
TEST_F(GameLiftServerManagerTest, ValidatePlayerJoinSession_CallWithDuplicatedConnectionId_GetFalseResultAndExpectedErrorLog)
{
AzFramework::PlayerConnectionConfig connectionConfig1;
Multiplayer::PlayerConnectionConfig connectionConfig1;
connectionConfig1.m_playerConnectionId = 123;
connectionConfig1.m_playerSessionId = "dummyPlayerSessionId1";
GenericOutcome successOutcome(nullptr);
@ -480,7 +480,7 @@ R"({
.Times(1)
.WillOnce(Return(successOutcome));
m_serverManager->ValidatePlayerJoinSession(connectionConfig1);
AzFramework::PlayerConnectionConfig connectionConfig2;
Multiplayer::PlayerConnectionConfig connectionConfig2;
connectionConfig2.m_playerConnectionId = 123;
connectionConfig2.m_playerSessionId = "dummyPlayerSessionId2";
AZ_TEST_START_TRACE_SUPPRESSION;
@ -491,7 +491,7 @@ R"({
TEST_F(GameLiftServerManagerTest, ValidatePlayerJoinSession_CallWithValidConnectionConfigButErrorOutcome_GetFalseResultAndExpectedErrorLog)
{
AzFramework::PlayerConnectionConfig connectionConfig;
Multiplayer::PlayerConnectionConfig connectionConfig;
connectionConfig.m_playerConnectionId = 123;
connectionConfig.m_playerSessionId = "dummyPlayerSessionId1";
EXPECT_CALL(*(m_serverManager->m_gameLiftServerSDKWrapperMockPtr), AcceptPlayerSession(testing::_)).Times(1);
@ -503,7 +503,7 @@ R"({
TEST_F(GameLiftServerManagerTest, ValidatePlayerJoinSession_CallWithValidConnectionConfigAndSuccessOutcome_GetTrueResult)
{
AzFramework::PlayerConnectionConfig connectionConfig;
Multiplayer::PlayerConnectionConfig connectionConfig;
connectionConfig.m_playerConnectionId = 123;
connectionConfig.m_playerSessionId = "dummyPlayerSessionId1";
GenericOutcome successOutcome(nullptr);
@ -516,7 +516,7 @@ R"({
TEST_F(GameLiftServerManagerTest, ValidatePlayerJoinSession_CallWithFirstErrorSecondSuccess_GetFirstFalseSecondTrueResult)
{
AzFramework::PlayerConnectionConfig connectionConfig1;
Multiplayer::PlayerConnectionConfig connectionConfig1;
connectionConfig1.m_playerConnectionId = 123;
connectionConfig1.m_playerSessionId = "dummyPlayerSessionId1";
GenericOutcome successOutcome(nullptr);
@ -530,7 +530,7 @@ R"({
auto result = m_serverManager->ValidatePlayerJoinSession(connectionConfig1);
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
EXPECT_FALSE(result);
AzFramework::PlayerConnectionConfig connectionConfig2;
Multiplayer::PlayerConnectionConfig connectionConfig2;
connectionConfig2.m_playerConnectionId = 123;
connectionConfig2.m_playerSessionId = "dummyPlayerSessionId2";
result = m_serverManager->ValidatePlayerJoinSession(connectionConfig2);
@ -549,7 +549,7 @@ R"({
for (int index = 0; index < testThreadNumber; index++)
{
testThreadPool.emplace_back(AZStd::thread([&]() {
AzFramework::PlayerConnectionConfig connectionConfig;
Multiplayer::PlayerConnectionConfig connectionConfig;
connectionConfig.m_playerConnectionId = 123;
connectionConfig.m_playerSessionId = "dummyPlayerSessionId";
auto result = m_serverManager->ValidatePlayerJoinSession(connectionConfig);
@ -571,19 +571,19 @@ R"({
EXPECT_CALL(*(m_serverManager->m_gameLiftServerSDKWrapperMockPtr), RemovePlayerSession(testing::_)).Times(0);
AZ_TEST_START_TRACE_SUPPRESSION;
m_serverManager->HandlePlayerLeaveSession(AzFramework::PlayerConnectionConfig());
m_serverManager->HandlePlayerLeaveSession(Multiplayer::PlayerConnectionConfig());
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
}
TEST_F(GameLiftServerManagerTest, HandlePlayerLeaveSession_CallWithNonExistentPlayerConnectionId_GetExpectedErrorLog)
{
AzFramework::PlayerConnectionConfig connectionConfig;
Multiplayer::PlayerConnectionConfig connectionConfig;
connectionConfig.m_playerConnectionId = 123;
connectionConfig.m_playerSessionId = "dummyPlayerSessionId";
auto result = m_serverManager->AddConnectedTestPlayer(connectionConfig);
EXPECT_TRUE(result);
AzFramework::PlayerConnectionConfig connectionConfig1;
Multiplayer::PlayerConnectionConfig connectionConfig1;
connectionConfig1.m_playerConnectionId = 456;
connectionConfig1.m_playerSessionId = "dummyPlayerSessionId";
@ -596,7 +596,7 @@ R"({
TEST_F(GameLiftServerManagerTest, HandlePlayerLeaveSession_CallWithValidConnectionConfigButErrorOutcome_GetExpectedErrorLog)
{
AzFramework::PlayerConnectionConfig connectionConfig;
Multiplayer::PlayerConnectionConfig connectionConfig;
connectionConfig.m_playerConnectionId = 123;
connectionConfig.m_playerSessionId = "dummyPlayerSessionId";
auto result = m_serverManager->AddConnectedTestPlayer(connectionConfig);
@ -615,7 +615,7 @@ R"({
TEST_F(GameLiftServerManagerTest, HandlePlayerLeaveSession_CallWithValidConnectionConfigAndSuccessOutcome_RemovePlayerSessionNotificationSent)
{
AzFramework::PlayerConnectionConfig connectionConfig;
Multiplayer::PlayerConnectionConfig connectionConfig;
connectionConfig.m_playerConnectionId = 123;
connectionConfig.m_playerSessionId = "dummyPlayerSessionId";
auto result = m_serverManager->AddConnectedTestPlayer(connectionConfig);
@ -631,7 +631,7 @@ R"({
TEST_F(GameLiftServerManagerTest, HandlePlayerLeaveSession_CallWithMultithread_OnlyOneNotificationIsSent)
{
AzFramework::PlayerConnectionConfig connectionConfig;
Multiplayer::PlayerConnectionConfig connectionConfig;
connectionConfig.m_playerConnectionId = 123;
connectionConfig.m_playerSessionId = "dummyPlayerSessionId";
auto result = m_serverManager->AddConnectedTestPlayer(connectionConfig);

@ -95,7 +95,7 @@ namespace UnitTest
UpdateGameSessionData(m_testGameSession);
}
bool AddConnectedTestPlayer(const AzFramework::PlayerConnectionConfig& playerConnectionConfig)
bool AddConnectedTestPlayer(const Multiplayer::PlayerConnectionConfig& playerConnectionConfig)
{
return AddConnectedPlayer(playerConnectionConfig);
}

@ -0,0 +1,154 @@
/*
* 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 <viewsrg.srgi>
#define UvSetCount 2
#include <Atom/RPI/ShaderResourceGroups/DefaultObjectSrg.azsli>
#include <Atom/RPI/ShaderResourceGroups/DefaultDrawSrg.azsli>
#include <Atom/RPI/TangentSpace.azsli>
// These enums need to be kept in sync with the enum values in DebugVertexStreams_IncompatibleEnums.lua
option enum class DebugVertexStream { Normals, Tangents, Bitangents, Uvs, TangentW } o_debugVertexStream = DebugVertexStream::Normals;
option enum class TangentOptions { UseVertexData, UseSurfaceGradient} o_tangentOptions = TangentOptions::UseVertexData;
option enum class BitangentOptions { UseVertexData, UseSurfaceGradient, ReconstructBitangent} o_bitangentOptions = BitangentOptions::UseVertexData;
option enum class ColorDisplayMode {ColorSpace, UnitSpace} o_colorDisplayMode = ColorDisplayMode::ColorSpace;
ShaderResourceGroup MaterialSrg : SRG_PerMaterial
{
uint m_uvIndex;
}
struct VSInput
{
// Base fields (required by the template azsli file)...
float3 m_position : POSITION;
float3 m_normal : NORMAL;
float4 m_tangent : TANGENT;
float3 m_bitangent : BITANGENT;
// Extended fields (only referenced in this azsl file)...
float2 m_uv0 : UV0;
float2 m_uv1 : UV1;
};
struct VSOutput
{
// Base fields (required by the template azsli file)...
// "centroid" is needed for SV_Depth to compile
precise linear centroid float4 m_position : SV_Position;
float3 m_normal: NORMAL;
float4 m_tangent : TANGENT;
float3 m_bitangent : BITANGENT;
float3 m_worldPosition : UV0;
// Extended fields (only referenced in this azsl file)...
float2 m_uv[UvSetCount] : UV1;
};
VSOutput MainVS(VSInput IN)
{
VSOutput OUT;
OUT.m_worldPosition = mul(ObjectSrg::GetWorldMatrix(), float4(IN.m_position, 1.0)).xyz;
OUT.m_position = mul(ViewSrg::m_viewProjectionMatrix, float4(OUT.m_worldPosition, 1.0));
// Only UV0 is supported
OUT.m_uv[0] = IN.m_uv0;
OUT.m_uv[1] = IN.m_uv1;
float4x4 objectToWorld = ObjectSrg::GetWorldMatrix();
float3x3 objectToWorldIT = ObjectSrg::GetWorldMatrixInverseTranspose();
ConstructTBN(IN.m_normal, IN.m_tangent, IN.m_bitangent, objectToWorld, objectToWorldIT, OUT.m_normal, OUT.m_tangent.xyz, OUT.m_bitangent);
OUT.m_tangent.w = IN.m_tangent.w;
return OUT;
}
struct PixelOutput
{
float4 m_color : SV_Target0;
};
float3 OffsetColor(float3 color)
{
if(o_colorDisplayMode == ColorDisplayMode::ColorSpace)
{
// Represent a vector in the (-1, -1, -1) to (1, 1, 1) range as a color in the (0, 0, 0) to (1, 1, 1) range
// Color key
// + x-axis: Light Coral
// - x-axis: Teal
// + y-axis: Bright Green
// - y-axis: Dark Magenta
// + z-axis: Medium Slate Blue
// - z-axis: Olive
return normalize(color) * 0.5 + 0.5;
}
else
{
// Use the normalized color, with any negative values represented as black
// + x-axis: Red
// - x-axis: Black
// + y-axis: Green
// - y-axis: Black
// + z-axis: Blue
// - z-axis: Black
return normalize(color);
}
}
PixelOutput MainPS(VSOutput IN)
{
PixelOutput OUT;
float3 tangents[UvSetCount] = { IN.m_tangent.xyz, IN.m_tangent.xyz };
float3 bitangents[UvSetCount] = { IN.m_bitangent.xyz, IN.m_bitangent.xyz };
if(o_bitangentOptions == BitangentOptions::ReconstructBitangent && MaterialSrg::m_uvIndex == 0)
{
bitangents[MaterialSrg::m_uvIndex] = cross(IN.m_normal.xyz, IN.m_tangent.xyz) * sign(IN.m_tangent.w);
}
else if((o_debugVertexStream == DebugVertexStream::Tangents && o_tangentOptions == TangentOptions::UseSurfaceGradient)
|| (o_debugVertexStream == DebugVertexStream::Bitangents && o_bitangentOptions == BitangentOptions::UseSurfaceGradient)
|| MaterialSrg::m_uvIndex > 0)
{
const bool isBackface = false;
SurfaceGradientNormalMapping_Init(IN.m_normal, IN.m_worldPosition, isBackface);
SurfaceGradientNormalMapping_GenerateTB(IN.m_uv[MaterialSrg::m_uvIndex], tangents[MaterialSrg::m_uvIndex], bitangents[MaterialSrg::m_uvIndex]);
}
float3 outColor = float3(1.0, 1.0, 1.0);
switch(o_debugVertexStream)
{
case DebugVertexStream::Normals:
outColor = OffsetColor(IN.m_normal);
break;
case DebugVertexStream::Tangents:
outColor = OffsetColor(tangents[MaterialSrg::m_uvIndex]);
break;
case DebugVertexStream::Bitangents:
outColor = OffsetColor(bitangents[MaterialSrg::m_uvIndex]);
break;
case DebugVertexStream::Uvs:
// Assume a tiled uv visualization, where anything greater than 1 wraps back around to 0
outColor = float3(frac(IN.m_uv[MaterialSrg::m_uvIndex].x), frac(IN.m_uv[MaterialSrg::m_uvIndex].y), 0.0f);
break;
case DebugVertexStream::TangentW:
float red = IN.m_tangent.w >= 0.0f ? 1.0f : 0.0f;
float green = IN.m_tangent.w <= 0.0f ? 1.0f : 0.0f;
float blue = IN.m_tangent.w == 0.0f ? 1.0f : 0.0f;
outColor = float3(red, green, blue);
break;
}
OUT.m_color.rgb = outColor;
OUT.m_color.a = 1.0;
return OUT;
}

@ -0,0 +1,4 @@
{
"materialType": "Materials/Special/DebugVertexStreams.materialtype",
"materialTypeVersion": 1
}

@ -0,0 +1,94 @@
{
"description": "A simple default base material for Atom testing.",
"version": 1,
"propertyLayout": {
"groups": [
{
"name": "general",
"displayName": "General Settings",
"description": "General settings."
}
],
"properties": {
"general": [
{
"name": "debugVertexStream",
"displayName": "Display Vertex Stream",
"description": "Display vertex stream interpolated over the triangle.",
"type": "Enum",
"defaultValue": "Normals",
"enumValues": [ "Normals", "Tangents", "Bitangents", "Uvs", "TangentW" ],
"connection": {
"type": "ShaderOption",
"name": "o_debugVertexStream"
}
},
{
"name": "tangentOptions",
"displayName": "Tangent Options",
"description": "Use the data from the vertices or use the Surface Gradient technique for calculating tangents.",
"type": "Enum",
"defaultValue": "UseVertexData",
"enumValues": [ "UseVertexData", "UseSurfaceGradient"],
"connection": {
"type": "ShaderOption",
"name": "o_tangentOptions"
}
},
{
"name": "bitangentOptions",
"displayName": "Bitangent Options",
"description": "Use the data from the vertices, use the Surface Gradient technique for calculating bitangents, or use the cross product to reconstruct the bitangents.",
"type": "Enum",
"defaultValue": "UseVertexData",
"enumValues": [ "UseVertexData", "UseSurfaceGradient", "ReconstructBitangent" ],
"connection": {
"type": "ShaderOption",
"name": "o_bitangentOptions"
}
},
{
"name": "colorDisplayMode",
"displayName": "Display Mode",
"description": "Offset the vector into the 0-1 range (ColorSpace), or display the raw unit vector including negative values (UnitSpace)",
"type": "Enum",
"defaultValue": "ColorSpace",
"enumValues": [ "ColorSpace", "UnitSpace"],
"connection": {
"type": "ShaderOption",
"name": "o_colorDisplayMode"
}
},
{
"name": "uvIndex",
"displayName": "UV Index",
"description": "UV set to display and use for tangents/bitangents.",
"type": "Enum",
"enumIsUv": true,
"defaultValue": "Tiled",
"connection": {
"type": "ShaderInput",
"name": "m_uvIndex"
}
}
]
}
},
"shaders": [
{
"file": "Materials/Special/DebugVertexStreams.shader"
}
],
"functors": [
{
"type": "Lua",
"args": {
"file": "DebugVertexStreams_IncompatibleEnums.lua"
}
}
],
"uvNameMap": {
"UV0": "Tiled",
"UV1": "Unwrapped"
}
}

@ -0,0 +1,24 @@
{
"Source" : "DebugVertexStreams.azsl",
"DepthStencilState" : {
"Depth" : { "Enable" : true, "CompareFunc" : "GreaterEqual" }
},
"DrawList" : "auxgeom",
"ProgramSettings":
{
"EntryPoints":
[
{
"name": "MainVS",
"type": "Vertex"
},
{
"name": "MainPS",
"type": "Fragment"
}
]
}
}

@ -0,0 +1,71 @@
--------------------------------------------------------------------------------------
--
-- 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
--
--
--
----------------------------------------------------------------------------------------------------
DebugVertexStream_Normals = 0
DebugVertexStream_Tangents = 1
DebugVertexStream_Bitangents = 2
DebugVertexStream_Uvs = 3
DebugVertexStream_TangentW = 4
function GetMaterialPropertyDependencies()
return { "general.debugVertexStream", "general.uvIndex"}
end
function ProcessEditor(context)
local vertexStream = context:GetMaterialPropertyValue_enum("general.debugVertexStream");
-- Depending on which vertex stream is being visualized, only certain settings are applicable
if(vertexStream == DebugVertexStream_Normals) then
-- Normals can be viewed as colors using either method
context:SetMaterialPropertyVisibility("general.colorDisplayMode", MaterialPropertyVisibility_Enabled)
-- Uv set and tangent/bitangent options do not impact normals
context:SetMaterialPropertyVisibility("general.tangentOptions", MaterialPropertyVisibility_Hidden)
context:SetMaterialPropertyVisibility("general.bitangentOptions", MaterialPropertyVisibility_Hidden)
context:SetMaterialPropertyVisibility("general.uvIndex", MaterialPropertyVisibility_Hidden)
elseif(vertexStream == DebugVertexStream_Tangents) then
-- Tangents can be viewed using either color display mode, and are affected by tangent options and uv index
context:SetMaterialPropertyVisibility("general.tangentOptions", MaterialPropertyVisibility_Enabled)
context:SetMaterialPropertyVisibility("general.colorDisplayMode", MaterialPropertyVisibility_Enabled)
context:SetMaterialPropertyVisibility("general.uvIndex", MaterialPropertyVisibility_Enabled)
context:SetMaterialPropertyVisibility("general.bitangentOptions", MaterialPropertyVisibility_Hidden)
elseif(vertexStream == DebugVertexStream_Bitangents) then
-- Bitangents can be viewed using either color display mode, and are affected by tangent options and uv index
context:SetMaterialPropertyVisibility("general.bitangentOptions", MaterialPropertyVisibility_Enabled)
context:SetMaterialPropertyVisibility("general.colorDisplayMode", MaterialPropertyVisibility_Enabled)
context:SetMaterialPropertyVisibility("general.uvIndex", MaterialPropertyVisibility_Enabled)
context:SetMaterialPropertyVisibility("general.tangentOptions", MaterialPropertyVisibility_Hidden)
elseif(vertexStream == DebugVertexStream_Uvs) then
-- Uvs are only impacted by uv index
context:SetMaterialPropertyVisibility("general.uvIndex", MaterialPropertyVisibility_Enabled)
context:SetMaterialPropertyVisibility("general.tangentOptions", MaterialPropertyVisibility_Hidden)
context:SetMaterialPropertyVisibility("general.bitangentOptions", MaterialPropertyVisibility_Hidden)
context:SetMaterialPropertyVisibility("general.colorDisplayMode", MaterialPropertyVisibility_Hidden)
elseif(vertexStream == DebugVertexStream_TangentW) then
-- Tangent.w can only use per-vertex data, and only for the first uv set, and is only displayed one way,
-- so it is not impacted by any settings
context:SetMaterialPropertyVisibility("general.tangentOptions", MaterialPropertyVisibility_Hidden)
context:SetMaterialPropertyVisibility("general.bitangentOptions", MaterialPropertyVisibility_Hidden)
context:SetMaterialPropertyVisibility("general.colorDisplayMode", MaterialPropertyVisibility_Hidden)
context:SetMaterialPropertyVisibility("general.uvIndex", MaterialPropertyVisibility_Hidden)
end
-- For the second uv set, only the surface gradient technique is supported for generating tangents and bitangents
local uvSet = context:GetMaterialPropertyValue_enum("general.uvIndex");
if(uvSet > 0) then
context:SetMaterialPropertyVisibility("general.tangentOptions", MaterialPropertyVisibility_Hidden)
context:SetMaterialPropertyVisibility("general.bitangentOptions", MaterialPropertyVisibility_Hidden)
end
end

@ -50,7 +50,8 @@
"FilePath": "Shaders/PostProcessing/SsaoCompute.shader"
},
"Make Fullscreen Pass": true,
"PipelineViewTag": "MainCamera"
"PipelineViewTag": "MainCamera",
"Use Async Compute": true
},
"FallbackConnections": [
{

@ -5,14 +5,16 @@
"ClassData": {
"m_imageDescriptor": {
"BindFlags": [
"ShaderRead",
"ShaderWrite"
],
"ShaderRead",
"ShaderWrite"
],
"Size": {
"Width": 256,
"Height": 256
},
"Format": 24
}
},
"Name": "$BrdfTexture",
"IsUniqueName": true
}
}

@ -72,7 +72,7 @@ namespace AZ
void DiffuseProbeGridVisualizationAccelerationStructurePass::BuildInternal()
{
SetScopeId(RHI::ScopeId(GetPathName()));
InitScope(RHI::ScopeId(GetPathName()));
}
void DiffuseProbeGridVisualizationAccelerationStructurePass::FrameBeginInternal(FramePrepareParams params)

@ -44,54 +44,16 @@ namespace AZ
{
using namespace RPI;
auto center = context.GetMaterialPropertyValue<Vector2>(m_center);
auto scale = context.GetMaterialPropertyValue<float>(m_scale);
auto scaleX = context.GetMaterialPropertyValue<float>(m_scaleX);
auto scaleY = context.GetMaterialPropertyValue<float>(m_scaleY);
auto translateX = context.GetMaterialPropertyValue<float>(m_translateX);
auto translateY = context.GetMaterialPropertyValue<float>(m_translateY);
auto rotateDegrees = context.GetMaterialPropertyValue<float>(m_rotateDegrees);
if (scaleX != 0.0f)
{
translateX *= (1.0f / scaleX);
}
if (scaleY != 0.0f)
{
translateY *= (1.0f / scaleY);
}
Matrix3x3 translateCenter2D = Matrix3x3::CreateIdentity();
translateCenter2D.SetBasisZ(-center.GetX(), -center.GetY(), 1.0f);
Matrix3x3 translateCenterInv2D = Matrix3x3::CreateIdentity();
translateCenterInv2D.SetBasisZ(center.GetX(), center.GetY(), 1.0f);
Matrix3x3 scale2D = Matrix3x3::CreateDiagonal(AZ::Vector3(scaleX * scale, scaleY * scale, 1.0f));
Matrix3x3 translate2D = Matrix3x3::CreateIdentity();
translate2D.SetBasisZ(translateX, translateY, 1.0f);
Matrix3x3 rotate2D = Matrix3x3::CreateRotationZ(AZ::DegToRad(rotateDegrees));
Matrix3x3 transform = translateCenter2D;
for (auto transformType : m_transformOrder)
{
switch (transformType)
{
case TransformType::Scale:
transform = scale2D * transform;
break;
case TransformType::Rotate:
transform = rotate2D * transform;
break;
case TransformType::Translate:
transform = translate2D * transform;
break;
}
}
transform = translateCenterInv2D * transform;
UvTransformDescriptor desc;
desc.m_center = context.GetMaterialPropertyValue<Vector2>(m_center);
desc.m_scale = context.GetMaterialPropertyValue<float>(m_scale);
desc.m_scaleX = context.GetMaterialPropertyValue<float>(m_scaleX);
desc.m_scaleY = context.GetMaterialPropertyValue<float>(m_scaleY);
desc.m_translateX = context.GetMaterialPropertyValue<float>(m_translateX);
desc.m_translateY = context.GetMaterialPropertyValue<float>(m_translateY);
desc.m_rotateDegrees = context.GetMaterialPropertyValue<float>(m_rotateDegrees);
Matrix3x3 transform = CreateUvTransformMatrix(desc, m_transformOrder);
context.GetShaderResourceGroup()->SetConstant(m_transformMatrix, transform);

@ -11,6 +11,7 @@
#include <Atom/RPI.Reflect/Material/MaterialFunctor.h>
#include <Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h>
#include <Atom/RHI.Reflect/Limits.h>
#include <Atom/Utils/MaterialUtils.h>
namespace AZ
{
@ -24,14 +25,6 @@ namespace AZ
public:
AZ_RTTI(Transform2DFunctor, "{3E9C4357-6B2D-4A22-89DB-462441C9D8CD}", RPI::MaterialFunctor);
enum class TransformType
{
Invalid,
Scale,
Rotate,
Translate
};
static void Reflect(ReflectContext* context);
using RPI::MaterialFunctor::Process;
@ -57,6 +50,4 @@ namespace AZ
} // namespace Render
AZ_TYPE_INFO_SPECIALIZE(Render::Transform2DFunctor::TransformType, "{D8C15D33-CE3D-4297-A646-030B0625BF84}");
} // namespace AZ

@ -85,13 +85,13 @@ namespace AZ
functor->m_transformOrder = m_transformOrder;
AZStd::set<Transform2DFunctor::TransformType> transformSet{m_transformOrder.begin(), m_transformOrder.end()};
AZStd::set<TransformType> transformSet{m_transformOrder.begin(), m_transformOrder.end()};
if (m_transformOrder.size() != transformSet.size())
{
AZ_Warning("Transform2DFunctor", false, "transformOrder field contains duplicate entries");
}
if (transformSet.find(Transform2DFunctor::TransformType::Invalid) != transformSet.end())
if (transformSet.find(TransformType::Invalid) != transformSet.end())
{
AZ_Warning("Transform2DFunctor", false, "transformOrder contains invalid entries");
}

@ -10,6 +10,7 @@
#include "./Transform2DFunctor.h"
#include <Atom/RPI.Edit/Material/MaterialFunctorSourceData.h>
#include <Atom/Utils/MaterialUtils.h>
namespace AZ
{
@ -30,7 +31,7 @@ namespace AZ
private:
AZStd::vector<Transform2DFunctor::TransformType> m_transformOrder; //!< Controls the order in which Scale, Translate, Rotate are performed
AZStd::vector<TransformType> m_transformOrder; //!< Controls the order in which Scale, Translate, Rotate are performed
// Material property inputs...
AZStd::string m_center; //!< material property for center of scaling and rotation

@ -50,7 +50,7 @@ namespace AZ
void DepthOfFieldCopyFocusDepthToCpuPass::BuildInternal()
{
SetScopeId(RHI::ScopeId(GetPathName()));
InitScope(RHI::ScopeId(GetPathName()));
}
void DepthOfFieldCopyFocusDepthToCpuPass::FrameBeginInternal(FramePrepareParams params)

@ -40,7 +40,7 @@ namespace AZ
void RayTracingAccelerationStructurePass::BuildInternal()
{
SetScopeId(RHI::ScopeId(GetPathName()));
InitScope(RHI::ScopeId(GetPathName()));
}
void RayTracingAccelerationStructurePass::FrameBeginInternal(FramePrepareParams params)

@ -76,6 +76,9 @@ namespace AZ
/// Returns the hardware queue class for this scope.
HardwareQueueClass GetHardwareQueueClass() const;
/// Sets the hardware queue class for this scope.
void SetHardwareQueueClass(HardwareQueueClass hardwareQueueClass);
/**
* Returns the estimated number of draw / dispatch / copy items that the user will submit
* while in this scope. This is an estimation intended to be used by the platform-specific
@ -120,7 +123,7 @@ namespace AZ
const AZStd::vector<Ptr<Fence>>& GetFencesToSignal() const;
/// Initializes the scope.
void Init(const ScopeId& scopeId);
void Init(const ScopeId& scopeId, HardwareQueueClass hardwareQueueClass = HardwareQueueClass::Graphics);
/// Activates the scope for the current frame.
void Activate(const FrameGraph* frameGraph, uint32_t index, const GraphGroupId& groupId);

@ -86,11 +86,22 @@ namespace AZ
ScopeProducer();
/**
* Sets ID of the scope producer. Used by class that inherit from
* ScopeProducer but that can't supply a ScopeId at construction.
* Sets the HardwareQueueClass on the scope
*/
void SetHardwareQueueClass(HardwareQueueClass hardwareQueueClass);
/**
* DEPRECATED.
* @deprecated Use InitScope instead
*/
void SetScopeId(const ScopeId& scopeId);
/**
* Initializes the scope with a ScopeId and HardwareQueueClass.
* Used by classes that inherit from ScopeProducer but can't supply a ScopeId at construction.
*/
void InitScope(const ScopeId& scopeId, HardwareQueueClass hardwareQueueClass = HardwareQueueClass::Graphics);
private:
//////////////////////////////////////////////////////////////////////////
// User Overrides - Derived classes should override from these methods.

@ -24,12 +24,13 @@ namespace AZ
return m_isActive;
}
void Scope::Init(const ScopeId& scopeId)
void Scope::Init(const ScopeId& scopeId, HardwareQueueClass hardwareQueueClass)
{
AZ_Assert(!scopeId.IsEmpty(), "Scope id is not valid.");
AZ_Assert(IsInitialized() == false, "Scope was previously initialized.");
SetName(scopeId);
m_id = scopeId;
m_hardwareQueueClass = hardwareQueueClass;
InitInternal();
m_isInitialized = true;
}
@ -134,6 +135,11 @@ namespace AZ
return m_hardwareQueueClass;
}
void Scope::SetHardwareQueueClass(HardwareQueueClass hardwareQueueClass)
{
m_hardwareQueueClass = hardwareQueueClass;
}
uint32_t Scope::GetEstimatedItemCount() const
{
return m_estimatedItemCount;

@ -40,7 +40,18 @@ namespace AZ
return m_scope.get();
}
void ScopeProducer::SetHardwareQueueClass(HardwareQueueClass hardwareQueueClass)
{
m_scope->SetHardwareQueueClass(hardwareQueueClass);
}
// DEPRECATED: use InitScope instead
void ScopeProducer::SetScopeId(const ScopeId& scopeId)
{
InitScope(scopeId);
}
void ScopeProducer::InitScope(const ScopeId& scopeId, HardwareQueueClass hardwareQueueClass)
{
m_scopeId = scopeId;
@ -49,7 +60,7 @@ namespace AZ
m_scope->Shutdown();
}
m_scope->Init(scopeId);
m_scope->Init(scopeId, hardwareQueueClass);
}
}
}

@ -26,13 +26,12 @@ float3 WorldSpaceToTangent(float3 vectorWS, float3 normalWS, float3 tangentWS, f
return float3(a,b,c);
}
//! Utility function for vertex shaders to transform vertex tangent, bitangent, and normal vectors into world space based on MikkT conventions.
//! Utility function for vertex shaders to transform vertex tangent, bitangent, and normal vectors into world space.
void ConstructTBN(float3 vertexNormal, float4 vertexTangent, float3 vertexBitangent, float4x4 localToWorld, float3x3 localToWorldInverseTranspose, out float3 normalWS, out float3 tangentWS, out float3 bitangentWS)
{
normalWS = normalize(mul(localToWorldInverseTranspose, vertexNormal));
tangentWS = normalize(mul(localToWorld, float4(vertexTangent.xyz, 0)).xyz);
float bitangentSign = -vertexTangent.w;
bitangentWS = normalize(mul(localToWorld, float4(vertexBitangent, 0)).xyz) * bitangentSign;
bitangentWS = normalize(mul(localToWorld, float4(vertexBitangent, 0)).xyz);
}
// ---------- Normal Calculation ----------

@ -21,6 +21,27 @@ namespace AZ
class AttachmentImagePool;
class ResourcePoolAsset;
struct CreateAttachmentImageRequest
{
//! The name of this image. It will be used as RHI object name (for gpu debug).
Name m_imageName;
//! If true, the AttachmentImage create function may fail if the attachment image with same name already exist.
//! The m_imageName will be used as the attachment id of the created attachment image.
//! The attachment image can be found by its name (same as its attachment id).
//! If false, a random generated uuid will be used for instance id as well as attachment id.
bool m_isUniqueName = false;
//! The ImageDescriptor for this AttachmentImage
RHI::ImageDescriptor m_imageDescriptor;
//! The attachment image pool which the AttachmentImage is created from.
//! A default system attachment image pool will be used if it's set to nullptr
const AttachmentImagePool* m_imagePool = nullptr;
// (Optional) Set the default clear value for this image
const RHI::ClearValue* m_optimizedClearValue = nullptr;
//! (Optional) The imageViewDescriptor for this image which overides the default ImageViewDescriptor.
const RHI::ImageViewDescriptor* m_imageViewDescriptor = nullptr;
};
//! AttachmentImage is intended for use, primarily, as an attachment on a pass. Image data can
//! be produced by the GPU or uploaded directly from CPU data. Use this class to represent
//! color / depth stencil targets, read-write images, etc.
@ -33,12 +54,17 @@ namespace AZ
AZ_INSTANCE_DATA(AttachmentImage, "{85691099-5143-4C11-88B0-897DA9064FDF}", Image);
AZ_CLASS_ALLOCATOR(AttachmentImage, AZ::SystemAllocator, 0);
~AttachmentImage() = default;
~AttachmentImage();
//! Instantiates or returns an existing image instance using its paired asset.
static Data::Instance<AttachmentImage> FindOrCreate(const Data::Asset<AttachmentImageAsset>& imageAsset);
//! Instantiates a unique instance with a random id, using data provided at runtime.
//! Creates an AttachmentImage
//! @param imagePool The attachment image pool which the AttachmentImage is created from
//! @param imageDescriptor The ImageDescriptor for this AttachmentImage
//! @param imageName The name of this image. It will be used as RHI object name (for gpu debug).
//! @param optimizedClearValue (Optional) set the default clear value for this image
//! @param imageViewDescriptor (Optional) The imageViewDescriptor for this image which overides the default ImageViewDescriptor.
static Data::Instance<AttachmentImage> Create(
const AttachmentImagePool& imagePool,
const RHI::ImageDescriptor& imageDescriptor,
@ -46,7 +72,14 @@ namespace AZ
const RHI::ClearValue* optimizedClearValue = nullptr,
const RHI::ImageViewDescriptor* imageViewDescriptor = nullptr);
const RHI::AttachmentId& GetAttachmentId();
//! Creates an AttachmentImage
static Data::Instance<AttachmentImage> Create(const CreateAttachmentImageRequest& createImageRequest);
//! Finds an AttachmentImage by an unique attachment name
static Data::Instance<AttachmentImage> FindByUniqueName(const Name& uniqueAttachmentName);
//! Return an unique id which can be used as an attachment id in frame graph attachment database
const RHI::AttachmentId& GetAttachmentId() const;
private:
AttachmentImage() = default;
@ -54,10 +87,14 @@ namespace AZ
//! Standard instance creation path.
static Data::Instance<AttachmentImage> CreateInternal(AttachmentImageAsset& imageAsset);
RHI::ResultCode Init(const AttachmentImageAsset& imageAsset);
void Shutdown();
Data::Instance<AttachmentImagePool> m_imagePool;
RHI::AttachmentId m_attachmentId;
// Need to keep a reference of the asset so the asset system won't release the asset after AttachmentImage was created
Data::Asset<AttachmentImageAsset> m_imageAsset;
};
}
}

@ -58,6 +58,9 @@ namespace AZ
const Data::Instance<StreamingImagePool>& GetSystemStreamingPool() const override;
const Data::Instance<AttachmentImagePool>& GetSystemAttachmentPool() const override;
const Data::Instance<StreamingImagePool>& GetStreamingPool() const override;
bool RegisterAttachmentImage(AttachmentImage* attachmentImage) override;
void UnregisterAttachmentImage(AttachmentImage* attachmentImage) override;
Data::Instance<AttachmentImage> FindRegisteredAttachmentImage(const Name& uniqueName) const override;
//////////////////////////////////////////////////////////////////////////
private:
@ -78,6 +81,10 @@ namespace AZ
AZStd::fixed_vector<Data::Instance<Image>, static_cast<uint32_t>(SystemImage::Count)> m_systemImages;
bool m_initialized = false;
// a collections of regirested attachment images
// Note: use AttachmentImage* instead of Data::Instance<AttachmentImage> so it can be released properly
AZStd::unordered_map<RHI::AttachmentId, AttachmentImage*> m_registeredAttachmentImages;
};
}
}

@ -14,9 +14,12 @@
namespace AZ
{
class Name;
namespace RPI
{
class Image;
class AttachmentImage;
class AttachmentImagePool;
class StreamingImagePool;
@ -64,6 +67,19 @@ namespace AZ
//! Returns the system attachment image pool. Use this if you do not need a custom pool for your allocation.
virtual const Data::Instance<AttachmentImagePool>& GetSystemAttachmentPool() const = 0;
//! Register an attachment image by its unique name (attachment id)
//! Return false if the image was failed to register.
//! It could be the image with same name was already registered.
//! Note: this function is only intended to be used by AttachmentImage class
//! Only attachment images created with an unique name will be registered
virtual bool RegisterAttachmentImage(AttachmentImage* attachmentImage) = 0;
//! Unregister an attachment image (if it's was registered)
virtual void UnregisterAttachmentImage(AttachmentImage* attachmentImage) = 0;
//! Find an attachment image by its unique name (same as its attachment id) from registered attachment images.
//! Note: only attachment image created with an uqniue name will be registered.
virtual Data::Instance<AttachmentImage> FindRegisteredAttachmentImage(const Name& uniqueName) const = 0;
virtual void Update() = 0;
};

@ -63,6 +63,10 @@ namespace AZ
//! Adds pass to list of children
void AddChild(const Ptr<Pass>& child);
//! Inserts a pass at specified position
//! If the position is invalid, the child pass won't be added, and the function returns false
bool InsertChild(const Ptr<Pass>& child, ChildPassIndex position);
//! Searches for a child pass with the given name. Returns the child's index if found, null index otherwise
ChildPassIndex FindChildPassIndex(const Name& passName) const;

@ -113,6 +113,9 @@ namespace AZ
// The shader resource group for this pass
Data::Instance<ShaderResourceGroup> m_shaderResourceGroup = nullptr;
// Determines which hardware queue the pass will run on
RHI::HardwareQueueClass m_hardwareQueueClass = RHI::HardwareQueueClass::Graphics;
private:
// Helper function that binds a single attachment to the pass shader resource group
void BindAttachment(const RHI::FrameGraphCompileContext& context, PassAttachmentBinding& binding, int16_t& imageIndex, int16_t& bufferIndex);

@ -10,6 +10,7 @@
#include <AtomCore/Instance/Instance.h>
#include <Atom/RHI/BufferPool.h>
#include <Atom/RHI/CopyItem.h>
#include <Atom/RHI/ScopeProducer.h>
#include <Atom/RPI.Public/Buffer/Buffer.h>
@ -103,6 +104,7 @@ namespace AZ
void LoadShader();
// Pass overrides
void BuildInternal() override;
void FrameBeginInternal(FramePrepareParams params) override;
// RHI::ScopeProducer overrides...

@ -165,6 +165,11 @@ namespace AZ
//! User should use this event to update the part scene srg they know of
void ConnectEvent(PrepareSceneSrgEvent::Handler& handler);
//! Rebuild pipeline states lookup table.
//! This function is called every time scene's render pipelines change.
//! User may call this function explicitly if render pipelines were changed
void RebuildPipelineStatesLookup();
protected:
// SceneFinder overrides...
void OnSceneNotifictaionHandlerConnected(SceneNotification* handler);
@ -190,9 +195,6 @@ namespace AZ
private:
Scene();
// Rebuild pipeline states lookup table.
// This function is called every time scene's render pipelines change.
void RebuildPipelineStatesLookup();
// Helper function to wait for end of TaskGraph and then delete the TaskGraphEvent
void WaitAndCleanTGEvent(AZStd::unique_ptr<AZ::TaskGraphEvent>&& completionTGEvent);

@ -42,12 +42,28 @@ namespace AZ
//! Return the clear value of the image. The clear value may only be useful for certain type of images such as render targets (color/depth stencil).
const RHI::ClearValue* GetOptimizedClearValue() const;
//! Return the name which can be used as debug name
const AZ::Name& GetName() const;
//! Return an unique name id which can be used as attachment id
RHI::AttachmentId GetAttachmentId() const;
//! Return ture if the attachment image has an unique name
//! An attachment image with an unique name will be registered to image system
//! and it can be found by ImageSystemInterface::FindRegisteredAttachmentImage() function
//! The unique name is same as its attachment Id
bool HasUniqueName() const;
private:
Data::Asset<ResourcePoolAsset> m_poolAsset;
// Clear value of the image. The value is only valid when m_isClearValueValid is true
RHI::ClearValue m_optimizedClearValue;
bool m_isClearValueValid = false;
// an name id
AZ::Name m_name;
bool m_isUniqueName = false;
// Clear value of the image
AZStd::shared_ptr<RHI::ClearValue> m_optimizedClearValue;
};
using AttachmentImageAssetHandler = AssetHandler<AttachmentImageAsset>;

@ -36,10 +36,18 @@ namespace AZ
//! Assigns the attachment image pool, which the runtime attachment image will allocate from. Required.
void SetPoolAsset(const Data::Asset<ResourcePoolAsset>& poolAsset);
//! @deprecated. Deprecated, use SetName() instead
//! Set a string to asset's hint. This info is only kept for runtime generated asset.
//! For asset on disc, the asset system will assign asset path to asset hint
void SetAssetHint(AZStd::string_view hint);
//! Set a name for this attachment image.
//! This name will be used for AttachmentImage's RHI Image's debug name.
//! @param isUniqueName If true the image will be registered to Image System and the unique need to be unique
//! among other attachment image with unique names. And the image can be found by
//! ImageSystemInterface::FindRegisteredAttachmentImage() function
void SetName(const AZ::Name& name, bool isUniqueName);
//! Finalizes and assigns ownership of the asset to result, if successful.
//! Otherwise false is returned and result is left untouched.
bool End(Data::Asset<AttachmentImageAsset>& result);

@ -29,12 +29,13 @@ namespace AZ
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<ComputePassData, RenderPassData>()
->Version(1)
->Version(2)
->Field("ShaderAsset", &ComputePassData::m_shaderReference)
->Field("Target Thread Count X", &ComputePassData::m_totalNumberOfThreadsX)
->Field("Target Thread Count Y", &ComputePassData::m_totalNumberOfThreadsY)
->Field("Target Thread Count Z", &ComputePassData::m_totalNumberOfThreadsZ)
->Field("Make Fullscreen Pass", &ComputePassData::m_makeFullscreenPass)
->Field("Use Async Compute", &ComputePassData::m_useAsyncCompute)
;
}
}
@ -46,6 +47,9 @@ namespace AZ
uint32_t m_totalNumberOfThreadsZ = 0;
bool m_makeFullscreenPass = false;
// Whether the pass should use async compute and run on the compute hardware queue.
bool m_useAsyncCompute = false;
};
} // namespace RPI
} // namespace AZ

@ -32,7 +32,7 @@ namespace AZ
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<CopyPassData, PassData>()
->Version(0)
->Version(1)
->Field("BufferSize", &CopyPassData::m_bufferSize)
->Field("BufferSourceOffset", &CopyPassData::m_bufferSourceOffset)
->Field("BufferSourceBytesPerRow", &CopyPassData::m_bufferSourceBytesPerRow)
@ -46,6 +46,7 @@ namespace AZ
->Field("ImageDestinationSubresource", &CopyPassData::m_imageDestinationSubresource)
->Field("ImageDestinationOrigin", &CopyPassData::m_imageDestinationOrigin)
->Field("CloneInput", &CopyPassData::m_cloneInput)
->Field("UseCopyQueue", &CopyPassData::m_useCopyQueue)
;
}
}
@ -75,6 +76,9 @@ namespace AZ
// If set to true, pass will automatically create a transient output attachment based on input
// If false, the output target of the copy will need to be specified
bool m_cloneInput = true;
// Whether the pass should use the copy queue.
bool m_useCopyQueue = false;
};
} // namespace RPI
} // namespace AZ

@ -60,7 +60,7 @@ namespace AZ
AZStd::placeholders::_1, AZStd::placeholders::_2);
builderDescriptor.m_processJobFunction = AZStd::bind(&AnyAssetBuilder::ProcessJob, this,
AZStd::placeholders::_1, AZStd::placeholders::_2);
builderDescriptor.m_version = 9;
builderDescriptor.m_version = 10;
BusConnect(builderDescriptor.m_busId);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save