Fix names display index and scripting dev gem (#6822)
* Fix input/output params not being zero-based * Expose missing Dump Database developer command * Fix issue where developer gem name is not the same as the target * Let the user specify folder to write to Signed-off-by: Alex Peterson <26804013+AMZN-alexpete@users.noreply.github.com>
This commit is contained in:
@@ -376,60 +376,60 @@ namespace ScriptCanvasEditor::Nodes
|
||||
|
||||
int paramIndex = 0;
|
||||
int outputIndex = 0;
|
||||
int slotIndex = 0;
|
||||
|
||||
auto busId = methodNode->GetBusSlotId();
|
||||
for (const auto& slot : methodNode->GetSlots())
|
||||
{
|
||||
GraphCanvas::TranslationKey slotKey = key;
|
||||
|
||||
int& index = (slot.IsData() && slot.IsInput()) ? paramIndex : outputIndex;
|
||||
int& inputOutputIndex = slot.IsInput() ? paramIndex : outputIndex;
|
||||
|
||||
const bool isBusIdSlot =
|
||||
methodNode->HasBusID() && busId == slot.GetId() && slot.GetDescriptor() == ScriptCanvas::SlotDescriptors::DataIn();
|
||||
if (slot.IsVisible())
|
||||
{
|
||||
AZ::EntityId graphCanvasSlotId = DisplayScriptCanvasSlot(graphCanvasNodeId, slot, index);
|
||||
AZ::EntityId graphCanvasSlotId = DisplayScriptCanvasSlot(graphCanvasNodeId, slot, slotIndex);
|
||||
|
||||
details.m_name = slot.GetName();
|
||||
details.m_tooltip = slot.GetToolTip();
|
||||
|
||||
if (methodNode->HasBusID() && busId == slot.GetId() && slot.GetDescriptor() == ScriptCanvas::SlotDescriptors::DataIn())
|
||||
if (isBusIdSlot)
|
||||
{
|
||||
key = ::Translation::GlobalKeys::EBusSenderIDKey;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key + ".details", details);
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(
|
||||
details, &GraphCanvas::TranslationRequests::GetDetails, key + ".details", details);
|
||||
}
|
||||
else
|
||||
else if (slot.IsData())
|
||||
{
|
||||
|
||||
|
||||
if (slot.IsData())
|
||||
key.clear();
|
||||
key << context << className << "methods" << updatedMethodName;
|
||||
if (slot.IsInput())
|
||||
{
|
||||
key.clear();
|
||||
key << context << className << "methods" << updatedMethodName;
|
||||
if (slot.IsData() && slot.IsInput())
|
||||
{
|
||||
key << "params";
|
||||
}
|
||||
else
|
||||
{
|
||||
key << "results";
|
||||
}
|
||||
key << index;
|
||||
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key + ".details", details);
|
||||
key << "params";
|
||||
}
|
||||
|
||||
if (slot.IsData())
|
||||
{
|
||||
index++;
|
||||
else
|
||||
{
|
||||
key << "results";
|
||||
}
|
||||
key << inputOutputIndex;
|
||||
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(
|
||||
details, &GraphCanvas::TranslationRequests::GetDetails, key + ".details", details);
|
||||
}
|
||||
|
||||
GraphCanvas::SlotRequestBus::Event(graphCanvasSlotId, &GraphCanvas::SlotRequests::SetDetails, details.m_name, details.m_tooltip);
|
||||
GraphCanvas::SlotRequestBus::Event(
|
||||
graphCanvasSlotId, &GraphCanvas::SlotRequests::SetDetails, details.m_name, details.m_tooltip);
|
||||
|
||||
UpdateSlotDatumLabel(graphCanvasNodeId, slot.GetId(), details.m_name);
|
||||
|
||||
}
|
||||
|
||||
++index;
|
||||
++slotIndex;
|
||||
|
||||
if (!isBusIdSlot && slot.IsData())
|
||||
{
|
||||
++inputOutputIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the name
|
||||
@@ -485,9 +485,6 @@ 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);
|
||||
@@ -501,8 +498,6 @@ 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())
|
||||
@@ -516,8 +511,6 @@ namespace ScriptCanvasEditor::Nodes
|
||||
|
||||
GraphCanvas::SlotRequestBus::Event(gcSlotId, &GraphCanvas::SlotRequests::SetDetails, details.m_name, details.m_tooltip);
|
||||
}
|
||||
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -615,17 +608,12 @@ 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;
|
||||
@@ -636,8 +624,6 @@ namespace ScriptCanvasEditor::Nodes
|
||||
|
||||
GraphCanvas::SlotRequestBus::Event(gcSlotId, &GraphCanvas::SlotRequests::SetName, details.m_name);
|
||||
GraphCanvas::SlotRequestBus::Event(gcSlotId, &GraphCanvas::SlotRequests::SetTooltip, details.m_tooltip);;
|
||||
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -703,9 +689,6 @@ 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);
|
||||
@@ -719,8 +702,6 @@ 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())
|
||||
@@ -731,8 +712,6 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
#include <QAction>
|
||||
#include <QObject>
|
||||
#include <QMenu>
|
||||
#include <QFileDialog>
|
||||
#include <QStandardPaths>
|
||||
#include <QMessageBox>
|
||||
#endif
|
||||
|
||||
#include <Source/Translation/TranslationBus.h>
|
||||
@@ -34,6 +37,26 @@ namespace ScriptCanvasDeveloperEditor
|
||||
qAction->setShortcut(QAction::tr("Ctrl+Alt+R", "Developer|Reload Text"));
|
||||
QObject::connect(qAction, &QAction::triggered, [mainWindow]() { ReloadText(mainWindow); });
|
||||
|
||||
qAction = mainMenu->addAction(QAction::tr("Dump Translation Database"));
|
||||
qAction->setAutoRepeat(false);
|
||||
qAction->setShortcut(QAction::tr("Ctrl+Alt+L", "Developer|Dump Translation Database"));
|
||||
QObject::connect(
|
||||
qAction, &QAction::triggered,
|
||||
[mainWindow]()
|
||||
{
|
||||
QString defaultPath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||
QString directory = QFileDialog::getExistingDirectory(mainWindow,
|
||||
QObject::tr("Select output folder for sc_translation.log file"), defaultPath);
|
||||
if (!directory.isEmpty())
|
||||
{
|
||||
const QString path = QDir::toNativeSeparators(directory + "/sc_translation.log");
|
||||
GraphCanvas::TranslationRequestBus::Broadcast(&GraphCanvas::TranslationRequests::DumpDatabase, path.toUtf8().constData());
|
||||
QMessageBox::information(
|
||||
mainWindow, QObject::tr("Finished writing translation database"),
|
||||
QObject::tr("Translation database written to:<br/><a href=\"file:///%1\">%1</a>").arg(path));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return qAction;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"gem_name": "ScriptCanvasDeveloperGem",
|
||||
"gem_name": "ScriptCanvasDeveloper",
|
||||
"display_name": "Script Canvas Developer",
|
||||
"license": "Apache-2.0 Or MIT",
|
||||
"license_url": "https://github.com/o3de/o3de/blob/development/LICENSE.txt",
|
||||
|
||||
Reference in New Issue
Block a user