Moved asynchronous image loading function to atom tools framework
Moved settings registry wrapper function to atom tools framework Created registry settings with default values for preview configurations based on asset type Changed lighting preset previews and thumbnails to use reflective material Created registry settings for preset selection dialog borders, padding, sizes Updated shared preview utility functions to compare against registered asset types instead of passing them in individually Signed-off-by: Guthrie Adams <guthadam@amazon.com>
This commit is contained in:
+5
-2
@@ -28,13 +28,16 @@ namespace MaterialEditor
|
||||
MaterialViewportRequestBus::BroadcastResult(presets, &MaterialViewportRequestBus::Events::GetLightingPresets);
|
||||
AZStd::sort(presets.begin(), presets.end(), [](const auto& a, const auto& b) { return a->m_displayName < b->m_displayName; });
|
||||
|
||||
const int itemSize = aznumeric_cast<int>(
|
||||
AtomToolsFramework::GetSettingOrDefault<AZ::u64>("/O3DE/Atom/MaterialEditor/PresetBrowserDialog/LightingItemSize", 180));
|
||||
|
||||
QListWidgetItem* selectedItem = nullptr;
|
||||
for (const auto& preset : presets)
|
||||
{
|
||||
AZStd::string path;
|
||||
MaterialViewportRequestBus::BroadcastResult(path, &MaterialViewportRequestBus::Events::GetLightingPresetLastSavePath, preset);
|
||||
QListWidgetItem* item =
|
||||
CreateListItem(preset->m_displayName.c_str(), AZ::RPI::AssetUtils::MakeAssetId(path, 0).GetValue(), QSize(180, 180));
|
||||
QListWidgetItem* item = CreateListItem(
|
||||
preset->m_displayName.c_str(), AZ::RPI::AssetUtils::MakeAssetId(path, 0).GetValue(), QSize(itemSize, itemSize));
|
||||
|
||||
m_listItemToPresetMap[item] = preset;
|
||||
|
||||
|
||||
+4
-1
@@ -27,10 +27,13 @@ namespace MaterialEditor
|
||||
MaterialViewportRequestBus::BroadcastResult(presets, &MaterialViewportRequestBus::Events::GetModelPresets);
|
||||
AZStd::sort(presets.begin(), presets.end(), [](const auto& a, const auto& b) { return a->m_displayName < b->m_displayName; });
|
||||
|
||||
const int itemSize = aznumeric_cast<int>(
|
||||
AtomToolsFramework::GetSettingOrDefault<AZ::u64>("/O3DE/Atom/MaterialEditor/PresetBrowserDialog/ModelItemSize", 90));
|
||||
|
||||
QListWidgetItem* selectedItem = nullptr;
|
||||
for (const auto& preset : presets)
|
||||
{
|
||||
QListWidgetItem* item = CreateListItem(preset->m_displayName.c_str(), preset->m_modelAsset.GetId(), QSize(90, 90));
|
||||
QListWidgetItem* item = CreateListItem(preset->m_displayName.c_str(), preset->m_modelAsset.GetId(), QSize(itemSize, itemSize));
|
||||
|
||||
m_listItemToPresetMap[item] = preset;
|
||||
|
||||
|
||||
+12
-4
@@ -51,13 +51,21 @@ namespace MaterialEditor
|
||||
|
||||
QListWidgetItem* PresetBrowserDialog::CreateListItem(const QString& title, const AZ::Data::AssetId& assetId, const QSize& size)
|
||||
{
|
||||
const int itemBorder = aznumeric_cast<int>(
|
||||
AtomToolsFramework::GetSettingOrDefault<AZ::u64>("/O3DE/Atom/MaterialEditor/PresetBrowserDialog/ItemBorder", 4));
|
||||
const int itemSpacing = aznumeric_cast<int>(
|
||||
AtomToolsFramework::GetSettingOrDefault<AZ::u64>("/O3DE/Atom/MaterialEditor/PresetBrowserDialog/ItemSpacing", 10));
|
||||
const int headerHeight = aznumeric_cast<int>(
|
||||
AtomToolsFramework::GetSettingOrDefault<AZ::u64>("/O3DE/Atom/MaterialEditor/PresetBrowserDialog/HeaderHeight", 15));
|
||||
|
||||
const QSize gridSize = m_ui->m_presetList->gridSize();
|
||||
m_ui->m_presetList->setGridSize(
|
||||
QSize(AZStd::max(gridSize.width(), size.width() + 10), AZStd::max(gridSize.height(), size.height() + 10 + 15)));
|
||||
m_ui->m_presetList->setGridSize(QSize(
|
||||
AZStd::max(gridSize.width(), size.width() + itemSpacing),
|
||||
AZStd::max(gridSize.height(), size.height() + itemSpacing + headerHeight)));
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem(m_ui->m_presetList);
|
||||
item->setData(Qt::UserRole, title);
|
||||
item->setSizeHint(size + QSize(4, 19));
|
||||
item->setSizeHint(size + QSize(itemBorder, itemBorder + headerHeight));
|
||||
m_ui->m_presetList->addItem(item);
|
||||
|
||||
QWidget* itemWidget = new QWidget(m_ui->m_presetList);
|
||||
@@ -67,7 +75,7 @@ namespace MaterialEditor
|
||||
|
||||
AzQtComponents::ElidingLabel* header = new AzQtComponents::ElidingLabel(itemWidget);
|
||||
header->setText(title);
|
||||
header->setFixedSize(QSize(size.width(), 15));
|
||||
header->setFixedSize(QSize(size.width(), headerHeight));
|
||||
header->setMargin(0);
|
||||
header->setStyleSheet("background-color: rgb(35, 35, 35)");
|
||||
AzQtComponents::Text::addPrimaryStyle(header);
|
||||
|
||||
Reference in New Issue
Block a user