Merge pull request #7628 from aws-lumberyard-dev/scripting/translation_error
Fixed ambiguous translation key when a property and a method share the same name
This commit is contained in:
@@ -81,6 +81,18 @@ namespace GraphCanvas
|
||||
{
|
||||
itemKey.append(AZStd::string::format(".%d", i));
|
||||
}
|
||||
|
||||
rapidjson::Value::ConstMemberIterator innerContextItr = element.FindMember(Schema::Field::context);
|
||||
if (innerContextItr != element.MemberEnd())
|
||||
{
|
||||
itemKey.append(AZStd::string::format(".%s", innerContextItr->value.GetString()));
|
||||
}
|
||||
|
||||
rapidjson::Value::ConstMemberIterator innerVariantItr = element.FindMember(Schema::Field::variant);
|
||||
if (innerVariantItr != element.MemberEnd())
|
||||
{
|
||||
itemKey.append(AZStd::string::format(".%s", innerVariantItr->value.GetString()));
|
||||
}
|
||||
}
|
||||
|
||||
AddEntryToDatabase(itemKey, "", element, translationFormat);
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
"methods": [
|
||||
{
|
||||
"base": "GetBaseColor",
|
||||
"context": "MaterialData",
|
||||
"entry": {
|
||||
"name": "In",
|
||||
"tooltip": "When signaled, this will invoke Get Base Color"
|
||||
@@ -525,13 +524,13 @@
|
||||
"base": "GetBaseColor",
|
||||
"context": "Getter",
|
||||
"details": {
|
||||
"name": "Get Base Color"
|
||||
"name": "Base Color"
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"typeid": "{72039442-EB38-4D42-A1AD-CB68F7E0EEF6}",
|
||||
"details": {
|
||||
"name": "Base Color"
|
||||
"name": "Value"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"base": "{FDD3D684-2C9A-0C05-D2A3-FD67685D8F26}",
|
||||
"context": "ScriptCanvas::Node",
|
||||
"variant": "",
|
||||
"details": {
|
||||
"name": "BranchInputTypeExample",
|
||||
"category": "Tests",
|
||||
"tooltip": "Example of branch passing as input by value, pointer and reference.",
|
||||
"subtitle": "Tests"
|
||||
},
|
||||
"slots": [
|
||||
{
|
||||
"base": "Input_Get Internal Vector",
|
||||
"details": {
|
||||
"name": "Get Internal Vector"
|
||||
}
|
||||
},
|
||||
{
|
||||
"base": "Output_On Get Internal Vector",
|
||||
"details": {
|
||||
"name": "On Get Internal Vector"
|
||||
}
|
||||
},
|
||||
{
|
||||
"base": "DataOutput_Result",
|
||||
"details": {
|
||||
"name": "Result"
|
||||
}
|
||||
},
|
||||
{
|
||||
"base": "Input_Branches On Input Type",
|
||||
"details": {
|
||||
"name": "Branches On Input Type"
|
||||
}
|
||||
},
|
||||
{
|
||||
"base": "DataInput_Input Type",
|
||||
"details": {
|
||||
"name": "Input Type"
|
||||
}
|
||||
},
|
||||
{
|
||||
"base": "Output_By Value",
|
||||
"details": {
|
||||
"name": "By Value"
|
||||
}
|
||||
},
|
||||
{
|
||||
"base": "DataOutput_Value Input",
|
||||
"details": {
|
||||
"name": "Value Input"
|
||||
}
|
||||
},
|
||||
{
|
||||
"base": "Output_By Pointer",
|
||||
"details": {
|
||||
"name": "By Pointer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"base": "DataOutput_Pointer Input",
|
||||
"details": {
|
||||
"name": "Pointer Input"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -338,7 +338,7 @@ namespace ScriptCanvasEditor::Nodes
|
||||
AZStd::string methodContext;
|
||||
// Get the method's text data
|
||||
GraphCanvas::TranslationRequests::Details methodDetails;
|
||||
methodDetails.m_name = details.m_name; // fallback
|
||||
methodDetails.m_name = methodName; // fallback
|
||||
key << "methods";
|
||||
AZStd::string updatedMethodName = methodName;
|
||||
if (isAccessor)
|
||||
@@ -355,13 +355,13 @@ namespace ScriptCanvasEditor::Nodes
|
||||
}
|
||||
updatedMethodName.append(methodName);
|
||||
}
|
||||
key << methodContext << updatedMethodName;
|
||||
key << updatedMethodName << methodContext;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(methodDetails, &GraphCanvas::TranslationRequests::GetDetails, key + ".details", methodDetails);
|
||||
|
||||
|
||||
if (methodDetails.m_subtitle.empty())
|
||||
{
|
||||
methodDetails.m_subtitle = details.m_category;
|
||||
methodDetails.m_subtitle = details.m_category.empty() ? details.m_name : details.m_category;
|
||||
}
|
||||
|
||||
// Add to the tooltip the C++ class for reference
|
||||
@@ -404,6 +404,19 @@ namespace ScriptCanvasEditor::Nodes
|
||||
{
|
||||
key.clear();
|
||||
key << context << className << "methods" << updatedMethodName;
|
||||
|
||||
if (isAccessor)
|
||||
{
|
||||
if (methodNode->GetMethodType() == ScriptCanvas::MethodType::Getter || methodNode->GetMethodType() == ScriptCanvas::MethodType::Free)
|
||||
{
|
||||
key << "Getter";
|
||||
}
|
||||
else
|
||||
{
|
||||
key << "Setter";
|
||||
}
|
||||
}
|
||||
|
||||
if (slot.IsInput())
|
||||
{
|
||||
key << "params";
|
||||
|
||||
+4
-1
@@ -86,13 +86,16 @@ namespace ScriptCanvasEditor
|
||||
|
||||
|
||||
AZStd::string updatedMethodName;
|
||||
AZStd::string methodContext;
|
||||
if (propertyStatus != ScriptCanvas::PropertyStatus::None)
|
||||
{
|
||||
updatedMethodName = (propertyStatus == ScriptCanvas::PropertyStatus::Getter) ? "Get" : "Set";
|
||||
methodContext = (propertyStatus == ScriptCanvas::PropertyStatus::Getter) ? "Getter" : "Setter";
|
||||
}
|
||||
|
||||
updatedMethodName.append(methodName);
|
||||
|
||||
key << "BehaviorClass" << className << "methods" << updatedMethodName << "details";
|
||||
key << "BehaviorClass" << className << "methods" << updatedMethodName << methodContext << "details";
|
||||
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
details.m_name = methodName;
|
||||
|
||||
@@ -1030,7 +1030,7 @@ namespace ScriptCanvasEditor
|
||||
context = (propertyStatus == ScriptCanvas::PropertyStatus::Getter) ? "Getter" : "Setter";
|
||||
}
|
||||
updatedMethodName += methodName;
|
||||
key << "BehaviorClass" << context << methodClass << "methods" << updatedMethodName << "details";
|
||||
key << "BehaviorClass" << methodClass << "methods" << updatedMethodName << context << "details";
|
||||
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
|
||||
@@ -258,7 +258,6 @@ namespace ScriptCanvasEditorTools
|
||||
AZStd::string cleanName = GraphCanvas::TranslationKey::Sanitize(methodPair.first);
|
||||
|
||||
methodEntry.m_key = cleanName;
|
||||
methodEntry.m_context = className;
|
||||
|
||||
methodEntry.m_details.m_category = "";
|
||||
methodEntry.m_details.m_tooltip = "";
|
||||
|
||||
Reference in New Issue
Block a user