Adding Setting to allow the user to choose the max number of items to show in the Search View
Merge pull request #1679 from aws-lumberyard-dev/LYN-4700
This commit is contained in:
@@ -82,6 +82,7 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent)
|
||||
|
||||
m_ui->m_assetBrowserTableViewWidget->setVisible(false);
|
||||
m_ui->m_toggleDisplayViewBtn->setVisible(false);
|
||||
m_ui->m_searchWidget->SetFilterInputInterval(AZStd::chrono::milliseconds(250));
|
||||
if (ed_useNewAssetBrowserTableView)
|
||||
{
|
||||
m_ui->m_toggleDisplayViewBtn->setVisible(true);
|
||||
|
||||
@@ -43,11 +43,16 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
|
||||
->Field("MaxCount", &AutoBackup::m_maxCount)
|
||||
->Field("RemindTime", &AutoBackup::m_remindTime);
|
||||
|
||||
serialize.Class<AssetBrowserSearch>()
|
||||
->Version(1)
|
||||
->Field("Max number of items displayed", &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch);
|
||||
|
||||
serialize.Class<CEditorPreferencesPage_Files>()
|
||||
->Version(1)
|
||||
->Field("Files", &CEditorPreferencesPage_Files::m_files)
|
||||
->Field("Editors", &CEditorPreferencesPage_Files::m_editors)
|
||||
->Field("AutoBackup", &CEditorPreferencesPage_Files::m_autoBackup);
|
||||
->Field("AutoBackup", &CEditorPreferencesPage_Files::m_autoBackup)
|
||||
->Field("AssetBrowserSearch", &CEditorPreferencesPage_Files::m_assetBrowserSearch);
|
||||
|
||||
|
||||
AZ::EditContext* editContext = serialize.GetEditContext();
|
||||
@@ -80,12 +85,19 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 100)
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AutoBackup::m_remindTime, "Remind Time", "Auto Remind Every (Minutes)");
|
||||
|
||||
editContext->Class<AssetBrowserSearch>("Asset Browser Search View", "Asset Browser Search View")
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch, "Maximum number of displayed items",
|
||||
"Maximum number of displayed items displayed in the Search View")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 50)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 5000);
|
||||
|
||||
editContext->Class<CEditorPreferencesPage_Files>("File Preferences", "Class for handling File Preferences")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_files, "Files", "File Preferences")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_editors, "External Editors", "External Editors")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_autoBackup, "Auto Backup", "Auto Backup");
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_autoBackup, "Auto Backup", "Auto Backup")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_assetBrowserSearch, "Asset Browser Search", "Asset Browser Search");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +136,8 @@ void CEditorPreferencesPage_Files::OnApply()
|
||||
gSettings.autoBackupTime = m_autoBackup.m_timeInterval;
|
||||
gSettings.autoBackupMaxCount = m_autoBackup.m_maxCount;
|
||||
gSettings.autoRemindTime = m_autoBackup.m_remindTime;
|
||||
|
||||
gSettings.maxNumberOfItemsShownInSearch = m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch;
|
||||
}
|
||||
|
||||
void CEditorPreferencesPage_Files::InitializeSettings()
|
||||
@@ -148,4 +162,6 @@ void CEditorPreferencesPage_Files::InitializeSettings()
|
||||
m_autoBackup.m_timeInterval = gSettings.autoBackupTime;
|
||||
m_autoBackup.m_maxCount = gSettings.autoBackupMaxCount;
|
||||
m_autoBackup.m_remindTime = gSettings.autoRemindTime;
|
||||
|
||||
m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch = gSettings.maxNumberOfItemsShownInSearch;
|
||||
}
|
||||
|
||||
@@ -69,10 +69,17 @@ private:
|
||||
int m_remindTime;
|
||||
};
|
||||
|
||||
struct AssetBrowserSearch
|
||||
{
|
||||
AZ_TYPE_INFO(AssetBrowserSearch, "{9FBFCD24-9452-49DF-99F4-2711443CEAAE}")
|
||||
|
||||
int m_maxNumberOfItemsShownInSearch;
|
||||
};
|
||||
|
||||
Files m_files;
|
||||
ExternalEditors m_editors;
|
||||
AutoBackup m_autoBackup;
|
||||
AssetBrowserSearch m_assetBrowserSearch;
|
||||
QIcon m_icon;
|
||||
};
|
||||
|
||||
|
||||
@@ -500,6 +500,7 @@ void SEditorSettings::Save()
|
||||
SaveValue("Settings", "AutoBackupTime", autoBackupTime);
|
||||
SaveValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
|
||||
SaveValue("Settings", "AutoRemindTime", autoRemindTime);
|
||||
SaveValue("Settings", "MaxDisplayedItemsNumInSearch", maxNumberOfItemsShownInSearch);
|
||||
SaveValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
|
||||
SaveValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
|
||||
SaveValue("Settings", "StylusMode", stylusMode);
|
||||
@@ -714,6 +715,7 @@ void SEditorSettings::Load()
|
||||
LoadValue("Settings", "AutoBackupTime", autoBackupTime);
|
||||
LoadValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
|
||||
LoadValue("Settings", "AutoRemindTime", autoRemindTime);
|
||||
LoadValue("Settings", "MaxDisplayedItemsNumInSearch", maxNumberOfItemsShownInSearch);
|
||||
LoadValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
|
||||
LoadValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
|
||||
LoadValue("Settings", "StylusMode", stylusMode);
|
||||
@@ -1209,3 +1211,8 @@ AzToolsFramework::ConsoleColorTheme SEditorSettings::GetConsoleColorTheme() cons
|
||||
{
|
||||
return consoleBackgroundColorTheme;
|
||||
}
|
||||
|
||||
int SEditorSettings::GetMaxNumberOfItemsShownInSearchView() const
|
||||
{
|
||||
return SEditorSettings::maxNumberOfItemsShownInSearch;
|
||||
}
|
||||
|
||||
@@ -289,6 +289,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
SettingOutcome GetValue(const AZStd::string_view path) override;
|
||||
SettingOutcome SetValue(const AZStd::string_view path, const AZStd::any& value) override;
|
||||
AzToolsFramework::ConsoleColorTheme GetConsoleColorTheme() const override;
|
||||
int GetMaxNumberOfItemsShownInSearchView() const override;
|
||||
|
||||
void ConvertPath(const AZStd::string_view sourcePath, AZStd::string& category, AZStd::string& attribute);
|
||||
|
||||
@@ -364,6 +365,13 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
int autoRemindTime;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Asset Browser Search View.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Current maximum number of items that can be displayed in the AssetBrowser Search View.
|
||||
int maxNumberOfItemsShownInSearch;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//! If true preview windows is displayed when browsing geometries.
|
||||
bool bPreviewGeometryWindow;
|
||||
|
||||
+2
-1
@@ -186,6 +186,7 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
invalidateFilter();
|
||||
|
||||
Q_EMIT filterChanged();
|
||||
}
|
||||
|
||||
@@ -205,6 +206,6 @@ namespace AzToolsFramework
|
||||
}
|
||||
|
||||
} // namespace AssetBrowser
|
||||
} // namespace AzToolsFramework// namespace AssetBrowser
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
#include "AssetBrowser/moc_AssetBrowserFilterModel.cpp"
|
||||
|
||||
@@ -134,7 +134,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//If the column of the parent is one of those we don't want any more rows as children
|
||||
if (parent.isValid())
|
||||
{
|
||||
if ((parent.column() != aznumeric_cast<int>(AssetBrowserEntry::Column::DisplayName)) &&
|
||||
|
||||
+32
-14
@@ -90,24 +90,38 @@ namespace AzToolsFramework
|
||||
const QAbstractItemModel* model, const QModelIndex& parent /*= QModelIndex()*/, int row /*= 0*/)
|
||||
{
|
||||
int rows = model ? model->rowCount(parent) : 0;
|
||||
for (int i = 0; i < rows; ++i)
|
||||
|
||||
if (parent == QModelIndex())
|
||||
{
|
||||
QModelIndex index = model->index(i, 0, parent);
|
||||
AssetBrowserEntry* entry = GetAssetEntry(m_filterModel->mapToSource(index));
|
||||
//We only wanna see the source assets.
|
||||
if (entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Source)
|
||||
{
|
||||
beginInsertRows(parent, row, row);
|
||||
m_indexMap[row] = index;
|
||||
endInsertRows();
|
||||
m_displayedItemsCounter = 0;
|
||||
}
|
||||
|
||||
Q_EMIT dataChanged(index, index);
|
||||
++row;
|
||||
for (int currentRow = 0; currentRow < rows; ++currentRow)
|
||||
{
|
||||
if (m_displayedItemsCounter < m_numberOfItemsDisplayed)
|
||||
{
|
||||
QModelIndex index = model->index(currentRow, 0, parent);
|
||||
AssetBrowserEntry* entry = GetAssetEntry(m_filterModel->mapToSource(index));
|
||||
// We only want to see the source assets.
|
||||
if (entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Source)
|
||||
{
|
||||
beginInsertRows(parent, row, row);
|
||||
m_indexMap[row] = index;
|
||||
endInsertRows();
|
||||
|
||||
Q_EMIT dataChanged(index, index);
|
||||
++row;
|
||||
++m_displayedItemsCounter;
|
||||
}
|
||||
|
||||
if (model->hasChildren(index))
|
||||
{
|
||||
row = BuildTableModelMap(model, index, row);
|
||||
}
|
||||
}
|
||||
|
||||
if (model->hasChildren(index))
|
||||
else
|
||||
{
|
||||
row = BuildTableModelMap(model, index, row);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return row;
|
||||
@@ -135,6 +149,10 @@ namespace AzToolsFramework
|
||||
m_indexMap.clear();
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
AzToolsFramework::EditorSettingsAPIBus::BroadcastResult(
|
||||
m_numberOfItemsDisplayed, &AzToolsFramework::EditorSettingsAPIBus::Handler::GetMaxNumberOfItemsShownInSearchView);
|
||||
|
||||
BuildTableModelMap(sourceModel());
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QPointer>
|
||||
#endif
|
||||
#include <Editor/EditorSettingsAPIBus.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -50,6 +51,8 @@ namespace AzToolsFramework
|
||||
int BuildTableModelMap(const QAbstractItemModel* model, const QModelIndex& parent = QModelIndex(), int row = 0);
|
||||
|
||||
private:
|
||||
int m_numberOfItemsDisplayed = 50;
|
||||
int m_displayedItemsCounter = 0;
|
||||
QPointer<AssetBrowserFilterModel> m_filterModel;
|
||||
QMap<int, QModelIndex> m_indexMap;
|
||||
};
|
||||
|
||||
+1
-11
@@ -6,18 +6,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <API/EditorAssetSystemAPI.h>
|
||||
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserModel.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntryCache.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Entries/ProductAssetBrowserEntry.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Entries/SourceAssetBrowserEntry.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Views/AssetBrowserTableView.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Views/EntryDelegate.h>
|
||||
|
||||
@@ -28,9 +20,7 @@ AZ_PUSH_DISABLE_WARNING(
|
||||
#include <QCoreApplication>
|
||||
#include <QHeaderView>
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QPen>
|
||||
|
||||
#include <QTimer>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
namespace AzToolsFramework
|
||||
|
||||
-2
@@ -9,7 +9,6 @@
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserTableModel.h>
|
||||
@@ -55,7 +54,6 @@ namespace AzToolsFramework
|
||||
void OnAssetBrowserComponentReady() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void selectionChangedSignal(const QItemSelection& selected, const QItemSelection& deselected);
|
||||
void ClearStringFilter();
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace AzToolsFramework
|
||||
virtual SettingOutcome GetValue(const AZStd::string_view path) = 0;
|
||||
virtual SettingOutcome SetValue(const AZStd::string_view path, const AZStd::any& value) = 0;
|
||||
virtual ConsoleColorTheme GetConsoleColorTheme() const = 0;
|
||||
virtual int GetMaxNumberOfItemsShownInSearchView() const = 0;
|
||||
};
|
||||
|
||||
using EditorSettingsAPIBus = AZ::EBus<EditorSettingsAPIRequests>;
|
||||
|
||||
Reference in New Issue
Block a user