Script Canvas, replace the text replacement system to a JSON file based one (#5228)

It is now possible to right click on nodes on the node palette to navigate to the file that holds the text data for any given node, this way it is easy to update and improve the naming of titles, subtitles, categories, tool tips and slots.
This commit is contained in:
Luis Sempé
2021-11-11 11:53:51 -08:00
committed by GitHub
parent 9d93282e42
commit 9e2a3226fd
1382 changed files with 209123 additions and 1515 deletions
@@ -40,9 +40,6 @@ namespace GraphCanvas
//! Set the tooltip for the node, which will display when the mouse is over the node but not a child item.
virtual void SetTooltip(const AZStd::string&) = 0;
//! Set the translation keyed tooltip for the node, which will display when the mouse is over the node but not a child item.
virtual void SetTranslationKeyedTooltip(const TranslationKeyedString&) = 0;
//! Get the tooltip that is currently set for the node.
virtual const AZStd::string GetTooltip() const = 0;
@@ -38,19 +38,18 @@ namespace GraphCanvas
virtual QGraphicsWidget* GetGraphicsWidget() = 0;
//! Set the node's details, title, subtitle, tooltip
virtual void SetDetails(const AZStd::string& title, const AZStd::string& subtitle) = 0;
//! Set the Node's title.
virtual void SetTitle(const AZStd::string& value) = 0;
virtual void SetTranslationKeyedTitle(const TranslationKeyedString& value) = 0;
//! Get the Node's title.
virtual AZStd::string GetTitle() const = 0;
//! Set the Node's sub-title.
virtual void SetSubTitle(const AZStd::string& value) = 0;
virtual void SetTranslationKeyedSubTitle(const TranslationKeyedString& value) = 0;
//! Get the Node's sub-title.
virtual AZStd::string GetSubTitle() const = 0;
@@ -89,8 +89,9 @@ namespace GraphCanvas
ConnectionType m_connectionType = ConnectionType::CT_Invalid;
TranslationKeyedString m_tooltip = TranslationKeyedString();
TranslationKeyedString m_name = TranslationKeyedString();
AZStd::string m_tooltip;
AZStd::string m_name;
SlotGroup m_slotGroup = SlotGroups::Invalid;
AZStd::string m_textDecoration;
@@ -209,22 +210,19 @@ namespace GraphCanvas
//! Get the name, or label, of the slot.
//! These generally appear as a label against \ref Input or \ref Output slots.
virtual const AZStd::string GetName() const = 0;
//! Set the slot's name.
virtual void SetName(const AZStd::string&) = 0;
//! Get and set the keys used for slot name translation.
virtual TranslationKeyedString GetTranslationKeyedName() const = 0;
virtual void SetTranslationKeyedName(const TranslationKeyedString&) = 0;
//! Set the slot's name & tooltip.
virtual void SetDetails(const AZStd::string& name, const AZStd::string& tooltip) = 0;
//! Get the tooltip for the slot.
virtual const AZStd::string GetTooltip() const = 0;
//! Set the tooltip this slot should display.
virtual void SetTooltip(const AZStd::string&) = 0;
//! Get and set the keys used for slot tooltip translation.
virtual TranslationKeyedString GetTranslationKeyedTooltip() const = 0;
virtual void SetTranslationKeyedTooltip(const TranslationKeyedString&) = 0;
//! Get the group of the slot
virtual SlotGroup GetSlotGroup() const = 0;
@@ -370,9 +368,10 @@ namespace GraphCanvas
using BusIdType = SlotId;
//! When the name of the slot changes, the new name is signaled.
virtual void OnNameChanged(const TranslationKeyedString&) {}
virtual void OnNameChanged(const AZStd::string&) {}
//! When the tooltip of the slot changes, the new tooltip value is emitted.
virtual void OnTooltipChanged(const TranslationKeyedString&) {}
virtual void OnTooltipChanged(const AZStd::string&) {}
virtual void OnRegisteredToNode(const AZ::EntityId&) {}
@@ -10,7 +10,7 @@
#include <AzCore/Debug/Profiler.h>
#define GRAPH_CANVAS_PROFILE_FUNCTION() AZ_PROFILE_FUNCTION(AzToolsFramework);
#define GRAPH_CANVAS_PROFILE_SCOPE(message) AZ_PROFILE_SCOPE(AzToolsFramework, message);
#define GRAPH_CANVAS_PROFILE_SCOPE(budget, message) AZ_PROFILE_SCOPE(budget, message);
#if GRAPH_CANVAS_ENABLE_DETAILED_PROFILING
#define GRAPH_CANVAS_DETAILED_PROFILE_FUNCTION() AZ_PROFILE_FUNCTION(AzToolsFramework);
@@ -6,6 +6,7 @@
*
*/
#include <AzCore/PlatformDef.h>
#include <AzCore/Debug/Profiler.h>
AZ_PUSH_DISABLE_WARNING(4251 4800 4244, "-Wunknown-warning-option")
#include <QBitmap>
@@ -141,6 +142,8 @@ namespace
namespace GraphCanvas
{
AZ_DEFINE_BUDGET(StyleManager);
////////////////////////
// StyleSheetComponent
////////////////////////
@@ -271,6 +274,8 @@ namespace GraphCanvas
: m_editorId(editorId)
, m_assetPath(assetPath)
{
GRAPH_CANVAS_PROFILE_SCOPE(StyleManager, "StyleManager::StyleManager");
StyleManagerRequestBus::Handler::BusConnect(m_editorId);
AZ::Data::AssetInfo assetInfo;
@@ -315,8 +320,11 @@ namespace GraphCanvas
}
}
void StyleManager::LoadStyleSheet()
{
GRAPH_CANVAS_PROFILE_SCOPE(StyleManager, "LoadStyleSheet");
AZStd::string file = AZStd::string::format("@products@/%s", m_assetPath.c_str());
AZ::IO::FileIOBase* fileBase = AZ::IO::FileIOBase::GetInstance();
@@ -393,7 +401,7 @@ namespace GraphCanvas
AZ::EntityId StyleManager::ResolveStyles(const AZ::EntityId& object) const
{
GRAPH_CANVAS_DETAILED_PROFILE_FUNCTION();
GRAPH_CANVAS_PROFILE_SCOPE(StyleManager, "ResolveStyles");
Styling::SelectorVector selectors;
StyledEntityRequestBus::EventResult(selectors, object, &StyledEntityRequests::GetStyleSelectors);
@@ -401,7 +409,7 @@ namespace GraphCanvas
QVector<StyleMatch> matches;
for (const auto& style : m_styles)
{
GRAPH_CANVAS_DETAILED_PROFILE_SCOPE("StyleManager::ResolveStyles::StyleMatching");
GRAPH_CANVAS_PROFILE_SCOPE(StyleManager, "StyleManager::ResolveStyles::StyleMatching");
int complexity = style->Matches(object);
if (complexity != 0)
{
@@ -410,7 +418,7 @@ namespace GraphCanvas
}
{
GRAPH_CANVAS_DETAILED_PROFILE_SCOPE("StyleManager::ResolveStyles::Sorting");
GRAPH_CANVAS_PROFILE_SCOPE(StyleManager, "StyleManager::ResolveStyles::Sorting");
std::stable_sort(matches.begin(), matches.end());
}
Styling::StyleVector result;
@@ -418,7 +426,7 @@ namespace GraphCanvas
const auto& constMatches = matches;
for (auto& match : constMatches)
{
GRAPH_CANVAS_DETAILED_PROFILE_SCOPE("StyleManager::ResolveStyles::ResultConstruction");
GRAPH_CANVAS_PROFILE_SCOPE(StyleManager, "StyleManager::ResolveStyles::ResultConstruction");
result.push_back(match.style);
}
@@ -19,6 +19,7 @@ AZ_POP_DISABLE_WARNING
#include <GraphCanvas/Widgets/GraphCanvasTreeItem.h>
#include <GraphCanvas/Editor/EditorTypes.h>
#include <AzCore/IO/Path/Path.h>
namespace GraphCanvas
{
@@ -86,6 +87,9 @@ namespace GraphCanvas
void SetError(const AZStd::string& errorString);
virtual AZ::IO::Path GetTranslationDataPath() const { return AZ::IO::Path(); }
virtual void GenerateTranslationData() {}
protected:
void PreOnChildAdded(GraphCanvasTreeItem* item) override;