From 5dc97e7e4b5e9272f4940628833315007a060c8b Mon Sep 17 00:00:00 2001 From: Nicholas Van Sickle Date: Tue, 11 Jan 2022 16:34:22 -0800 Subject: [PATCH 01/12] Fix Prefab instance assets not preloading PrefabCatchmentProcessor::ProcessPrefab was no longer updating the ProcessedObjectStore's referenced object list, this change exposes the referenced asset list in the new PrefabDocument API and uses them to update the referenced asset list. Signed-off-by: Nicholas Van Sickle --- .../Prefab/Spawnable/PrefabCatchmentProcessor.cpp | 1 + .../Prefab/Spawnable/PrefabDocument.cpp | 12 +++++++++++- .../Prefab/Spawnable/PrefabDocument.h | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Spawnable/PrefabCatchmentProcessor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Spawnable/PrefabCatchmentProcessor.cpp index 40cd52cac8..a5ca034c36 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Spawnable/PrefabCatchmentProcessor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Spawnable/PrefabCatchmentProcessor.cpp @@ -64,6 +64,7 @@ namespace AzToolsFramework::Prefab::PrefabConversionUtils AZStd::move(uniqueName), context.GetSourceUuid(), AZStd::move(serializer)); AZ_Assert(spawnable, "Failed to create a new spawnable."); + object.GetReferencedAssets() = prefab.GetReferencedAssets(); Instance& instance = prefab.GetInstance(); // Resolve entity aliases that store PrefabDOM information to use the spawnable instead. This is done before the entities are // moved from the instance as they'd otherwise can't be found. diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Spawnable/PrefabDocument.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Spawnable/PrefabDocument.cpp index 04fdea30d2..230c2226cd 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Spawnable/PrefabDocument.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Spawnable/PrefabDocument.cpp @@ -124,12 +124,22 @@ namespace AzToolsFramework::Prefab::PrefabConversionUtils return *m_instance; } + AZStd::vector>& PrefabDocument::GetReferencedAssets() + { + return m_referencedAssets; + } + + const AZStd::vector>& PrefabDocument::GetReferencedAssets() const + { + return m_referencedAssets; + } + bool PrefabDocument::ConstructInstanceFromPrefabDom(const PrefabDom& prefab) { using namespace AzToolsFramework::Prefab; m_instance->Reset(); - if (PrefabDomUtils::LoadInstanceFromPrefabDom(*m_instance, prefab, PrefabDomUtils::LoadFlags::AssignRandomEntityId)) + if (PrefabDomUtils::LoadInstanceFromPrefabDom(*m_instance, prefab, m_referencedAssets, PrefabDomUtils::LoadFlags::AssignRandomEntityId)) { return true; } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Spawnable/PrefabDocument.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Spawnable/PrefabDocument.h index 215daf7f71..661dba5edf 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Spawnable/PrefabDocument.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Spawnable/PrefabDocument.h @@ -53,12 +53,16 @@ namespace AzToolsFramework::Prefab::PrefabConversionUtils AzToolsFramework::Prefab::Instance& GetInstance(); const AzToolsFramework::Prefab::Instance& GetInstance() const; + AZStd::vector>& GetReferencedAssets(); + const AZStd::vector>& GetReferencedAssets() const; + private: bool ConstructInstanceFromPrefabDom(const PrefabDom& prefab); mutable PrefabDom m_dom; AZStd::unique_ptr m_instance; AZStd::string m_name; + AZStd::vector> m_referencedAssets; mutable bool m_isDirty{ false }; }; } // namespace AzToolsFramework::Prefab::PrefabConversionUtils From b772d7b3e8abd15acaf1db40d5a79357927f014d Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Wed, 12 Jan 2022 11:10:34 -0800 Subject: [PATCH 02/12] Removing multiplayer script canvas translation files from the scriptcanvas gem; these will eventually move into AutomatedTesting project once repopulated (if needed). Signed-off-by: Gene Walters --- ...orityToAutonomousNoParamsNotifyEvent.names | 50 -- .../AuthorityToAutonomousNotifyEvent.names | 56 --- ...AuthorityToClientNoParamsNotifyEvent.names | 50 -- .../AuthorityToClientNotifyEvent.names | 56 --- ...nomousToAuthorityNoParamsNotifyEvent.names | 50 -- .../AutonomousToAuthorityNotifyEvent.names | 56 --- .../ServerToAuthorityNoParamNotifyEvent.names | 50 -- .../ServerToAuthorityNotifyEvent.names | 56 --- .../Classes/NetworkTestPlayerComponent.names | 438 ------------------ ...tworkTestPlayerComponentNetworkInput.names | 129 ------ 10 files changed, 991 deletions(-) delete mode 100644 Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToAutonomousNoParamsNotifyEvent.names delete mode 100644 Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToAutonomousNotifyEvent.names delete mode 100644 Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToClientNoParamsNotifyEvent.names delete mode 100644 Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToClientNotifyEvent.names delete mode 100644 Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AutonomousToAuthorityNoParamsNotifyEvent.names delete mode 100644 Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AutonomousToAuthorityNotifyEvent.names delete mode 100644 Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/ServerToAuthorityNoParamNotifyEvent.names delete mode 100644 Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/ServerToAuthorityNotifyEvent.names delete mode 100644 Gems/ScriptCanvas/Assets/TranslationAssets/Classes/NetworkTestPlayerComponent.names delete mode 100644 Gems/ScriptCanvas/Assets/TranslationAssets/Classes/NetworkTestPlayerComponentNetworkInput.names diff --git a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToAutonomousNoParamsNotifyEvent.names b/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToAutonomousNoParamsNotifyEvent.names deleted file mode 100644 index 216212ca4a..0000000000 --- a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToAutonomousNoParamsNotifyEvent.names +++ /dev/null @@ -1,50 +0,0 @@ -{ - "entries": [ - { - "base": "AuthorityToAutonomousNoParams Notify Event", - "context": "AZEventHandler", - "variant": "", - "details": { - "name": "Authority To Autonomous No Params Notify Event" - }, - "slots": [ - { - "base": "AuthorityToAutonomousNoParams Notify Event", - "details": { - "name": "AuthorityToAutonomousNoParams Notify Event" - } - }, - { - "base": "Connect", - "details": { - "name": "Connect" - } - }, - { - "base": "Disconnect", - "details": { - "name": "Disconnect" - } - }, - { - "base": "On Connected", - "details": { - "name": "On Connected" - } - }, - { - "base": "On Disconnected", - "details": { - "name": "On Disconnected" - } - }, - { - "base": "OnEvent", - "details": { - "name": "OnEvent" - } - } - ] - } - ] -} \ No newline at end of file diff --git a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToAutonomousNotifyEvent.names b/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToAutonomousNotifyEvent.names deleted file mode 100644 index 50c0ec6013..0000000000 --- a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToAutonomousNotifyEvent.names +++ /dev/null @@ -1,56 +0,0 @@ -{ - "entries": [ - { - "base": "AuthorityToAutonomous Notify Event", - "context": "AZEventHandler", - "variant": "", - "details": { - "name": "Authority To Autonomous Notify Event" - }, - "slots": [ - { - "base": "someFloat", - "details": { - "name": "someFloat" - } - }, - { - "base": "AuthorityToAutonomous Notify Event", - "details": { - "name": "AuthorityToAutonomous Notify Event" - } - }, - { - "base": "Connect", - "details": { - "name": "Connect" - } - }, - { - "base": "Disconnect", - "details": { - "name": "Disconnect" - } - }, - { - "base": "On Connected", - "details": { - "name": "On Connected" - } - }, - { - "base": "On Disconnected", - "details": { - "name": "On Disconnected" - } - }, - { - "base": "OnEvent", - "details": { - "name": "OnEvent" - } - } - ] - } - ] -} \ No newline at end of file diff --git a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToClientNoParamsNotifyEvent.names b/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToClientNoParamsNotifyEvent.names deleted file mode 100644 index bf5b975d63..0000000000 --- a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToClientNoParamsNotifyEvent.names +++ /dev/null @@ -1,50 +0,0 @@ -{ - "entries": [ - { - "base": "AuthorityToClientNoParams Notify Event", - "context": "AZEventHandler", - "variant": "", - "details": { - "name": "Authority To Client No Params Notify Event" - }, - "slots": [ - { - "base": "AuthorityToClientNoParams Notify Event", - "details": { - "name": "AuthorityToClientNoParams Notify Event" - } - }, - { - "base": "Connect", - "details": { - "name": "Connect" - } - }, - { - "base": "Disconnect", - "details": { - "name": "Disconnect" - } - }, - { - "base": "On Connected", - "details": { - "name": "On Connected" - } - }, - { - "base": "On Disconnected", - "details": { - "name": "On Disconnected" - } - }, - { - "base": "OnEvent", - "details": { - "name": "OnEvent" - } - } - ] - } - ] -} \ No newline at end of file diff --git a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToClientNotifyEvent.names b/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToClientNotifyEvent.names deleted file mode 100644 index d3ba2e9299..0000000000 --- a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AuthorityToClientNotifyEvent.names +++ /dev/null @@ -1,56 +0,0 @@ -{ - "entries": [ - { - "base": "AuthorityToClient Notify Event", - "context": "AZEventHandler", - "variant": "", - "details": { - "name": "Authority To Client Notify Event" - }, - "slots": [ - { - "base": "someFloat", - "details": { - "name": "someFloat" - } - }, - { - "base": "AuthorityToClient Notify Event", - "details": { - "name": "AuthorityToClient Notify Event" - } - }, - { - "base": "Connect", - "details": { - "name": "Connect" - } - }, - { - "base": "Disconnect", - "details": { - "name": "Disconnect" - } - }, - { - "base": "On Connected", - "details": { - "name": "On Connected" - } - }, - { - "base": "On Disconnected", - "details": { - "name": "On Disconnected" - } - }, - { - "base": "OnEvent", - "details": { - "name": "OnEvent" - } - } - ] - } - ] -} \ No newline at end of file diff --git a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AutonomousToAuthorityNoParamsNotifyEvent.names b/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AutonomousToAuthorityNoParamsNotifyEvent.names deleted file mode 100644 index ba5f7aec0c..0000000000 --- a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AutonomousToAuthorityNoParamsNotifyEvent.names +++ /dev/null @@ -1,50 +0,0 @@ -{ - "entries": [ - { - "base": "AutonomousToAuthorityNoParams Notify Event", - "context": "AZEventHandler", - "variant": "", - "details": { - "name": "Autonomous To Authority No Params Notify Event" - }, - "slots": [ - { - "base": "AutonomousToAuthorityNoParams Notify Event", - "details": { - "name": "AutonomousToAuthorityNoParams Notify Event" - } - }, - { - "base": "Connect", - "details": { - "name": "Connect" - } - }, - { - "base": "Disconnect", - "details": { - "name": "Disconnect" - } - }, - { - "base": "On Connected", - "details": { - "name": "On Connected" - } - }, - { - "base": "On Disconnected", - "details": { - "name": "On Disconnected" - } - }, - { - "base": "OnEvent", - "details": { - "name": "OnEvent" - } - } - ] - } - ] -} \ No newline at end of file diff --git a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AutonomousToAuthorityNotifyEvent.names b/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AutonomousToAuthorityNotifyEvent.names deleted file mode 100644 index 73566d177e..0000000000 --- a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/AutonomousToAuthorityNotifyEvent.names +++ /dev/null @@ -1,56 +0,0 @@ -{ - "entries": [ - { - "base": "AutonomousToAuthority Notify Event", - "context": "AZEventHandler", - "variant": "", - "details": { - "name": "Autonomous To Authority Notify Event" - }, - "slots": [ - { - "base": "someFloat", - "details": { - "name": "someFloat" - } - }, - { - "base": "AutonomousToAuthority Notify Event", - "details": { - "name": "AutonomousToAuthority Notify Event" - } - }, - { - "base": "Connect", - "details": { - "name": "Connect" - } - }, - { - "base": "Disconnect", - "details": { - "name": "Disconnect" - } - }, - { - "base": "On Connected", - "details": { - "name": "On Connected" - } - }, - { - "base": "On Disconnected", - "details": { - "name": "On Disconnected" - } - }, - { - "base": "OnEvent", - "details": { - "name": "OnEvent" - } - } - ] - } - ] -} \ No newline at end of file diff --git a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/ServerToAuthorityNoParamNotifyEvent.names b/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/ServerToAuthorityNoParamNotifyEvent.names deleted file mode 100644 index b6694211cd..0000000000 --- a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/ServerToAuthorityNoParamNotifyEvent.names +++ /dev/null @@ -1,50 +0,0 @@ -{ - "entries": [ - { - "base": "ServerToAuthorityNoParam Notify Event", - "context": "AZEventHandler", - "variant": "", - "details": { - "name": "Server To Authority No Param Notify Event" - }, - "slots": [ - { - "base": "ServerToAuthorityNoParam Notify Event", - "details": { - "name": "ServerToAuthorityNoParam Notify Event" - } - }, - { - "base": "Connect", - "details": { - "name": "Connect" - } - }, - { - "base": "Disconnect", - "details": { - "name": "Disconnect" - } - }, - { - "base": "On Connected", - "details": { - "name": "On Connected" - } - }, - { - "base": "On Disconnected", - "details": { - "name": "On Disconnected" - } - }, - { - "base": "OnEvent", - "details": { - "name": "OnEvent" - } - } - ] - } - ] -} \ No newline at end of file diff --git a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/ServerToAuthorityNotifyEvent.names b/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/ServerToAuthorityNotifyEvent.names deleted file mode 100644 index 71ab303260..0000000000 --- a/Gems/ScriptCanvas/Assets/TranslationAssets/AZEvents/ServerToAuthorityNotifyEvent.names +++ /dev/null @@ -1,56 +0,0 @@ -{ - "entries": [ - { - "base": "ServerToAuthority Notify Event", - "context": "AZEventHandler", - "variant": "", - "details": { - "name": "Server To Authority Notify Event" - }, - "slots": [ - { - "base": "someFloat", - "details": { - "name": "someFloat" - } - }, - { - "base": "ServerToAuthority Notify Event", - "details": { - "name": "ServerToAuthority Notify Event" - } - }, - { - "base": "Connect", - "details": { - "name": "Connect" - } - }, - { - "base": "Disconnect", - "details": { - "name": "Disconnect" - } - }, - { - "base": "On Connected", - "details": { - "name": "On Connected" - } - }, - { - "base": "On Disconnected", - "details": { - "name": "On Disconnected" - } - }, - { - "base": "OnEvent", - "details": { - "name": "OnEvent" - } - } - ] - } - ] -} \ No newline at end of file diff --git a/Gems/ScriptCanvas/Assets/TranslationAssets/Classes/NetworkTestPlayerComponent.names b/Gems/ScriptCanvas/Assets/TranslationAssets/Classes/NetworkTestPlayerComponent.names deleted file mode 100644 index 22636e0453..0000000000 --- a/Gems/ScriptCanvas/Assets/TranslationAssets/Classes/NetworkTestPlayerComponent.names +++ /dev/null @@ -1,438 +0,0 @@ -{ - "entries": [ - { - "base": "NetworkTestPlayerComponent", - "context": "BehaviorClass", - "variant": "", - "details": { - "name": "Network Test Player Component" - }, - "methods": [ - { - "base": "AutonomousToAuthority", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Autonomous To Authority" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Autonomous To Authority is invoked" - }, - "details": { - "name": "Autonomous To Authority" - }, - "params": [ - { - "typeid": "{CA5E5C37-98A6-04D2-E15C-1B4BFEE4C7DD}", - "details": { - "name": "Network Test Player Component" - } - }, - { - "typeid": "{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}", - "details": { - "name": "float" - } - } - ] - }, - { - "base": "ServerToAuthority", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Server To Authority" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Server To Authority is invoked" - }, - "details": { - "name": "Server To Authority" - }, - "params": [ - { - "typeid": "{CA5E5C37-98A6-04D2-E15C-1B4BFEE4C7DD}", - "details": { - "name": "Network Test Player Component" - } - }, - { - "typeid": "{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}", - "details": { - "name": "float" - } - } - ] - }, - { - "base": "AutonomousToAuthorityByEntityId", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Autonomous To Authority By Entity Id" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Autonomous To Authority By Entity Id is invoked" - }, - "details": { - "name": "Autonomous To Authority By Entity Id" - }, - "params": [ - { - "typeid": "{6383F1D3-BB27-4E6B-A49A-6409B2059EAA}", - "details": { - "name": "Source", - "tooltip": "The Source containing the NetworkTestPlayerComponentController" - } - }, - { - "typeid": "{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}", - "details": { - "name": "some Float" - } - } - ] - }, - { - "base": "ServerToAuthorityByEntityId", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Server To Authority By Entity Id" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Server To Authority By Entity Id is invoked" - }, - "details": { - "name": "Server To Authority By Entity Id" - }, - "params": [ - { - "typeid": "{6383F1D3-BB27-4E6B-A49A-6409B2059EAA}", - "details": { - "name": "Source", - "tooltip": "The Source containing the NetworkTestPlayerComponentController" - } - }, - { - "typeid": "{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}", - "details": { - "name": "some Float" - } - } - ] - }, - { - "base": "AutonomousToAuthorityNoParams", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Autonomous To Authority No Params" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Autonomous To Authority No Params is invoked" - }, - "details": { - "name": "Autonomous To Authority No Params" - }, - "params": [ - { - "typeid": "{CA5E5C37-98A6-04D2-E15C-1B4BFEE4C7DD}", - "details": { - "name": "Network Test Player Component" - } - } - ] - }, - { - "base": "AuthorityToAutonomous", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Authority To Autonomous" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Authority To Autonomous is invoked" - }, - "details": { - "name": "Authority To Autonomous" - }, - "params": [ - { - "typeid": "{CA5E5C37-98A6-04D2-E15C-1B4BFEE4C7DD}", - "details": { - "name": "Network Test Player Component" - } - }, - { - "typeid": "{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}", - "details": { - "name": "float" - } - } - ] - }, - { - "base": "AuthorityToClientNoParams", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Authority To Client No Params" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Authority To Client No Params is invoked" - }, - "details": { - "name": "Authority To Client No Params" - }, - "params": [ - { - "typeid": "{CA5E5C37-98A6-04D2-E15C-1B4BFEE4C7DD}", - "details": { - "name": "Network Test Player Component" - } - } - ] - }, - { - "base": "AuthorityToClientByEntityId", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Authority To Client By Entity Id" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Authority To Client By Entity Id is invoked" - }, - "details": { - "name": "Authority To Client By Entity Id" - }, - "params": [ - { - "typeid": "{6383F1D3-BB27-4E6B-A49A-6409B2059EAA}", - "details": { - "name": "Source", - "tooltip": "The Source containing the NetworkTestPlayerComponentController" - } - }, - { - "typeid": "{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}", - "details": { - "name": "some Float" - } - } - ] - }, - { - "base": "AuthorityToClient", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Authority To Client" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Authority To Client is invoked" - }, - "details": { - "name": "Authority To Client" - }, - "params": [ - { - "typeid": "{CA5E5C37-98A6-04D2-E15C-1B4BFEE4C7DD}", - "details": { - "name": "Network Test Player Component" - } - }, - { - "typeid": "{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}", - "details": { - "name": "float" - } - } - ] - }, - { - "base": "AuthorityToAutonomousNoParams", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Authority To Autonomous No Params" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Authority To Autonomous No Params is invoked" - }, - "details": { - "name": "Authority To Autonomous No Params" - }, - "params": [ - { - "typeid": "{CA5E5C37-98A6-04D2-E15C-1B4BFEE4C7DD}", - "details": { - "name": "Network Test Player Component" - } - } - ] - }, - { - "base": "ServerToAuthorityNoParamByEntityId", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Server To Authority No Param By Entity Id" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Server To Authority No Param By Entity Id is invoked" - }, - "details": { - "name": "Server To Authority No Param By Entity Id" - }, - "params": [ - { - "typeid": "{6383F1D3-BB27-4E6B-A49A-6409B2059EAA}", - "details": { - "name": "Source", - "tooltip": "The Source containing the NetworkTestPlayerComponentController" - } - } - ] - }, - { - "base": "AuthorityToClientNoParamsByEntityId", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Authority To Client No Params By Entity Id" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Authority To Client No Params By Entity Id is invoked" - }, - "details": { - "name": "Authority To Client No Params By Entity Id" - }, - "params": [ - { - "typeid": "{6383F1D3-BB27-4E6B-A49A-6409B2059EAA}", - "details": { - "name": "Source", - "tooltip": "The Source containing the NetworkTestPlayerComponentController" - } - } - ] - }, - { - "base": "AuthorityToAutonomousByEntityId", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Authority To Autonomous By Entity Id" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Authority To Autonomous By Entity Id is invoked" - }, - "details": { - "name": "Authority To Autonomous By Entity Id" - }, - "params": [ - { - "typeid": "{6383F1D3-BB27-4E6B-A49A-6409B2059EAA}", - "details": { - "name": "Source", - "tooltip": "The Source containing the NetworkTestPlayerComponentController" - } - }, - { - "typeid": "{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}", - "details": { - "name": "some Float" - } - } - ] - }, - { - "base": "AutonomousToAuthorityNoParamsByEntityId", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Autonomous To Authority No Params By Entity Id" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Autonomous To Authority No Params By Entity Id is invoked" - }, - "details": { - "name": "Autonomous To Authority No Params By Entity Id" - }, - "params": [ - { - "typeid": "{6383F1D3-BB27-4E6B-A49A-6409B2059EAA}", - "details": { - "name": "Source", - "tooltip": "The Source containing the NetworkTestPlayerComponentController" - } - } - ] - }, - { - "base": "AuthorityToAutonomousNoParamsByEntityId", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Authority To Autonomous No Params By Entity Id" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Authority To Autonomous No Params By Entity Id is invoked" - }, - "details": { - "name": "Authority To Autonomous No Params By Entity Id" - }, - "params": [ - { - "typeid": "{6383F1D3-BB27-4E6B-A49A-6409B2059EAA}", - "details": { - "name": "Source", - "tooltip": "The Source containing the NetworkTestPlayerComponentController" - } - } - ] - }, - { - "base": "ServerToAuthorityNoParam", - "context": "NetworkTestPlayerComponent", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Server To Authority No Param" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Server To Authority No Param is invoked" - }, - "details": { - "name": "Server To Authority No Param" - }, - "params": [ - { - "typeid": "{CA5E5C37-98A6-04D2-E15C-1B4BFEE4C7DD}", - "details": { - "name": "Network Test Player Component" - } - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/Gems/ScriptCanvas/Assets/TranslationAssets/Classes/NetworkTestPlayerComponentNetworkInput.names b/Gems/ScriptCanvas/Assets/TranslationAssets/Classes/NetworkTestPlayerComponentNetworkInput.names deleted file mode 100644 index d8c016db0f..0000000000 --- a/Gems/ScriptCanvas/Assets/TranslationAssets/Classes/NetworkTestPlayerComponentNetworkInput.names +++ /dev/null @@ -1,129 +0,0 @@ -{ - "entries": [ - { - "base": "NetworkTestPlayerComponentNetworkInput", - "context": "BehaviorClass", - "variant": "", - "details": { - "name": "Network Test Player Component Network Input" - }, - "methods": [ - { - "base": "CreateFromValues", - "context": "NetworkTestPlayerComponentNetworkInput", - "entry": { - "name": "In", - "tooltip": "When signaled, this will invoke Create From Values" - }, - "exit": { - "name": "Out", - "tooltip": "Signaled after Create From Values is invoked" - }, - "details": { - "name": "Create From Values" - }, - "params": [ - { - "typeid": "{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}", - "details": { - "name": "left Right" - } - } - ], - "results": [ - { - "typeid": "{12A1776B-61F6-4E5F-356A-AD718A62051F}", - "details": { - "name": "Network Test Player Component Network Input" - } - } - ] - }, - { - "base": "GetFwdBack", - "details": { - "name": "Get Fwd Back" - }, - "params": [ - { - "typeid": "{12A1776B-61F6-4E5F-356A-AD718A62051F}", - "details": { - "name": "Network Test Player Component Network Input" - } - } - ], - "results": [ - { - "typeid": "{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}", - "details": { - "name": "Fwd Back" - } - } - ] - }, - { - "base": "SetFwdBack", - "details": { - "name": "Set Fwd Back" - }, - "params": [ - { - "typeid": "{12A1776B-61F6-4E5F-356A-AD718A62051F}", - "details": { - "name": "Network Test Player Component Network Input" - } - }, - { - "typeid": "{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}", - "details": { - "name": "Fwd Back" - } - } - ] - }, - { - "base": "GetLeftRight", - "details": { - "name": "Get Left Right" - }, - "params": [ - { - "typeid": "{12A1776B-61F6-4E5F-356A-AD718A62051F}", - "details": { - "name": "Network Test Player Component Network Input" - } - } - ], - "results": [ - { - "typeid": "{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}", - "details": { - "name": "Left Right" - } - } - ] - }, - { - "base": "SetLeftRight", - "details": { - "name": "Set Left Right" - }, - "params": [ - { - "typeid": "{12A1776B-61F6-4E5F-356A-AD718A62051F}", - "details": { - "name": "Network Test Player Component Network Input" - } - }, - { - "typeid": "{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}", - "details": { - "name": "Left Right" - } - } - ] - } - ] - } - ] -} \ No newline at end of file From 561ff40c8154c335ad435086923a20aefa66a2d5 Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Wed, 12 Jan 2022 11:13:10 -0800 Subject: [PATCH 03/12] Creating a new multiplayer component which we'll assign to a networked level entity (as opposed to a network player). Signed-off-by: Gene Walters --- ...workTestLevelEntityComponent.AutoComponent.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 AutomatedTesting/Gem/Code/Source/AutoGen/NetworkTestLevelEntityComponent.AutoComponent.xml diff --git a/AutomatedTesting/Gem/Code/Source/AutoGen/NetworkTestLevelEntityComponent.AutoComponent.xml b/AutomatedTesting/Gem/Code/Source/AutoGen/NetworkTestLevelEntityComponent.AutoComponent.xml new file mode 100644 index 0000000000..2fd196a2f6 --- /dev/null +++ b/AutomatedTesting/Gem/Code/Source/AutoGen/NetworkTestLevelEntityComponent.AutoComponent.xml @@ -0,0 +1,15 @@ + + + + + + + + + From ee3196d64a9d31929951ad60134b22dbe4b1db02 Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Wed, 12 Jan 2022 11:31:45 -0800 Subject: [PATCH 04/12] Removed an RPC that's now being used inside the NetLevelEntity autocomponent Signed-off-by: Gene Walters --- .../Source/AutoGen/NetworkTestPlayerComponent.AutoComponent.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/AutomatedTesting/Gem/Code/Source/AutoGen/NetworkTestPlayerComponent.AutoComponent.xml b/AutomatedTesting/Gem/Code/Source/AutoGen/NetworkTestPlayerComponent.AutoComponent.xml index 251d2b25af..b4dd35d741 100644 --- a/AutomatedTesting/Gem/Code/Source/AutoGen/NetworkTestPlayerComponent.AutoComponent.xml +++ b/AutomatedTesting/Gem/Code/Source/AutoGen/NetworkTestPlayerComponent.AutoComponent.xml @@ -29,8 +29,6 @@ - - From 3b84049a1d12409d0cfa7bffcd5a059cc592915f Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Wed, 12 Jan 2022 12:18:06 -0800 Subject: [PATCH 05/12] Adding NetworkTestLevelEntityComponent to cmake for compilation Signed-off-by: Gene Walters --- AutomatedTesting/Gem/Code/automatedtesting_files.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/AutomatedTesting/Gem/Code/automatedtesting_files.cmake b/AutomatedTesting/Gem/Code/automatedtesting_files.cmake index eb619104a4..1f6dbbd772 100644 --- a/AutomatedTesting/Gem/Code/automatedtesting_files.cmake +++ b/AutomatedTesting/Gem/Code/automatedtesting_files.cmake @@ -12,4 +12,5 @@ set(FILES Source/AutomatedTestingSystemComponent.cpp Source/AutomatedTestingSystemComponent.h Source/AutoGen/NetworkTestPlayerComponent.AutoComponent.xml + Source/AutoGen/NetworkTestLevelEntityComponent.AutoComponent.xml ) From 4e811d5af8383844889ed45f903b8650319c0d08 Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Wed, 12 Jan 2022 12:19:59 -0800 Subject: [PATCH 06/12] Small update: adding the component type to a warning in order to help debug what component is failing Signed-off-by: Gene Walters --- Code/Framework/AzCore/AzCore/Component/Component.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Component/Component.cpp b/Code/Framework/AzCore/AzCore/Component/Component.cpp index c9829c6dd8..c11e4ef69f 100644 --- a/Code/Framework/AzCore/AzCore/Component/Component.cpp +++ b/Code/Framework/AzCore/AzCore/Component/Component.cpp @@ -49,7 +49,7 @@ namespace AZ return m_entity->GetId(); } - AZ_Warning("System", false, "Can't get component %p entity ID as it is not attached to an entity yet!", this); + AZ_Warning("System", false, "Can't get component (type: %s, addr: %p) entity ID as it is not attached to an entity yet!", RTTI_GetTypeName(), this); return EntityId(); } @@ -60,7 +60,7 @@ namespace AZ return NamedEntityId(m_entity->GetId(), m_entity->GetName()); } - AZ_Warning("System", false, "Can't get component %p entity ID as it is not attached to an entity yet!", this); + AZ_Warning("System", false, "Can't get component (type: %s, addr: %p) entity ID as it is not attached to an entity yet!", RTTI_GetTypeName(), this); return NamedEntityId(); } From a635e935e3893ad974e92a52fe4c71a115f1a325 Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Wed, 12 Jan 2022 12:20:46 -0800 Subject: [PATCH 07/12] minor typo fix on code warning Signed-off-by: Gene Walters --- Code/Framework/AzCore/AzCore/Component/Entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Framework/AzCore/AzCore/Component/Entity.cpp b/Code/Framework/AzCore/AzCore/Component/Entity.cpp index c5cda98f2c..db9ead93ad 100644 --- a/Code/Framework/AzCore/AzCore/Component/Entity.cpp +++ b/Code/Framework/AzCore/AzCore/Component/Entity.cpp @@ -230,7 +230,7 @@ namespace AZ EBUS_EVENT_ID(m_id, EntityBus, OnEntityDeactivated, m_id); EBUS_EVENT(EntitySystemBus, OnEntityDeactivated, m_id); - AZ_Assert(m_state == State::Active, "Component should be in Active state to br Deactivated!"); + AZ_Assert(m_state == State::Active, "Component should be in Active state to be Deactivated!"); SetState(State::Deactivating); for (ComponentArrayType::reverse_iterator it = m_components.rbegin(); it != m_components.rend(); ++it) From 49a0c78013391ca62424560a05a59434ff30c8f9 Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Wed, 12 Jan 2022 12:33:28 -0800 Subject: [PATCH 08/12] Check if transform component is attached to an entity before sending out notifications that rely upon having an entity; this stops runtime warnings when calling GetEntityId() Signed-off-by: Gene Walters --- .../Components/TransformComponent.cpp | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp index 809f664a10..e4e0ea08b2 100644 --- a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp @@ -585,21 +585,25 @@ namespace AzFramework EBUS_EVENT_PTR(m_notificationBus, AZ::TransformNotificationBus, OnParentChanged, oldParent, parentId); m_parentChangedEvent.Signal(oldParent, parentId); - if (oldParent != parentId) // Don't send removal notification while activating. + // Check if we're attached to an entity; the following notifications rely upon having a valid entity id + if (m_entity != nullptr) { - EBUS_EVENT_ID(oldParent, AZ::TransformNotificationBus, OnChildRemoved, GetEntityId()); - auto oldParentTransform = AZ::TransformBus::FindFirstHandler(oldParent); - if (oldParentTransform) + if (oldParent != parentId) // Don't send removal notification while activating. { - oldParentTransform->NotifyChildChangedEvent(AZ::ChildChangeType::Removed, GetEntityId()); + EBUS_EVENT_ID(oldParent, AZ::TransformNotificationBus, OnChildRemoved, GetEntityId()); + auto oldParentTransform = AZ::TransformBus::FindFirstHandler(oldParent); + if (oldParentTransform) + { + oldParentTransform->NotifyChildChangedEvent(AZ::ChildChangeType::Removed, GetEntityId()); + } } - } - EBUS_EVENT_ID(parentId, AZ::TransformNotificationBus, OnChildAdded, GetEntityId()); - auto newParentTransform = AZ::TransformBus::FindFirstHandler(parentId); - if (newParentTransform) - { - newParentTransform->NotifyChildChangedEvent(AZ::ChildChangeType::Added, GetEntityId()); + EBUS_EVENT_ID(parentId, AZ::TransformNotificationBus, OnChildAdded, GetEntityId()); + auto newParentTransform = AZ::TransformBus::FindFirstHandler(parentId); + if (newParentTransform) + { + newParentTransform->NotifyChildChangedEvent(AZ::ChildChangeType::Added, GetEntityId()); + } } } From ffde76208154d9e6c20f44f1d151eff82e763e9e Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Wed, 12 Jan 2022 12:43:39 -0800 Subject: [PATCH 09/12] Minor comment tweak, and code readability Signed-off-by: Gene Walters --- .../Code/Source/Editor/MultiplayerEditorConnection.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.cpp b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.cpp index c8c1ed15bd..3ae4eb6444 100644 --- a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.cpp +++ b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.cpp @@ -100,8 +100,8 @@ namespace Multiplayer { // Editor Server Init is intended for non-release targets m_byteStream.Write(packet.GetAssetData().GetSize(), reinterpret_cast(packet.ModifyAssetData().GetBuffer())); - - // In case if this is the last update, process the byteStream buffer. Otherwise more packets are expected + + // If this is the last update then process the byteStream buffer. Otherwise more packets are expected if (packet.GetLastUpdate()) { // This is the last expected packet @@ -150,9 +150,8 @@ namespace Multiplayer AZ::Interface::Get()->BuildSpawnablesList(); // Load the level via the root spawnable that was registered - const AZ::CVarFixedString loadLevelString = "LoadLevel Root.spawnable"; const auto console = AZ::Interface::Get(); - console->PerformCommand(loadLevelString.c_str()); + console->PerformCommand("LoadLevel Root.spawnable"); // Setup the normal multiplayer connection AZ::Interface::Get()->InitializeMultiplayer(MultiplayerAgentType::DedicatedServer); From c8e5bcc901c989c12c3e485df9427d0546d8d7ac Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Fri, 14 Jan 2022 12:01:32 -0800 Subject: [PATCH 10/12] Dont allow spawning netbound entities by default, we first need to initialize multiplayer and know our network agent type (dedicated-server/client-server/client). This will stop the editor playmode (which doesn't init multiplayer until it connects to the server) from spawning netbound entities Signed-off-by: Gene Walters --- Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h index dd2e7956ca..47238cc729 100644 --- a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h +++ b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h @@ -184,7 +184,7 @@ namespace Multiplayer double m_serverSendAccumulator = 0.0; float m_renderBlendFactor = 0.0f; float m_tickFactor = 0.0f; - bool m_spawnNetboundEntities = true; + bool m_spawnNetboundEntities = false; #if !defined(AZ_RELEASE_BUILD) MultiplayerEditorConnection m_editorConnectionListener; From e4bd28f636d9421bb1807bac8c1586afa26afe37 Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Fri, 14 Jan 2022 13:48:37 -0800 Subject: [PATCH 11/12] Update NetworkSpawnableLibrary to only hold onto network.spawnables (instead of all spawnables) Signed-off-by: Gene Walters --- .../Source/NetworkEntity/NetworkSpawnableLibrary.cpp | 4 ++-- .../Code/Source/NetworkEntity/NetworkSpawnableLibrary.h | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkSpawnableLibrary.cpp b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkSpawnableLibrary.cpp index f60778dbb4..7fb7bfdc39 100644 --- a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkSpawnableLibrary.cpp +++ b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkSpawnableLibrary.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include namespace Multiplayer @@ -42,7 +41,8 @@ namespace Multiplayer auto enumerateCallback = [this](const AZ::Data::AssetId id, const AZ::Data::AssetInfo& info) { - if (info.m_assetType == AZ::AzTypeInfo::Uuid()) + if (info.m_assetType == AZ::AzTypeInfo::Uuid() && + info.m_relativePath.ends_with(".network.spawnable")) { ProcessSpawnableAsset(info.m_relativePath, id); } diff --git a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkSpawnableLibrary.h b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkSpawnableLibrary.h index 0fc3ae07cc..db22ccf9de 100644 --- a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkSpawnableLibrary.h +++ b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkSpawnableLibrary.h @@ -22,13 +22,16 @@ namespace Multiplayer NetworkSpawnableLibrary(); ~NetworkSpawnableLibrary(); - - /// INetworkSpawnableLibrary overrides. + + //! INetworkSpawnableLibrary overrides. + //! @{ + // Iterates over all assets (on-disk and in-memory) and stores any spawnables that are "network.spawnables" + // This allows us to look up network spawnable assets by name or id for later use void BuildSpawnablesList() override; void ProcessSpawnableAsset(const AZStd::string& relativePath, AZ::Data::AssetId id) override; AZ::Name GetSpawnableNameFromAssetId(AZ::Data::AssetId assetId) override; AZ::Data::AssetId GetAssetIdByName(AZ::Name name) override; - + //! @} private: AZStd::unordered_map m_spawnables; From 786d6b5f85e7c1f5bf1f9ce8d24a0571c8d06ba1 Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Tue, 18 Jan 2022 10:22:31 -0800 Subject: [PATCH 12/12] minor code readability tweak Signed-off-by: Gene Walters --- .../Code/Source/NetworkEntity/NetworkEntityManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityManager.cpp b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityManager.cpp index fa524d464a..0a6aeea8a8 100644 --- a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityManager.cpp +++ b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityManager.cpp @@ -542,7 +542,7 @@ namespace Multiplayer optionalArgs.m_preInsertionCallback = [netSpawnableName, rootTransform = transform] (AzFramework::EntitySpawnTicket::Id, AzFramework::SpawnableEntityContainerView entities) { - bool shouldUpdateTransform = (rootTransform.IsClose(AZ::Transform::Identity()) == false); + const bool shouldUpdateTransform = !rootTransform.IsClose(AZ::Transform::Identity()); for (uint32_t netEntityIndex = 0, entitiesSize = aznumeric_cast(entities.size()); netEntityIndex < entitiesSize; ++netEntityIndex)