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:
+26
-18
@@ -91,17 +91,19 @@ namespace GraphCanvas
|
||||
|
||||
}
|
||||
|
||||
void GeneralNodeTitleComponent::SetTitle(const AZStd::string& title)
|
||||
void GeneralNodeTitleComponent::SetDetails(const AZStd::string& title, const AZStd::string& subtitle)
|
||||
{
|
||||
m_title.SetFallback(title);
|
||||
m_title = title;
|
||||
m_subTitle = subtitle;
|
||||
|
||||
if (m_generalNodeTitleWidget)
|
||||
{
|
||||
m_generalNodeTitleWidget->SetTitle(title);
|
||||
m_generalNodeTitleWidget->SetDetails(title, subtitle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GeneralNodeTitleComponent::SetTranslationKeyedTitle(const TranslationKeyedString& title)
|
||||
void GeneralNodeTitleComponent::SetTitle(const AZStd::string& title)
|
||||
{
|
||||
m_title = title;
|
||||
|
||||
@@ -113,20 +115,10 @@ namespace GraphCanvas
|
||||
|
||||
AZStd::string GeneralNodeTitleComponent::GetTitle() const
|
||||
{
|
||||
return m_title.GetDisplayString();
|
||||
return m_title;
|
||||
}
|
||||
|
||||
void GeneralNodeTitleComponent::SetSubTitle(const AZStd::string& subtitle)
|
||||
{
|
||||
m_subTitle.SetFallback(subtitle);
|
||||
|
||||
if (m_generalNodeTitleWidget)
|
||||
{
|
||||
m_generalNodeTitleWidget->SetSubTitle(subtitle);
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralNodeTitleComponent::SetTranslationKeyedSubTitle(const TranslationKeyedString& subtitle)
|
||||
{
|
||||
m_subTitle = subtitle;
|
||||
|
||||
@@ -138,7 +130,7 @@ namespace GraphCanvas
|
||||
|
||||
AZStd::string GeneralNodeTitleComponent::GetSubTitle() const
|
||||
{
|
||||
return m_subTitle.GetDisplayString();
|
||||
return m_subTitle;
|
||||
}
|
||||
|
||||
QGraphicsWidget* GeneralNodeTitleComponent::GetGraphicsWidget()
|
||||
@@ -270,7 +262,23 @@ namespace GraphCanvas
|
||||
SceneNotificationBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void GeneralNodeTitleGraphicsWidget::SetTitle(const TranslationKeyedString& title)
|
||||
void GeneralNodeTitleGraphicsWidget::SetDetails(const AZStd::string& title, const AZStd::string& subtitle)
|
||||
{
|
||||
bool updateLayout = false;
|
||||
if (m_titleWidget)
|
||||
{
|
||||
m_titleWidget->SetLabel(title);
|
||||
updateLayout = true;
|
||||
}
|
||||
|
||||
if (m_subTitleWidget)
|
||||
{
|
||||
m_subTitleWidget->SetLabel(subtitle);
|
||||
updateLayout = true;
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralNodeTitleGraphicsWidget::SetTitle(const AZStd::string& title)
|
||||
{
|
||||
if (m_titleWidget)
|
||||
{
|
||||
@@ -279,7 +287,7 @@ namespace GraphCanvas
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralNodeTitleGraphicsWidget::SetSubTitle(const TranslationKeyedString& subtitle)
|
||||
void GeneralNodeTitleGraphicsWidget::SetSubTitle(const AZStd::string& subtitle)
|
||||
{
|
||||
if (m_subTitleWidget)
|
||||
{
|
||||
|
||||
@@ -68,12 +68,11 @@ namespace GraphCanvas
|
||||
////
|
||||
|
||||
// NodeTitleRequestBus
|
||||
void SetDetails(const AZStd::string& title, const AZStd::string& subtitle) override;
|
||||
void SetTitle(const AZStd::string& title) override;
|
||||
void SetTranslationKeyedTitle(const TranslationKeyedString& title) override;
|
||||
AZStd::string GetTitle() const override;
|
||||
|
||||
void SetSubTitle(const AZStd::string& subtitle) override;
|
||||
void SetTranslationKeyedSubTitle(const TranslationKeyedString& subtitle) override;
|
||||
AZStd::string GetSubTitle() const override;
|
||||
|
||||
QGraphicsWidget* GetGraphicsWidget() override;
|
||||
@@ -96,8 +95,8 @@ namespace GraphCanvas
|
||||
private:
|
||||
GeneralNodeTitleComponent(const GeneralNodeTitleComponent&) = delete;
|
||||
|
||||
TranslationKeyedString m_title;
|
||||
TranslationKeyedString m_subTitle;
|
||||
AZStd::string m_title;
|
||||
AZStd::string m_subTitle;
|
||||
|
||||
AZStd::string m_basePalette;
|
||||
|
||||
@@ -123,9 +122,10 @@ namespace GraphCanvas
|
||||
|
||||
void Activate();
|
||||
void Deactivate();
|
||||
|
||||
void SetTitle(const TranslationKeyedString& title);
|
||||
void SetSubTitle(const TranslationKeyedString& subtitle);
|
||||
|
||||
void SetDetails(const AZStd::string& title, const AZStd::string& subtitle);
|
||||
void SetTitle(const AZStd::string& title);
|
||||
void SetSubTitle(const AZStd::string& subtitle);
|
||||
|
||||
void SetPaletteOverride(AZStd::string_view paletteOverride);
|
||||
void SetPaletteOverride(const AZ::Uuid& uuid);
|
||||
|
||||
@@ -1007,20 +1007,16 @@ namespace GraphCanvas
|
||||
{
|
||||
if (!configuration.m_name.empty())
|
||||
{
|
||||
cloneConfiguration->m_name.Clear();
|
||||
cloneConfiguration->m_name.SetFallback(configuration.m_name);
|
||||
cloneConfiguration->m_name = configuration.m_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
AZStd::string nodeTitle;
|
||||
NodeTitleRequestBus::EventResult(nodeTitle, configuration.m_targetEndpoint.GetNodeId(), &NodeTitleRequests::GetTitle);
|
||||
|
||||
AZStd::string displayName = AZStd::string::format("%s:%s", nodeTitle.c_str(), cloneConfiguration->m_name.GetDisplayString().c_str());
|
||||
AZStd::string displayName = AZStd::string::format("%s:%s", nodeTitle.c_str(), cloneConfiguration->m_name.c_str());
|
||||
|
||||
// Gain some context. Lost the ability to refresh the strings.
|
||||
// Should be fixable once we get an actual use case for this setup.
|
||||
cloneConfiguration->m_name.Clear();
|
||||
cloneConfiguration->m_name.SetFallback(displayName);
|
||||
cloneConfiguration->m_name = displayName;
|
||||
}
|
||||
|
||||
AZ::Entity* slotEntity = nullptr;
|
||||
|
||||
@@ -315,12 +315,6 @@ namespace GraphCanvas
|
||||
NodeNotificationBus::Event(GetEntityId(), &NodeNotifications::OnTooltipChanged, m_configuration.GetTooltip());
|
||||
}
|
||||
|
||||
void NodeComponent::SetTranslationKeyedTooltip(const TranslationKeyedString& tooltip)
|
||||
{
|
||||
m_configuration.SetTooltip(tooltip.GetDisplayString());
|
||||
NodeNotificationBus::Event(GetEntityId(), &NodeNotifications::OnTooltipChanged, m_configuration.GetTooltip());
|
||||
}
|
||||
|
||||
void NodeComponent::AddSlot(const AZ::EntityId& slotId)
|
||||
{
|
||||
AZ_Assert(slotId.IsValid(), "Slot entity (ID: %s) is not valid!", slotId.ToString().data());
|
||||
|
||||
@@ -106,7 +106,6 @@ namespace GraphCanvas
|
||||
|
||||
// NodeRequestBus
|
||||
void SetTooltip(const AZStd::string& tooltip) override;
|
||||
void SetTranslationKeyedTooltip(const TranslationKeyedString& tooltip) override;
|
||||
const AZStd::string GetTooltip() const override { return m_configuration.GetTooltip(); }
|
||||
|
||||
void SetShowInOutliner(bool showInOutliner) override { m_configuration.SetShowInOutliner(showInOutliner); }
|
||||
|
||||
Reference in New Issue
Block a user