Disambiguate setters and getters with the same name + updates to fix duplicates
Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com>
This commit is contained in:
@@ -328,6 +328,7 @@ namespace ScriptCanvasEditor::Nodes
|
||||
// Set the class' name as the subtitle fallback
|
||||
details.m_subtitle = details.m_name;
|
||||
|
||||
AZStd::string methodContext;
|
||||
// Get the method's text data
|
||||
GraphCanvas::TranslationRequests::Details methodDetails;
|
||||
methodDetails.m_name = details.m_name; // fallback
|
||||
@@ -338,14 +339,16 @@ namespace ScriptCanvasEditor::Nodes
|
||||
if (methodNode->GetMethodType() == ScriptCanvas::MethodType::Getter || methodNode->GetMethodType() == ScriptCanvas::MethodType::Free)
|
||||
{
|
||||
updatedMethodName = "Get";
|
||||
methodContext = "Getter";
|
||||
}
|
||||
else
|
||||
{
|
||||
updatedMethodName = "Set";
|
||||
methodContext = "Setter";
|
||||
}
|
||||
updatedMethodName.append(methodName);
|
||||
}
|
||||
key << updatedMethodName;
|
||||
key << methodContext << updatedMethodName;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(methodDetails, &GraphCanvas::TranslationRequests::GetDetails, key + ".details", methodDetails);
|
||||
|
||||
|
||||
|
||||
@@ -1023,13 +1023,15 @@ namespace ScriptCanvasEditor
|
||||
|
||||
GraphCanvas::TranslationKey key;
|
||||
|
||||
AZStd::string context;
|
||||
AZStd::string updatedMethodName;
|
||||
if (propertyStatus != ScriptCanvas::PropertyStatus::None)
|
||||
{
|
||||
updatedMethodName = (propertyStatus == ScriptCanvas::PropertyStatus::Getter) ? "Get" : "Set";
|
||||
context = (propertyStatus == ScriptCanvas::PropertyStatus::Getter) ? "Getter" : "Setter";
|
||||
}
|
||||
updatedMethodName += methodName;
|
||||
key << "BehaviorClass" << methodClass.c_str() << "methods" << updatedMethodName << "details";
|
||||
key << "BehaviorClass" << context << methodClass << "methods" << updatedMethodName << "details";
|
||||
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
|
||||
@@ -915,6 +915,7 @@ namespace ScriptCanvasEditorTools
|
||||
AZStd::string methodName = "Get";
|
||||
methodName.append(cleanName);
|
||||
method.m_key = methodName;
|
||||
method.m_context = "Getter";
|
||||
method.m_details.m_name = methodName;
|
||||
method.m_details.m_tooltip = behaviorProperty->m_getter->m_debugDescription ? behaviorProperty->m_getter->m_debugDescription : "";
|
||||
|
||||
@@ -925,6 +926,8 @@ namespace ScriptCanvasEditorTools
|
||||
// We know this is a getter, so there will only be one parameter, we will use the method name as a best
|
||||
// guess for the argument name
|
||||
SplitCamelCase(cleanName);
|
||||
method.m_arguments.push_back(); // argument 0 is reserve for a "return value" which there won't be one
|
||||
method.m_arguments.push_back(); // adding entry for the argument name
|
||||
method.m_arguments[1].m_details.m_name = cleanName;
|
||||
|
||||
entry->m_methods.push_back(method);
|
||||
@@ -942,6 +945,7 @@ namespace ScriptCanvasEditorTools
|
||||
methodName.append(cleanName);
|
||||
|
||||
method.m_key = methodName;
|
||||
method.m_context = "Setter";
|
||||
method.m_details.m_name = methodName;
|
||||
method.m_details.m_tooltip = behaviorProperty->m_setter->m_debugDescription ? behaviorProperty->m_getter->m_debugDescription : "";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user