Fixed the application of translation overrides to free standing BehaviorProperty constants

Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com>
This commit is contained in:
lsemp3d
2021-11-12 15:45:55 -08:00
parent 4fac65b600
commit 5072c2667f
11 changed files with 155 additions and 26 deletions
@@ -5,9 +5,26 @@
"context": "Constant",
"variant": "",
"details": {
"name": "ShapeType_Box::Getter",
"category": "Constants"
}
"name": "Get Shape Type: Box",
"category": "Constants/Physics"
},
"methods": [
{
"key": "ShapeType_Box",
"details": {
"name": "Get Shape Type: Box",
"subtitle": "Shape Type"
},
"results": [
{
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
"details": {
"name": "Shape Type"
}
}
]
}
]
}
]
}
@@ -5,9 +5,26 @@
"context": "Constant",
"variant": "",
"details": {
"name": "ShapeType_Cylinder::Getter",
"category": "Constants"
}
"name": "Get Shape Type: Cylinder",
"category": "Constants/Physics"
},
"methods": [
{
"key": "ShapeType_Cylinder",
"details": {
"name": "Get Shape Type: Cylinder",
"subtitle": "Shape Type"
},
"results": [
{
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
"details": {
"name": "Shape Type"
}
}
]
}
]
}
]
}
@@ -5,9 +5,26 @@
"context": "Constant",
"variant": "",
"details": {
"name": "ShapeType_PhysicsAsset::Getter",
"category": "Constants"
}
"name": "Get Shape Type: Physics Asset",
"category": "Constants/Physics"
},
"methods": [
{
"key": "ShapeType_PhysicsAsset",
"details": {
"name": "Get Shape Type: Physics Asset",
"subtitle": "Shape Type"
},
"results": [
{
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
"details": {
"name": "Shape Type"
}
}
]
}
]
}
]
}
@@ -5,9 +5,26 @@
"context": "Constant",
"variant": "",
"details": {
"name": "ShapeType_Sphere::Getter",
"category": "Constants"
}
"name": "Get Shape Type: Sphere",
"category": "Constants/Physics"
},
"methods": [
{
"key": "ShapeType_Sphere",
"details": {
"name": "SGet Shape Type: Sphere",
"subtitle": "Shape Type"
},
"results": [
{
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
"details": {
"name": "Shape Type"
}
}
]
}
]
}
]
}
@@ -0,0 +1,28 @@
{
"entries": [
{
"key": "SlopeAlignmentModifierComponentTypeId",
"context": "Constant",
"variant": "",
"details": {
"name": ""
},
"methods": [
{
"key": "SlopeAlignmentModifierComponentTypeId",
"details": {
"name": "SlopeAlignmentModifierComponentTypeId::Getter"
},
"results": [
{
"typeid": "{E152C105-A133-4D03-BBF8-3D4B2FBA3E2A}",
"details": {
"name": "AZ::Uuid"
}
}
]
}
]
}
]
}
@@ -266,6 +266,7 @@ namespace ScriptCanvasEditor::Nodes
graphCanvasEntity->CreateComponent<SlotMappingComponent>(methodNode->GetEntityId());
graphCanvasEntity->CreateComponent<SceneMemberMappingComponent>(methodNode->GetEntityId());
bool isAccessor = false;
switch (methodNode->GetMethodType())
{
case ScriptCanvas::MethodType::Event:
@@ -273,8 +274,9 @@ namespace ScriptCanvasEditor::Nodes
break;
case ScriptCanvas::MethodType::Getter:
case ScriptCanvas::MethodType::Setter:
case ScriptCanvas::MethodType::Member:
case ScriptCanvas::MethodType::Free:
isAccessor = true;
case ScriptCanvas::MethodType::Member:
graphCanvasEntity->CreateComponent<ClassMethodNodeDescriptorComponent>();
break;
break;
@@ -297,14 +299,29 @@ namespace ScriptCanvasEditor::Nodes
const bool isEBusSender = (methodNode->GetMethodType() == ScriptCanvas::MethodType::Event);
const AZStd::string& className = methodNode->GetMethodClassName();
const AZStd::string& methodName = methodNode->GetName();
AZStd::string methodName = methodNode->GetName();
GraphCanvas::TranslationKey key;
if (isAccessor)
{
AZ::StringFunc::Replace(methodName, "::Getter", "");
AZ::StringFunc::Replace(methodName, "::Setter", "");
}
GraphCanvas::TranslationRequests::Details details;
details.m_name = methodName;
GraphCanvas::TranslationKey key;
key = isEBusSender ? "EBusSender" : "BehaviorClass";
key << className;
AZStd::string context;
if (methodNode->GetMethodType() == ScriptCanvas::MethodType::Free)
{
context = "Constant";
}
else
{
context = isEBusSender ? "EBusSender" : "BehaviorClass";
}
key << context << className;
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key + ".details", details);
@@ -351,8 +368,8 @@ namespace ScriptCanvasEditor::Nodes
if (slot.IsData())
{
key = isEBusSender ? "EBusSender" : "BehaviorClass";
key << className << "methods" << methodName;
key.clear();
key << context << className << "methods" << methodName;
if (slot.IsData() && slot.IsInput())
{
key << "params";
@@ -151,13 +151,11 @@ namespace ScriptCanvasEditor
: DraggableNodePaletteTreeItem(nodeModelInformation.m_methodName, ScriptCanvasEditor::AssetEditorId)
, m_methodName{ nodeModelInformation.m_methodName }
{
SetToolTip(QString::fromUtf8(nodeModelInformation.m_displayName.data(),
aznumeric_cast<int>(nodeModelInformation.m_displayName.size())));
SetToolTip(QString::fromUtf8(nodeModelInformation.m_toolTip.data(),
aznumeric_cast<int>(nodeModelInformation.m_toolTip.size())));
SetTitlePalette("MethodNodeTitlePalette");
SetName(nodeModelInformation.m_displayName.c_str());
}
GraphCanvas::GraphCanvasMimeEvent* GlobalMethodEventPaletteTreeItem::CreateMimeEvent() const
@@ -1049,17 +1049,22 @@ namespace ScriptCanvasEditor
if (auto registerIter = m_registeredNodes.find(nodeIdentifier); registerIter == m_registeredNodes.end())
{
auto methodModelInformation = AZStd::make_unique<GlobalMethodNodeModelInformation>();
methodModelInformation->m_methodName = behaviorMethod.m_name;
methodModelInformation->m_nodeIdentifier = nodeIdentifier;
methodModelInformation->m_methodName = behaviorMethod.m_name;
methodModelInformation->m_titlePaletteOverride = "MethodNodeTitlePalette";
AZStd::string name = behaviorProperty->m_name;
AZ::StringFunc::Replace(name, "::Getter", "");
AZ::StringFunc::Replace(name, "::Setter", "");
GraphCanvas::TranslationKey key;
key << "Constant" << behaviorProperty->m_name.c_str() << "details";
key << "Constant" << name << "details";
GraphCanvas::TranslationRequests::Details details;
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
methodModelInformation->m_displayName = details.m_name;
methodModelInformation->m_toolTip = details.m_tooltip;
methodModelInformation->m_categoryPath = details.m_category;
@@ -58,8 +58,14 @@ namespace ScriptCanvas
AZStd::string resultSlotName(AZStd::string::format("Result: %s", Data::GetName(outputType).data()));
AZStd::string className = outputConfig.config.m_className ? *outputConfig.config.m_className : "";
if (className.empty())
{
className = outputConfig.config.m_prettyClassName;
}
GraphCanvas::TranslationKey key;
key << "BehaviorClass" << *outputConfig.config.m_className << "methods" << *outputConfig.config.m_lookupName << "results" << resultIndex << "details";
key << "BehaviorClass" << className << "methods" << *outputConfig.config.m_lookupName << "results" << resultIndex << "details";
GraphCanvas::TranslationRequests::Details details;
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
@@ -14,6 +14,7 @@
#include <Core/SlotExecutionMap.h>
#include <Libraries/Core/MethodUtility.h>
#include <ScriptCanvas/Utils/BehaviorContextUtils.h>
#include <AzCore/StringFunc/StringFunc.h>
namespace MethodCPP
{
@@ -389,6 +390,9 @@ namespace ScriptCanvas
MethodConfiguration config(*method, MethodType::Free);
config.m_namespaces = &m_namespaces;
config.m_lookupName = &methodName;
config.m_prettyClassName = methodName;
AZ::StringFunc::Replace(config.m_prettyClassName, "::Getter", "");
AZ::StringFunc::Replace(config.m_prettyClassName, "::Setter", "");
InitializeMethod(config);
}
}
@@ -764,7 +764,7 @@ namespace ScriptCanvasEditorTools
Entry entry;
TranslateBehaviorProperty(behaviorProperty, "", "Constant", &entry);
TranslateBehaviorProperty(behaviorProperty, propertyName, "Constant", &entry);
TranslationFormat translationRoot;
translationRoot.m_entries.push_back(entry);
@@ -830,6 +830,9 @@ namespace ScriptCanvasEditorTools
if (!entry)
{
entry = &localEntry;
}
else if (entry->m_key.empty())
{
entry->m_key = className;
entry->m_context = context;
}