Merge pull request #115 from aws-lumberyard-dev/Atom/guthadam/ATOM-15267
[ATOM-15267] Material Editor: Create material dialog respects default standard PBR selection
This commit is contained in:
+21
-8
@@ -60,13 +60,17 @@ namespace MaterialEditor
|
||||
AZ::Data::AssetCatalogRequestBus::Broadcast(&AZ::Data::AssetCatalogRequestBus::Events::EnumerateAssets, nullptr, enumerateCB, nullptr);
|
||||
|
||||
//Update the material type file info whenever the combo box selection changes
|
||||
QObject::connect(m_ui->m_materialTypeComboBox, static_cast<void(QComboBox::*)(const int)>(&QComboBox::currentIndexChanged), m_ui->m_materialTypeComboBox, [this](int index) {
|
||||
QVariant data = m_ui->m_materialTypeComboBox->itemData(index);
|
||||
m_materialTypeFileInfo = QFileInfo(data.toString());
|
||||
});
|
||||
QObject::connect(m_ui->m_materialTypeComboBox, static_cast<void (QComboBox::*)(const int)>(&QComboBox::currentIndexChanged), this, [this]() { UpdateMaterialTypeSelection(); });
|
||||
QObject::connect(m_ui->m_materialTypeComboBox, &QComboBox::currentTextChanged, this, [this]() { UpdateMaterialTypeSelection(); });
|
||||
|
||||
//Select StandardPBR by default but we will later data drive this with editor settings
|
||||
m_ui->m_materialTypeComboBox->setCurrentText("StandardPBR");
|
||||
// Select StandardPBR by default but we will later data drive this with editor settings
|
||||
const int index = m_ui->m_materialTypeComboBox->findText("StandardPBR");
|
||||
if (index >= 0)
|
||||
{
|
||||
m_ui->m_materialTypeComboBox->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
UpdateMaterialTypeSelection();
|
||||
}
|
||||
|
||||
void CreateMaterialDialog::InitMaterialFileSelection()
|
||||
@@ -88,15 +92,24 @@ namespace MaterialEditor
|
||||
m_materialFileInfo.absoluteFilePath(),
|
||||
QString("Material (*.material)"));
|
||||
|
||||
//Reject empty or invalid filenames which indicate user cancellation
|
||||
// Reject empty or invalid filenames which indicate user cancellation
|
||||
if (!fileInfo.absoluteFilePath().isEmpty())
|
||||
{
|
||||
m_materialFileInfo = fileInfo;
|
||||
m_ui->m_materialFilePicker->setText(m_materialFileInfo.fileName());
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void CreateMaterialDialog::UpdateMaterialTypeSelection()
|
||||
{
|
||||
const int index = m_ui->m_materialTypeComboBox->currentIndex();
|
||||
if (index >= 0)
|
||||
{
|
||||
const QVariant itemData = m_ui->m_materialTypeComboBox->itemData(index);
|
||||
m_materialTypeFileInfo = QFileInfo(itemData.toString());
|
||||
}
|
||||
}
|
||||
} // namespace MaterialEditor
|
||||
|
||||
#include <Window/CreateMaterialDialog/moc_CreateMaterialDialog.cpp>
|
||||
|
||||
+1
@@ -36,5 +36,6 @@ namespace MaterialEditor
|
||||
QScopedPointer<Ui::CreateMaterialDialog> m_ui;
|
||||
void InitMaterialTypeSelection();
|
||||
void InitMaterialFileSelection();
|
||||
void UpdateMaterialTypeSelection();
|
||||
};
|
||||
} // namespace MaterialEditor
|
||||
|
||||
Reference in New Issue
Block a user