Improved generation by splitting up CamelCase text for names, updated more node names
Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com>
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Settings/SettingsRegistry.h>
|
||||
#include <AzCore/std/string/regex.h>
|
||||
|
||||
#include <AzFramework/Gem/GemInfo.h>
|
||||
|
||||
@@ -87,6 +88,8 @@ namespace ScriptCanvasEditorTools
|
||||
entry.m_details.m_name = prettyName;
|
||||
}
|
||||
|
||||
SplitCamelCase(entry.m_details.m_name);
|
||||
|
||||
for (auto event : behaviorEBus->m_events)
|
||||
{
|
||||
const AZ::BehaviorEBusEventSender& ebusSender = event.second;
|
||||
@@ -112,6 +115,8 @@ namespace ScriptCanvasEditorTools
|
||||
eventEntry.m_details.m_name = prettyName.empty() ? eventName : prettyName;
|
||||
eventEntry.m_details.m_tooltip = Helpers::ReadStringAttribute(event.second.m_attributes, AZ::Script::Attributes::ToolTip);
|
||||
|
||||
SplitCamelCase(eventEntry.m_details.m_name);
|
||||
|
||||
eventEntry.m_entry.m_name = "In";
|
||||
eventEntry.m_entry.m_tooltip = AZStd::string::format("When signaled, this will invoke %s", eventEntry.m_details.m_name.c_str());
|
||||
eventEntry.m_exit.m_name = "Out";
|
||||
@@ -141,6 +146,8 @@ namespace ScriptCanvasEditorTools
|
||||
|
||||
argument.m_typeId = argumentType.ToString<AZStd::string>();
|
||||
|
||||
SplitCamelCase(argument.m_details.m_name);
|
||||
|
||||
eventEntry.m_arguments.push_back(argument);
|
||||
}
|
||||
|
||||
@@ -160,6 +167,8 @@ namespace ScriptCanvasEditorTools
|
||||
|
||||
result.m_typeId = resultType.ToString<AZStd::string>();
|
||||
|
||||
SplitCamelCase(result.m_details.m_name);
|
||||
|
||||
eventEntry.m_results.push_back(result);
|
||||
}
|
||||
|
||||
@@ -229,6 +238,8 @@ namespace ScriptCanvasEditorTools
|
||||
details.m_category = Helpers::GetStringAttribute(behaviorClass, AZ::Script::Attributes::Category);
|
||||
details.m_tooltip = Helpers::GetStringAttribute(behaviorClass, AZ::Script::Attributes::ToolTip);
|
||||
|
||||
SplitCamelCase(details.m_name);
|
||||
|
||||
if (!behaviorClass->m_methods.empty())
|
||||
{
|
||||
for (const auto& methodPair : behaviorClass->m_methods)
|
||||
@@ -246,10 +257,14 @@ namespace ScriptCanvasEditorTools
|
||||
methodEntry.m_details.m_tooltip = "";
|
||||
methodEntry.m_details.m_name = methodPair.second->m_name;
|
||||
|
||||
AZStd::string prefix = className + "::";
|
||||
AZ::StringFunc::Replace(methodEntry.m_details.m_name, prefix.c_str(), "");
|
||||
SplitCamelCase(methodEntry.m_details.m_name);
|
||||
|
||||
methodEntry.m_entry.m_name = "In";
|
||||
methodEntry.m_entry.m_tooltip = AZStd::string::format("When signaled, this will invoke %s", cleanName.c_str());
|
||||
methodEntry.m_entry.m_tooltip = AZStd::string::format("When signaled, this will invoke %s", methodEntry.m_details.m_name.c_str());
|
||||
methodEntry.m_exit.m_name = "Out";
|
||||
methodEntry.m_exit.m_tooltip = AZStd::string::format("Signaled after %s is invoked", cleanName.c_str());
|
||||
methodEntry.m_exit.m_tooltip = AZStd::string::format("Signaled after %s is invoked", methodEntry.m_details.m_name.c_str());
|
||||
|
||||
if (!Helpers::MethodHasAttribute(behaviorMethod, AZ::ScriptCanvasAttributes::FloatingFunction))
|
||||
{
|
||||
@@ -260,11 +275,6 @@ namespace ScriptCanvasEditorTools
|
||||
methodEntry.m_details.m_category = Helpers::ReadStringAttribute(behaviorMethod->m_attributes, AZ::Script::Attributes::Category);
|
||||
}
|
||||
|
||||
if (methodEntry.m_details.m_category.empty())
|
||||
{
|
||||
methodEntry.m_details.m_category = "Other";
|
||||
}
|
||||
|
||||
// Arguments (Input Slots)
|
||||
if (behaviorMethod->GetNumArguments() > 0)
|
||||
{
|
||||
@@ -285,6 +295,8 @@ namespace ScriptCanvasEditorTools
|
||||
argument.m_details.m_category = "";
|
||||
argument.m_details.m_tooltip = argumentDescription;
|
||||
|
||||
SplitCamelCase(argument.m_details.m_name);
|
||||
|
||||
methodEntry.m_arguments.push_back(argument);
|
||||
}
|
||||
}
|
||||
@@ -305,6 +317,8 @@ namespace ScriptCanvasEditorTools
|
||||
result.m_details.m_name = resultParameter->m_name;
|
||||
result.m_details.m_tooltip = resultDescription;
|
||||
|
||||
SplitCamelCase(result.m_details.m_name);
|
||||
|
||||
methodEntry.m_results.push_back(result);
|
||||
}
|
||||
|
||||
@@ -380,6 +394,8 @@ namespace ScriptCanvasEditorTools
|
||||
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;
|
||||
@@ -479,6 +495,8 @@ namespace ScriptCanvasEditorTools
|
||||
details.m_name = cleanName;
|
||||
}
|
||||
|
||||
SplitCamelCase(details.m_name);
|
||||
|
||||
// Tooltip attribute takes priority over the edit data description
|
||||
AZStd::string tooltip = Helpers::GetStringAttribute(classData, AZ::Script::Attributes::ToolTip);
|
||||
if (!tooltip.empty())
|
||||
@@ -666,6 +684,7 @@ namespace ScriptCanvasEditorTools
|
||||
|
||||
EntryDetails& details = entry.m_details;
|
||||
details.m_name = behaviorClass->m_name;
|
||||
SplitCamelCase(details.m_name);
|
||||
|
||||
// Get the pretty name
|
||||
AZStd::string prettyName;
|
||||
@@ -699,6 +718,7 @@ namespace ScriptCanvasEditorTools
|
||||
|
||||
methodEntry.m_details.m_tooltip = Helpers::GetStringAttribute(behaviorMethod, AZ::Script::Attributes::ToolTip);
|
||||
methodEntry.m_details.m_name = methodPair.second->m_name;
|
||||
SplitCamelCase(methodEntry.m_details.m_name);
|
||||
|
||||
// Strip the className from the methodName
|
||||
AZStd::string qualifiedName = behaviorClass->m_name + "::";
|
||||
@@ -731,6 +751,8 @@ namespace ScriptCanvasEditorTools
|
||||
argument.m_details.m_category = "";
|
||||
argument.m_details.m_tooltip = argumentDescription;
|
||||
|
||||
SplitCamelCase(argument.m_details.m_name);
|
||||
|
||||
methodEntry.m_arguments.push_back(argument);
|
||||
}
|
||||
}
|
||||
@@ -751,6 +773,8 @@ namespace ScriptCanvasEditorTools
|
||||
result.m_details.m_name = resultName;
|
||||
result.m_details.m_tooltip = resultDescription;
|
||||
|
||||
SplitCamelCase(result.m_details.m_name);
|
||||
|
||||
methodEntry.m_results.push_back(result);
|
||||
}
|
||||
|
||||
@@ -790,7 +814,8 @@ namespace ScriptCanvasEditorTools
|
||||
TranslationFormat translationRoot;
|
||||
translationRoot.m_entries.push_back(entry);
|
||||
|
||||
AZStd::string fileName = AZStd::string::format("Properties/%s", behaviorProperty->m_name.c_str());
|
||||
AZStd::string cleanName = GraphCanvas::TranslationKey::Sanitize(behaviorProperty->m_name);
|
||||
AZStd::string fileName = AZStd::string::format("Properties/%s", cleanName.c_str());
|
||||
SaveJSONData(fileName, translationRoot);
|
||||
}
|
||||
|
||||
@@ -816,6 +841,8 @@ namespace ScriptCanvasEditorTools
|
||||
argument.m_details.m_category = "";
|
||||
argument.m_details.m_tooltip = argumentDescription;
|
||||
|
||||
SplitCamelCase(argument.m_details.m_name);
|
||||
|
||||
methodEntry.m_arguments.push_back(argument);
|
||||
}
|
||||
}
|
||||
@@ -836,6 +863,8 @@ namespace ScriptCanvasEditorTools
|
||||
result.m_details.m_name = resultParameter->m_name;
|
||||
result.m_details.m_tooltip = resultDescription;
|
||||
|
||||
SplitCamelCase(result.m_details.m_name);
|
||||
|
||||
methodEntry.m_results.push_back(result);
|
||||
}
|
||||
}
|
||||
@@ -871,6 +900,8 @@ namespace ScriptCanvasEditorTools
|
||||
method.m_details.m_name = methodName;
|
||||
method.m_details.m_tooltip = behaviorProperty->m_getter->m_debugDescription ? behaviorProperty->m_getter->m_debugDescription : "";
|
||||
|
||||
SplitCamelCase(method.m_details.m_name);
|
||||
|
||||
TranslateMethod(behaviorProperty->m_getter, method);
|
||||
|
||||
entry->m_methods.push_back(method);
|
||||
@@ -891,6 +922,8 @@ namespace ScriptCanvasEditorTools
|
||||
method.m_details.m_name = methodName;
|
||||
method.m_details.m_tooltip = behaviorProperty->m_setter->m_debugDescription ? behaviorProperty->m_getter->m_debugDescription : "";
|
||||
|
||||
SplitCamelCase(method.m_details.m_name);
|
||||
|
||||
TranslateMethod(behaviorProperty->m_setter, method);
|
||||
|
||||
entry->m_methods.push_back(method);
|
||||
@@ -920,6 +953,8 @@ namespace ScriptCanvasEditorTools
|
||||
entry.m_details.m_tooltip = behaviorEbus->m_toolTip;
|
||||
entry.m_details.m_category = "EBus Handlers";
|
||||
|
||||
SplitCamelCase(entry.m_details.m_name);
|
||||
|
||||
for (const AZ::BehaviorEBusHandler::BusForwarderEvent& event : handler->GetEvents())
|
||||
{
|
||||
Method methodEntry;
|
||||
@@ -930,6 +965,8 @@ namespace ScriptCanvasEditorTools
|
||||
methodEntry.m_details.m_tooltip = "";
|
||||
methodEntry.m_details.m_name = event.m_name;
|
||||
|
||||
SplitCamelCase(methodEntry.m_details.m_name);
|
||||
|
||||
// Arguments (Input Slots)
|
||||
if (!event.m_parameters.empty())
|
||||
{
|
||||
@@ -974,6 +1011,8 @@ namespace ScriptCanvasEditorTools
|
||||
argument.m_details.m_name = argumentName;
|
||||
argument.m_details.m_tooltip = argumentDescription;
|
||||
|
||||
SplitCamelCase(argument.m_details.m_name);
|
||||
|
||||
methodEntry.m_arguments.push_back(argument);
|
||||
}
|
||||
}
|
||||
@@ -1004,6 +1043,8 @@ namespace ScriptCanvasEditorTools
|
||||
result.m_details.m_name = resultName;
|
||||
result.m_details.m_tooltip = resultDescription;
|
||||
|
||||
SplitCamelCase(result.m_details.m_name);
|
||||
|
||||
methodEntry.m_results.push_back(result);
|
||||
}
|
||||
|
||||
@@ -1252,6 +1293,13 @@ namespace ScriptCanvasEditorTools
|
||||
|
||||
}
|
||||
|
||||
void TranslationGeneration::SplitCamelCase(AZStd::string& text)
|
||||
{
|
||||
AZStd::regex splitRegex(R"(/[a-z]+|[0-9]+|(?:[A-Z][a-z]+)|(?:[A-Z]+(?=(?:[A-Z][a-z])|[^AZa-z]|[$\d\n]))/g)");
|
||||
text = AZStd::regex_replace(text, splitRegex, " $&");
|
||||
text = AZ::StringFunc::LStrip(text);
|
||||
}
|
||||
|
||||
namespace Helpers
|
||||
{
|
||||
AZStd::string ReadStringAttribute(const AZ::AttributeArray& attributes, const AZ::Crc32& attribute)
|
||||
|
||||
Reference in New Issue
Block a user