Merge pull request #5296 from aws-lumberyard-dev/sc-editor-asset-redux
Sc editor asset redux
This commit is contained in:
+22
-6
@@ -39,7 +39,12 @@ namespace AzToolsFramework
|
||||
typeFilter->SetAssetType(filterType);
|
||||
typeFilter->SetFilterPropagation(AssetBrowserEntryFilter::PropagateDirection::Down);
|
||||
|
||||
m_assetBrowserFilterModel->SetFilter(FilterConstType(typeFilter));
|
||||
SetFilter(FilterConstType(typeFilter));
|
||||
}
|
||||
|
||||
void AssetCompleterModel::SetFilter(FilterConstType filter)
|
||||
{
|
||||
m_assetBrowserFilterModel->SetFilter(filter);
|
||||
|
||||
RefreshAssetList();
|
||||
}
|
||||
@@ -120,9 +125,6 @@ namespace AzToolsFramework
|
||||
int rows = m_assetBrowserFilterModel->rowCount(index);
|
||||
if (rows == 0)
|
||||
{
|
||||
if (index != QModelIndex()) {
|
||||
AZ_Error("AssetCompleterModel", false, "No children detected in FetchResources()");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,7 +133,7 @@ namespace AzToolsFramework
|
||||
QModelIndex childIndex = m_assetBrowserFilterModel->index(i, 0, index);
|
||||
AssetBrowserEntry* childEntry = GetAssetEntry(m_assetBrowserFilterModel->mapToSource(childIndex));
|
||||
|
||||
if (childEntry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Product)
|
||||
if (childEntry->GetEntryType() == m_entryType)
|
||||
{
|
||||
ProductAssetBrowserEntry* productEntry = static_cast<ProductAssetBrowserEntry*>(childEntry);
|
||||
AZStd::string assetName;
|
||||
@@ -167,7 +169,6 @@ namespace AzToolsFramework
|
||||
return m_assets[index.row()].m_displayName;
|
||||
}
|
||||
|
||||
|
||||
const AZ::Data::AssetId AssetCompleterModel::GetAssetIdFromIndex(const QModelIndex& index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
@@ -177,4 +178,19 @@ namespace AzToolsFramework
|
||||
|
||||
return m_assets[index.row()].m_assetId;
|
||||
}
|
||||
|
||||
const AZStd::string_view AssetCompleterModel::GetPathFromIndex(const QModelIndex& index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return m_assets[index.row()].m_path;
|
||||
}
|
||||
|
||||
void AssetCompleterModel::SetFetchEntryType(AssetBrowserEntry::AssetEntryType entryType)
|
||||
{
|
||||
m_entryType = entryType;
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -32,6 +32,7 @@ namespace AzToolsFramework
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
void SetFilter(AZ::Data::AssetType filterType);
|
||||
void SetFilter(FilterConstType filter);
|
||||
void RefreshAssetList();
|
||||
void SearchStringHighlight(QString searchString);
|
||||
|
||||
@@ -39,6 +40,9 @@ namespace AzToolsFramework
|
||||
|
||||
const AZStd::string_view GetNameFromIndex(const QModelIndex& index);
|
||||
const AZ::Data::AssetId GetAssetIdFromIndex(const QModelIndex& index);
|
||||
const AZStd::string_view GetPathFromIndex(const QModelIndex& index);
|
||||
|
||||
void SetFetchEntryType(AssetBrowserEntry::AssetEntryType entryType);
|
||||
|
||||
private:
|
||||
struct AssetItem
|
||||
@@ -57,6 +61,8 @@ namespace AzToolsFramework
|
||||
AZStd::vector<AssetItem> m_assets;
|
||||
//! String that will be highlighted in the suggestions
|
||||
QString m_highlightString;
|
||||
|
||||
AssetBrowserEntry::AssetEntryType m_entryType = AssetBrowserEntry::AssetEntryType::Product;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+8
-3
@@ -1288,7 +1288,7 @@ namespace AzToolsFramework
|
||||
return newCtrl;
|
||||
}
|
||||
|
||||
void AssetPropertyHandlerDefault::ConsumeAttribute(PropertyAssetCtrl* GUI, AZ::u32 attrib, PropertyAttributeReader* attrValue, const char* debugName)
|
||||
void AssetPropertyHandlerDefault::ConsumeAttributeInternal(PropertyAssetCtrl* GUI, AZ::u32 attrib, PropertyAttributeReader* attrValue, const char* debugName)
|
||||
{
|
||||
(void)debugName;
|
||||
|
||||
@@ -1487,6 +1487,11 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
void AssetPropertyHandlerDefault::ConsumeAttribute(PropertyAssetCtrl* GUI, AZ::u32 attrib, PropertyAttributeReader* attrValue, const char* debugName)
|
||||
{
|
||||
ConsumeAttributeInternal(GUI, attrib, attrValue, debugName);
|
||||
}
|
||||
|
||||
void AssetPropertyHandlerDefault::WriteGUIValuesIntoProperty(size_t index, PropertyAssetCtrl* GUI, property_t& instance, InstanceDataNode* node)
|
||||
{
|
||||
(void)index;
|
||||
@@ -1629,8 +1634,8 @@ namespace AzToolsFramework
|
||||
|
||||
void RegisterAssetPropertyHandler()
|
||||
{
|
||||
EBUS_EVENT(PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew AssetPropertyHandlerDefault());
|
||||
EBUS_EVENT(PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew SimpleAssetPropertyHandlerDefault());
|
||||
PropertyTypeRegistrationMessages::Bus::Broadcast(&PropertyTypeRegistrationMessages::RegisterPropertyType, aznew AssetPropertyHandlerDefault());
|
||||
PropertyTypeRegistrationMessages::Bus::Broadcast(&PropertyTypeRegistrationMessages::RegisterPropertyType, aznew SimpleAssetPropertyHandlerDefault());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-5
@@ -175,10 +175,11 @@ namespace AzToolsFramework
|
||||
virtual void SetFolderSelection(const AZStd::string& /* folderPath */) {}
|
||||
virtual void ClearAssetInternal();
|
||||
|
||||
void ConfigureAutocompleter();
|
||||
virtual void ConfigureAutocompleter();
|
||||
void RefreshAutocompleter();
|
||||
void EnableAutocompleter();
|
||||
void DisableAutocompleter();
|
||||
const QModelIndex GetSourceIndex(const QModelIndex& index);
|
||||
|
||||
void HandleFieldClear();
|
||||
AZStd::string AddDefaultSuffix(const AZStd::string& filename);
|
||||
@@ -235,20 +236,19 @@ namespace AzToolsFramework
|
||||
void SetSelectedAssetID(const AZ::Data::AssetId& newID, const AZ::Data::AssetType& newType);
|
||||
void SetCurrentAssetHint(const AZStd::string& hint);
|
||||
void SetDefaultAssetID(const AZ::Data::AssetId& defaultID);
|
||||
void PopupAssetPicker();
|
||||
virtual void PopupAssetPicker();
|
||||
void OnClearButtonClicked();
|
||||
void UpdateAssetDisplay();
|
||||
void OnLineEditFocus(bool focus);
|
||||
virtual void OnEditButtonClicked();
|
||||
void OnThumbnailClicked();
|
||||
void OnCompletionModelReset();
|
||||
void OnAutocomplete(const QModelIndex& index);
|
||||
virtual void OnAutocomplete(const QModelIndex& index);
|
||||
void OnTextChange(const QString& text);
|
||||
void OnReturnPressed();
|
||||
void ShowContextMenu(const QPoint& pos);
|
||||
|
||||
private:
|
||||
const QModelIndex GetSourceIndex(const QModelIndex& index);
|
||||
void UpdateThumbnail();
|
||||
};
|
||||
|
||||
@@ -270,7 +270,8 @@ namespace AzToolsFramework
|
||||
virtual void UpdateWidgetInternalTabbing(PropertyAssetCtrl* widget) override { widget->UpdateTabOrder(); }
|
||||
|
||||
virtual QWidget* CreateGUI(QWidget* pParent) override;
|
||||
virtual void ConsumeAttribute(PropertyAssetCtrl* GUI, AZ::u32 attrib, PropertyAttributeReader* attrValue, const char* debugName) 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;
|
||||
virtual void WriteGUIValuesIntoProperty(size_t index, PropertyAssetCtrl* GUI, property_t& instance, InstanceDataNode* node) override;
|
||||
virtual bool ReadValuesIntoGUI(size_t index, PropertyAssetCtrl* GUI, const property_t& instance, InstanceDataNode* node) override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user