Updated node format to account for duplicated slot names + regenerated node names
Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com>
This commit is contained in:
+4
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-3
@@ -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();
|
||||
@@ -375,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();
|
||||
@@ -389,7 +398,7 @@ namespace ScriptCanvasEditor::Nodes
|
||||
}
|
||||
else
|
||||
{
|
||||
int& index = (slot.IsData() && slot.IsInput()) ? paramIndex : outputIndex;
|
||||
|
||||
|
||||
if (slot.IsData())
|
||||
{
|
||||
@@ -419,6 +428,8 @@ namespace ScriptCanvasEditor::Nodes
|
||||
UpdateSlotDatumLabel(graphCanvasNodeId, slot.GetId(), details.m_name);
|
||||
|
||||
}
|
||||
|
||||
++index;
|
||||
}
|
||||
|
||||
// Set the name
|
||||
@@ -474,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);
|
||||
@@ -487,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())
|
||||
@@ -500,6 +516,8 @@ namespace ScriptCanvasEditor::Nodes
|
||||
|
||||
GraphCanvas::SlotRequestBus::Event(gcSlotId, &GraphCanvas::SlotRequests::SetDetails, details.m_name, details.m_tooltip);
|
||||
}
|
||||
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,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;
|
||||
@@ -613,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -678,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);
|
||||
@@ -691,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())
|
||||
@@ -701,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -786,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
|
||||
@@ -874,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)
|
||||
@@ -1144,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())
|
||||
{
|
||||
@@ -1247,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);
|
||||
}
|
||||
|
||||
@@ -483,6 +483,7 @@ namespace ScriptCanvasEditorTools
|
||||
{
|
||||
TranslateNode(node);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TranslationGeneration::TranslateNode(const AZ::TypeId& nodeTypeId)
|
||||
@@ -557,8 +558,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)
|
||||
@@ -569,16 +573,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();
|
||||
@@ -617,8 +621,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();
|
||||
@@ -631,8 +635,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();
|
||||
@@ -1321,7 +1325,7 @@ namespace ScriptCanvasEditorTools
|
||||
|
||||
scratchBuffer.Clear();
|
||||
|
||||
AzQtComponents::ShowFileOnDesktop(endPath.c_str());
|
||||
// AzQtComponents::ShowFileOnDesktop(endPath.c_str());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user