Fixed support for AZEvent name generation

Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com>
This commit is contained in:
lsemp3d
2021-12-02 16:43:21 -08:00
parent eedbf77e3d
commit 88b6e52248
12 changed files with 952 additions and 203 deletions
@@ -0,0 +1,50 @@
{
"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"
}
}
]
}
]
}
@@ -0,0 +1,56 @@
{
"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"
}
}
]
}
]
}
@@ -0,0 +1,50 @@
{
"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"
}
}
]
}
]
}
@@ -0,0 +1,56 @@
{
"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"
}
}
]
}
]
}
@@ -0,0 +1,50 @@
{
"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"
}
}
]
}
]
}
@@ -0,0 +1,56 @@
{
"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"
}
}
]
}
]
}
@@ -0,0 +1,50 @@
{
"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"
}
}
]
}
]
}
@@ -0,0 +1,56 @@
{
"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"
}
}
]
}
]
}
@@ -436,25 +436,11 @@
"details": {
"name": "Get Normal"
},
"params": [
{
"typeid": "",
"details": {
"name": ""
}
},
{
"typeid": "",
"details": {
"name": "Normal"
}
}
],
"results": [
{
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
"details": {
"name": "int"
"name": "Normal"
}
}
]
@@ -465,25 +451,11 @@
"details": {
"name": "Get Diffuse"
},
"params": [
{
"typeid": "",
"details": {
"name": ""
}
},
{
"typeid": "",
"details": {
"name": "Diffuse"
}
}
],
"results": [
{
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
"details": {
"name": "int"
"name": "Diffuse"
}
}
]
@@ -494,25 +466,11 @@
"details": {
"name": "Get Specular"
},
"params": [
{
"typeid": "",
"details": {
"name": ""
}
},
{
"typeid": "",
"details": {
"name": "Specular"
}
}
],
"results": [
{
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
"details": {
"name": "int"
"name": "Specular"
}
}
]
@@ -523,25 +481,11 @@
"details": {
"name": "Get Bump"
},
"params": [
{
"typeid": "",
"details": {
"name": ""
}
},
{
"typeid": "",
"details": {
"name": "Bump"
}
}
],
"results": [
{
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
"details": {
"name": "int"
"name": "Bump"
}
}
]
@@ -552,25 +496,11 @@
"details": {
"name": "Get Emissive"
},
"params": [
{
"typeid": "",
"details": {
"name": ""
}
},
{
"typeid": "",
"details": {
"name": "Emissive"
}
}
],
"results": [
{
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
"details": {
"name": "int"
"name": "Emissive"
}
}
]
@@ -581,25 +511,11 @@
"details": {
"name": "Get Roughness"
},
"params": [
{
"typeid": "",
"details": {
"name": ""
}
},
{
"typeid": "",
"details": {
"name": "Roughness"
}
}
],
"results": [
{
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
"details": {
"name": "int"
"name": "Roughness"
}
}
]
@@ -610,25 +526,11 @@
"details": {
"name": "Get Base Color"
},
"params": [
{
"typeid": "",
"details": {
"name": ""
}
},
{
"typeid": "",
"details": {
"name": "Base Color"
}
}
],
"results": [
{
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
"details": {
"name": "int"
"name": "Base Color"
}
}
]
@@ -639,25 +541,11 @@
"details": {
"name": "Get Ambient Occlusion"
},
"params": [
{
"typeid": "",
"details": {
"name": ""
}
},
{
"typeid": "",
"details": {
"name": "Ambient Occlusion"
}
}
],
"results": [
{
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
"details": {
"name": "int"
"name": "Ambient Occlusion"
}
}
]
@@ -668,25 +556,11 @@
"details": {
"name": "Get Metallic"
},
"params": [
{
"typeid": "",
"details": {
"name": ""
}
},
{
"typeid": "",
"details": {
"name": "Metallic"
}
}
],
"results": [
{
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
"details": {
"name": "int"
"name": "Metallic"
}
}
]
@@ -0,0 +1,438 @@
{
"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"
}
}
]
}
]
}
]
}
@@ -187,7 +187,7 @@ namespace ScriptCanvasEditorTools
}
}
AZ::Entity* TranslationGeneration::TranslateAZEvent(const AZ::BehaviorMethod& method)
AZ::Entity* TranslationGeneration::GetAZEventNode(const AZ::BehaviorMethod& method)
{
// Make sure the method returns an AZ::Event by reference or pointer
if (AZ::MethodReturnsAzEventByReferenceOrPointer(method))
@@ -247,6 +247,11 @@ namespace ScriptCanvasEditorTools
{
const AZ::BehaviorMethod* behaviorMethod = methodPair.second;
if (TranslateSingleAZEvent(behaviorMethod))
{
continue;
}
Method methodEntry;
AZStd::string cleanName = GraphCanvas::TranslationKey::Sanitize(methodPair.first);
@@ -362,20 +367,79 @@ namespace ScriptCanvasEditorTools
return true;
}
//! Generate the translation data for a specific AZ::Event
bool TranslationGeneration::TranslateSingleAZEvent(const AZ::BehaviorMethod* method)
{
AZ::Entity* node = GetAZEventNode(*method);
if (!node)
{
return false;
}
TranslationFormat translationRoot;
ScriptCanvas::Nodes::Core::AzEventHandler* nodeComponent = node->FindComponent<ScriptCanvas::Nodes::Core::AzEventHandler>();
nodeComponent->Init();
nodeComponent->Configure();
const ScriptCanvas::Nodes::Core::AzEventEntry& azEventEntry{ nodeComponent->GetEventEntry() };
Entry entry;
entry.m_key = azEventEntry.m_eventName;
entry.m_context = "AZEventHandler";
entry.m_details.m_name = azEventEntry.m_eventName;
SplitCamelCase(entry.m_details.m_name);
for (const ScriptCanvas::Slot& slot : nodeComponent->GetSlots())
{
Slot slotEntry;
if (slot.IsVisible())
{
slotEntry.m_key = slot.GetName();
if (slot.GetId() == azEventEntry.m_azEventInputSlotId)
{
slotEntry.m_details.m_name = azEventEntry.m_eventName;
}
else
{
slotEntry.m_details.m_name = slot.GetName();
}
entry.m_slots.push_back(slotEntry);
}
}
translationRoot.m_entries.push_back(entry);
// delete the node, don't need to keep it beyond this point
delete node;
AZStd::string filename = GraphCanvas::TranslationKey::Sanitize(entry.m_key);
AZStd::string targetFile = AZStd::string::format("AZEvents/%s", filename.c_str());
SaveJSONData(targetFile, translationRoot);
translationRoot.m_entries.clear();
return true;
}
void TranslationGeneration::TranslateAZEvents()
{
GraphCanvas::TranslationKey translationKey;
AZStd::vector<AZ::Entity*> nodes;
AZStd::vector<AZ::BehaviorMethod*> methods;
// Methods
for (const auto& behaviorMethod : m_behaviorContext->m_methods)
{
const auto& method = *behaviorMethod.second;
AZ::Entity* node = TranslateAZEvent(method);
if (node)
{
nodes.push_back(node);
}
const auto method = behaviorMethod.second;
methods.push_back(method);
}
// Methods in classes
@@ -383,66 +447,14 @@ namespace ScriptCanvasEditorTools
{
for (auto behaviorMethod : behaviorClass.second->m_methods)
{
const auto& method = *behaviorMethod.second;
AZ::Entity* node = TranslateAZEvent(method);
if (node)
{
nodes.push_back(node);
}
const auto method = behaviorMethod.second;
methods.push_back(method);
}
}
TranslationFormat translationRoot;
for (auto& node : nodes)
for (auto& method : methods)
{
ScriptCanvas::Nodes::Core::AzEventHandler* nodeComponent = node->FindComponent<ScriptCanvas::Nodes::Core::AzEventHandler>();
nodeComponent->Init();
nodeComponent->Configure();
const ScriptCanvas::Nodes::Core::AzEventEntry& azEventEntry{ nodeComponent->GetEventEntry() };
Entry entry;
entry.m_key = azEventEntry.m_eventName;
entry.m_context = "AZEventHandler";
entry.m_details.m_name = azEventEntry.m_eventName;
SplitCamelCase(entry.m_details.m_name);
for (const ScriptCanvas::Slot& slot : nodeComponent->GetSlots())
{
Slot slotEntry;
if (slot.IsVisible())
{
slotEntry.m_key = slot.GetName();
if (slot.GetId() == azEventEntry.m_azEventInputSlotId)
{
slotEntry.m_details.m_name = azEventEntry.m_eventName;
}
else
{
slotEntry.m_details.m_name = slot.GetName();
}
entry.m_slots.push_back(slotEntry);
}
}
translationRoot.m_entries.push_back(entry);
// delete the node, don't need to keep it beyond this point
delete node;
AZStd::string filename = GraphCanvas::TranslationKey::Sanitize(entry.m_key);
AZStd::string targetFile = AZStd::string::format("AZEvents/%s", filename.c_str());
SaveJSONData(targetFile, translationRoot);
translationRoot.m_entries.clear();
TranslateSingleAZEvent(method);
}
}
@@ -930,9 +942,7 @@ namespace ScriptCanvasEditorTools
// We know this is a getter, so there will only be one parameter, we will use the method name as a best
// guess for the argument name
SplitCamelCase(cleanName);
method.m_arguments.push_back(); // argument 0 is reserve for a "return value" which there won't be one
method.m_arguments.push_back(); // adding entry for the argument name
method.m_arguments[1].m_details.m_name = cleanName;
method.m_results[0].m_details.m_name = cleanName;
entry->m_methods.push_back(method);
@@ -108,7 +108,7 @@ namespace ScriptCanvasEditorTools
void TranslateEBus(const AZ::BehaviorEBus* behaviorEBus);
//! Generate the translation data for a specific AZ::Event
AZ::Entity* TranslateAZEvent(const AZ::BehaviorMethod& method);
bool TranslateSingleAZEvent(const AZ::BehaviorMethod* method);
//! Generate the translation data for AZ::Events
void TranslateAZEvents();
@@ -133,6 +133,9 @@ namespace ScriptCanvasEditorTools
private:
//! Returns the entity for a valid AZ::Event
AZ::Entity* GetAZEventNode(const AZ::BehaviorMethod& method);
//! Utility to populate a BehaviorMethod's translation data
void TranslateMethod(AZ::BehaviorMethod* behaviorMethod, Method& methodEntry);