Skip to content

Commit efdfc65

Browse files
authored
Merge pull request o3de#17482 from aws-lumberyard-dev/daimini/dpe/VectorClearFix
DPE | Layout classes rewrite to fix refresh issues with containers.
2 parents 72a704e + 0acda10 commit efdfc65

File tree

8 files changed

+255
-293
lines changed

8 files changed

+255
-293
lines changed

Code/Framework/AzFramework/AzFramework/DocumentPropertyEditor/PropertyEditorNodes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ namespace AZ::DocumentPropertyEditor::Nodes
228228

229229
enum class ContainerAction
230230
{
231+
None = 0,
231232
AddElement,
232233
RemoveElement,
233234
Clear,

Code/Framework/AzFramework/AzFramework/DocumentPropertyEditor/Reflection/LegacyReflectionBridge.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,7 @@ namespace AZ::Reflection
18011801
if (serializeContext == nullptr)
18021802
{
18031803
AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext);
1804-
AZ_Assert(serializeContext != nullptr, "Unable to retreive a SerializeContext");
1804+
AZ_Assert(serializeContext != nullptr, "Unable to retrieve a SerializeContext");
18051805
}
18061806

18071807
LegacyReflectionInternal::InstanceVisitor helper(visitor, instance, typeId, serializeContext);

Code/Framework/AzFramework/AzFramework/DocumentPropertyEditor/Reflection/LegacyReflectionBridge.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ namespace AZ::Reflection::LegacyReflectionInternal
9090
{
9191
AZ_TYPE_INFO(KeyEntry, "{718537E1-DFF5-4662-AB86-1D5C0C8A0768}");
9292

93-
//! Stores the address and type ID of an associative contaienr key
93+
//! Stores the address and type ID of an associative container key
9494
AZ::PointerObject m_keyInstance;
9595
//! Stores the attributes of a single associative container element key
9696
AZStd::vector<AttributeData> m_keyAttributes;

Code/Framework/AzToolsFramework/AzToolsFramework/UI/DocumentPropertyEditor/ContainerActionButtonHandler.cpp

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,72 @@ namespace AzToolsFramework
1818

1919
void ContainerActionButtonHandler::SetValueFromDom(const AZ::Dom::Value& node)
2020
{
21-
GenericButtonHandler::SetValueFromDom(node);
2221

23-
static QIcon s_iconAdd(QStringLiteral(":/stylesheet/img/UI20/add-16.svg"));
24-
static QIcon s_iconRemove(QStringLiteral(":/stylesheet/img/UI20/delete-16.svg"));
25-
static QIcon s_iconClear(QStringLiteral(":/stylesheet/img/UI20/delete-16.svg"));
26-
static QIcon s_iconUp(QStringLiteral(":/stylesheet/img/indicator-arrow-up.svg"));
27-
static QIcon s_iconDown(QStringLiteral(":/stylesheet/img/indicator-arrow-down.svg"));
22+
static const QIcon s_iconAdd(QStringLiteral(":/stylesheet/img/UI20/add-16.svg"));
23+
static const QIcon s_iconRemove(QStringLiteral(":/stylesheet/img/UI20/delete-16.svg"));
24+
static const QIcon s_iconClear(QStringLiteral(":/stylesheet/img/UI20/delete-16.svg"));
25+
static const QIcon s_iconUp(QStringLiteral(":/stylesheet/img/indicator-arrow-up.svg"));
26+
static const QIcon s_iconDown(QStringLiteral(":/stylesheet/img/indicator-arrow-down.svg"));
2827

2928
using AZ::DocumentPropertyEditor::Nodes::ContainerAction;
3029
using AZ::DocumentPropertyEditor::Nodes::ContainerActionButton;
3130

31+
GenericButtonHandler::SetValueFromDom(node);
32+
33+
auto oldAction = m_action;
3234
m_action = ContainerActionButton::Action.ExtractFromDomNode(node).value_or(ContainerAction::AddElement);
35+
36+
if (m_action == oldAction)
37+
{
38+
return;
39+
}
40+
3341
switch (m_action)
3442
{
3543
case ContainerAction::AddElement:
36-
setIcon(s_iconAdd);
37-
setToolTip("Add new child element");
38-
break;
44+
{
45+
setIcon(s_iconAdd);
46+
setToolTip(tr("Add new child element"));
47+
break;
48+
}
3949
case ContainerAction::RemoveElement:
40-
setIcon(s_iconRemove);
41-
setToolTip(tr("Remove this element"));
42-
break;
50+
{
51+
setIcon(s_iconRemove);
52+
setToolTip(tr("Remove this element"));
53+
break;
54+
}
4355
case ContainerAction::Clear:
44-
setIcon(s_iconClear);
45-
setToolTip(tr("Remove all elements"));
46-
break;
56+
{
57+
setIcon(s_iconClear);
58+
setToolTip(tr("Remove all elements"));
59+
break;
60+
}
4761
case ContainerAction::MoveUp:
48-
setIcon(s_iconUp);
49-
setToolTip(tr("move this element up"));
50-
break;
62+
{
63+
setIcon(s_iconUp);
64+
setToolTip(tr("move this element up"));
65+
break;
66+
}
5167
case ContainerAction::MoveDown:
52-
setIcon(s_iconDown);
53-
setToolTip(tr("move this element down"));
54-
break;
68+
{
69+
setIcon(s_iconDown);
70+
setToolTip(tr("move this element down"));
71+
break;
72+
}
73+
case ContainerAction::None:
74+
default:
75+
{
76+
AZ_Error("DPE", false, "ContainerActionButtonHandler::SetValueFromDom passed invalid action!");
77+
break;
78+
}
5579
}
5680
}
5781

82+
bool ContainerActionButtonHandler::ResetToDefaults()
83+
{
84+
return GenericButtonHandler::ResetToDefaults();
85+
}
86+
5887
void ContainerActionButtonHandler::OnClicked()
5988
{
6089
using AZ::DocumentPropertyEditor::Nodes::Container;

Code/Framework/AzToolsFramework/AzToolsFramework/UI/DocumentPropertyEditor/ContainerActionButtonHandler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace AzToolsFramework
1818
ContainerActionButtonHandler();
1919

2020
void SetValueFromDom(const AZ::Dom::Value& node) override;
21+
virtual bool ResetToDefaults() override;
2122

2223
static constexpr const AZStd::string_view GetHandlerName()
2324
{

0 commit comments

Comments
 (0)