Merge branch 'development' of https://github.com/o3de/o3de into sc-editor-asset-redux
Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
+17
-27
@@ -97,23 +97,17 @@ namespace ScriptCanvasEditor
|
||||
, m_isOverload(isOverload)
|
||||
, m_propertyStatus(propertyStatus)
|
||||
{
|
||||
AZStd::string displayEventName = TranslationHelper::GetKeyTranslation(TranslationContextGroup::EbusSender, m_busName.toUtf8().data(), m_eventName.toUtf8().data(), TranslationItemType::Node, TranslationKeyId::Name);
|
||||
GraphCanvas::TranslationKey key;
|
||||
key << "EBusSender" << busName << "methods" << eventName << "details";
|
||||
|
||||
if (displayEventName.empty())
|
||||
{
|
||||
SetName(m_eventName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetName(displayEventName.c_str());
|
||||
}
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
details.m_name = eventName;
|
||||
details.m_subtitle = busName;
|
||||
|
||||
AZStd::string displayEventTooltip = TranslationHelper::GetKeyTranslation(TranslationContextGroup::EbusSender, m_busName.toUtf8().data(), m_eventName.toUtf8().data(), TranslationItemType::Node, TranslationKeyId::Tooltip);
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
|
||||
if (!displayEventTooltip.empty())
|
||||
{
|
||||
SetToolTip(displayEventTooltip.c_str());
|
||||
}
|
||||
SetName(details.m_name.c_str());
|
||||
SetToolTip(details.m_tooltip.c_str());
|
||||
|
||||
SetTitlePalette("MethodNodeTitlePalette");
|
||||
}
|
||||
@@ -302,23 +296,19 @@ namespace ScriptCanvasEditor
|
||||
, m_busId(busId)
|
||||
, m_eventId(eventId)
|
||||
{
|
||||
AZStd::string displayEventName = TranslationHelper::GetKeyTranslation(TranslationContextGroup::EbusHandler, m_busName.c_str(), m_eventName.c_str(), TranslationItemType::Node, TranslationKeyId::Name);
|
||||
GraphCanvas::TranslationKey key;
|
||||
key << "EBusHandler" << busName << "methods" << eventName << "details";
|
||||
|
||||
if (displayEventName.empty())
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
details.m_name = m_eventName;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
if (details.m_name.empty())
|
||||
{
|
||||
SetName(m_eventName.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
SetName(displayEventName.c_str());
|
||||
details.m_name = m_eventName;
|
||||
}
|
||||
|
||||
AZStd::string displayEventTooltip = TranslationHelper::GetKeyTranslation(TranslationContextGroup::EbusHandler, m_busName.c_str(), m_eventName.c_str(), TranslationItemType::Node, TranslationKeyId::Tooltip);
|
||||
|
||||
if (!displayEventTooltip.empty())
|
||||
{
|
||||
SetToolTip(displayEventTooltip.c_str());
|
||||
}
|
||||
SetName(details.m_name.c_str());
|
||||
SetToolTip(details.m_tooltip.c_str());
|
||||
|
||||
SetTitlePalette("HandlerNodeTitlePalette");
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "CreateNodeMimeEvent.h"
|
||||
|
||||
#include <ScriptCanvas/GraphCanvas/NodeDescriptorBus.h>
|
||||
#include "TranslationGeneration.h"
|
||||
|
||||
namespace ScriptCanvasEditor
|
||||
{
|
||||
@@ -62,6 +63,24 @@ namespace ScriptCanvasEditor
|
||||
|
||||
ScriptCanvas::PropertyStatus GetPropertyStatus() const;
|
||||
|
||||
AZ::IO::Path GetTranslationDataPath() const override
|
||||
{
|
||||
return AZ::IO::Path("EBus\\Senders") / GetBusName();
|
||||
}
|
||||
|
||||
void GenerateTranslationData() override
|
||||
{
|
||||
AZ::BehaviorContext* behaviorContext{};
|
||||
AZ::ComponentApplicationBus::BroadcastResult(behaviorContext, &AZ::ComponentApplicationRequests::GetBehaviorContext);
|
||||
|
||||
const char* ebusName = m_busName.toUtf8().data();
|
||||
auto behaviorEbus = behaviorContext->m_ebuses.find(ebusName);
|
||||
|
||||
ScriptCanvasEditorTools::TranslationGeneration translation;
|
||||
translation.TranslateEBus(behaviorEbus->second);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
bool m_isOverload;
|
||||
QString m_busName;
|
||||
@@ -154,6 +173,22 @@ namespace ScriptCanvasEditor
|
||||
ScriptCanvas::EBusBusId GetBusId() const;
|
||||
ScriptCanvas::EBusEventId GetEventId() const;
|
||||
|
||||
AZ::IO::Path GetTranslationDataPath() const override
|
||||
{
|
||||
return AZ::IO::Path("EBus\\Handlers") / GetBusName();
|
||||
}
|
||||
|
||||
void GenerateTranslationData() override
|
||||
{
|
||||
AZ::BehaviorContext* behaviorContext{};
|
||||
AZ::ComponentApplicationBus::BroadcastResult(behaviorContext, &AZ::ComponentApplicationRequests::GetBehaviorContext);
|
||||
|
||||
auto behaviorEbus = behaviorContext->m_ebuses.find(m_busName.c_str());
|
||||
|
||||
ScriptCanvasEditorTools::TranslationGeneration translation;
|
||||
translation.TranslateEBus(behaviorEbus->second);
|
||||
}
|
||||
|
||||
private:
|
||||
AZStd::string m_busName;
|
||||
AZStd::string m_eventName;
|
||||
|
||||
+14
-19
@@ -82,16 +82,17 @@ namespace ScriptCanvasEditor
|
||||
, m_isOverload(isOverload)
|
||||
, m_propertyStatus(propertyStatus)
|
||||
{
|
||||
AZStd::string displayMethodName = TranslationHelper::GetKeyTranslation(TranslationContextGroup::ClassMethod, m_className.toUtf8().data(), m_methodName.toUtf8().data(), TranslationItemType::Node, TranslationKeyId::Name);
|
||||
GraphCanvas::TranslationKey key;
|
||||
key << "BehaviorClass" << className << "methods" << methodName << "details";
|
||||
|
||||
if (displayMethodName.empty())
|
||||
{
|
||||
SetName(m_methodName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetName(displayMethodName.c_str());
|
||||
}
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
details.m_name = methodName;
|
||||
details.m_subtitle = className;
|
||||
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
|
||||
SetName(details.m_name.c_str());
|
||||
SetToolTip(details.m_tooltip.c_str());
|
||||
|
||||
if (propertyStatus == ScriptCanvas::PropertyStatus::Getter)
|
||||
{
|
||||
@@ -102,13 +103,6 @@ namespace ScriptCanvasEditor
|
||||
SetName(AZStd::string::format("Set %s", GetName().toUtf8().data()).data());
|
||||
}
|
||||
|
||||
AZStd::string displayEventTooltip = TranslationHelper::GetKeyTranslation(TranslationContextGroup::ClassMethod, m_className.toUtf8().data(), m_methodName.toUtf8().data(), TranslationItemType::Node, TranslationKeyId::Tooltip);
|
||||
|
||||
if (!displayEventTooltip.empty())
|
||||
{
|
||||
SetToolTip(displayEventTooltip.c_str());
|
||||
}
|
||||
|
||||
SetTitlePalette("MethodNodeTitlePalette");
|
||||
}
|
||||
|
||||
@@ -230,9 +224,10 @@ namespace ScriptCanvasEditor
|
||||
// CustomNodePaletteTreeItem
|
||||
//////////////////////////////
|
||||
|
||||
CustomNodePaletteTreeItem::CustomNodePaletteTreeItem(const AZ::Uuid& typeId, AZStd::string_view nodeName)
|
||||
: DraggableNodePaletteTreeItem(nodeName, ScriptCanvasEditor::AssetEditorId)
|
||||
, m_typeId(typeId)
|
||||
CustomNodePaletteTreeItem::CustomNodePaletteTreeItem(const ScriptCanvasEditor::CustomNodeModelInformation& info)
|
||||
: DraggableNodePaletteTreeItem(info.m_displayName, ScriptCanvasEditor::AssetEditorId)
|
||||
, m_info(info)
|
||||
, m_typeId(info.m_typeId)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+37
-1
@@ -10,6 +10,9 @@
|
||||
#include <GraphCanvas/Widgets/NodePalette/TreeItems/DraggableNodePaletteTreeItem.h>
|
||||
|
||||
#include "CreateNodeMimeEvent.h"
|
||||
#include "NodePaletteModel.h"
|
||||
#include <Source/Translation/TranslationBus.h>
|
||||
#include "TranslationGeneration.h"
|
||||
|
||||
namespace ScriptCanvasEditor
|
||||
{
|
||||
@@ -56,6 +59,23 @@ namespace ScriptCanvasEditor
|
||||
bool IsOverload() const;
|
||||
ScriptCanvas::PropertyStatus GetPropertyStatus() const;
|
||||
|
||||
AZ::IO::Path GetTranslationDataPath() const override
|
||||
{
|
||||
return AZ::IO::Path("Classes") / GetClassMethodName();
|
||||
}
|
||||
|
||||
void GenerateTranslationData() override
|
||||
{
|
||||
AZ::BehaviorContext* behaviorContext{};
|
||||
AZ::ComponentApplicationBus::BroadcastResult(behaviorContext, &AZ::ComponentApplicationRequests::GetBehaviorContext);
|
||||
|
||||
const char* className = m_className.toUtf8().data();
|
||||
auto behaviorClass = behaviorContext->m_classes.find(className);
|
||||
|
||||
ScriptCanvasEditorTools::TranslationGeneration translation;
|
||||
translation.TranslateBehaviorClass(behaviorClass->second);
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_isOverload = false;
|
||||
QString m_className;
|
||||
@@ -137,15 +157,31 @@ namespace ScriptCanvasEditor
|
||||
AZ_CLASS_ALLOCATOR(CustomNodePaletteTreeItem, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(CustomNodePaletteTreeItem, "{50E75C4D-F59C-4AF6-A6A3-5BAD557E335C}", GraphCanvas::DraggableNodePaletteTreeItem);
|
||||
|
||||
CustomNodePaletteTreeItem(const AZ::Uuid& typeId, AZStd::string_view nodeName);
|
||||
explicit CustomNodePaletteTreeItem(const ScriptCanvasEditor::CustomNodeModelInformation&);
|
||||
~CustomNodePaletteTreeItem() = default;
|
||||
|
||||
GraphCanvas::GraphCanvasMimeEvent* CreateMimeEvent() const override;
|
||||
|
||||
AZ::Uuid GetTypeId() const;
|
||||
const ScriptCanvasEditor::CustomNodeModelInformation& GetInfo() const { return m_info; }
|
||||
|
||||
AZ::IO::Path GetTranslationDataPath() const override
|
||||
{
|
||||
AZStd::string filename = AZStd::string::format("%s_%s", GetInfo().m_categoryPath.c_str(), GetName().toUtf8().data());
|
||||
filename = GraphCanvas::TranslationKey::Sanitize(filename);
|
||||
|
||||
return AZ::IO::Path("Nodes") / filename;
|
||||
}
|
||||
|
||||
void GenerateTranslationData() override
|
||||
{
|
||||
ScriptCanvasEditorTools::TranslationGeneration translation;
|
||||
translation.TranslateNode(m_typeId);
|
||||
}
|
||||
|
||||
private:
|
||||
AZ::Uuid m_typeId;
|
||||
ScriptCanvasEditor::CustomNodeModelInformation m_info;
|
||||
};
|
||||
|
||||
// </CustomNode>
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
#include <ScriptCanvas/Data/Traits.h>
|
||||
|
||||
AZ_DEFINE_BUDGET(NodePaletteModel);
|
||||
|
||||
namespace
|
||||
{
|
||||
// Various Helper Methods
|
||||
@@ -82,11 +84,6 @@ namespace
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MethodHasAttribute(const AZ::BehaviorMethod* method, AZ::Crc32 attribute)
|
||||
{
|
||||
return AZ::FindAttribute(attribute, method->m_attributes) != nullptr; // warning C4800: 'AZ::Attribute *': forcing value to bool 'true' or 'false' (performance warning)
|
||||
}
|
||||
|
||||
// Checks for and returns the Category attribute from an AZ::AttributeArray
|
||||
AZStd::string GetCategoryPath(const AZ::AttributeArray& attributes, const AZ::BehaviorContext& behaviorContext)
|
||||
{
|
||||
@@ -116,6 +113,9 @@ namespace
|
||||
, ScriptCanvas::PropertyStatus propertyStatus
|
||||
, bool isOverloaded)
|
||||
{
|
||||
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "RegisterMethod");
|
||||
|
||||
if (IsDeprecated(method.m_attributes))
|
||||
{
|
||||
return;
|
||||
@@ -150,6 +150,9 @@ namespace
|
||||
void RegisterGlobalMethod(ScriptCanvasEditor::NodePaletteModel& nodePaletteModel, const AZ::BehaviorContext& behaviorContext,
|
||||
const AZ::BehaviorMethod& behaviorMethod)
|
||||
{
|
||||
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "RegisterGlobalMethod");
|
||||
|
||||
const auto isExposableOutcome = ScriptCanvas::IsExposable(behaviorMethod);
|
||||
if (!isExposableOutcome.IsSuccess())
|
||||
{
|
||||
@@ -176,6 +179,8 @@ namespace
|
||||
//! Retrieve the list of EBuses t hat should not be exposed in the ScriptCanvasEditor Node Palette
|
||||
AZStd::unordered_set<AZ::Crc32> GetEBusExcludeSet(const AZ::BehaviorContext& behaviorContext)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "GetEBusExcludeSet");
|
||||
|
||||
// We will skip buses that are ONLY registered on classes that derive from EditorComponentBase,
|
||||
// because they don't have a runtime implementation. Buses such as the TransformComponent which
|
||||
// is implemented by both an EditorComponentBase derived class and a Component derived class
|
||||
@@ -252,6 +257,8 @@ namespace
|
||||
void PopulateScriptCanvasDerivedNodes(ScriptCanvasEditor::NodePaletteModel& nodePaletteModel,
|
||||
const AZ::SerializeContext& serializeContext)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "PopulateScriptCanvasDerivedNodes");
|
||||
|
||||
// Get all the types.
|
||||
auto EnumerateLibraryDefintionNodes = [&nodePaletteModel, &serializeContext](
|
||||
const AZ::SerializeContext::ClassData* classData, const AZ::Uuid&) -> bool
|
||||
@@ -333,6 +340,8 @@ namespace
|
||||
|
||||
void PopulateVariablePalette()
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "PopulateVariablePalette");
|
||||
|
||||
auto dataRegistry = ScriptCanvas::GetDataRegistry();
|
||||
|
||||
for (auto& type : dataRegistry->m_creatableTypes)
|
||||
@@ -347,6 +356,8 @@ namespace
|
||||
void PopulateBehaviorContextGlobalMethods(ScriptCanvasEditor::NodePaletteModel& nodePaletteModel,
|
||||
const AZ::BehaviorContext& behaviorContext)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "PopulateBehaviorContextGlobalMethods");
|
||||
|
||||
// BehaviorMethods are not associated with a class
|
||||
// therefore the Uuid is set to Null
|
||||
const AZ::Uuid behaviorMethodUuid = AZ::Uuid::CreateNull();
|
||||
@@ -377,6 +388,8 @@ namespace
|
||||
void PopulateBehaviorContextGlobalProperties(ScriptCanvasEditor::NodePaletteModel& nodePaletteModel,
|
||||
const AZ::BehaviorContext& behaviorContext)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "PopulateBehaviorContextGlobalProperties");
|
||||
|
||||
const AZ::Uuid behaviorMethodUuid = AZ::Uuid::CreateNull();
|
||||
for (const auto& [propertyName, behaviorProperty] : behaviorContext.m_properties)
|
||||
{
|
||||
@@ -398,7 +411,7 @@ namespace
|
||||
|
||||
if (behaviorProperty->m_getter && !behaviorProperty->m_setter)
|
||||
{
|
||||
nodePaletteModel.RegisterGlobalConstant(behaviorContext, *behaviorProperty->m_getter);
|
||||
nodePaletteModel.RegisterGlobalConstant(behaviorContext, behaviorProperty , *behaviorProperty->m_getter);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -419,6 +432,8 @@ namespace
|
||||
void PopulateBehaviorContextClassMethods(ScriptCanvasEditor::NodePaletteModel& nodePaletteModel,
|
||||
const AZ::BehaviorContext& behaviorContext)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "PopulateBehaviorContextClassMethods");
|
||||
|
||||
AZ::SerializeContext* serializeContext{};
|
||||
AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationRequests::GetSerializeContext);
|
||||
|
||||
@@ -456,21 +471,17 @@ namespace
|
||||
{
|
||||
AZStd::string categoryPath;
|
||||
|
||||
AZStd::string translationContext = ScriptCanvasEditor::TranslationHelper::GetContextName(ScriptCanvasEditor::TranslationContextGroup::ClassMethod, behaviorClass->m_name);
|
||||
AZStd::string translationKey = ScriptCanvasEditor::TranslationHelper::GetClassKey(ScriptCanvasEditor::TranslationContextGroup::ClassMethod, behaviorClass->m_name, ScriptCanvasEditor::TranslationKeyId::Category);
|
||||
AZStd::string translatedCategory = QCoreApplication::translate(translationContext.c_str(), translationKey.c_str()).toUtf8().data();
|
||||
GraphCanvas::TranslationKey key;
|
||||
key << "BehaviorClass" << behaviorClass->m_name.c_str() << "details";
|
||||
|
||||
if (translatedCategory != translationKey)
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
|
||||
categoryPath = details.m_category;
|
||||
|
||||
if (categoryPath.empty())
|
||||
{
|
||||
categoryPath = translatedCategory;
|
||||
}
|
||||
else
|
||||
{
|
||||
AZStd::string behaviorContextCategory = GetCategoryPath(behaviorClass->m_attributes, behaviorContext);
|
||||
if (!behaviorContextCategory.empty())
|
||||
{
|
||||
categoryPath = behaviorContextCategory;
|
||||
}
|
||||
categoryPath = GetCategoryPath(behaviorClass->m_attributes, behaviorContext);
|
||||
}
|
||||
|
||||
auto dataRegistry = ScriptCanvas::GetDataRegistry();
|
||||
@@ -507,15 +518,13 @@ namespace
|
||||
|
||||
categoryPath.append("/");
|
||||
|
||||
AZStd::string displayName = ScriptCanvasEditor::TranslationHelper::GetClassKeyTranslation(ScriptCanvasEditor::TranslationContextGroup::ClassMethod, classIter.first, ScriptCanvasEditor::TranslationKeyId::Name);
|
||||
|
||||
if (displayName.empty())
|
||||
if (details.m_name.empty())
|
||||
{
|
||||
categoryPath.append(classNamePretty.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
categoryPath.append(displayName.c_str());
|
||||
categoryPath.append(details.m_name.c_str());
|
||||
}
|
||||
|
||||
for (auto property : behaviorClass->m_properties)
|
||||
@@ -552,6 +561,9 @@ namespace
|
||||
void PopulateBehaviorContextOverloadedMethods(ScriptCanvasEditor::NodePaletteModel& nodePaletteModel,
|
||||
const AZ::BehaviorContext& behaviorContext)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "PopulateBehaviorContextOverloadedMethods");
|
||||
|
||||
|
||||
for (const AZ::ExplicitOverloadInfo& explicitOverload : behaviorContext.m_explicitOverloads)
|
||||
{
|
||||
RegisterMethod(nodePaletteModel, behaviorContext, explicitOverload.m_categoryPath, nullptr, explicitOverload.m_name, *explicitOverload.m_overloads.begin()->first, ScriptCanvas::PropertyStatus::None, true);
|
||||
@@ -561,6 +573,8 @@ namespace
|
||||
void PopulateBehaviorContextEBusHandler(ScriptCanvasEditor::NodePaletteModel& nodePaletteModel,
|
||||
const AZ::BehaviorContext& behaviorContext, const AZ::BehaviorEBus& behaviorEbus)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "PopulateBehaviorContextEBusHandler");
|
||||
|
||||
if (AZ::ScopedBehaviorEBusHandler handler{ behaviorEbus }; handler)
|
||||
{
|
||||
auto excludeEbusAttributeData = azdynamic_cast<const AZ::Edit::AttributeData<AZ::Script::Attributes::ExcludeFlags>*>(
|
||||
@@ -573,32 +587,17 @@ namespace
|
||||
const AZ::BehaviorEBusHandler::EventArray& events(handler->GetEvents());
|
||||
if (!events.empty())
|
||||
{
|
||||
AZStd::string translationContext = ScriptCanvasEditor::TranslationHelper::GetContextName(ScriptCanvasEditor::TranslationContextGroup::EbusHandler, behaviorEbus.m_name);
|
||||
AZStd::string categoryPath;
|
||||
|
||||
GraphCanvas::TranslationKey key;
|
||||
key << "EBusHandler" << behaviorEbus.m_name.c_str() << "details";
|
||||
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
|
||||
AZStd::string categoryPath = details.m_category.empty() ? GetCategoryPath(behaviorEbus.m_attributes, behaviorContext) : details.m_category;
|
||||
|
||||
// Treat the EBusHandler name as a Category key in order to allow multiple buses to be merged into a single Category.
|
||||
{
|
||||
AZStd::string translationKey = ScriptCanvasEditor::TranslationHelper::GetClassKey(ScriptCanvasEditor::TranslationContextGroup::EbusHandler, behaviorEbus.m_name, ScriptCanvasEditor::TranslationKeyId::Category);
|
||||
AZStd::string translatedCategory = QCoreApplication::translate(translationContext.c_str(), translationKey.c_str()).toUtf8().data();
|
||||
|
||||
if (translatedCategory != translationKey)
|
||||
{
|
||||
categoryPath = translatedCategory;
|
||||
}
|
||||
else
|
||||
{
|
||||
AZStd::string behaviourContextCategory = GetCategoryPath(behaviorEbus.m_attributes, behaviorContext);
|
||||
if (!behaviourContextCategory.empty())
|
||||
{
|
||||
categoryPath = behaviourContextCategory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Treat the EBusHandler name as a Category key in order to allow multiple busses to be merged into a single Category.
|
||||
{
|
||||
AZStd::string translationKey = ScriptCanvasEditor::TranslationHelper::GetClassKey(ScriptCanvasEditor::TranslationContextGroup::EbusHandler, behaviorEbus.m_name, ScriptCanvasEditor::TranslationKeyId::Name);
|
||||
AZStd::string translatedName = QCoreApplication::translate(translationContext.c_str(), translationKey.c_str()).toUtf8().data();
|
||||
|
||||
if (!categoryPath.empty())
|
||||
{
|
||||
categoryPath.append("/");
|
||||
@@ -608,9 +607,9 @@ namespace
|
||||
categoryPath = "Other/";
|
||||
}
|
||||
|
||||
if (translatedName != translationKey)
|
||||
if (!details.m_name.empty())
|
||||
{
|
||||
categoryPath.append(translatedName.c_str());
|
||||
categoryPath.append(details.m_name.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -629,31 +628,22 @@ namespace
|
||||
void PopulateBehaviorContextEBusEventMethods(ScriptCanvasEditor::NodePaletteModel& nodePaletteModel,
|
||||
const AZ::BehaviorContext& behaviorContext, const AZ::BehaviorEBus& behaviorEbus)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "PopulateBehaviorContextEBusEventMethods");
|
||||
|
||||
if (!behaviorEbus.m_events.empty())
|
||||
{
|
||||
AZStd::string categoryPath;
|
||||
GraphCanvas::TranslationKey key;
|
||||
key << "EBusSender" << behaviorEbus.m_name.c_str() << "details";
|
||||
|
||||
AZStd::string translationContext = ScriptCanvasEditor::TranslationHelper::GetContextName(ScriptCanvasEditor::TranslationContextGroup::EbusSender, behaviorEbus.m_name);
|
||||
AZStd::string translationKey = ScriptCanvasEditor::TranslationHelper::GetClassKey(ScriptCanvasEditor::TranslationContextGroup::EbusSender, behaviorEbus.m_name, ScriptCanvasEditor::TranslationKeyId::Category);
|
||||
AZStd::string translatedCategory = QCoreApplication::translate(translationContext.c_str(), translationKey.c_str()).toUtf8().data();
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
|
||||
if (translatedCategory != translationKey)
|
||||
{
|
||||
categoryPath = translatedCategory;
|
||||
}
|
||||
else
|
||||
{
|
||||
AZStd::string behaviourContextCategory = GetCategoryPath(behaviorEbus.m_attributes, behaviorContext);
|
||||
if (!behaviourContextCategory.empty())
|
||||
{
|
||||
categoryPath = behaviourContextCategory;
|
||||
}
|
||||
}
|
||||
AZStd::string categoryPath = details.m_category.empty() ? GetCategoryPath(behaviorEbus.m_attributes, behaviorContext) : details.m_category;
|
||||
|
||||
// Parent
|
||||
AZStd::string displayName = ScriptCanvasEditor::TranslationHelper::GetClassKeyTranslation(ScriptCanvasEditor::TranslationContextGroup::EbusSender, behaviorEbus.m_name, ScriptCanvasEditor::TranslationKeyId::Name);
|
||||
AZStd::string displayName = details.m_name;
|
||||
|
||||
// Treat the EBus name as a Category key in order to allow multiple busses to be merged into a single Category.
|
||||
// Treat the EBus name as a Category key in order to allow multiple buses to be merged into a single Category.
|
||||
if (!categoryPath.empty())
|
||||
{
|
||||
categoryPath.append("/");
|
||||
@@ -663,18 +653,18 @@ namespace
|
||||
categoryPath = "Other/";
|
||||
}
|
||||
|
||||
if (displayName.empty())
|
||||
if (!details.m_name.empty())
|
||||
{
|
||||
categoryPath.append(behaviorEbus.m_name.c_str());
|
||||
categoryPath.append(details.m_name.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
categoryPath.append(displayName.c_str());
|
||||
categoryPath.append(behaviorEbus.m_name.c_str());
|
||||
}
|
||||
|
||||
ScriptCanvasEditor::CategoryInformation ebusCategoryInformation;
|
||||
|
||||
ebusCategoryInformation.m_tooltip = ScriptCanvasEditor::TranslationHelper::GetClassKeyTranslation(ScriptCanvasEditor::TranslationContextGroup::EbusSender, behaviorEbus.m_name, ScriptCanvasEditor::TranslationKeyId::Tooltip);
|
||||
ebusCategoryInformation.m_tooltip = details.m_tooltip;
|
||||
|
||||
nodePaletteModel.RegisterCategoryInformation(categoryPath, ebusCategoryInformation);
|
||||
|
||||
@@ -700,6 +690,7 @@ namespace
|
||||
void PopulateBehaviorContextEBuses(ScriptCanvasEditor::NodePaletteModel& nodePaletteModel,
|
||||
const AZ::BehaviorContext& behaviorContext)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "PopulateBehaviorContextEBuses");
|
||||
AZStd::unordered_set<AZ::Crc32> skipBuses = GetEBusExcludeSet(behaviorContext);
|
||||
|
||||
for (const auto& [ebusName, behaviorEbus] : behaviorContext.m_ebuses)
|
||||
@@ -758,10 +749,13 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Helper function for populating the node palette model.
|
||||
// Pulled out just to make the tabbing a bit nicer, since it's a huge method.
|
||||
void PopulateNodePaletteModel(ScriptCanvasEditor::NodePaletteModel& nodePaletteModel)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "PopulateNodePaletteModel");
|
||||
|
||||
AZ::SerializeContext* serializeContext = nullptr;
|
||||
AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationRequests::GetSerializeContext);
|
||||
|
||||
@@ -791,8 +785,10 @@ namespace
|
||||
|
||||
// Populates the NodePalette with EBus Event method nodes and EBus Event handler nodes
|
||||
PopulateBehaviorContextEBuses(nodePaletteModel, *behaviorContext);
|
||||
|
||||
// Populates the NodePalette with Methods reflected directly on the BehaviorContext
|
||||
PopulateBehaviorContextGlobalMethods(nodePaletteModel, *behaviorContext);
|
||||
|
||||
// Populates the NodePalette with Properties reflected directly on the BehaviorContext
|
||||
PopulateBehaviorContextGlobalProperties(nodePaletteModel, *behaviorContext);
|
||||
}
|
||||
@@ -895,6 +891,8 @@ namespace ScriptCanvasEditor
|
||||
|
||||
void NodePaletteModel::RegisterCustomNode(AZStd::string_view categoryPath, const AZ::Uuid& uuid, AZStd::string_view name, const AZ::SerializeContext::ClassData* classData)
|
||||
{
|
||||
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "NodePaletteModel::RegisterCustomNode");
|
||||
ScriptCanvas::NodeTypeIdentifier nodeIdentifier = ScriptCanvas::NodeUtils::ConstructCustomNodeIdentifier(uuid);
|
||||
|
||||
auto mapIter = m_registeredNodes.find(nodeIdentifier);
|
||||
@@ -905,47 +903,38 @@ namespace ScriptCanvasEditor
|
||||
|
||||
customNodeInformation->m_nodeIdentifier = nodeIdentifier;
|
||||
customNodeInformation->m_typeId = uuid;
|
||||
|
||||
customNodeInformation->m_displayName = name;
|
||||
customNodeInformation->m_categoryPath = categoryPath;
|
||||
|
||||
bool isDeprecated(false);
|
||||
|
||||
if (classData && classData->m_editData && classData->m_editData->m_name)
|
||||
{
|
||||
auto nodeContextName = ScriptCanvasEditor::Nodes::GetContextName(*classData);
|
||||
auto contextName = ScriptCanvasEditor::TranslationHelper::GetContextName(ScriptCanvasEditor::TranslationContextGroup::ClassMethod, nodeContextName);
|
||||
GraphCanvas::TranslationKey key;
|
||||
key << "ScriptCanvas::Node" << classData->m_typeId.ToString<AZStd::string>().c_str() << "details";
|
||||
|
||||
GraphCanvas::TranslationKeyedString nodeKeyedString({}, contextName);
|
||||
nodeKeyedString.m_key = ScriptCanvasEditor::TranslationHelper::GetKey(ScriptCanvasEditor::TranslationContextGroup::ClassMethod, nodeContextName, classData->m_editData->m_name, ScriptCanvasEditor::TranslationItemType::Node, ScriptCanvasEditor::TranslationKeyId::Name);
|
||||
customNodeInformation->m_displayName = nodeKeyedString.GetDisplayString();
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
|
||||
GraphCanvas::TranslationKeyedString tooltipKeyedString(AZStd::string(), nodeKeyedString.m_context);
|
||||
tooltipKeyedString.m_key = ScriptCanvasEditor::TranslationHelper::GetKey(ScriptCanvasEditor::TranslationContextGroup::ClassMethod, nodeContextName, classData->m_editData->m_name, ScriptCanvasEditor::TranslationItemType::Node, ScriptCanvasEditor::TranslationKeyId::Tooltip);
|
||||
if (details.m_name.empty())
|
||||
{
|
||||
details.m_name = classData->m_editData->m_name;
|
||||
details.m_tooltip = classData->m_editData->m_description;
|
||||
}
|
||||
|
||||
customNodeInformation->m_toolTip = tooltipKeyedString.GetDisplayString();
|
||||
customNodeInformation->m_displayName = details.m_name;
|
||||
customNodeInformation->m_toolTip = details.m_tooltip;
|
||||
|
||||
if (!details.m_category.empty())
|
||||
{
|
||||
customNodeInformation->m_categoryPath = details.m_category;
|
||||
}
|
||||
|
||||
if (customNodeInformation->m_displayName.empty())
|
||||
{
|
||||
customNodeInformation->m_displayName = classData->m_editData->m_name;
|
||||
}
|
||||
|
||||
GraphCanvas::TranslationKeyedString categoryKeyedString(ScriptCanvasEditor::Nodes::GetCategoryName(*classData), nodeKeyedString.m_context);
|
||||
categoryKeyedString.m_key = ScriptCanvasEditor::TranslationHelper::GetKey(ScriptCanvasEditor::TranslationContextGroup::ClassMethod, nodeContextName, classData->m_editData->m_name, ScriptCanvasEditor::TranslationItemType::Node, ScriptCanvasEditor::TranslationKeyId::Category);
|
||||
|
||||
customNodeInformation->m_categoryPath = categoryKeyedString.GetDisplayString();
|
||||
|
||||
if (customNodeInformation->m_categoryPath.empty())
|
||||
{
|
||||
if (contextName.empty())
|
||||
{
|
||||
customNodeInformation->m_categoryPath = categoryPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
customNodeInformation->m_categoryPath = contextName;
|
||||
}
|
||||
}
|
||||
|
||||
auto editorDataElement = classData->m_editData->FindElementData(AZ::Edit::ClassElements::EditorData);
|
||||
|
||||
if (editorDataElement)
|
||||
@@ -1003,11 +992,13 @@ namespace ScriptCanvasEditor
|
||||
( const AZStd::string& categoryPath
|
||||
, const AZStd::string& methodClass
|
||||
, const AZStd::string& methodName
|
||||
, const AZ::BehaviorMethod* behaviorMethod
|
||||
, const AZ::BehaviorContext* behaviorContext
|
||||
, const AZ::BehaviorMethod*
|
||||
, const AZ::BehaviorContext*
|
||||
, ScriptCanvas::PropertyStatus propertyStatus
|
||||
, bool isOverload)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "NodePaletteModel::RegisterClassNode");
|
||||
|
||||
ScriptCanvas::NodeTypeIdentifier nodeIdentifier = isOverload ? ScriptCanvas::NodeUtils::ConstructMethodOverloadedNodeIdentifier(methodName) : ScriptCanvas::NodeUtils::ConstructMethodNodeIdentifier(methodClass, methodName, propertyStatus);
|
||||
|
||||
auto registerIter = m_registeredNodes.find(nodeIdentifier);
|
||||
@@ -1022,44 +1013,34 @@ namespace ScriptCanvasEditor
|
||||
methodModelInformation->m_propertyStatus = propertyStatus;
|
||||
methodModelInformation->m_titlePaletteOverride = "MethodNodeTitlePalette";
|
||||
|
||||
methodModelInformation->m_displayName = TranslationHelper::GetKeyTranslation(TranslationContextGroup::ClassMethod, methodClass.c_str(), methodName.c_str(), TranslationItemType::Node, TranslationKeyId::Name);
|
||||
GraphCanvas::TranslationKey catkey;
|
||||
catkey << "BehaviorClass" << methodClass.c_str() << "details";
|
||||
GraphCanvas::TranslationRequests::Details catdetails;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(catdetails, &GraphCanvas::TranslationRequests::GetDetails, catkey, catdetails);
|
||||
|
||||
if (methodModelInformation->m_displayName.empty())
|
||||
{
|
||||
methodModelInformation->m_displayName = methodName;
|
||||
}
|
||||
GraphCanvas::TranslationKey key;
|
||||
key << "BehaviorClass" << methodClass.c_str() << "methods" << methodName.c_str() << "details";
|
||||
|
||||
methodModelInformation->m_toolTip = TranslationHelper::GetKeyTranslation(TranslationContextGroup::ClassMethod, methodClass.c_str(), methodName.c_str(), TranslationItemType::Node, TranslationKeyId::Tooltip);
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
|
||||
GraphCanvas::TranslationKeyedString methodCategoryString;
|
||||
methodCategoryString.m_context = ScriptCanvasEditor::TranslationHelper::GetContextName(ScriptCanvasEditor::TranslationContextGroup::ClassMethod, methodClass.c_str());
|
||||
methodCategoryString.m_key = ScriptCanvasEditor::TranslationHelper::GetKey(ScriptCanvasEditor::TranslationContextGroup::ClassMethod, methodClass.c_str(), methodName.c_str(), ScriptCanvasEditor::TranslationItemType::Node, ScriptCanvasEditor::TranslationKeyId::Category);
|
||||
|
||||
methodModelInformation->m_categoryPath = methodCategoryString.GetDisplayString();
|
||||
methodModelInformation->m_displayName = details.m_name.empty() ? methodName : details.m_name;
|
||||
methodModelInformation->m_toolTip = details.m_tooltip;
|
||||
methodModelInformation->m_categoryPath = categoryPath;
|
||||
|
||||
if (methodModelInformation->m_categoryPath.empty())
|
||||
{
|
||||
if (!MethodHasAttribute(behaviorMethod, AZ::ScriptCanvasAttributes::FloatingFunction))
|
||||
{
|
||||
methodModelInformation->m_categoryPath = categoryPath;
|
||||
}
|
||||
else if (MethodHasAttribute(behaviorMethod, AZ::Script::Attributes::Category))
|
||||
{
|
||||
methodModelInformation->m_categoryPath = GetCategoryPath(behaviorMethod->m_attributes, (*behaviorContext));
|
||||
}
|
||||
|
||||
if (methodModelInformation->m_categoryPath.empty())
|
||||
{
|
||||
methodModelInformation->m_categoryPath = "Other";
|
||||
}
|
||||
methodModelInformation->m_categoryPath = "Other";
|
||||
}
|
||||
|
||||
m_registeredNodes.emplace(AZStd::make_pair(nodeIdentifier, methodModelInformation));
|
||||
}
|
||||
}
|
||||
|
||||
void NodePaletteModel::RegisterGlobalConstant(const AZ::BehaviorContext& behaviorContext, const AZ::BehaviorMethod& behaviorMethod)
|
||||
void NodePaletteModel::RegisterGlobalConstant(const AZ::BehaviorContext&, const AZ::BehaviorProperty* behaviorProperty, const AZ::BehaviorMethod& behaviorMethod)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "NodePaletteModel::RegisterGlobalConstant");
|
||||
|
||||
// Construct Node Identifier using the BehaviorMethod name and the ScriptCanvas Method typeid
|
||||
ScriptCanvas::NodeTypeIdentifier nodeIdentifier =
|
||||
ScriptCanvas::NodeUtils::ConstructGlobalMethodNodeIdentifier(behaviorMethod.m_name);
|
||||
@@ -1073,35 +1054,29 @@ namespace ScriptCanvasEditor
|
||||
|
||||
methodModelInformation->m_titlePaletteOverride = "MethodNodeTitlePalette";
|
||||
|
||||
methodModelInformation->m_displayName = TranslationHelper::GetGlobalMethodKeyTranslation(methodModelInformation->m_methodName,
|
||||
TranslationItemType::Node, TranslationKeyId::Name);
|
||||
methodModelInformation->m_toolTip = TranslationHelper::GetGlobalMethodKeyTranslation(methodModelInformation->m_methodName,
|
||||
TranslationItemType::Node, TranslationKeyId::Tooltip);
|
||||
methodModelInformation->m_categoryPath = TranslationHelper::GetGlobalMethodKeyTranslation(methodModelInformation->m_methodName,
|
||||
TranslationItemType::Node, TranslationKeyId::Category);
|
||||
GraphCanvas::TranslationKey key;
|
||||
key << "Constant" << behaviorProperty->m_name.c_str() << "details";
|
||||
|
||||
if (methodModelInformation->m_displayName.empty())
|
||||
{
|
||||
methodModelInformation->m_displayName = methodModelInformation->m_methodName;
|
||||
}
|
||||
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;
|
||||
|
||||
if (methodModelInformation->m_categoryPath.empty())
|
||||
{
|
||||
methodModelInformation->m_categoryPath = GetCategoryPath(behaviorMethod.m_attributes, behaviorContext);
|
||||
// Default to making the Category for Global Methods to be informative that the method
|
||||
// is registered with the Behavior Context
|
||||
if (methodModelInformation->m_categoryPath.empty())
|
||||
{
|
||||
methodModelInformation->m_categoryPath = "Constants";
|
||||
}
|
||||
methodModelInformation->m_categoryPath = "Constants";
|
||||
}
|
||||
|
||||
m_registeredNodes.emplace(nodeIdentifier, methodModelInformation.release());
|
||||
}
|
||||
}
|
||||
|
||||
void NodePaletteModel::RegisterMethodNode(const AZ::BehaviorContext& behaviorContext, const AZ::BehaviorMethod& behaviorMethod)
|
||||
void NodePaletteModel::RegisterMethodNode(const AZ::BehaviorContext&, const AZ::BehaviorMethod& behaviorMethod)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "NodePaletteModel::RegisterMethodNode");
|
||||
|
||||
// Construct Node Identifier using the BehaviorMethod name and the ScriptCanvas Method typeid
|
||||
ScriptCanvas::NodeTypeIdentifier nodeIdentifier =
|
||||
ScriptCanvas::NodeUtils::ConstructGlobalMethodNodeIdentifier(behaviorMethod.m_name);
|
||||
@@ -1112,31 +1087,17 @@ namespace ScriptCanvasEditor
|
||||
auto methodModelInformation = AZStd::make_unique<GlobalMethodNodeModelInformation>();
|
||||
methodModelInformation->m_methodName = behaviorMethod.m_name;
|
||||
methodModelInformation->m_nodeIdentifier = nodeIdentifier;
|
||||
|
||||
methodModelInformation->m_titlePaletteOverride = "MethodNodeTitlePalette";
|
||||
|
||||
methodModelInformation->m_displayName = TranslationHelper::GetGlobalMethodKeyTranslation(methodModelInformation->m_methodName,
|
||||
TranslationItemType::Node, TranslationKeyId::Name);
|
||||
methodModelInformation->m_toolTip = TranslationHelper::GetGlobalMethodKeyTranslation(methodModelInformation->m_methodName,
|
||||
TranslationItemType::Node, TranslationKeyId::Tooltip);
|
||||
methodModelInformation->m_categoryPath = TranslationHelper::GetGlobalMethodKeyTranslation(methodModelInformation->m_methodName,
|
||||
TranslationItemType::Node, TranslationKeyId::Category);
|
||||
GraphCanvas::TranslationKey key;
|
||||
key << "BehaviorMethod" << behaviorMethod.m_name.c_str() << "details";
|
||||
|
||||
if (methodModelInformation->m_displayName.empty())
|
||||
{
|
||||
methodModelInformation->m_displayName = methodModelInformation->m_methodName;
|
||||
}
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
|
||||
if (methodModelInformation->m_categoryPath.empty())
|
||||
{
|
||||
methodModelInformation->m_categoryPath = GetCategoryPath(behaviorMethod.m_attributes, behaviorContext);
|
||||
// Default to making the Category for Global Methods to be informative that the method
|
||||
// is registered with the Behavior Context
|
||||
if (methodModelInformation->m_categoryPath.empty())
|
||||
{
|
||||
methodModelInformation->m_categoryPath = "Behavior Context: Global Methods";
|
||||
}
|
||||
}
|
||||
methodModelInformation->m_displayName = details.m_name.empty() ? behaviorMethod.m_name : details.m_name;
|
||||
methodModelInformation->m_toolTip = details.m_tooltip.empty() ? "" : details.m_tooltip;
|
||||
methodModelInformation->m_categoryPath = details.m_category.empty() ? "Behavior Context: Global Methods" : details.m_category;
|
||||
|
||||
m_registeredNodes.emplace(nodeIdentifier, methodModelInformation.release());
|
||||
}
|
||||
@@ -1144,6 +1105,8 @@ namespace ScriptCanvasEditor
|
||||
|
||||
void NodePaletteModel::RegisterEBusHandlerNodeModelInformation(AZStd::string_view categoryPath, AZStd::string_view busName, AZStd::string_view eventName, const ScriptCanvas::EBusBusId& busId, const AZ::BehaviorEBusHandler::BusForwarderEvent& forwardEvent)
|
||||
{
|
||||
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "NodePaletteModel::RegisterEBusHandlerNodeModelInformation");
|
||||
ScriptCanvas::NodeTypeIdentifier nodeIdentifier = ScriptCanvas::NodeUtils::ConstructEBusEventReceiverIdentifier(busId, forwardEvent.m_eventId);
|
||||
|
||||
auto nodeIter = m_registeredNodes.find(nodeIdentifier);
|
||||
@@ -1161,18 +1124,14 @@ namespace ScriptCanvasEditor
|
||||
handlerInformation->m_busId = busId;
|
||||
handlerInformation->m_eventId = forwardEvent.m_eventId;
|
||||
|
||||
AZStd::string displayEventName = TranslationHelper::GetKeyTranslation(TranslationContextGroup::EbusHandler, busName.data(), eventName.data(), TranslationItemType::Node, TranslationKeyId::Name);
|
||||
GraphCanvas::TranslationKey key;
|
||||
key << "EBusHandler" << busName << "methods" << eventName << "details";
|
||||
|
||||
if (displayEventName.empty())
|
||||
{
|
||||
handlerInformation->m_displayName = eventName;
|
||||
}
|
||||
else
|
||||
{
|
||||
handlerInformation->m_displayName = displayEventName;
|
||||
}
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
|
||||
handlerInformation->m_toolTip = TranslationHelper::GetKeyTranslation(TranslationContextGroup::EbusHandler, busName.data(), eventName.data(), TranslationItemType::Node, TranslationKeyId::Tooltip);
|
||||
handlerInformation->m_displayName = details.m_name.empty() ? eventName : details.m_name.c_str();
|
||||
handlerInformation->m_toolTip = details.m_tooltip.empty() ? "" : details.m_tooltip;
|
||||
|
||||
m_registeredNodes.emplace(AZStd::make_pair(nodeIdentifier, handlerInformation));
|
||||
}
|
||||
@@ -1188,6 +1147,8 @@ namespace ScriptCanvasEditor
|
||||
, ScriptCanvas::PropertyStatus propertyStatus
|
||||
, bool isOverload)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "NodePaletteModel::RegisterEBusSenderNodeModelInformation");
|
||||
|
||||
ScriptCanvas::NodeTypeIdentifier nodeIdentifier = isOverload ? ScriptCanvas::NodeUtils::ConstructEBusEventSenderOverloadedIdentifier(busId, eventId) : ScriptCanvas::NodeUtils::ConstructEBusEventSenderIdentifier(busId, eventId);
|
||||
|
||||
auto nodeIter = m_registeredNodes.find(nodeIdentifier);
|
||||
@@ -1207,18 +1168,14 @@ namespace ScriptCanvasEditor
|
||||
senderInformation->m_busId = busId;
|
||||
senderInformation->m_eventId = eventId;
|
||||
|
||||
AZStd::string displayEventName = TranslationHelper::GetKeyTranslation(TranslationContextGroup::EbusSender, busName.data(), eventName.data(), TranslationItemType::Node, TranslationKeyId::Name);
|
||||
GraphCanvas::TranslationKey key;
|
||||
key << "EBusSender" << busName << "methods" << eventName << "details";
|
||||
|
||||
if (displayEventName.empty())
|
||||
{
|
||||
senderInformation->m_displayName = eventName;
|
||||
}
|
||||
else
|
||||
{
|
||||
senderInformation->m_displayName = displayEventName;
|
||||
}
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
|
||||
senderInformation->m_toolTip = TranslationHelper::GetKeyTranslation(TranslationContextGroup::EbusSender, busName.data(), eventName.data(), TranslationItemType::Node, TranslationKeyId::Tooltip);
|
||||
senderInformation->m_displayName = details.m_name.empty() ? eventName : details.m_name.c_str();
|
||||
senderInformation->m_toolTip = details.m_tooltip.empty() ? "" : details.m_tooltip;
|
||||
|
||||
m_registeredNodes.emplace(AZStd::make_pair(nodeIdentifier, senderInformation));
|
||||
}
|
||||
@@ -1226,6 +1183,8 @@ namespace ScriptCanvasEditor
|
||||
|
||||
AZStd::vector<ScriptCanvas::NodeTypeIdentifier> NodePaletteModel::RegisterScriptEvent(ScriptEvents::ScriptEventsAsset* scriptEventAsset)
|
||||
{
|
||||
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "NodePaletteModel::RegisterScriptEvent");
|
||||
const ScriptEvents::ScriptEvent& scriptEvent = scriptEventAsset->m_definition;
|
||||
|
||||
ScriptCanvas::EBusBusId busId = scriptEventAsset->GetBusId();
|
||||
@@ -1236,7 +1195,7 @@ namespace ScriptCanvasEditor
|
||||
|
||||
AZStd::vector<ScriptCanvas::NodeTypeIdentifier> identifiers;
|
||||
|
||||
// Each event has a handler and a reciever
|
||||
// Each event has a handler and a receiver
|
||||
identifiers.reserve(methods.size() * 2);
|
||||
|
||||
for (const auto& method : methods)
|
||||
@@ -1444,6 +1403,8 @@ namespace ScriptCanvasEditor
|
||||
|
||||
AZStd::vector<ScriptCanvas::NodeTypeIdentifier> NodePaletteModel::ProcessAsset(AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(NodePaletteModel, "NodePaletteModel::RegisterScriptEvent");
|
||||
|
||||
AZStd::lock_guard<AZStd::recursive_mutex> myLocker(m_mutex);
|
||||
|
||||
if (entry)
|
||||
|
||||
@@ -80,7 +80,8 @@ namespace ScriptCanvasEditor
|
||||
void RegisterCustomNode(AZStd::string_view categoryPath, const AZ::Uuid& uuid, AZStd::string_view name, const AZ::SerializeContext::ClassData* classData);
|
||||
void RegisterClassNode(const AZStd::string& categoryPath, const AZStd::string& methodClass, const AZStd::string& methodName, const AZ::BehaviorMethod* behaviorMethod, const AZ::BehaviorContext* behaviorContext, ScriptCanvas::PropertyStatus propertyStatus, bool isOverload);
|
||||
void RegisterMethodNode(const AZ::BehaviorContext& behaviorContext, const AZ::BehaviorMethod& behaviorMethod);
|
||||
void RegisterGlobalConstant(const AZ::BehaviorContext& behaviorContext, const AZ::BehaviorMethod& behaviorMethod);
|
||||
void RegisterGlobalConstant(const AZ::BehaviorContext& behaviorContext, const AZ::BehaviorProperty* behaviorProperty, const AZ::BehaviorMethod& behaviorMethod);
|
||||
|
||||
|
||||
void RegisterEBusHandlerNodeModelInformation(AZStd::string_view categoryPath, AZStd::string_view busName, AZStd::string_view eventName, const ScriptCanvas::EBusBusId& busId, const AZ::BehaviorEBusHandler::BusForwarderEvent& forwardEvent);
|
||||
void RegisterEBusSenderNodeModelInformation(AZStd::string_view categoryPath, AZStd::string_view busName, AZStd::string_view eventName, const ScriptCanvas::EBusBusId& busId, const ScriptCanvas::EBusEventId& eventId, const AZ::BehaviorEBusEventSender& eventSender, ScriptCanvas::PropertyStatus propertyStatus, bool isOverload);
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
#include <ScriptCanvas/Libraries/Libraries.h>
|
||||
#include <ScriptCanvas/Utils/NodeUtils.h>
|
||||
#include <ScriptEvents/ScriptEventsAsset.h>
|
||||
#include "AzQtComponents/Utilities/DesktopUtilities.h"
|
||||
|
||||
namespace ScriptCanvasEditor
|
||||
{
|
||||
@@ -99,7 +100,7 @@ namespace ScriptCanvasEditor
|
||||
|
||||
if (auto customModelInformation = azrtti_cast<const CustomNodeModelInformation*>(modelInformation))
|
||||
{
|
||||
createdItem = parentItem->CreateChildNode<CustomNodePaletteTreeItem>(customModelInformation->m_typeId, customModelInformation->m_displayName);
|
||||
createdItem = parentItem->CreateChildNode<CustomNodePaletteTreeItem>(*customModelInformation);
|
||||
createdItem->SetToolTip(QString(customModelInformation->m_toolTip.c_str()));
|
||||
}
|
||||
else if (auto methodNodeModelInformation = azrtti_cast<const MethodNodeModelInformation*>(modelInformation))
|
||||
@@ -660,6 +661,11 @@ namespace ScriptCanvasEditor
|
||||
, m_previousCycleAction(nullptr)
|
||||
, m_ignoreSelectionChanged(false)
|
||||
{
|
||||
|
||||
GraphCanvas::NodePaletteTreeView* treeView = GetTreeView();
|
||||
|
||||
treeView->setContextMenuPolicy(Qt::ContextMenuPolicy::ActionsContextMenu);
|
||||
|
||||
if (!paletteConfig.m_isInContextMenu)
|
||||
{
|
||||
QMenu* creationMenu = new QMenu();
|
||||
@@ -677,10 +683,11 @@ namespace ScriptCanvasEditor
|
||||
|
||||
AddSearchCustomizationWidget(m_newCustomEvent);
|
||||
|
||||
GraphCanvas::NodePaletteTreeView* treeView = GetTreeView();
|
||||
|
||||
|
||||
{
|
||||
m_nextCycleAction = new QAction(treeView);
|
||||
m_nextCycleAction->setText(tr("Next Instance in Graph"));
|
||||
|
||||
m_nextCycleAction->setShortcut(QKeySequence(Qt::Key_F8));
|
||||
treeView->addAction(m_nextCycleAction);
|
||||
@@ -690,6 +697,7 @@ namespace ScriptCanvasEditor
|
||||
|
||||
{
|
||||
m_previousCycleAction = new QAction(treeView);
|
||||
m_previousCycleAction->setText(tr("Previous Instance in Graph"));
|
||||
|
||||
m_previousCycleAction->setShortcut(QKeySequence(Qt::Key_F7));
|
||||
treeView->addAction(m_previousCycleAction);
|
||||
@@ -699,6 +707,23 @@ namespace ScriptCanvasEditor
|
||||
|
||||
QObject::connect(treeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &NodePaletteDockWidget::OnTreeSelectionChanged);
|
||||
QObject::connect(treeView, &GraphCanvas::NodePaletteTreeView::OnTreeItemDoubleClicked, this, &NodePaletteDockWidget::HandleTreeItemDoubleClicked);
|
||||
|
||||
{
|
||||
m_openTranslationData = new QAction(treeView);
|
||||
m_openTranslationData->setText("Open Translation Data");
|
||||
treeView->addAction(m_openTranslationData);
|
||||
|
||||
QObject::connect(m_openTranslationData, &QAction::triggered, this, &NodePaletteDockWidget::OpenTranslationData);
|
||||
}
|
||||
|
||||
{
|
||||
m_generateTranslation = new QAction(treeView);
|
||||
m_generateTranslation->setText("Generate Translation");
|
||||
treeView->addAction(m_generateTranslation);
|
||||
|
||||
QObject::connect(m_generateTranslation, &QAction::triggered, this, &NodePaletteDockWidget::GenerateTranslation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ConfigureSearchCustomizationMargins(QMargins(0, 0, 0, 0), 0);
|
||||
@@ -781,6 +806,7 @@ namespace ScriptCanvasEditor
|
||||
{
|
||||
m_nextCycleAction->setEnabled(true);
|
||||
m_previousCycleAction->setEnabled(true);
|
||||
m_openTranslationData->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -793,6 +819,7 @@ namespace ScriptCanvasEditor
|
||||
{
|
||||
m_nextCycleAction->setEnabled(false);
|
||||
m_previousCycleAction->setEnabled(false);
|
||||
m_openTranslationData->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -816,6 +843,84 @@ namespace ScriptCanvasEditor
|
||||
CycleToNextNode();
|
||||
}
|
||||
|
||||
static AZStd::string GetGemPath(const AZStd::string& gemName)
|
||||
{
|
||||
if (auto settingsRegistry = AZ::Interface<AZ::SettingsRegistryInterface>::Get(); settingsRegistry != nullptr)
|
||||
{
|
||||
AZ::IO::Path gemSourceAssetDirectories;
|
||||
AZStd::vector<AzFramework::GemInfo> gemInfos;
|
||||
if (AzFramework::GetGemsInfo(gemInfos, *settingsRegistry))
|
||||
{
|
||||
auto FindGemByName = [gemName](const AzFramework::GemInfo& gemInfo)
|
||||
{
|
||||
return gemInfo.m_gemName == gemName;
|
||||
};
|
||||
// Gather unique list of Gem Paths from the Settings Registry
|
||||
|
||||
auto foundIt = AZStd::find_if(gemInfos.begin(), gemInfos.end(), FindGemByName);
|
||||
if (foundIt != gemInfos.end())
|
||||
{
|
||||
const AzFramework::GemInfo& gemInfo = *foundIt;
|
||||
for (const AZ::IO::Path& absoluteSourcePath : gemInfo.m_absoluteSourcePaths)
|
||||
{
|
||||
gemSourceAssetDirectories = (absoluteSourcePath / gemInfo.GetGemAssetFolder());
|
||||
}
|
||||
|
||||
return gemSourceAssetDirectories.c_str();
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void NodePaletteDockWidget::GenerateTranslation()
|
||||
{
|
||||
QModelIndexList indexList = GetTreeView()->selectionModel()->selectedRows();
|
||||
|
||||
if (indexList.size() == 1)
|
||||
{
|
||||
QSortFilterProxyModel* filterModel = static_cast<QSortFilterProxyModel*>(GetTreeView()->model());
|
||||
|
||||
for (const QModelIndex& index : indexList)
|
||||
{
|
||||
QModelIndex sourceIndex = filterModel->mapToSource(index);
|
||||
|
||||
GraphCanvas::NodePaletteTreeItem* nodePaletteItem = static_cast<GraphCanvas::NodePaletteTreeItem*>(sourceIndex.internalPointer());
|
||||
nodePaletteItem->GenerateTranslationData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodePaletteDockWidget::OpenTranslationData()
|
||||
{
|
||||
QModelIndexList indexList = GetTreeView()->selectionModel()->selectedRows();
|
||||
|
||||
if (indexList.size() == 1)
|
||||
{
|
||||
QSortFilterProxyModel* filterModel = static_cast<QSortFilterProxyModel*>(GetTreeView()->model());
|
||||
|
||||
for (const QModelIndex& index : indexList)
|
||||
{
|
||||
QModelIndex sourceIndex = filterModel->mapToSource(index);
|
||||
|
||||
GraphCanvas::NodePaletteTreeItem* nodePaletteItem = static_cast<GraphCanvas::NodePaletteTreeItem*>(sourceIndex.internalPointer());
|
||||
if (nodePaletteItem)
|
||||
{
|
||||
AZ::IO::Path gemPath = GetGemPath("ScriptCanvas.Editor");
|
||||
gemPath = gemPath / AZ::IO::Path("TranslationAssets");
|
||||
gemPath = gemPath / nodePaletteItem->GetTranslationDataPath();
|
||||
gemPath.ReplaceExtension(".names");
|
||||
|
||||
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
if (fileIO->Exists(gemPath.c_str()))
|
||||
{
|
||||
AzQtComponents::ShowFileOnDesktop(gemPath.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodePaletteDockWidget::ConfigureHelper()
|
||||
{
|
||||
if (!m_cyclingHelper.IsConfigured() && !m_cyclingIdentifiers.empty())
|
||||
|
||||
@@ -193,8 +193,6 @@ namespace ScriptCanvasEditor
|
||||
void OnSelectionChanged() override;
|
||||
////
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
GraphCanvas::GraphCanvasTreeItem* CreatePaletteRoot() const override;
|
||||
@@ -209,6 +207,8 @@ namespace ScriptCanvasEditor
|
||||
private:
|
||||
|
||||
void HandleTreeItemDoubleClicked(GraphCanvas::GraphCanvasTreeItem* treeItem);
|
||||
void OpenTranslationData();
|
||||
void GenerateTranslation();
|
||||
|
||||
void ConfigureHelper();
|
||||
void ParseCycleTargets(GraphCanvas::GraphCanvasTreeItem* treeItem);
|
||||
@@ -225,6 +225,10 @@ namespace ScriptCanvasEditor
|
||||
QAction* m_previousCycleAction;
|
||||
|
||||
bool m_ignoreSelectionChanged;
|
||||
|
||||
QMenu* m_contextMenu;
|
||||
QAction* m_openTranslationData;
|
||||
QAction* m_generateTranslation;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include <ScriptCanvas/Data/DataRegistry.h>
|
||||
#include <ScriptCanvas/GraphCanvas/NodeDescriptorBus.h>
|
||||
#include <ScriptCanvas/Asset/RuntimeAsset.h>
|
||||
#include "GraphCanvas/Components/Slots/Data/DataSlotBus.h"
|
||||
|
||||
namespace ScriptCanvasEditor
|
||||
{
|
||||
@@ -886,6 +887,7 @@ namespace ScriptCanvasEditor
|
||||
|
||||
ScriptCanvas::NodeRequestBus::EventResult(removedReferences, memberPair.m_scriptCanvasId, &ScriptCanvas::NodeRequests::RemoveVariableReferences, variableIds);
|
||||
|
||||
|
||||
// If we didn't remove the references. Just delete the node.
|
||||
if (!removedReferences)
|
||||
{
|
||||
|
||||
@@ -113,16 +113,14 @@ namespace ScriptCanvasEditor
|
||||
actionItem.m_name = QString(eventConfigurations[i].m_eventName.c_str());
|
||||
actionItem.m_eventId = eventConfigurations[i].m_eventId;
|
||||
|
||||
AZStd::string translatedName = TranslationHelper::GetKeyTranslation(TranslationContextGroup::EbusHandler, m_busName, eventConfigurations[i].m_eventName, TranslationItemType::Node, TranslationKeyId::Name);
|
||||
GraphCanvas::TranslationKey key;
|
||||
key << "EBusHandler" << m_busName.c_str() << "methods" << eventConfigurations[i].m_eventName << "details";
|
||||
|
||||
if (translatedName.empty())
|
||||
{
|
||||
actionItem.m_displayName = actionItem.m_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
actionItem.m_displayName = QString(translatedName.c_str());
|
||||
}
|
||||
GraphCanvas::TranslationRequests::Details details;
|
||||
details.m_name = actionItem.m_name.toUtf8().data();
|
||||
GraphCanvas::TranslationRequestBus::BroadcastResult(details, &GraphCanvas::TranslationRequests::GetDetails, key, details);
|
||||
|
||||
actionItem.m_displayName = QString(details.m_name.c_str());
|
||||
|
||||
actionItem.m_index = i;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user