PR feedback

This commit is contained in:
mnaumov
2021-04-26 17:42:49 -07:00
parent 09a0676b9c
commit 91f027a05c
11 changed files with 44 additions and 59 deletions
@@ -118,6 +118,7 @@ namespace AZ
const static AZ::Crc32 StringLineEditingCompleteNotify = AZ_CRC("StringLineEditingCompleteNotify", 0x139e5fa9);
const static AZ::Crc32 NameLabelOverride = AZ_CRC("NameLabelOverride", 0x9ff79cab);
const static AZ::Crc32 AssetPickerTitle = AZ_CRC_CE("AssetPickerTitle");
const static AZ::Crc32 ChildNameLabelOverride = AZ_CRC("ChildNameLabelOverride", 0x73dd2909);
//! Container attribute that is used to override labels for its elements given the index of the element
const static AZ::Crc32 IndexedChildNameLabelOverride = AZ_CRC("IndexedChildNameLabelOverride", 0x5f313ac2);
@@ -679,22 +679,7 @@ namespace AzToolsFramework
AssetSelectionModel PropertyAssetCtrl::GetAssetSelectionModel()
{
auto selectionModel = AssetSelectionModel::AssetTypeSelection(GetCurrentAssetType());
QString title;
auto propertyRowWidget = FindFirstParent<PropertyRowWidget>(parent());
if (propertyRowWidget)
{
if (!propertyRowWidget->label().isEmpty())
{
title = propertyRowWidget->label();
}
auto reflectedPropertyEditor = FindFirstParent<ReflectedPropertyEditor>(propertyRowWidget->parent());
if (reflectedPropertyEditor && !reflectedPropertyEditor->GetTitle().isEmpty())
{
title = QString("%1 %2").arg(reflectedPropertyEditor->GetTitle()).arg(title);
}
}
selectionModel.SetTitle(title);
selectionModel.SetTitle(m_title);
return selectionModel;
}
@@ -1076,6 +1061,11 @@ namespace AzToolsFramework
m_editButton->setIcon(icon);
}
void PropertyAssetCtrl::SetTitle(const QString& title)
{
m_title = title;
}
void PropertyAssetCtrl::SetEditNotifyTarget(void* editNotifyTarget)
{
m_editNotifyTarget = editNotifyTarget;
@@ -1211,7 +1201,16 @@ namespace AzToolsFramework
{
(void)debugName;
if (attrib == AZ_CRC("EditCallback", 0xb74f2ee1))
if (attrib == AZ_CRC_CE("AssetPickerTitle"))
{
AZStd::string title;
attrValue->Read<AZStd::string>(title);
if (!title.empty())
{
GUI->SetTitle(title.c_str());
}
}
else if (attrib == AZ_CRC("EditCallback", 0xb74f2ee1))
{
PropertyAssetCtrl::EditCallbackType* func = azdynamic_cast<PropertyAssetCtrl::EditCallbackType*>(attrValue->GetAttribute());
if (func)
@@ -95,6 +95,7 @@ namespace AzToolsFramework
void OnAssetIDChanged(AZ::Data::AssetId newAssetID);
protected:
QString m_title;
ThumbnailDropDown* m_thumbnailDropDown = nullptr;
Thumbnailer::ThumbnailWidget* m_thumbnail = nullptr;
QPushButton* m_errorButton = nullptr;
@@ -178,9 +179,6 @@ namespace AzToolsFramework
void HandleFieldClear();
AZStd::string AddDefaultSuffix(const AZStd::string& filename);
template <class Widget_Type>
Widget_Type* FindFirstParent(QObject* pParent) const;
//////////////////////////////////////////////////////////////////////////
// AssetSystemBus
void SourceFileChanged(AZStd::string relativePath, AZStd::string scanFolder, AZ::Uuid sourceUUID) override;
@@ -195,6 +193,7 @@ namespace AzToolsFramework
//////////////////////////////////////////////////////////////////////////
public slots:
void SetTitle(const QString& title);
void SetEditNotifyTarget(void* editNotifyTarget);
void SetEditNotifyCallback(EditCallbackType* editNotifyCallback); // This is meant to be used with the "EditCallback" Attribute
void SetClearNotifyCallback(ClearCallbackType* clearNotifyCallback); // This is meant to be used with the "ClearNotify" Attribute
@@ -236,22 +235,6 @@ namespace AzToolsFramework
void UpdateThumbnail();
};
template<class Widget_Type>
Widget_Type* PropertyAssetCtrl::FindFirstParent(QObject* pParent) const
{
Widget_Type* widget = nullptr;
while (pParent)
{
widget = qobject_cast<Widget_Type*>(pParent);
if (widget)
{
break;
}
pParent = pParent->parent();
}
return widget;
}
class AssetPropertyHandlerDefault
: QObject
, public PropertyHandler<AZ::Data::Asset<AZ::Data::AssetData>, PropertyAssetCtrl>
@@ -2248,16 +2248,6 @@ namespace AzToolsFramework
m_impl->m_visibilityCallback = callback;
}
void ReflectedPropertyEditor::SetTitle(const QString& title)
{
m_title = title;
}
const QString& ReflectedPropertyEditor::GetTitle() const
{
return m_title;
}
QWidget* ReflectedPropertyEditor::GetContainerWidget()
{
return m_impl->m_containerWidget;
@@ -156,9 +156,6 @@ namespace AzToolsFramework
using VisibilityCallback = AZStd::function<void(InstanceDataNode* node, NodeDisplayVisibility& visibility, bool& checkChildVisibility)>;
void SetVisibilityCallback(VisibilityCallback callback);
void SetTitle(const QString& title);
const QString& GetTitle() const;
signals:
void OnExpansionContractionDone();
private:
@@ -166,7 +163,6 @@ namespace AzToolsFramework
std::unique_ptr<Impl> m_impl;
AZStd::string m_currentFilterString;
QString m_title;
virtual void paintEvent(QPaintEvent* event) override;
int m_updateDepth = 0;