Merge branch 'development' into redcode/driller_removal

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-12-03 13:35:16 -08:00
478 changed files with 7537 additions and 7933 deletions
@@ -188,7 +188,7 @@ namespace ScriptCanvasEditor
if (scriptCanvasSlot && scriptCanvasSlot->IsVisible())
{
auto graphCanvasSlotId = Nodes::DisplayScriptCanvasSlot(GetEntityId(), (*scriptCanvasSlot));
auto graphCanvasSlotId = Nodes::DisplayScriptCanvasSlot(GetEntityId(), (*scriptCanvasSlot), 0);
GraphCanvas::TranslationKey key;
key << "EBusHandler" << eventHandler->GetEBusName() << "methods" << m_eventName;
@@ -219,9 +219,10 @@ namespace ScriptCanvasEditor
if (scriptCanvasSlot && scriptCanvasSlot->IsVisible())
{
auto graphCanvasSlotId = Nodes::DisplayScriptCanvasSlot(GetEntityId(), (*scriptCanvasSlot));
int& index = (scriptCanvasSlot->IsData() && scriptCanvasSlot->IsOutput()) ? paramIndex : outputIndex;
auto graphCanvasSlotId = Nodes::DisplayScriptCanvasSlot(GetEntityId(), (*scriptCanvasSlot), index);
GraphCanvas::TranslationRequests::Details details;
if (scriptCanvasSlot->IsData())
@@ -254,7 +255,7 @@ namespace ScriptCanvasEditor
if (scriptCanvasSlot && scriptCanvasSlot->IsVisible())
{
Nodes::DisplayScriptCanvasSlot(GetEntityId(), (*scriptCanvasSlot));
Nodes::DisplayScriptCanvasSlot(GetEntityId(), (*scriptCanvasSlot), 0);
}
}
@@ -177,9 +177,11 @@ namespace ScriptCanvasEditor
if (scriptCanvasSlot && scriptCanvasSlot->IsVisible())
{
Nodes::DisplayScriptCanvasSlot(GetEntityId(), (*scriptCanvasSlot));
Nodes::DisplayScriptCanvasSlot(GetEntityId(), (*scriptCanvasSlot), 0);
}
int paramIndex = 0;
int outputIndex = 0;
//
// inputCount and outputCount work because the order of the slots is maintained from the BehaviorContext, if this changes
// in the future then we should consider storing the actual offset or key name at that time.
@@ -188,10 +190,14 @@ namespace ScriptCanvasEditor
{
scriptCanvasSlot = eventHandler->GetSlot(slotId);
int& index = (scriptCanvasSlot->IsData() && scriptCanvasSlot->IsInput()) ? paramIndex : outputIndex;
if (scriptCanvasSlot && scriptCanvasSlot->IsVisible())
{
Nodes::DisplayScriptCanvasSlot(GetEntityId(), (*scriptCanvasSlot));
Nodes::DisplayScriptCanvasSlot(GetEntityId(), (*scriptCanvasSlot), index);
}
++index;
}
if (myEvent.m_resultSlotId.IsValid())
@@ -200,7 +206,7 @@ namespace ScriptCanvasEditor
if (scriptCanvasSlot && scriptCanvasSlot->IsVisible())
{
Nodes::DisplayScriptCanvasSlot(GetEntityId(), (*scriptCanvasSlot));
Nodes::DisplayScriptCanvasSlot(GetEntityId(), (*scriptCanvasSlot), 0);
}
}
@@ -110,12 +110,17 @@ namespace ScriptCanvasEditor::Nodes
GraphCanvas::TranslationRequests::Details details;
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
int paramIndex = 0;
int outputIndex = 0;
// Create the GraphCanvas slots
for (const auto& slot : node->GetSlots())
{
GraphCanvas::TranslationKey slotKey;
slotKey << "ScriptCanvas::Node" << azrtti_typeid(node).ToString<AZStd::string>() << "slots";
int& index = (slot.IsData() && slot.IsInput()) ? paramIndex : outputIndex;
if (slot.IsVisible())
{
AZStd::string slotKeyStr;
@@ -150,11 +155,13 @@ namespace ScriptCanvasEditor::Nodes
slotDetails.m_tooltip = slot.GetToolTip();
}
AZ::EntityId graphCanvasSlotId = DisplayScriptCanvasSlot(graphCanvasEntity->GetId(), slot);
AZ::EntityId graphCanvasSlotId = DisplayScriptCanvasSlot(graphCanvasEntity->GetId(), slot, index);
GraphCanvas::SlotRequestBus::Event(graphCanvasSlotId, &GraphCanvas::SlotRequests::SetName, slotDetails.m_name);
GraphCanvas::SlotRequestBus::Event(graphCanvasSlotId, &GraphCanvas::SlotRequests::SetTooltip, slotDetails.m_tooltip);
}
++index;
}
const auto& visualExtensions = node->GetVisualExtensions();
@@ -328,6 +335,7 @@ namespace ScriptCanvasEditor::Nodes
// Set the class' name as the subtitle fallback
details.m_subtitle = details.m_name;
AZStd::string methodContext;
// Get the method's text data
GraphCanvas::TranslationRequests::Details methodDetails;
methodDetails.m_name = details.m_name; // fallback
@@ -338,14 +346,16 @@ namespace ScriptCanvasEditor::Nodes
if (methodNode->GetMethodType() == ScriptCanvas::MethodType::Getter || methodNode->GetMethodType() == ScriptCanvas::MethodType::Free)
{
updatedMethodName = "Get";
methodContext = "Getter";
}
else
{
updatedMethodName = "Set";
methodContext = "Setter";
}
updatedMethodName.append(methodName);
}
key << updatedMethodName;
key << methodContext << updatedMethodName;
GraphCanvas::TranslationRequestBus::BroadcastResult(methodDetails, &GraphCanvas::TranslationRequests::GetDetails, key + ".details", methodDetails);
@@ -372,9 +382,11 @@ namespace ScriptCanvasEditor::Nodes
{
GraphCanvas::TranslationKey slotKey = key;
int& index = (slot.IsData() && slot.IsInput()) ? paramIndex : outputIndex;
if (slot.IsVisible())
{
AZ::EntityId graphCanvasSlotId = DisplayScriptCanvasSlot(graphCanvasNodeId, slot);
AZ::EntityId graphCanvasSlotId = DisplayScriptCanvasSlot(graphCanvasNodeId, slot, index);
details.m_name = slot.GetName();
details.m_tooltip = slot.GetToolTip();
@@ -386,7 +398,7 @@ namespace ScriptCanvasEditor::Nodes
}
else
{
int& index = (slot.IsData() && slot.IsInput()) ? paramIndex : outputIndex;
if (slot.IsData())
{
@@ -416,6 +428,8 @@ namespace ScriptCanvasEditor::Nodes
UpdateSlotDatumLabel(graphCanvasNodeId, slot.GetId(), details.m_name);
}
++index;
}
// Set the name
@@ -471,6 +485,9 @@ namespace ScriptCanvasEditor::Nodes
AZStd::vector< ScriptCanvas::SlotId > scriptCanvasSlots = busNode->GetNonEventSlotIds();
int paramIndex = 0;
int outputIndex = 0;
for (const auto& slotId : scriptCanvasSlots)
{
ScriptCanvas::Slot* slot = busNode->GetSlot(slotId);
@@ -484,6 +501,8 @@ namespace ScriptCanvasEditor::Nodes
if (slot->IsVisible())
{
int& index = (slot->IsData() && slot->IsInput()) ? paramIndex : outputIndex;
AZ::EntityId gcSlotId = DisplayScriptCanvasSlot(graphCanvasNodeId, (*slot), group);
if (busNode->IsIDRequired() && slot->GetDescriptor() == ScriptCanvas::SlotDescriptors::DataIn())
@@ -497,6 +516,8 @@ namespace ScriptCanvasEditor::Nodes
GraphCanvas::SlotRequestBus::Event(gcSlotId, &GraphCanvas::SlotRequests::SetDetails, details.m_name, details.m_tooltip);
}
++index;
}
}
@@ -594,12 +615,17 @@ namespace ScriptCanvasEditor::Nodes
*graphCanvasUserData = azEventNode->GetEntityId();
}
int paramIndex = 0;
int outputIndex = 0;
for (const ScriptCanvas::Slot& slot: azEventNode->GetSlots())
{
GraphCanvas::SlotGroup group = GraphCanvas::SlotGroups::Invalid;
if (slot.IsVisible())
{
int& index = (slot.IsData() && slot.IsInput()) ? paramIndex : outputIndex;
AZ::EntityId gcSlotId = DisplayScriptCanvasSlot(graphCanvasNodeId, slot, group);
GraphCanvas::TranslationKey key;
@@ -610,6 +636,8 @@ namespace ScriptCanvasEditor::Nodes
GraphCanvas::SlotRequestBus::Event(gcSlotId, &GraphCanvas::SlotRequests::SetName, details.m_name);
GraphCanvas::SlotRequestBus::Event(gcSlotId, &GraphCanvas::SlotRequests::SetTooltip, details.m_tooltip);;
++index;
}
}
@@ -675,6 +703,9 @@ namespace ScriptCanvasEditor::Nodes
AZStd::vector< ScriptCanvas::SlotId > scriptCanvasSlots = busNode->GetNonEventSlotIds();
int paramIndex = 0;
int outputIndex = 0;
for (const auto& slotId : scriptCanvasSlots)
{
ScriptCanvas::Slot* slot = busNode->GetSlot(slotId);
@@ -688,6 +719,8 @@ namespace ScriptCanvasEditor::Nodes
if (slot->IsVisible())
{
int& index = (slot->IsData() && slot->IsInput()) ? paramIndex : outputIndex;
AZ::EntityId gcSlotId = DisplayScriptCanvasSlot(graphCanvasNodeId, (*slot), group);
if (busNode->IsIDRequired() && slot->GetDescriptor() == ScriptCanvas::SlotDescriptors::DataIn())
@@ -698,6 +731,8 @@ namespace ScriptCanvasEditor::Nodes
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
GraphCanvas::SlotRequestBus::Event(gcSlotId, &GraphCanvas::SlotRequests::SetDetails, details.m_name, details.m_tooltip);
}
++index;
}
}
@@ -783,17 +818,24 @@ namespace ScriptCanvasEditor::Nodes
return graphCanvasNodeId;
}
int paramIndex = 0;
int outputIndex = 0;
for (const auto& slot : senderNode->GetSlots())
{
int& index = (slot.IsData() && slot.IsInput()) ? paramIndex : outputIndex;
if (slot.IsVisible())
{
AZ::EntityId graphCanvasSlotId = DisplayScriptCanvasSlot(graphCanvasNodeId, slot);
AZ::EntityId graphCanvasSlotId = DisplayScriptCanvasSlot(graphCanvasNodeId, slot, index);
GraphCanvas::SlotRequestBus::Event(graphCanvasSlotId, &GraphCanvas::SlotRequests::SetName, slot.GetName());
GraphCanvas::SlotRequestBus::Event(graphCanvasSlotId, &GraphCanvas::SlotRequests::SetTooltip, slot.GetToolTip());
UpdateSlotDatumLabel(graphCanvasNodeId, slot.GetId(), slot.GetName());
}
++index;
}
// Set the name
@@ -871,14 +913,21 @@ namespace ScriptCanvasEditor::Nodes
return graphCanvasNodeId;
}
int paramIndex = 0;
int outputIndex = 0;
for (const auto& slot : functionNode->GetSlots())
{
AZ::EntityId graphCanvasSlotId = DisplayScriptCanvasSlot(graphCanvasNodeId, slot);
int& index = (slot.IsData() && slot.IsInput()) ? paramIndex : outputIndex;
AZ::EntityId graphCanvasSlotId = DisplayScriptCanvasSlot(graphCanvasNodeId, slot, index);
GraphCanvas::SlotRequestBus::Event(graphCanvasSlotId, &GraphCanvas::SlotRequests::SetName, slot.GetName());
GraphCanvas::SlotRequestBus::Event(graphCanvasSlotId, &GraphCanvas::SlotRequests::SetTooltip, slot.GetToolTip());
UpdateSlotDatumLabel(graphCanvasNodeId, slot.GetId(), slot.GetName());
++index;
}
if (asset)
@@ -1141,7 +1190,7 @@ namespace ScriptCanvasEditor::Nodes
return graphCanvasConnectionType;
}
AZ::EntityId DisplayScriptCanvasSlot(AZ::EntityId graphCanvasNodeId, const ScriptCanvas::Slot& slot, GraphCanvas::SlotGroup slotGroup)
AZ::EntityId DisplayScriptCanvasSlot(AZ::EntityId graphCanvasNodeId, const ScriptCanvas::Slot& slot, int slotIndex, GraphCanvas::SlotGroup slotGroup)
{
if (!slot.IsVisible())
{
@@ -1244,6 +1293,7 @@ namespace ScriptCanvasEditor::Nodes
}
slotKeyStr.append(slot.GetName());
slotKeyStr.append(AZStd::string::format("_%d", slotIndex));
slotKey << slotKeyStr << "details";
GraphCanvas::TranslationRequests::Details slotDetails;
@@ -63,5 +63,5 @@ namespace ScriptCanvasEditor::Nodes
// SlotGroup will control how elements are grouped.
// Invalid will cause the slots to put themselves into whatever category they belong to by default.
AZ::EntityId DisplayScriptCanvasSlot(AZ::EntityId graphCanvasNodeId, const ScriptCanvas::Slot& slot, GraphCanvas::SlotGroup group = GraphCanvas::SlotGroups::Invalid);
AZ::EntityId DisplayScriptCanvasSlot(AZ::EntityId graphCanvasNodeId, const ScriptCanvas::Slot& slot, int slotIndex, GraphCanvas::SlotGroup group = GraphCanvas::SlotGroups::Invalid);
}
@@ -1023,13 +1023,15 @@ namespace ScriptCanvasEditor
GraphCanvas::TranslationKey key;
AZStd::string context;
AZStd::string updatedMethodName;
if (propertyStatus != ScriptCanvas::PropertyStatus::None)
{
updatedMethodName = (propertyStatus == ScriptCanvas::PropertyStatus::Getter) ? "Get" : "Set";
context = (propertyStatus == ScriptCanvas::PropertyStatus::Getter) ? "Getter" : "Setter";
}
updatedMethodName += methodName;
key << "BehaviorClass" << methodClass.c_str() << "methods" << updatedMethodName << "details";
key << "BehaviorClass" << context << methodClass << "methods" << updatedMethodName << "details";
GraphCanvas::TranslationRequests::Details details;
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
@@ -188,7 +188,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))
@@ -248,6 +248,11 @@ namespace ScriptCanvasEditorTools
{
const AZ::BehaviorMethod* behaviorMethod = methodPair.second;
if (TranslateSingleAZEvent(behaviorMethod))
{
continue;
}
Method methodEntry;
AZStd::string cleanName = GraphCanvas::TranslationKey::Sanitize(methodPair.first);
@@ -363,20 +368,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
@@ -384,66 +448,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);
}
}
@@ -484,6 +496,7 @@ namespace ScriptCanvasEditorTools
{
TranslateNode(node);
}
}
void TranslationGeneration::TranslateNode(const AZ::TypeId& nodeTypeId)
@@ -558,8 +571,11 @@ namespace ScriptCanvasEditorTools
nodeComponent->Init();
nodeComponent->Configure();
int inputIndex = 0;
int outputIndex = 0;
int exeInputIndex = 0;
int exeOutputIndex = 0;
int dataInputIndex = 0;
int dataOutputIndex = 0;
const auto& allSlots = nodeComponent->GetAllSlots();
for (const auto& slot : allSlots)
@@ -570,16 +586,16 @@ namespace ScriptCanvasEditorTools
{
if (slot->GetDescriptor().IsInput())
{
slotEntry.m_key = AZStd::string::format("Input_%s", slot->GetName().c_str());
inputIndex++;
slotEntry.m_key = AZStd::string::format("Input_%s_%d", slot->GetName().c_str(), exeInputIndex);
exeInputIndex++;
slotEntry.m_details.m_name = slot->GetName();
slotEntry.m_details.m_tooltip = slot->GetToolTip();
}
else if (slot->GetDescriptor().IsOutput())
{
slotEntry.m_key = AZStd::string::format("Output_%s", slot->GetName().c_str());
outputIndex++;
slotEntry.m_key = AZStd::string::format("Output_%s_%d", slot->GetName().c_str(), exeOutputIndex);
exeOutputIndex++;
slotEntry.m_details.m_name = slot->GetName();
slotEntry.m_details.m_tooltip = slot->GetToolTip();
@@ -618,8 +634,8 @@ namespace ScriptCanvasEditorTools
if (slot->GetDescriptor().IsInput())
{
slotEntry.m_key = AZStd::string::format("DataInput_%s", slot->GetName().c_str());
inputIndex++;
slotEntry.m_key = AZStd::string::format("DataInput_%s_%d", slot->GetName().c_str(), dataInputIndex);
dataInputIndex++;
AZStd::string argumentKey = slotTypeKey;
AZStd::string argumentName = slot->GetName();
@@ -632,8 +648,8 @@ namespace ScriptCanvasEditorTools
}
else if (slot->GetDescriptor().IsOutput())
{
slotEntry.m_key = AZStd::string::format("DataOutput_%s", slot->GetName().c_str());
outputIndex++;
slotEntry.m_key = AZStd::string::format("DataOutput_%s_%d", slot->GetName().c_str(), dataOutputIndex);
dataOutputIndex++;
AZStd::string resultKey = slotTypeKey;
AZStd::string resultName = slot->GetName();
@@ -943,6 +959,7 @@ namespace ScriptCanvasEditorTools
AZStd::string methodName = "Get";
methodName.append(cleanName);
method.m_key = methodName;
method.m_context = "Getter";
method.m_details.m_name = methodName;
method.m_details.m_tooltip = behaviorProperty->m_getter->m_debugDescription ? behaviorProperty->m_getter->m_debugDescription : "";
@@ -953,7 +970,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[1].m_details.m_name = cleanName;
method.m_results[0].m_details.m_name = cleanName;
entry->m_methods.push_back(method);
@@ -970,6 +987,7 @@ namespace ScriptCanvasEditorTools
methodName.append(cleanName);
method.m_key = methodName;
method.m_context = "Setter";
method.m_details.m_name = methodName;
method.m_details.m_tooltip = behaviorProperty->m_setter->m_debugDescription ? behaviorProperty->m_getter->m_debugDescription : "";
@@ -1345,7 +1363,7 @@ namespace ScriptCanvasEditorTools
scratchBuffer.Clear();
AzQtComponents::ShowFileOnDesktop(endPath.c_str());
// AzQtComponents::ShowFileOnDesktop(endPath.c_str());
}
@@ -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();
@@ -136,6 +136,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);