Only allow streaming image assets with supported pixel formats to be selected for an image gradient
Signed-off-by: Chris Galvan <chgalvan@amazon.com>
This commit is contained in:
+11
-4
@@ -82,7 +82,7 @@ namespace AzToolsFramework
|
||||
});
|
||||
connect(m_ui->m_assetBrowserTreeViewWidget, &QAbstractItemView::doubleClicked, this, &AssetPickerDialog::DoubleClickedSlot);
|
||||
connect(m_ui->m_assetBrowserTreeViewWidget, &AssetBrowserTreeView::selectionChangedSignal, this,
|
||||
[this](const QItemSelection&, const QItemSelection&){ AssetPickerDialog::SelectionChangedSlot(); });
|
||||
[this](const QItemSelection&, const QItemSelection&){ SelectionChangedSlot(); });
|
||||
connect(m_ui->m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(m_ui->m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace AzToolsFramework
|
||||
m_ui->m_assetBrowserTableViewWidget, &AssetBrowserTableView::selectionChangedSignal, this,
|
||||
[this](const QItemSelection&, const QItemSelection&)
|
||||
{
|
||||
AssetPickerDialog::SelectionChangedSlot();
|
||||
SelectionChangedSlot();
|
||||
});
|
||||
|
||||
connect(m_ui->m_assetBrowserTableViewWidget, &QAbstractItemView::doubleClicked, this, &AssetPickerDialog::DoubleClickedSlot);
|
||||
@@ -174,8 +174,15 @@ namespace AzToolsFramework
|
||||
m_tableModel->UpdateTableModelMaps();
|
||||
}
|
||||
|
||||
QTimer::singleShot(0, this, &AssetPickerDialog::RestoreState);
|
||||
SelectionChangedSlot();
|
||||
QTimer::singleShot(0, this, [this]() {
|
||||
RestoreState();
|
||||
|
||||
// The selection doesn't propogate immediately, so we need to delay
|
||||
// it as well so that the OK button can be updated appropriately.
|
||||
// Otherwise, it will always be disabled when you first launch
|
||||
// the asset picker dialog.
|
||||
SelectionChangedSlot();
|
||||
});
|
||||
}
|
||||
|
||||
AssetPickerDialog::~AssetPickerDialog() = default;
|
||||
|
||||
+3
-3
@@ -58,16 +58,16 @@ namespace AzToolsFramework
|
||||
void keyPressEvent(QKeyEvent* e) override;
|
||||
void resizeEvent(QResizeEvent* resizeEvent) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
protected Q_SLOTS:
|
||||
void DoubleClickedSlot(const QModelIndex& index);
|
||||
void SelectionChangedSlot();
|
||||
void RestoreState();
|
||||
void OnFilterUpdated();
|
||||
|
||||
private:
|
||||
protected:
|
||||
//! Evaluate whether current selection is valid.
|
||||
//! Valid selection requires exactly one item to be selected, must be source or product type, and must match the wildcard filter
|
||||
bool EvaluateSelection() const;
|
||||
virtual bool EvaluateSelection() const;
|
||||
void UpdatePreview() const;
|
||||
void SaveState();
|
||||
|
||||
|
||||
+18
-3
@@ -813,7 +813,7 @@ namespace AzToolsFramework
|
||||
selection.SetDisplayFilter(FilterConstType(compFilter));
|
||||
}
|
||||
|
||||
AssetBrowserComponentRequestBus::Broadcast(&AssetBrowserComponentRequests::PickAssets, selection, parentWidget());
|
||||
PickAssetSelectionFromDialog(selection, parentWidget());
|
||||
if (selection.IsValid())
|
||||
{
|
||||
const auto product = azrtti_cast<const ProductAssetBrowserEntry*>(selection.GetResult());
|
||||
@@ -831,6 +831,11 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyAssetCtrl::PickAssetSelectionFromDialog(AssetSelectionModel& selection, QWidget* parent)
|
||||
{
|
||||
AssetBrowserComponentRequestBus::Broadcast(&AssetBrowserComponentRequests::PickAssets, selection, parent);
|
||||
}
|
||||
|
||||
void PropertyAssetCtrl::OnClearButtonClicked()
|
||||
{
|
||||
ClearAssetInternal();
|
||||
@@ -1524,7 +1529,7 @@ namespace AzToolsFramework
|
||||
ConsumeAttributeInternal(GUI, attrib, attrValue, debugName);
|
||||
}
|
||||
|
||||
void AssetPropertyHandlerDefault::WriteGUIValuesIntoProperty(size_t index, PropertyAssetCtrl* GUI, property_t& instance, InstanceDataNode* node)
|
||||
void AssetPropertyHandlerDefault::WriteGUIValuesIntoPropertyInternal(size_t index, PropertyAssetCtrl* GUI, property_t& instance, InstanceDataNode* node)
|
||||
{
|
||||
(void)index;
|
||||
(void)node;
|
||||
@@ -1539,7 +1544,12 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
bool AssetPropertyHandlerDefault::ReadValuesIntoGUI(size_t index, PropertyAssetCtrl* GUI, const property_t& instance, InstanceDataNode* node)
|
||||
void AssetPropertyHandlerDefault::WriteGUIValuesIntoProperty(size_t index, PropertyAssetCtrl* GUI, property_t& instance, InstanceDataNode* node)
|
||||
{
|
||||
WriteGUIValuesIntoPropertyInternal(index, GUI, instance, node);
|
||||
}
|
||||
|
||||
bool AssetPropertyHandlerDefault::ReadValuesIntoGUIInternal(size_t index, PropertyAssetCtrl* GUI, const property_t& instance, InstanceDataNode* node)
|
||||
{
|
||||
(void)index;
|
||||
(void)node;
|
||||
@@ -1559,6 +1569,11 @@ namespace AzToolsFramework
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AssetPropertyHandlerDefault::ReadValuesIntoGUI(size_t index, PropertyAssetCtrl* GUI, const property_t& instance, InstanceDataNode* node)
|
||||
{
|
||||
return ReadValuesIntoGUIInternal(index, GUI, instance, node);
|
||||
}
|
||||
|
||||
QWidget* SimpleAssetPropertyHandlerDefault::CreateGUI(QWidget* pParent)
|
||||
{
|
||||
PropertyAssetCtrl* newCtrl = aznew PropertyAssetCtrl(pParent);
|
||||
|
||||
+3
@@ -244,6 +244,7 @@ namespace AzToolsFramework
|
||||
void SetCurrentAssetHint(const AZStd::string& hint);
|
||||
void SetDefaultAssetID(const AZ::Data::AssetId& defaultID);
|
||||
virtual void PopupAssetPicker();
|
||||
virtual void PickAssetSelectionFromDialog(AssetSelectionModel& selection, QWidget* parent);
|
||||
void OnClearButtonClicked();
|
||||
void UpdateAssetDisplay();
|
||||
void OnLineEditFocus(bool focus);
|
||||
@@ -280,7 +281,9 @@ namespace AzToolsFramework
|
||||
virtual QWidget* CreateGUI(QWidget* pParent) override;
|
||||
static void ConsumeAttributeInternal(PropertyAssetCtrl* GUI, AZ::u32 attrib, PropertyAttributeReader* attrValue, const char* debugName);
|
||||
void ConsumeAttribute(PropertyAssetCtrl* GUI, AZ::u32 attrib, PropertyAttributeReader* attrValue, const char* debugName) override;
|
||||
static void WriteGUIValuesIntoPropertyInternal(size_t index, PropertyAssetCtrl* GUI, property_t& instance, InstanceDataNode* node);
|
||||
virtual void WriteGUIValuesIntoProperty(size_t index, PropertyAssetCtrl* GUI, property_t& instance, InstanceDataNode* node) override;
|
||||
static bool ReadValuesIntoGUIInternal(size_t index, PropertyAssetCtrl* GUI, const property_t& instance, InstanceDataNode* node);
|
||||
virtual bool ReadValuesIntoGUI(size_t index, PropertyAssetCtrl* GUI, const property_t& instance, InstanceDataNode* node) override;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user