Asset Bundler - Minor Feedback (#550)

Asset Bundler - Minor Feedback

* updated the formatting so all lines are shorter than 140 characters

* fixed a few nitpicks that came up on a recent PR

* removed a function that wasn't being used anymore

* updated some error messages based on PR feedback
This commit is contained in:
Zaladane
2021-05-05 13:59:37 -07:00
committed by GitHub
parent 5783bf635b
commit 1455fcbde6
37 changed files with 529 additions and 207 deletions
@@ -20,13 +20,18 @@
namespace AssetBundler
{
const char* DateTimeFormat = "hh:mm:ss MMM dd, yyyy";
const char* ReadOnlyFileErrorMessage = "File (%s) is Read-Only. Please check your version control and try again.";
AssetBundlerAbstractFileTableModel::AssetBundlerAbstractFileTableModel(QObject* parent)
: QAbstractTableModel(parent)
{
}
void AssetBundlerAbstractFileTableModel::Reload(const char* fileExtension, const QSet<QString>& watchedFolders, const QSet<QString>& watchedFiles, const AZStd::unordered_map<AZStd::string, AZStd::string>& pathToProjectNameMap)
void AssetBundlerAbstractFileTableModel::Reload(
const char* fileExtension,
const QSet<QString>& watchedFolders,
const QSet<QString>& watchedFiles,
const AZStd::unordered_map<AZStd::string, AZStd::string>& pathToProjectNameMap)
{
AZStd::vector<AZStd::string> keysToRemove = m_fileListKeys;
@@ -49,7 +54,9 @@ namespace AssetBundler
// If a project name is already specified, then the associated file is a default file
LoadFile(absolutePath, projectName, !projectName.empty());
keysToRemove.erase(AZStd::remove(keysToRemove.begin(), keysToRemove.end(), AssetBundler::GenerateKeyFromAbsolutePath(absolutePath)), keysToRemove.end());
keysToRemove.erase(
AZStd::remove(keysToRemove.begin(), keysToRemove.end(), AssetBundler::GenerateKeyFromAbsolutePath(absolutePath)),
keysToRemove.end());
}
}
@@ -63,7 +70,9 @@ namespace AssetBundler
// If a project name is already specified, then the associated file is a default file
LoadFile(absolutePath, projectName, !projectName.empty());
keysToRemove.erase(AZStd::remove(keysToRemove.begin(), keysToRemove.end(), AssetBundler::GenerateKeyFromAbsolutePath(absolutePath)), keysToRemove.end());
keysToRemove.erase(
AZStd::remove(keysToRemove.begin(), keysToRemove.end(), AssetBundler::GenerateKeyFromAbsolutePath(absolutePath)),
keysToRemove.end());
}
}
@@ -74,7 +83,9 @@ namespace AssetBundler
}
}
void AssetBundlerAbstractFileTableModel::ReloadFiles(const AZStd::vector<AZStd::string>& absoluteFilePathList, AZStd::unordered_map<AZStd::string, AZStd::string> pathToProjectNameMap)
void AssetBundlerAbstractFileTableModel::ReloadFiles(
const AZStd::vector<AZStd::string>& absoluteFilePathList,
AZStd::unordered_map<AZStd::string, AZStd::string> pathToProjectNameMap)
{
for (const AZStd::string& absoluteFilePath : absoluteFilePathList)
{
@@ -30,6 +30,7 @@ namespace AssetBundler
{
extern const char* DateTimeFormat;
extern const char* ReadOnlyFileErrorMessage;
//! Provides an abstract model that can be subclassed to create table models used to store information about files found on-disk.
class AssetBundlerAbstractFileTableModel
@@ -47,9 +48,15 @@ namespace AssetBundler
//////////////////////////////////////////////////////////////////////////
// Pure virtual functions
virtual AZStd::vector<AZStd::string> CreateNewFiles(const AZStd::string& absoluteFilePath, const AzFramework::PlatformFlags& platforms, const QString& project = QString()) = 0;
virtual AZStd::vector<AZStd::string> CreateNewFiles(
const AZStd::string& absoluteFilePath,
const AzFramework::PlatformFlags& platforms,
const QString& project = QString()) = 0;
virtual bool DeleteFile(const QModelIndex& index) = 0;
virtual void LoadFile(const AZStd::string& absoluteFilePath, const AZStd::string& projectName = "", bool isDefaultFile = false) = 0;
virtual void LoadFile(
const AZStd::string& absoluteFilePath,
const AZStd::string& projectName = "",
bool isDefaultFile = false) = 0;
virtual bool WriteToDisk(const AZStd::string& key) = 0;
//! Returns the absolute path of the file at the given index on success, returns an empty string on failure.
@@ -60,9 +67,15 @@ namespace AssetBundler
//////////////////////////////////////////////////////////////////////////
//! Reload all the data based on the watched folders and files
virtual void Reload(const char* fileExtension, const QSet<QString>& watchedFolders, const QSet<QString>& watchedFiles = QSet<QString>(), const AZStd::unordered_map<AZStd::string, AZStd::string>& pathToProjectNameMap = AZStd::unordered_map<AZStd::string, AZStd::string>());
virtual void Reload(
const char* fileExtension,
const QSet<QString>& watchedFolders,
const QSet<QString>& watchedFiles = QSet<QString>(),
const AZStd::unordered_map<AZStd::string, AZStd::string>& pathToProjectNameMap = AZStd::unordered_map<AZStd::string, AZStd::string>());
virtual void ReloadFiles(const AZStd::vector<AZStd::string>& absoluteFilePathList, AZStd::unordered_map<AZStd::string, AZStd::string> pathToProjectNameMap = AZStd::unordered_map<AZStd::string, AZStd::string>());
virtual void ReloadFiles(
const AZStd::vector<AZStd::string>& absoluteFilePathList,
AZStd::unordered_map<AZStd::string, AZStd::string> pathToProjectNameMap = AZStd::unordered_map<AZStd::string, AZStd::string>());
bool Save(const QModelIndex& selectedIndex);
@@ -87,12 +87,15 @@ namespace AssetBundler
{
if (AZ::IO::FileIOBase::GetInstance()->IsReadOnly(absolutePath))
{
AZ_Error(AssetBundler::AppWindowName, false, ReadOnlyFileErrorMessage, absolutePath);
return false;
}
auto deleteResult = AZ::IO::FileIOBase::GetInstance()->Remove(absolutePath);
if (!deleteResult)
{
AZ_Error(AssetBundler::AppWindowName, false,
"Unable to delete (%s). Result code: %u", absolutePath, deleteResult.GetResultCode());
return false;
}
}
@@ -104,7 +107,10 @@ namespace AssetBundler
return true;
}
void AssetListFileTableModel::LoadFile(const AZStd::string& absoluteFilePath, const AZStd::string& /*projectName*/, bool /*isDefaultFile*/)
void AssetListFileTableModel::LoadFile(
const AZStd::string& absoluteFilePath,
const AZStd::string& /*projectName*/,
bool /*isDefaultFile*/)
{
AZStd::string fullFileName;
AzFramework::StringFunc::Path::GetFullFileName(absoluteFilePath.c_str(), fullFileName);
@@ -56,7 +56,10 @@ namespace AssetBundler
//////////////////////////////////////////////////////////////////////////
// AssetBundlerAbstractFileTableModel overrides
AZStd::vector<AZStd::string> CreateNewFiles(const AZStd::string& /*absoluteFilePath*/, const AzFramework::PlatformFlags& /*platforms*/, const QString& /*project*/) override { return {}; }
AZStd::vector<AZStd::string> CreateNewFiles(
const AZStd::string& /*absoluteFilePath*/,
const AzFramework::PlatformFlags& /*platforms*/,
const QString& /*project*/) override { return {}; }
bool DeleteFile(const QModelIndex& index) override;
void LoadFile(const AZStd::string& absoluteFilePath, const AZStd::string& projectName = "", bool isDefaultFile = false) override;
bool WriteToDisk(const AZStd::string& key) override;
@@ -23,7 +23,10 @@ namespace AssetBundler
: public QAbstractTableModel
{
public:
explicit AssetListTableModel(QObject* parent = nullptr, const AZStd::string& absolutePath = AZStd::string(), const AZStd::string& platform = "");
explicit AssetListTableModel(
QObject* parent = nullptr,
const AZStd::string& absolutePath = AZStd::string(),
const AZStd::string& platform = "");
virtual ~AssetListTableModel() {}
AZStd::shared_ptr<AzToolsFramework::AssetSeedManager> GetSeedListManager() { return m_seedListManager; }
@@ -73,14 +73,15 @@ namespace AssetBundler
{
if (AZ::IO::FileIOBase::GetInstance()->IsReadOnly(absolutePath))
{
AZ_Error(AssetBundler::AppWindowName, false, "File (%s) is Read-Only. Please check your version control and try again.", absolutePath);
AZ_Error(AssetBundler::AppWindowName, false, ReadOnlyFileErrorMessage, absolutePath);
return false;
}
auto deleteResult = AZ::IO::FileIOBase::GetInstance()->Remove(absolutePath);
if (!deleteResult)
{
AZ_Error(AssetBundler::AppWindowName, false, "Unable to delete: %s", absolutePath);
AZ_Error(AssetBundler::AppWindowName, false,
"Unable to delete (%s). Result code: %u", absolutePath, deleteResult.GetResultCode());
return false;
}
}
@@ -175,7 +176,10 @@ namespace AssetBundler
return Column::ColumnFileCreationTime;
}
void BundleFileListModel::LoadFile(const AZStd::string& absoluteFilePath, const AZStd::string& /*projectName*/, bool /*isDefaultFile*/)
void BundleFileListModel::LoadFile(
const AZStd::string& absoluteFilePath,
const AZStd::string& /*projectName*/,
bool /*isDefaultFile*/)
{
AZStd::string key = AssetBundler::GenerateKeyFromAbsolutePath(absoluteFilePath);
@@ -43,7 +43,10 @@ namespace AssetBundler
explicit BundleFileListModel();
virtual ~BundleFileListModel() {}
AZStd::vector<AZStd::string> CreateNewFiles(const AZStd::string& /*absoluteFilePath*/, const AzFramework::PlatformFlags& /*platforms*/, const QString& /*project*/) override { return {}; }
AZStd::vector<AZStd::string> CreateNewFiles(
const AZStd::string& /*absoluteFilePath*/,
const AzFramework::PlatformFlags& /*platforms*/,
const QString& /*project*/) override { return {}; }
bool DeleteFile(const QModelIndex& index) override;
void LoadFile(const AZStd::string& absoluteFilePath, const AZStd::string& projectName = "", bool isDefaultFile = false) override;
bool WriteToDisk(const AZStd::string& /*key*/) override { return true; }
@@ -67,7 +67,10 @@ namespace AssetBundler
{
}
AZStd::vector<AZStd::string> RulesFileTableModel::CreateNewFiles(const AZStd::string& absoluteFilePath, const AzFramework::PlatformFlags& /*platforms*/, const QString& /*project*/)
AZStd::vector<AZStd::string> RulesFileTableModel::CreateNewFiles(
const AZStd::string& absoluteFilePath,
const AzFramework::PlatformFlags& /*platforms*/,
const QString& /*project*/)
{
if (absoluteFilePath.empty())
{
@@ -116,14 +119,16 @@ namespace AssetBundler
// Remove file from disk
if (AZ::IO::FileIOBase::GetInstance()->IsReadOnly(rulesFileInfo->m_absolutePath.c_str()))
{
AZ_Error(AssetBundler::AppWindowName, false, "File (%s) is Read-Only. Please check your version control and try again.", rulesFileInfo->m_absolutePath.c_str());
AZ_Error(AssetBundler::AppWindowName, false, ReadOnlyFileErrorMessage, rulesFileInfo->m_absolutePath.c_str());
return false;
}
auto deleteResult = AZ::IO::FileIOBase::GetInstance()->Remove(rulesFileInfo->m_absolutePath.c_str());
if (!deleteResult)
{
AZ_Error(AssetBundler::AppWindowName, false, "Unable to delete: %s", rulesFileInfo->m_absolutePath.c_str());
AZ_Error(AssetBundler::AppWindowName, false,
"Unable to delete (%s). Result code: %u", rulesFileInfo->m_absolutePath.c_str(),
deleteResult.GetResultCode());
return false;
}
@@ -134,7 +139,10 @@ namespace AssetBundler
return true;
}
void RulesFileTableModel::LoadFile(const AZStd::string& absoluteFilePath, const AZStd::string& /*projectName*/, bool /*isDefaultFile*/)
void RulesFileTableModel::LoadFile(
const AZStd::string& absoluteFilePath,
const AZStd::string& /*projectName*/,
bool /*isDefaultFile*/)
{
// Get the file name without the extension for display purposes
AZStd::string fileName(absoluteFilePath);
@@ -145,7 +153,8 @@ namespace AssetBundler
auto fileInfoIt = m_rulesFileInfoMap.find(key);
if (fileInfoIt != m_rulesFileInfoMap.end() && fileInfoIt->second->m_hasUnsavedChanges)
{
AZ_Warning(AssetBundler::AppWindowName, false, "Rules File %s has unsaved changes and couldn't be reloaded", absoluteFilePath.c_str());
AZ_Warning(AssetBundler::AppWindowName, false,
"Rules File %s has unsaved changes and couldn't be reloaded", absoluteFilePath.c_str());
return;
}
@@ -48,7 +48,10 @@ namespace AssetBundler
RulesFileTableModel();
virtual ~RulesFileTableModel() {}
AZStd::vector<AZStd::string> CreateNewFiles(const AZStd::string& absoluteFilePath, const AzFramework::PlatformFlags& platforms = AzFramework::PlatformFlags::Platform_NONE, const QString& project = QString()) override;
AZStd::vector<AZStd::string> CreateNewFiles(
const AZStd::string& absoluteFilePath,
const AzFramework::PlatformFlags& platforms = AzFramework::PlatformFlags::Platform_NONE,
const QString& project = QString()) override;
bool DeleteFile(const QModelIndex& index) override;
@@ -91,12 +91,19 @@ namespace AssetBundler
m_seedTabWidget = nullptr;
}
void SeedListFileTableModel::AddDefaultSeedsToInMemoryList(const AZStd::vector<AZStd::string>& defaultSeeds, const char* projectName, const AzFramework::PlatformFlags& platforms)
void SeedListFileTableModel::AddDefaultSeedsToInMemoryList(
const AZStd::vector<AZStd::string>& defaultSeeds,
const char* projectName,
const AzFramework::PlatformFlags& platforms)
{
m_inMemoryDefaultSeedList.reset(new SeedListFileInfo(m_inMemoryDefaultSeedListKey, tr("DefaultSeeds"), QString(projectName), false, true, defaultSeeds, platforms));
m_inMemoryDefaultSeedList.reset(
new SeedListFileInfo(m_inMemoryDefaultSeedListKey, tr("DefaultSeeds"), QString(projectName), false, true, defaultSeeds, platforms));
}
AZStd::vector<AZStd::string> SeedListFileTableModel::CreateNewFiles(const AZStd::string& absoluteFilePath, const AzFramework::PlatformFlags& /*platforms*/, const QString& project)
AZStd::vector<AZStd::string> SeedListFileTableModel::CreateNewFiles(
const AZStd::string& absoluteFilePath,
const AzFramework::PlatformFlags& /*platforms*/,
const QString& project)
{
if (absoluteFilePath.empty())
{
@@ -111,7 +118,8 @@ namespace AssetBundler
// Create a Seed List File and save it to disk
AZStd::string key = AssetBundler::GenerateKeyFromAbsolutePath(absoluteFilePath);
AZStd::shared_ptr<SeedListFileInfo> newSeedListFile = AZStd::make_shared<SeedListFileInfo>(absoluteFilePath, QString(fileName.c_str()), project, false);
AZStd::shared_ptr<SeedListFileInfo> newSeedListFile =
AZStd::make_shared<SeedListFileInfo>(absoluteFilePath, QString(fileName.c_str()), project, false);
newSeedListFile->m_seedListModel->SetHasUnsavedChanges(true);
bool saveResult = newSeedListFile->SaveSeedFile();
if (!saveResult)
@@ -151,14 +159,15 @@ namespace AssetBundler
{
if (AZ::IO::FileIOBase::GetInstance()->IsReadOnly(absolutePath))
{
AZ_Error(AssetBundler::AppWindowName, false, "File (%s) is Read-Only. Please check your version control and try again.", absolutePath);
AZ_Error(AssetBundler::AppWindowName, false, ReadOnlyFileErrorMessage, absolutePath);
return false;
}
auto deleteResult = AZ::IO::FileIOBase::GetInstance()->Remove(absolutePath);
if (!deleteResult)
{
AZ_Error(AssetBundler::AppWindowName, false, "Unable to delete: %s", absolutePath);
AZ_Error(AssetBundler::AppWindowName, false,
"Unable to delete (%s). Result code: %u", absolutePath, deleteResult.GetResultCode());
return false;
}
}
@@ -170,7 +179,11 @@ namespace AssetBundler
return true;
}
void SeedListFileTableModel::Reload(const char* fileExtension, const QSet<QString>& watchedFolders, const QSet<QString>& watchedFiles, const AZStd::unordered_map<AZStd::string, AZStd::string>& pathToProjectNameMap)
void SeedListFileTableModel::Reload(
const char* fileExtension,
const QSet<QString>& watchedFolders,
const QSet<QString>& watchedFiles,
const AZStd::unordered_map<AZStd::string, AZStd::string>& pathToProjectNameMap)
{
// Load in the Seed List files from disk
AssetBundlerAbstractFileTableModel::Reload(fileExtension, watchedFolders, watchedFiles, pathToProjectNameMap);
@@ -191,7 +204,8 @@ namespace AssetBundler
auto fileInfoIt = m_seedListFileInfoMap.find(key);
if (fileInfoIt != m_seedListFileInfoMap.end() && fileInfoIt->second->HasUnsavedChanges())
{
AZ_Warning(AssetBundler::AppWindowName, false, "Seed List File %s has unsaved changes and couldn't be reloaded", absoluteFilePath.c_str());
AZ_Warning(AssetBundler::AppWindowName, false,
"Seed List File %s has unsaved changes and couldn't be reloaded", absoluteFilePath.c_str());
return;
}
@@ -208,7 +222,8 @@ namespace AssetBundler
projectNameOnDisplay = outcome.TakeValue();
}
m_seedListFileInfoMap[key].reset(new SeedListFileInfo(absoluteFilePath, QString(fileName.c_str()), QString(projectNameOnDisplay.c_str()), true, isDefaultFile));
m_seedListFileInfoMap[key].reset(
new SeedListFileInfo(absoluteFilePath, QString(fileName.c_str()), QString(projectNameOnDisplay.c_str()), true, isDefaultFile));
AddFileKey(key);
}
@@ -241,7 +256,9 @@ namespace AssetBundler
emit dataChanged(firstIndex, lastIndex, { Qt::CheckStateRole });
}
AZStd::vector<AZStd::string> SeedListFileTableModel::GenerateAssetLists(const AZStd::string& absoluteFilePath, const AzFramework::PlatformFlags& platforms)
AZStd::vector<AZStd::string> SeedListFileTableModel::GenerateAssetLists(
const AZStd::string& absoluteFilePath,
const AzFramework::PlatformFlags& platforms)
{
if (!m_checkedSeedListFiles.size())
{
@@ -280,7 +297,8 @@ namespace AssetBundler
AZStd::vector<AZStd::string> createdFiles;
for (const auto& platformIndex : AzFramework::PlatformHelper::GetPlatformIndicesInterpreted(platforms))
{
AZStd::string platformSpecificCachePath = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(platformIndex);
AZStd::string platformSpecificCachePath =
AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(platformIndex);
AzFramework::StringFunc::Path::StripFullName(platformSpecificCachePath);
FilePath platformSpecificPath(absoluteFilePath, AZStd::string(AzFramework::PlatformHelper::GetPlatformName(platformIndex)));
@@ -304,7 +322,10 @@ namespace AssetBundler
return seedFileInfoOutcome.GetValue()->m_seedListModel;
}
bool SeedListFileTableModel::SetSeedPlatforms(const QModelIndex& seedFileIndex, const QModelIndex& seedIndex, const AzFramework::PlatformFlags& platforms)
bool SeedListFileTableModel::SetSeedPlatforms(
const QModelIndex& seedFileIndex,
const QModelIndex& seedIndex,
const AzFramework::PlatformFlags& platforms)
{
AZStd::string key = GetFileKey(seedFileIndex);
if (key.empty())
@@ -334,7 +355,10 @@ namespace AssetBundler
return true;
}
bool SeedListFileTableModel::AddSeed(const QModelIndex& seedFileIndex, const AZStd::string& seedRelativePath, const AzFramework::PlatformFlags& platforms)
bool SeedListFileTableModel::AddSeed(
const QModelIndex& seedFileIndex,
const AZStd::string& seedRelativePath,
const AzFramework::PlatformFlags& platforms)
{
AZStd::string key = GetFileKey(seedFileIndex);
if (key.empty())
@@ -71,15 +71,28 @@ namespace AssetBundler
explicit SeedListFileTableModel(SeedTabWidget* parentSeedTabWidget);
virtual ~SeedListFileTableModel();
void AddDefaultSeedsToInMemoryList(const AZStd::vector<AZStd::string>& defaultSeeds, const char* projectName, const AzFramework::PlatformFlags& platforms);
void AddDefaultSeedsToInMemoryList(
const AZStd::vector<AZStd::string>& defaultSeeds,
const char* projectName,
const AzFramework::PlatformFlags& platforms);
AZStd::vector<AZStd::string> CreateNewFiles(const AZStd::string& absoluteFilePath, const AzFramework::PlatformFlags& platforms, const QString& project) override;
AZStd::vector<AZStd::string> CreateNewFiles(
const AZStd::string& absoluteFilePath,
const AzFramework::PlatformFlags& platforms,
const QString& project) override;
bool DeleteFile(const QModelIndex& index) override;
void Reload(const char* fileExtension, const QSet<QString>& watchedFolders, const QSet<QString>& watchedFiles = QSet<QString>(), const AZStd::unordered_map<AZStd::string, AZStd::string>& pathToProjectNameMap = AZStd::unordered_map<AZStd::string, AZStd::string>()) override;
void Reload(
const char* fileExtension,
const QSet<QString>& watchedFolders,
const QSet<QString>& watchedFiles = QSet<QString>(),
const AZStd::unordered_map<AZStd::string, AZStd::string>& pathToProjectNameMap = AZStd::unordered_map<AZStd::string, AZStd::string>()) override;
void LoadFile(const AZStd::string& absoluteFilePath, const AZStd::string& projectName = "", bool isDefaultFile = false) override;
void LoadFile(
const AZStd::string& absoluteFilePath,
const AZStd::string& projectName = "",
bool isDefaultFile = false) override;
void SelectDefaultSeedLists(bool setSelected);
@@ -38,7 +38,11 @@ namespace AssetBundler
//////////////////////////////////////////////////////////////////////////////////////////////////
// SeedListTableModel
//////////////////////////////////////////////////////////////////////////////////////////////////
SeedListTableModel::SeedListTableModel(QObject* parent, const AZStd::string& absolutePath, const AZStd::vector<AZStd::string>& defaultSeeds, const AzFramework::PlatformFlags& platforms)
SeedListTableModel::SeedListTableModel(
QObject* parent,
const AZStd::string& absolutePath,
const AZStd::vector<AZStd::string>& defaultSeeds,
const AzFramework::PlatformFlags& platforms)
: QAbstractTableModel(parent)
{
m_seedListManager.reset(new AzToolsFramework::AssetSeedManager());
@@ -66,7 +70,10 @@ namespace AssetBundler
QString platformList;
for (const auto& seed : m_seedListManager->GetAssetSeedList())
{
assetInfo = AzToolsFramework::AssetSeedManager::GetAssetInfoById(seed.m_assetId, AzFramework::PlatformHelper::GetPlatformIndicesInterpreted(seed.m_platformFlags)[0], absolutePath);
assetInfo = AzToolsFramework::AssetSeedManager::GetAssetInfoById(
seed.m_assetId,
AzFramework::PlatformHelper::GetPlatformIndicesInterpreted(seed.m_platformFlags)[0],
absolutePath);
platformList = QString(m_seedListManager->GetReadablePlatformList(seed).c_str());
m_additionalSeedInfoMap[seed.m_assetId].reset(new AdditionalSeedInfo(assetInfo.m_relativePath.c_str(), platformList));
@@ -126,7 +133,8 @@ namespace AssetBundler
AZ_Error(AssetBundler::AppWindowName, false, "Unable to find additional Seed info");
return false;
}
additionalSeedInfo->second->m_platformList = QString(AzFramework::PlatformHelper::GetCommaSeparatedPlatformList(platforms).c_str());
additionalSeedInfo->second->m_platformList =
QString(AzFramework::PlatformHelper::GetCommaSeparatedPlatformList(platforms).c_str());
SetHasUnsavedChanges(true);
@@ -140,7 +148,8 @@ namespace AssetBundler
bool SeedListTableModel::AddSeed(const AZStd::string& seedRelativePath, const AzFramework::PlatformFlags& platforms)
{
AZStd::pair<AZ::Data::AssetId, AzFramework::PlatformFlags> addSeedsResult = m_seedListManager->AddSeedAssetForValidPlatforms(seedRelativePath, platforms);
AZStd::pair<AZ::Data::AssetId, AzFramework::PlatformFlags> addSeedsResult =
m_seedListManager->AddSeedAssetForValidPlatforms(seedRelativePath, platforms);
if (!addSeedsResult.first.IsValid() || addSeedsResult.second == AzFramework::PlatformFlags::Platform_NONE)
{
@@ -36,7 +36,11 @@ namespace AssetBundler
: public QAbstractTableModel
{
public:
explicit SeedListTableModel(QObject* parent = nullptr, const AZStd::string& absolutePath = AZStd::string(), const AZStd::vector<AZStd::string>& defaultSeeds = AZStd::vector<AZStd::string>(), const AzFramework::PlatformFlags& platforms = AzFramework::PlatformFlags::Platform_NONE);
explicit SeedListTableModel(
QObject* parent = nullptr,
const AZStd::string& absolutePath = AZStd::string(),
const AZStd::vector<AZStd::string>& defaultSeeds = AZStd::vector<AZStd::string>(),
const AzFramework::PlatformFlags& platforms = AzFramework::PlatformFlags::Platform_NONE);
virtual ~SeedListTableModel() {}
AZStd::shared_ptr<AzToolsFramework::AssetSeedManager> GetSeedListManager() { return m_seedListManager; }
@@ -22,7 +22,10 @@ const char QtRelativePathPrefix[] = "../";
namespace AssetBundler
{
AddSeedDialog::AddSeedDialog(QWidget* parent, const AzFramework::PlatformFlags& enabledPlatforms, const AZStd::string& platformSpecificCachePath)
AddSeedDialog::AddSeedDialog(
QWidget* parent,
const AzFramework::PlatformFlags& enabledPlatforms,
const AZStd::string& platformSpecificCachePath)
: QDialog(parent)
, m_platformSpecificCachePath(platformSpecificCachePath.c_str())
{
@@ -35,7 +38,10 @@ namespace AssetBundler
// Set up Platform selection
m_ui->platformSelectionWidget->Init(enabledPlatforms);
connect(m_ui->platformSelectionWidget, &PlatformSelectionWidget::PlatformsSelected, this, &AddSeedDialog::OnPlatformSelectionChanged);
connect(m_ui->platformSelectionWidget,
&PlatformSelectionWidget::PlatformsSelected,
this,
&AddSeedDialog::OnPlatformSelectionChanged);
// Set up Cancel and Create New File buttons
m_ui->addSeedButton->setEnabled(false);
@@ -34,7 +34,10 @@ namespace AssetBundler
Q_OBJECT
public:
explicit AddSeedDialog(QWidget* parent, const AzFramework::PlatformFlags& enabledPlatforms, const AZStd::string& platformSpecificCachePath);
explicit AddSeedDialog(
QWidget* parent,
const AzFramework::PlatformFlags& enabledPlatforms,
const AZStd::string& platformSpecificCachePath);
virtual ~AddSeedDialog() {}
AZStd::string GetFileName();
@@ -73,7 +73,10 @@ namespace AssetBundler
SetupContextMenu();
Reload();
connect(GetFileTableView()->header(), &QHeaderView::sortIndicatorChanged, m_fileTableFilterModel.get(), &AssetBundlerFileTableFilterModel::sort);
connect(GetFileTableView()->header(),
&QHeaderView::sortIndicatorChanged,
m_fileTableFilterModel.get(),
&AssetBundlerFileTableFilterModel::sort);
GetFileTableView()->header()->setSortIndicatorShown(true);
// Setting this in descending order will ensure the most recent files are at the top
GetFileTableView()->header()->setSortIndicator(GetFileTableModel()->GetTimeStampColumnIndex(), Qt::DescendingOrder);
@@ -163,9 +166,11 @@ namespace AssetBundler
return;
}
QString messageBoxText = QString(tr("Are you sure you would like to delete %1? \n\nThis will permanently delete the file.")).arg(QString(selectedFileAbsolutePath.c_str()));
QString messageBoxText =
QString(tr("Are you sure you would like to delete %1? \n\nThis will permanently delete the file.")).arg(QString(selectedFileAbsolutePath.c_str()));
QMessageBox::StandardButton confirmDeleteFileResult = QMessageBox::question(this, QString(tr("Delete %1")).arg(GetFileTypeDisplayName()), messageBoxText);
QMessageBox::StandardButton confirmDeleteFileResult =
QMessageBox::question(this, QString(tr("Delete %1")).arg(GetFileTypeDisplayName()), messageBoxText);
if (confirmDeleteFileResult != QMessageBox::StandardButton::Yes)
{
// User canceled out of the confirmation dialog
@@ -206,7 +211,8 @@ namespace AssetBundler
defaultFolderPath = m_guiApplicationManager->GetBundlesFolder();
break;
default:
AZ_Warning(AssetBundler::AppWindowName, false, "No default folder is defined for AssetBundlingFileType ( %i ).", static_cast<int>(fileType));
AZ_Warning(AssetBundler::AppWindowName, false,
"No default folder is defined for AssetBundlingFileType ( %i ).", static_cast<int>(fileType));
break;
}
@@ -224,7 +230,8 @@ namespace AssetBundler
void AssetBundlerTabWidget::AddScanPathToAssetBundlerSettings(AssetBundlingFileType fileType, const QString& filePath)
{
AZStd::string assetBundlerSettingsFileAbsolutePath = GetAssetBundlerUserSettingsFile(m_guiApplicationManager->GetCurrentProjectFolder().c_str());
AZStd::string assetBundlerSettingsFileAbsolutePath =
GetAssetBundlerUserSettingsFile(m_guiApplicationManager->GetCurrentProjectFolder().c_str());
QJsonObject assetBundlerSettings = AssetBundler::ReadJson(assetBundlerSettingsFileAbsolutePath);
QJsonObject scanPathsSettings = assetBundlerSettings[ScanPathsKey].toObject();
QJsonArray scanPaths = scanPathsSettings[AssetBundlingFileTypes[fileType]].toArray();
@@ -256,7 +263,8 @@ namespace AssetBundler
void AssetBundlerTabWidget::RemoveScanPathFromAssetBundlerSettings(AssetBundlingFileType fileType, const QString& filePath)
{
AZStd::string assetBundlerSettingsFileAbsolutePath = GetAssetBundlerUserSettingsFile(m_guiApplicationManager->GetCurrentProjectFolder().c_str());
AZStd::string assetBundlerSettingsFileAbsolutePath =
GetAssetBundlerUserSettingsFile(m_guiApplicationManager->GetCurrentProjectFolder().c_str());
QJsonObject assetBundlerSettings = AssetBundler::ReadJson(assetBundlerSettingsFileAbsolutePath);
QJsonObject scanPathsSettings = assetBundlerSettings[ScanPathsKey].toObject();
QJsonArray scanPaths = scanPathsSettings[AssetBundlingFileTypes[fileType]].toArray();
@@ -305,7 +313,10 @@ namespace AssetBundler
void AssetBundlerTabWidget::SetupContextMenu()
{
GetFileTableView()->setContextMenuPolicy(Qt::CustomContextMenu);
connect(GetFileTableView(), &QTreeView::customContextMenuRequested, this, &AssetBundlerTabWidget::OnFileTableContextMenuRequested);
connect(GetFileTableView(),
&QTreeView::customContextMenuRequested,
this,
&AssetBundlerTabWidget::OnFileTableContextMenuRequested);
}
void AssetBundlerTabWidget::ReadAssetBundlerSettings(const AZStd::string& filePath, AssetBundlingFileType fileType)
@@ -78,7 +78,9 @@ namespace AssetBundler
virtual void ApplyConfig() = 0;
virtual void FileSelectionChanged(const QItemSelection& /*selected*/ = QItemSelection(), const QItemSelection& /*deselected*/ = QItemSelection()) = 0;
virtual void FileSelectionChanged(
const QItemSelection& /*selected*/ = QItemSelection(),
const QItemSelection& /*deselected*/ = QItemSelection()) = 0;
static void InitAssetBundlerSettings(const char* currentProjectFolderPath);
@@ -44,14 +44,22 @@ namespace AssetBundler
m_ui->mainVerticalLayout->setContentsMargins(10, 10, 10, 10);
// File view of all Asset List Files
m_fileTableFilterModel.reset(new AssetBundlerFileTableFilterModel(this, m_fileTableModel->GetFileNameColumnIndex(), m_fileTableModel->GetTimeStampColumnIndex()));
m_fileTableFilterModel.reset(new AssetBundlerFileTableFilterModel(
this,
m_fileTableModel->GetFileNameColumnIndex(),
m_fileTableModel->GetTimeStampColumnIndex()));
m_fileTableFilterModel->setSourceModel(m_fileTableModel.data());
m_ui->assetListsTable->setModel(m_fileTableFilterModel.data());
connect(m_ui->fileFilteredSearchWidget, &AzQtComponents::FilteredSearchWidget::TextFilterChanged,
m_fileTableFilterModel.data(), static_cast<void (QSortFilterProxyModel::*)(const QString&)>(&AssetBundlerFileTableFilterModel::FilterChanged));
connect(m_ui->fileFilteredSearchWidget,
&AzQtComponents::FilteredSearchWidget::TextFilterChanged,
m_fileTableFilterModel.data(),
static_cast<void (QSortFilterProxyModel::*)(const QString&)>(&AssetBundlerFileTableFilterModel::FilterChanged));
connect(m_ui->assetListsTable->selectionModel(), &QItemSelectionModel::selectionChanged, this, &AssetListTabWidget::FileSelectionChanged);
connect(m_ui->assetListsTable->selectionModel(),
&QItemSelectionModel::selectionChanged,
this,
&AssetListTabWidget::FileSelectionChanged);
m_ui->fileTableHeaderLayout->setContentsMargins(0, 0, 0, 0);
m_ui->fileTableVerticalLayout->setContentsMargins(0, 0, 0, 0);
@@ -70,8 +78,10 @@ namespace AssetBundler
m_assetListContentsFilterModel->setSourceModel(m_assetListContentsModel.data());
m_ui->assetListContentsTable->setModel(m_assetListContentsFilterModel.data());
connect(m_ui->assetListContentsFilteredSearchWidget, &AzQtComponents::FilteredSearchWidget::TextFilterChanged,
m_assetListContentsFilterModel.data(), static_cast<void (QSortFilterProxyModel::*)(const QString&)>(&AssetBundlerFileTableFilterModel::FilterChanged));
connect(m_ui->assetListContentsFilteredSearchWidget,
&AzQtComponents::FilteredSearchWidget::TextFilterChanged,
m_assetListContentsFilterModel.data(),
static_cast<void (QSortFilterProxyModel::*)(const QString&)>(&AssetBundlerFileTableFilterModel::FilterChanged));
m_ui->fileContentsHeaderLayout->setContentsMargins(0, 0, 0, 0);
@@ -121,13 +131,21 @@ namespace AssetBundler
m_ui->fileTableFrame->setFixedWidth(config.fileTableWidth);
m_ui->assetListsTable->header()->resizeSection(AssetListFileTableModel::Column::ColumnFileName, config.assetListFileNameColumnWidth);
m_ui->assetListsTable->header()->resizeSection(AssetListFileTableModel::Column::ColumnPlatform, config.assetListPlatformColumnWidth);
m_ui->assetListsTable->header()->resizeSection(
AssetListFileTableModel::Column::ColumnFileName,
config.assetListFileNameColumnWidth);
m_ui->assetListsTable->header()->resizeSection(
AssetListFileTableModel::Column::ColumnPlatform,
config.assetListPlatformColumnWidth);
m_ui->assetListContentsFilteredSearchWidget->setFixedWidth(config.fileTableWidth);
m_ui->assetListContentsTable->header()->resizeSection(AssetListTableModel::Column::ColumnAssetName, config.productAssetNameColumnWidth);
m_ui->assetListContentsTable->header()->resizeSection(AssetListTableModel::Column::ColumnRelativePath, config.productAssetRelativePathColumnWidth);
m_ui->assetListContentsTable->header()->resizeSection(
AssetListTableModel::Column::ColumnAssetName,
config.productAssetNameColumnWidth);
m_ui->assetListContentsTable->header()->resizeSection(
AssetListTableModel::Column::ColumnRelativePath,
config.productAssetRelativePathColumnWidth);
}
@@ -65,7 +65,9 @@ namespace AssetBundler
AssetBundlerAbstractFileTableModel* GetFileTableModel() override;
void SetActiveProjectLabel(const QString& labelText) override;
void ApplyConfig() override;
void FileSelectionChanged(const QItemSelection& /*selected*/ = QItemSelection(), const QItemSelection& /*deselected*/ = QItemSelection()) override;
void FileSelectionChanged(
const QItemSelection& /*selected*/ = QItemSelection(),
const QItemSelection& /*deselected*/ = QItemSelection()) override;
//////////////////////////////////////////////////////////////////////////
private:
@@ -34,14 +34,22 @@ namespace AssetBundler
m_ui->mainVerticalLayout->setContentsMargins(MarginSize, MarginSize, MarginSize, MarginSize);
m_fileTableModel.reset(new BundleFileListModel);
m_fileTableFilterModel.reset(new AssetBundlerFileTableFilterModel(this, m_fileTableModel->GetFileNameColumnIndex(), m_fileTableModel->GetTimeStampColumnIndex()));
m_fileTableFilterModel.reset(new AssetBundlerFileTableFilterModel(
this,
m_fileTableModel->GetFileNameColumnIndex(),
m_fileTableModel->GetTimeStampColumnIndex()));
m_fileTableFilterModel->setSourceModel(m_fileTableModel.data());
m_ui->fileTableView->setModel(m_fileTableFilterModel.data());
connect(m_ui->fileFilteredSearchWidget, &AzQtComponents::FilteredSearchWidget::TextFilterChanged,
m_fileTableFilterModel.data(), static_cast<void (QSortFilterProxyModel::*)(const QString&)>(&AssetBundlerFileTableFilterModel::FilterChanged));
connect(m_ui->fileFilteredSearchWidget,
&AzQtComponents::FilteredSearchWidget::TextFilterChanged,
m_fileTableFilterModel.data(),
static_cast<void (QSortFilterProxyModel::*)(const QString&)>(&AssetBundlerFileTableFilterModel::FilterChanged));
connect(m_ui->fileTableView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &BundleListTabWidget::FileSelectionChanged);
connect(m_ui->fileTableView->selectionModel(),
&QItemSelectionModel::selectionChanged,
this,
&BundleListTabWidget::FileSelectionChanged);
m_ui->fileTableView->setIndentation(0);
@@ -53,7 +53,9 @@ namespace AssetBundler
AssetBundlerAbstractFileTableModel* GetFileTableModel() override;
void SetActiveProjectLabel(const QString& labelText) override;
void ApplyConfig() override;
void FileSelectionChanged(const QItemSelection& /*selected*/ = QItemSelection(), const QItemSelection& /*deselected*/ = QItemSelection()) override;
void FileSelectionChanged(
const QItemSelection& /*selected*/ = QItemSelection(),
const QItemSelection& /*deselected*/ = QItemSelection()) override;
private:
void ClearDisplayedBundleValues();
@@ -42,7 +42,8 @@ namespace AssetBundler
if (!IsComparisonDataIndexValid())
{
AZ_Error("AssetBundler", false, "ComparisonData index ( %u ) is out of bounds. ComparisonData cannot be displayed.", m_comparisonDataIndex);
AZ_Error("AssetBundler", false,
"ComparisonData index ( %u ) is out of bounds. ComparisonData cannot be displayed.", m_comparisonDataIndex);
return;
}
@@ -64,14 +65,26 @@ namespace AssetBundler
connect(m_ui->nameLineEdit, &QLineEdit::textEdited, this, &ComparisonDataWidget::OnNameLineEditChanged);
m_ui->comparisonTypeComboBox->installEventFilter(mouseWheelEventFilter);
connect(m_ui->comparisonTypeComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ComparisonDataWidget::OnComparisonTypeComboBoxChanged);
connect(m_ui->comparisonTypeComboBox,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
&ComparisonDataWidget::OnComparisonTypeComboBoxChanged);
m_ui->firstInputComboBox->installEventFilter(mouseWheelEventFilter);
connect(m_ui->firstInputComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ComparisonDataWidget::OnFirstInputComboBoxChanged);
connect(m_ui->firstInputBrowseButton, &QPushButton::pressed, this, &ComparisonDataWidget::OnFirstInputBrowseButtonPressed);
connect(m_ui->firstInputComboBox,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
&ComparisonDataWidget::OnFirstInputComboBoxChanged);
connect(m_ui->firstInputBrowseButton,
&QPushButton::pressed,
this,
&ComparisonDataWidget::OnFirstInputBrowseButtonPressed);
m_ui->secondInputComboBox->installEventFilter(mouseWheelEventFilter);
connect(m_ui->secondInputComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ComparisonDataWidget::OnSecondInputComboBoxChanged);
connect(m_ui->secondInputComboBox,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
&ComparisonDataWidget::OnSecondInputComboBoxChanged);
connect(m_ui->secondInputBrowseButton, &QPushButton::pressed, this, &ComparisonDataWidget::OnSecondInputBrowseButtonPressed);
connect(m_ui->filePatternLineEdit, &QLineEdit::textEdited, this, &ComparisonDataWidget::OnFilePatternLineEditChanged);
@@ -187,7 +200,8 @@ namespace AssetBundler
m_ui->filePatternLineEdit->setText(comparisonData.m_filePattern.c_str());
}
void ComparisonDataWidget::InitComparisonTypeComboBox(const AzToolsFramework::AssetFileInfoListComparison::ComparisonData& comparisonData)
void ComparisonDataWidget::InitComparisonTypeComboBox(
const AzToolsFramework::AssetFileInfoListComparison::ComparisonData& comparisonData)
{
using namespace AzToolsFramework;
@@ -225,7 +239,8 @@ namespace AssetBundler
initialSelectionIndex = ComparisonTypeIndex::Complement;
break;
default:
AZ_Warning("AssetBundler", false, "ComparisonType ( %u ) is not supported in the Asset Bundler", comparisonData.m_comparisonType);
AZ_Warning("AssetBundler", false,
"ComparisonType ( %u ) is not supported in the Asset Bundler", comparisonData.m_comparisonType);
}
}
@@ -32,7 +32,10 @@ namespace AssetBundler
m_ui->platformSelectionWidget->Init(enabledPlatforms);
m_ui->platformSelectionWidget->SetSelectedPlatforms(selectedPlatforms, partiallySelectedPlatforms);
connect(m_ui->platformSelectionWidget, &PlatformSelectionWidget::PlatformsSelected, this, &EditSeedDialog::OnPlatformSelectionChanged);
connect(m_ui->platformSelectionWidget,
&PlatformSelectionWidget::PlatformsSelected,
this,
&EditSeedDialog::OnPlatformSelectionChanged);
// Set up confirm and cancel buttons
connect(m_ui->applyChangesButton, &QPushButton::clicked, this, &QDialog::accept);
@@ -49,7 +52,9 @@ namespace AssetBundler
return m_ui->platformSelectionWidget->GetPartiallySelectedPlatforms();
}
void EditSeedDialog::OnPlatformSelectionChanged(const AzFramework::PlatformFlags& selectedPlatforms, const AzFramework::PlatformFlags& partiallySelectedPlatforms)
void EditSeedDialog::OnPlatformSelectionChanged(
const AzFramework::PlatformFlags& selectedPlatforms,
const AzFramework::PlatformFlags& partiallySelectedPlatforms)
{
// Disable the "Apply Changes" button if no platforms are selected
bool areAnyPlatformsSelected = selectedPlatforms != AzFramework::PlatformFlags::Platform_NONE ||
@@ -44,7 +44,9 @@ namespace AssetBundler
AzFramework::PlatformFlags GetPartiallySelectedPlatformFlags();
private:
void OnPlatformSelectionChanged(const AzFramework::PlatformFlags& selectedPlatforms, const AzFramework::PlatformFlags& partiallySelectedPlatforms);
void OnPlatformSelectionChanged(
const AzFramework::PlatformFlags& selectedPlatforms,
const AzFramework::PlatformFlags& partiallySelectedPlatforms);
QSharedPointer<Ui::EditSeedDialog> m_ui;
};
@@ -52,26 +52,41 @@ namespace AssetBundler
// Bundle Output
m_ui->outputBundlePathLineEdit->setReadOnly(true);
connect(m_ui->outputBundlePathBrowseButton, &QPushButton::clicked, this, &GenerateBundlesModal::OnOutputBundleLocationBrowseButtonPressed);
connect(m_ui->outputBundlePathBrowseButton,
&QPushButton::clicked,
this,
&GenerateBundlesModal::OnOutputBundleLocationBrowseButtonPressed);
// Bundle Settings files
m_ui->bundleSettingsFileLineEdit->setReadOnly(true);
m_ui->bundleSettingsFileLineEdit->setText(tr(CustomBundleSettingsText));
connect(m_ui->bundleSettingsFileBrowseButton, &QPushButton::clicked, this, &GenerateBundlesModal::OnBundleSettingsBrowseButtonPressed);
connect(m_ui->bundleSettingsFileSaveButton, &QPushButton::clicked, this, &GenerateBundlesModal::OnBundleSettingsSaveButtonPressed);
connect(m_ui->bundleSettingsFileBrowseButton,
&QPushButton::clicked,
this,
&GenerateBundlesModal::OnBundleSettingsBrowseButtonPressed);
connect(m_ui->bundleSettingsFileSaveButton,
&QPushButton::clicked,
this,
&GenerateBundlesModal::OnBundleSettingsSaveButtonPressed);
// Max Bundle Size
m_ui->maxBundleSizeSpinBox->setRange(1, AzToolsFramework::MaxBundleSizeInMB);
m_ui->maxBundleSizeSpinBox->setValue(AzToolsFramework::MaxBundleSizeInMB);
m_ui->maxBundleSizeSpinBox->setButtonSymbols(QAbstractSpinBox::ButtonSymbols::NoButtons);
m_ui->maxBundleSizeSpinBox->setSuffix(" MB");
connect(m_ui->maxBundleSizeSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &GenerateBundlesModal::OnMaxBundleSizeChanged);
connect(m_ui->maxBundleSizeSpinBox,
QOverload<int>::of(&QSpinBox::valueChanged),
this,
&GenerateBundlesModal::OnMaxBundleSizeChanged);
// Bundle Version
m_ui->bundleVersionSpinBox->setRange(1, AzFramework::AssetBundleManifest::CurrentBundleVersion);
m_ui->bundleVersionSpinBox->setValue(AzFramework::AssetBundleManifest::CurrentBundleVersion);
m_ui->bundleVersionSpinBox->setButtonSymbols(QAbstractSpinBox::ButtonSymbols::NoButtons);
connect(m_ui->bundleVersionSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &GenerateBundlesModal::OnBundleVersionChanged);
connect(m_ui->bundleVersionSpinBox,
QOverload<int>::of(&QSpinBox::valueChanged),
this,
&GenerateBundlesModal::OnBundleVersionChanged);
// Cancel and Generate Bundles buttons
m_ui->generateBundlesButton->setEnabled(false);
@@ -197,9 +212,11 @@ namespace AssetBundler
if (AZ::IO::FileIOBase::GetInstance()->Exists(bundleSettingsAbsolutePath.c_str()))
{
QString messageBoxText = QString(tr("Bundle Settings ( %1 ) already exists on-disk. Saving the current settings will override the existing settings. \n\nDo you wish to continue?")).arg(bundleSettingsAbsolutePath.c_str());
QString messageBoxText = QString(tr(
"Bundle Settings ( %1 ) already exists on-disk. Saving the current settings will override the existing settings. \n\nDo you wish to continue?")).arg(bundleSettingsAbsolutePath.c_str());
QMessageBox::StandardButton confirmDeleteFileResult = QMessageBox::question(this, QString(tr("Replace Existing Settings")), messageBoxText);
QMessageBox::StandardButton confirmDeleteFileResult =
QMessageBox::question(this, QString(tr("Replace Existing Settings")), messageBoxText);
if (confirmDeleteFileResult != QMessageBox::StandardButton::Yes)
{
// User canceled out of the operation
@@ -237,9 +254,11 @@ namespace AssetBundler
if (AZ::IO::FileIOBase::GetInstance()->Exists(m_bundleSettings.m_bundleFilePath.c_str()))
{
QString messageBoxText = QString(tr("Asset Bundle ( %1 ) already exists on-disk. Generating a new Bundle will override the existing Bundle. \n\nDo you wish to permanently delete the existing Bundle?")).arg(m_bundleSettings.m_bundleFilePath.c_str());
QString messageBoxText = QString(tr(
"Asset Bundle ( %1 ) already exists on-disk. Generating a new Bundle will override the existing Bundle. \n\nDo you wish to permanently delete the existing Bundle?")).arg(m_bundleSettings.m_bundleFilePath.c_str());
QMessageBox::StandardButton confirmDeleteFileResult = QMessageBox::question(this, QString(tr("Replace Existing Bundle")), messageBoxText);
QMessageBox::StandardButton confirmDeleteFileResult =
QMessageBox::question(this, QString(tr("Replace Existing Bundle")), messageBoxText);
if (confirmDeleteFileResult != QMessageBox::StandardButton::Yes)
{
// User canceled out of the operation
@@ -259,10 +278,14 @@ namespace AssetBundler
if (result)
{
m_assetListTabWidget->AddScanPathToAssetBundlerSettings(AssetBundlingFileType::BundleFileType, m_bundleSettings.m_bundleFilePath);
m_assetListTabWidget->AddScanPathToAssetBundlerSettings(
AssetBundlingFileType::BundleFileType,
m_bundleSettings.m_bundleFilePath);
// The watched files list was updated after the files were created, so we need to force-reload them
m_assetListTabWidget->GetGUIApplicationManager()->UpdateFiles(AssetBundlingFileType::BundleFileType, { m_bundleSettings.m_bundleFilePath });
m_assetListTabWidget->GetGUIApplicationManager()->UpdateFiles(
AssetBundlingFileType::BundleFileType,
{ m_bundleSettings.m_bundleFilePath });
}
AZStd::vector<AZStd::string> generatedFilePaths = { m_bundleSettings.m_bundleFilePath };
@@ -63,7 +63,10 @@ namespace AssetBundler
// Set up Tabs
AssetBundlerTabWidget::InitAssetBundlerSettings(m_guiApplicationManager->GetCurrentProjectFolder().c_str());
m_seedListTab.reset(new SeedTabWidget(this, m_guiApplicationManager, QString(m_guiApplicationManager->GetAssetBundlingFolder().c_str())));
m_seedListTab.reset(new SeedTabWidget(
this,
m_guiApplicationManager,
QString(m_guiApplicationManager->GetAssetBundlingFolder().c_str())));
m_ui->tabWidget->addTab(m_seedListTab.data(), m_seedListTab->GetTabTitle());
m_assetListTab.reset(new AssetListTabWidget(this, m_guiApplicationManager));
@@ -51,7 +51,8 @@ namespace AssetBundler
m_newFileDialog.setNameFilter(fileNameFilter);
m_newFileDialog.setViewMode(QFileDialog::Detail);
m_newFileDialog.setDirectory(m_startingPath);
// We are not creating a new file when Qt thinks we are, so we need to block signals or else the file watcher will be triggered too soon
// We are not creating a new file when Qt thinks we are, so we need to block signals or else the file watcher will be
// triggered too soon
m_newFileDialog.blockSignals(true);
// Set up Platform selection
@@ -61,7 +62,10 @@ namespace AssetBundler
disabledPatformMessageOverride = tr("This platform is not valid for all input Asset Lists.");
}
m_ui->platformSelectionWidget->Init(enabledPlatforms, disabledPatformMessageOverride);
connect(m_ui->platformSelectionWidget, &PlatformSelectionWidget::PlatformsSelected, this, &NewFileDialog::OnPlatformSelectionChanged);
connect(m_ui->platformSelectionWidget,
&PlatformSelectionWidget::PlatformsSelected,
this,
&NewFileDialog::OnPlatformSelectionChanged);
// Set up Cancel and Create New File buttons
m_ui->createFileButton->setEnabled(false);
@@ -112,7 +116,8 @@ namespace AssetBundler
{
// Check to see if any of the selected platform-specific files already exist on-disk
QString overwriteExistingFilesList;
AZStd::fixed_vector<AZStd::string, AzFramework::NumPlatforms> selectedPlatformNames = AzFramework::PlatformHelper::GetPlatforms(GetPlatformFlags());
AZStd::fixed_vector<AZStd::string, AzFramework::NumPlatforms> selectedPlatformNames =
AzFramework::PlatformHelper::GetPlatforms(GetPlatformFlags());
for (const AZStd::string& platformName : selectedPlatformNames)
{
FilePath platformSpecificFilePath(GetAbsoluteFilePath(), platformName);
@@ -126,9 +131,11 @@ namespace AssetBundler
// Ask the user if they are sure they want to overwrite existing files
if (!overwriteExistingFilesList.isEmpty())
{
QString messageBoxText = QString(tr("The following files already exist on-disk. Generating new files will overwrite the existing ones.\n\n%1\n\nDo you wish to permanently delete the existing files?")).arg(overwriteExistingFilesList);
QString messageBoxText = QString(tr(
"The following files already exist on-disk. Generating new files will overwrite the existing ones.\n\n%1\n\nDo you wish to permanently delete the existing files?")).arg(overwriteExistingFilesList);
QMessageBox::StandardButton confirmDeleteFileResult = QMessageBox::question(this, QString(tr("Replace Existing Files")), messageBoxText);
QMessageBox::StandardButton confirmDeleteFileResult =
QMessageBox::question(this, QString(tr("Replace Existing Files")), messageBoxText);
if (confirmDeleteFileResult != QMessageBox::StandardButton::Yes)
{
// User canceled out of the operation
@@ -139,7 +146,11 @@ namespace AssetBundler
emit QDialog::accept();
}
AZStd::string NewFileDialog::OSNewFileDialog(QWidget* parent, const char* fileExtension, const char* fileTypeDisplayName, const AZStd::string& startingDirectory)
AZStd::string NewFileDialog::OSNewFileDialog(
QWidget* parent,
const char* fileExtension,
const char* fileTypeDisplayName,
const AZStd::string& startingDirectory)
{
QFileDialog filePathDialog(parent);
filePathDialog.setFileMode(QFileDialog::AnyFile);
@@ -160,13 +171,17 @@ namespace AssetBundler
AZStd::string absoluteFilePath(filePathDialog.selectedFiles()[0].toUtf8().data());
if (!AzFramework::StringFunc::Path::HasExtension(absoluteFilePath.c_str()))
{
absoluteFilePath = AZStd::string::format("%s%c%s", absoluteFilePath.c_str(), AZ_FILESYSTEM_EXTENSION_SEPARATOR, fileExtension);
absoluteFilePath =
AZStd::string::format("%s%c%s", absoluteFilePath.c_str(), AZ_FILESYSTEM_EXTENSION_SEPARATOR, fileExtension);
}
return absoluteFilePath;
}
int NewFileDialog::FileGenerationResultMessageBox(QWidget* parent, const AZStd::vector<AZStd::string>& generatedFiles, bool generatedWithErrors)
int NewFileDialog::FileGenerationResultMessageBox(
QWidget* parent,
const AZStd::vector<AZStd::string>& generatedFiles,
bool generatedWithErrors)
{
QMessageBox messageBox(parent);
messageBox.setStandardButtons(QMessageBox::Ok);
@@ -51,9 +51,16 @@ namespace AssetBundler
//! A standard OS-specific New File Dialog, but blocks all Qt signals from the dialog and does NOT create a new file.
//! Use in place of the static QFileDialog functions to avoid unexpected file watcher updates.
//! Returns the absolute path of the file the user either selected or attempted to create, or an empty string if the user canceled out of the dialog.
static AZStd::string OSNewFileDialog(QWidget* parent, const char* fileExtension, const char* fileTypeDisplayName, const AZStd::string& startingDirectory);
static AZStd::string OSNewFileDialog(
QWidget* parent,
const char* fileExtension,
const char* fileTypeDisplayName,
const AZStd::string& startingDirectory);
static int FileGenerationResultMessageBox(QWidget* parent, const AZStd::vector<AZStd::string>& generatedFiles, bool generatedWithErrors);
static int FileGenerationResultMessageBox(
QWidget* parent,
const AZStd::vector<AZStd::string>& generatedFiles,
bool generatedWithErrors);
private:
void OnBrowseButtonPressed();
@@ -66,7 +66,9 @@ namespace AssetBundler
}
}
void PlatformSelectionWidget::SetSelectedPlatforms(const AzFramework::PlatformFlags& selectedPlatforms, const AzFramework::PlatformFlags& partiallySelectedPlatforms)
void PlatformSelectionWidget::SetSelectedPlatforms(
const AzFramework::PlatformFlags& selectedPlatforms,
const AzFramework::PlatformFlags& partiallySelectedPlatforms)
{
m_selectedPlatforms = AzFramework::PlatformFlags::Platform_NONE;
m_partiallySelectedPlatforms = AzFramework::PlatformFlags::Platform_NONE;
@@ -39,7 +39,9 @@ namespace AssetBundler
void Init(const AzFramework::PlatformFlags& enabledPlatforms, const QString& disabledPatformMessageOverride = "");
void SetSelectedPlatforms(const AzFramework::PlatformFlags& selectedPlatforms, const AzFramework::PlatformFlags& partiallySelectedPlatforms);
void SetSelectedPlatforms(
const AzFramework::PlatformFlags& selectedPlatforms,
const AzFramework::PlatformFlags& partiallySelectedPlatforms);
AzFramework::PlatformFlags GetSelectedPlatforms();
AzFramework::PlatformFlags GetPartiallySelectedPlatforms();
@@ -45,14 +45,22 @@ namespace AssetBundler
m_ui->fileTableView->setModel(m_fileTableModel.data());
// Table View of all Rules files
m_fileTableFilterModel.reset(new AssetBundlerFileTableFilterModel(this, m_fileTableModel->GetFileNameColumnIndex(), m_fileTableModel->GetTimeStampColumnIndex()));
m_fileTableFilterModel.reset(new AssetBundlerFileTableFilterModel(
this,
m_fileTableModel->GetFileNameColumnIndex(),
m_fileTableModel->GetTimeStampColumnIndex()));
m_fileTableFilterModel->setSourceModel(m_fileTableModel.data());
m_ui->fileTableView->setModel(m_fileTableFilterModel.data());
connect(m_ui->fileFilteredSearchWidget, &AzQtComponents::FilteredSearchWidget::TextFilterChanged,
m_fileTableFilterModel.data(), static_cast<void (QSortFilterProxyModel::*)(const QString&)>(&AssetBundlerFileTableFilterModel::FilterChanged));
connect(m_ui->fileFilteredSearchWidget,
&AzQtComponents::FilteredSearchWidget::TextFilterChanged,
m_fileTableFilterModel.data(),
static_cast<void (QSortFilterProxyModel::*)(const QString&)>(&AssetBundlerFileTableFilterModel::FilterChanged));
connect(m_ui->fileTableView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &RulesTabWidget::FileSelectionChanged);
connect(m_ui->fileTableView->selectionModel(),
&QItemSelectionModel::selectionChanged,
this,
&RulesTabWidget::FileSelectionChanged);
m_ui->fileTableView->setIndentation(0);
@@ -76,7 +84,10 @@ namespace AssetBundler
void RulesTabWidget::Reload()
{
m_fileTableModel->Reload(AzToolsFramework::AssetFileInfoListComparison::GetComparisonRulesFileExtension(), m_watchedFolders, m_watchedFiles);
m_fileTableModel->Reload(
AzToolsFramework::AssetFileInfoListComparison::GetComparisonRulesFileExtension(),
m_watchedFolders,
m_watchedFiles);
FileSelectionChanged();
}
@@ -223,7 +234,8 @@ namespace AssetBundler
AZStd::vector<AZStd::string> outputFilePaths;
bool hasFileGenerationErrors = false;
AZStd::fixed_vector<AZStd::string, AzFramework::NumPlatforms> selectedPlatformNames = AzFramework::PlatformHelper::GetPlatforms(runRuleDialog.GetPlatformFlags());
AZStd::fixed_vector<AZStd::string, AzFramework::NumPlatforms> selectedPlatformNames =
AzFramework::PlatformHelper::GetPlatforms(runRuleDialog.GetPlatformFlags());
for (const AZStd::string& platformName : selectedPlatformNames)
{
// We do not want to modify the original Rules file, as we do not save Asset List file paths to disk
@@ -238,7 +250,8 @@ namespace AssetBundler
{
if (comparisonStep.m_cachedFirstInputPath.empty())
{
AZ_Error("AssetBundler", false, "Unable to run Rule: Comparison Step #%u has no specified first input.", comparisonStepIndex);
AZ_Error("AssetBundler", false,
"Unable to run Rule: Comparison Step #%u has no specified first input.", comparisonStepIndex);
return;
}
@@ -251,7 +264,8 @@ namespace AssetBundler
{
if (comparisonStep.m_cachedSecondInputPath.empty())
{
AZ_Error("AssetBundler", false, "Unable to run Rule: Comparison Step #%u has no specified second input.", comparisonStepIndex);
AZ_Error("AssetBundler", false,
"Unable to run Rule: Comparison Step #%u has no specified second input.", comparisonStepIndex);
return;
}
@@ -313,17 +327,28 @@ namespace AssetBundler
}
}
void RulesTabWidget::CreateComparisonDataCard(AZStd::shared_ptr<AzToolsFramework::AssetFileInfoListComparison> comparisonList, size_t comparisonDataIndex)
void RulesTabWidget::CreateComparisonDataCard(
AZStd::shared_ptr<AzToolsFramework::AssetFileInfoListComparison> comparisonList,
size_t comparisonDataIndex)
{
ComparisonDataCard* comparisonDataCard = new ComparisonDataCard(comparisonList, comparisonDataIndex, m_guiApplicationManager->GetAssetListsFolder());
ComparisonDataCard* comparisonDataCard = new ComparisonDataCard(
comparisonList,
comparisonDataIndex,
m_guiApplicationManager->GetAssetListsFolder());
comparisonDataCard->setTitle(tr("Step %1").arg(static_cast<int>(comparisonDataIndex) + 1));
m_ui->comparisonDataListLayout->addWidget(comparisonDataCard);
m_comparisonDataCardList.push_back(comparisonDataCard);
ComparisonDataWidget* comparisonDataWidget = comparisonDataCard->GetComparisonDataWidget();
connect(comparisonDataCard, &ComparisonDataCard::comparisonDataCardContextMenuRequested, this, &RulesTabWidget::OnComparisonDataCardContextMenuRequested);
connect(comparisonDataCard,
&ComparisonDataCard::comparisonDataCardContextMenuRequested,
this,
&RulesTabWidget::OnComparisonDataCardContextMenuRequested);
connect(comparisonDataWidget, &ComparisonDataWidget::comparisonDataChanged, this, &RulesTabWidget::MarkFileChanged);
connect(comparisonDataWidget, &ComparisonDataWidget::comparisonDataTokenNameChanged, this, &RulesTabWidget::OnAnyTokenNameChanged);
connect(comparisonDataWidget,
&ComparisonDataWidget::comparisonDataTokenNameChanged,
this,
&RulesTabWidget::OnAnyTokenNameChanged);
comparisonDataCard->show();
}
@@ -81,7 +81,9 @@ namespace AssetBundler
void ApplyConfig() override;
void FileSelectionChanged(const QItemSelection& /*selected*/ = QItemSelection(), const QItemSelection& /*deselected*/ = QItemSelection()) override;
void FileSelectionChanged(
const QItemSelection& /*selected*/ = QItemSelection(),
const QItemSelection& /*deselected*/ = QItemSelection()) override;
private:
void OnNewFileButtonPressed();
@@ -94,7 +96,9 @@ namespace AssetBundler
void PopulateComparisonDataCardList();
void CreateComparisonDataCard(AZStd::shared_ptr<AzToolsFramework::AssetFileInfoListComparison> comparisonList, size_t comparisonDataIndex);
void CreateComparisonDataCard(
AZStd::shared_ptr<AzToolsFramework::AssetFileInfoListComparison> comparisonList,
size_t comparisonDataIndex);
void RemoveAllComparisonDataCards();
@@ -56,14 +56,22 @@ namespace AssetBundler
AZ::Debug::TraceMessageBus::Handler::BusConnect();
// File view of all Seed List Files
m_fileTableFilterModel.reset(new AssetBundlerFileTableFilterModel(this, m_fileTableModel->GetFileNameColumnIndex(), m_fileTableModel->GetTimeStampColumnIndex()));
m_fileTableFilterModel.reset(new AssetBundlerFileTableFilterModel(
this,
m_fileTableModel->GetFileNameColumnIndex(),
m_fileTableModel->GetTimeStampColumnIndex()));
m_fileTableFilterModel->setSourceModel(m_fileTableModel.data());
m_ui->fileTableView->setModel(m_fileTableFilterModel.data());
connect(m_ui->fileFilteredSearchWidget, &AzQtComponents::FilteredSearchWidget::TextFilterChanged,
m_fileTableFilterModel.data(), static_cast<void (QSortFilterProxyModel::*)(const QString&)>(&AssetBundlerFileTableFilterModel::FilterChanged));
connect(m_ui->fileFilteredSearchWidget,
&AzQtComponents::FilteredSearchWidget::TextFilterChanged,
m_fileTableFilterModel.data(),
static_cast<void (QSortFilterProxyModel::*)(const QString&)>(&AssetBundlerFileTableFilterModel::FilterChanged));
connect(m_ui->fileTableView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &SeedTabWidget::FileSelectionChanged);
connect(m_ui->fileTableView->selectionModel(),
&QItemSelectionModel::selectionChanged,
this,
&SeedTabWidget::FileSelectionChanged);
m_ui->fileTableView->setIndentation(CheckBoxTableIndentationSize);
@@ -82,11 +90,16 @@ namespace AssetBundler
m_seedListContentsFilterModel->setSourceModel(m_seedListContentsModel.data());
m_ui->seedFileContentsTable->setModel(m_seedListContentsFilterModel.data());
connect(m_ui->seedListContentsFilteredSearchWidget, &AzQtComponents::FilteredSearchWidget::TextFilterChanged,
m_seedListContentsFilterModel.data(), static_cast<void (QSortFilterProxyModel::*)(const QString&)>(&AssetBundlerFileTableFilterModel::FilterChanged));
connect(m_ui->seedListContentsFilteredSearchWidget,
&AzQtComponents::FilteredSearchWidget::TextFilterChanged,
m_seedListContentsFilterModel.data(),
static_cast<void (QSortFilterProxyModel::*)(const QString&)>(&AssetBundlerFileTableFilterModel::FilterChanged));
m_ui->seedFileContentsTable->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_ui->seedFileContentsTable, &QTreeView::customContextMenuRequested, this, &SeedTabWidget::OnSeedListContentsTableContextMenuRequested);
connect(m_ui->seedFileContentsTable,
&QTreeView::customContextMenuRequested,
this,
&SeedTabWidget::OnSeedListContentsTableContextMenuRequested);
m_ui->seedFileContentsTable->setIndentation(0);
@@ -112,7 +125,11 @@ namespace AssetBundler
void SeedTabWidget::Reload()
{
// Reload all the seed list files
m_fileTableModel->Reload(AzToolsFramework::AssetSeedManager::GetSeedFileExtension(), m_watchedFolders, m_watchedFiles, m_filePathToGemNameMap);
m_fileTableModel->Reload(
AzToolsFramework::AssetSeedManager::GetSeedFileExtension(),
m_watchedFolders,
m_watchedFiles,
m_filePathToGemNameMap);
// Update the selected row
FileSelectionChanged();
@@ -138,12 +155,18 @@ namespace AssetBundler
m_watchedFolders.insert(m_guiApplicationManager->GetSeedListsFolder().c_str());
// Get the list of default Seed List files
m_filePathToGemNameMap = AssetBundler::GetDefaultSeedListFiles(AZStd::string_view{ AZ::Utils::GetEnginePath() }, m_guiApplicationManager->GetCurrentProjectName(),
m_filePathToGemNameMap = AssetBundler::GetDefaultSeedListFiles(
AZStd::string_view{ AZ::Utils::GetEnginePath() },
m_guiApplicationManager->GetCurrentProjectName(),
m_guiApplicationManager->GetGemInfoList(), m_guiApplicationManager->GetEnabledPlatforms());
// Get the list of default Seeds that are not stored in a Seed List file on-disk
AZStd::vector<AZStd::string> defaultSeeds = GetDefaultSeeds(AZ::Utils::GetProjectPath(), m_guiApplicationManager->GetCurrentProjectName());
m_fileTableModel->AddDefaultSeedsToInMemoryList(defaultSeeds, m_guiApplicationManager->GetCurrentProjectName().c_str(), m_guiApplicationManager->GetEnabledPlatforms());
AZStd::vector<AZStd::string> defaultSeeds =
GetDefaultSeeds(AZ::Utils::GetProjectPath(), m_guiApplicationManager->GetCurrentProjectName());
m_fileTableModel->AddDefaultSeedsToInMemoryList(
defaultSeeds,
m_guiApplicationManager->GetCurrentProjectName().c_str(),
m_guiApplicationManager->GetEnabledPlatforms());
// Set the new watched filess for the model
m_watchedFiles.clear();
@@ -185,7 +208,9 @@ namespace AssetBundler
m_ui->fileTableView->header()->resizeSection(SeedListFileTableModel::Column::ColumnCheckBox, config.checkBoxColumnWidth);
m_ui->fileTableView->header()->resizeSection(SeedListFileTableModel::Column::ColumnProject, config.projectNameColumnWidth);
m_ui->seedFileContentsTable->header()->resizeSection(SeedListTableModel::Column::ColumnRelativePath, config.seedListContentsNameColumnWidth);
m_ui->seedFileContentsTable->header()->resizeSection(
SeedListTableModel::Column::ColumnRelativePath,
config.seedListContentsNameColumnWidth);
}
void SeedTabWidget::UncheckSelectDefaultSeedListsCheckBox()
@@ -198,15 +223,25 @@ namespace AssetBundler
m_ui->generateAssetListsButton->setEnabled(isEnabled);
}
bool SeedTabWidget::OnPreError(const char* /*window*/, const char* /*fileName*/, int /*line*/, const char* /*func*/, const char* /*message*/)
bool SeedTabWidget::OnPreError(
const char* /*window*/,
const char* /*fileName*/,
int /*line*/,
const char* /*func*/,
const char* /*message*/)
{
m_hasWarnings = true;
m_hasWarningsOrErrors = true;
return false;
}
bool SeedTabWidget::OnPreWarning(const char* /*window*/, const char* /*fileName*/, int /*line*/, const char* /*func*/, const char* /*message*/)
bool SeedTabWidget::OnPreWarning(
const char* /*window*/,
const char* /*fileName*/,
int /*line*/,
const char* /*func*/,
const char* /*message*/)
{
m_hasWarnings = true;
m_hasWarningsOrErrors = true;
return false;
}
@@ -275,11 +310,13 @@ namespace AssetBundler
return;
}
m_hasWarnings = false;
auto createdFiles = m_fileTableModel->GenerateAssetLists(m_generateAssetListsDialog->GetAbsoluteFilePath(), m_generateAssetListsDialog->GetPlatformFlags());
m_hasWarningsOrErrors = false;
auto createdFiles = m_fileTableModel->GenerateAssetLists(
m_generateAssetListsDialog->GetAbsoluteFilePath(),
m_generateAssetListsDialog->GetPlatformFlags());
// Warnings will not prevent the generation of Asset List files, we must track them separately
NewFileDialog::FileGenerationResultMessageBox(this, createdFiles, m_hasWarnings);
NewFileDialog::FileGenerationResultMessageBox(this, createdFiles, m_hasWarningsOrErrors);
if (createdFiles.empty())
{
@@ -306,7 +343,8 @@ namespace AssetBundler
}
// Get the current platforms of the selected Seed so we can display them as already checked
QModelIndex currentSeedIndex = m_seedListContentsFilterModel->mapToSource(m_ui->seedFileContentsTable->selectionModel()->currentIndex());
QModelIndex currentSeedIndex =
m_seedListContentsFilterModel->mapToSource(m_ui->seedFileContentsTable->selectionModel()->currentIndex());
auto getPlatformOutcome = m_seedListContentsModel->GetSeedPlatforms(currentSeedIndex);
if (!getPlatformOutcome.IsSuccess())
{
@@ -375,7 +413,8 @@ namespace AssetBundler
AzFramework::PlatformFlags checkedPlatforms = m_editSeedDialog->GetPlatformFlags();
AzFramework::PlatformFlags partiallyCheckedPlatforms = m_editSeedDialog->GetPartiallySelectedPlatformFlags();
// If the platform is partially checked, we want to keep its original status when saving the changes
AzFramework::PlatformFlags platformFlags = indexToPlatformFlagsMap[currentSeedIndex] & partiallyCheckedPlatforms | checkedPlatforms;
AzFramework::PlatformFlags platformFlags =
indexToPlatformFlagsMap[currentSeedIndex] & partiallyCheckedPlatforms | checkedPlatforms;
m_fileTableModel->SetSeedPlatforms(m_selectedFileTableIndex, currentSeedIndex, platformFlags);
}
@@ -391,8 +430,10 @@ namespace AssetBundler
// Get path to the platform-specific cache folder of one of the enabled platforms
AzFramework::PlatformFlags enabledPlatforms = m_guiApplicationManager->GetEnabledPlatforms();
AZStd::fixed_vector<AzFramework::PlatformId, AzFramework::PlatformId::NumPlatformIds> enabledPlatformIndices = AzFramework::PlatformHelper::GetPlatformIndicesInterpreted(enabledPlatforms);
AZStd::string platformSpecificCachePath = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(enabledPlatformIndices[0]);
AZStd::fixed_vector<AzFramework::PlatformId, AzFramework::PlatformId::NumPlatformIds> enabledPlatformIndices =
AzFramework::PlatformHelper::GetPlatformIndicesInterpreted(enabledPlatforms);
AZStd::string platformSpecificCachePath =
AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(enabledPlatformIndices[0]);
// Create and display the Add Seed Dialog
m_addSeedDialog.reset(new AddSeedDialog(this, enabledPlatforms, platformSpecificCachePath));
@@ -416,7 +457,8 @@ namespace AssetBundler
}
// Set the data in the model
QModelIndex currentSeedIndex = m_seedListContentsFilterModel->mapToSource(m_ui->seedFileContentsTable->selectionModel()->currentIndex());
QModelIndex currentSeedIndex =
m_seedListContentsFilterModel->mapToSource(m_ui->seedFileContentsTable->selectionModel()->currentIndex());
m_fileTableModel->RemoveSeed(m_selectedFileTableIndex, currentSeedIndex);
}
@@ -82,7 +82,9 @@ namespace AssetBundler
void ApplyConfig() override;
void FileSelectionChanged(const QItemSelection& /*selected*/ = QItemSelection(), const QItemSelection& /*deselected*/ = QItemSelection()) override;
void FileSelectionChanged(
const QItemSelection& /*selected*/ = QItemSelection(),
const QItemSelection& /*deselected*/ = QItemSelection()) override;
void UncheckSelectDefaultSeedListsCheckBox();
@@ -124,6 +126,6 @@ namespace AssetBundler
QSharedPointer<EditSeedDialog> m_editSeedDialog;
QSharedPointer<AddSeedDialog> m_addSeedDialog;
bool m_hasWarnings = false;
bool m_hasWarningsOrErrors = false;
};
} // namespace AssetBundler
@@ -83,7 +83,8 @@ namespace AssetBundler
ConfigHelpers::read<int>(settings, QStringLiteral("AssetListFileNameColumnWidth"), config.assetListFileNameColumnWidth);
ConfigHelpers::read<int>(settings, QStringLiteral("AssetListPlatformColumnWidth"), config.assetListPlatformColumnWidth);
ConfigHelpers::read<int>(settings, QStringLiteral("ProductAssetNameColumnWidth"), config.productAssetNameColumnWidth);
ConfigHelpers::read<int>(settings, QStringLiteral("ProductAssetRelativePathColumnWidth"), config.productAssetRelativePathColumnWidth);
ConfigHelpers::read<int>(
settings, QStringLiteral("ProductAssetRelativePathColumnWidth"), config.productAssetRelativePathColumnWidth);
}
return config;
@@ -159,8 +160,7 @@ namespace AssetBundler
m_platformCatalogManager = AZStd::make_unique<AzToolsFramework::PlatformAddressedAssetCatalogManager>();
// Define some application-level settings
QApplication::setOrganizationName("Amazon");
QApplication::setOrganizationDomain("amazon.com");
QApplication::setOrganizationName("O3DE");
QApplication::setApplicationName("Asset Bundler");
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
@@ -194,7 +194,12 @@ namespace AssetBundler
engineRoot);
AzQtComponents::StyleManager::setStyleSheet(m_mainWindow.data(), QStringLiteral("style:AssetBundler.qss"));
AzQtComponents::ConfigHelpers::loadConfig<Config, GUIApplicationManager>(&m_fileWatcher, &m_config, QStringLiteral("style:AssetBundlerConfig.ini"), this, std::bind(&GUIApplicationManager::ApplyConfig, this));
AzQtComponents::ConfigHelpers::loadConfig<Config, GUIApplicationManager>(
&m_fileWatcher,
&m_config,
QStringLiteral("style:AssetBundlerConfig.ini"),
this,
std::bind(&GUIApplicationManager::ApplyConfig, this));
ApplyConfig();
qApp->setWindowIcon(QIcon("style:AssetBundler-Icon-256x256@x2.ico"));
@@ -238,7 +243,12 @@ namespace AssetBundler
m_fileWatcher.removePaths(paths.values());
}
bool GUIApplicationManager::OnPreError(const char* /*window*/, const char* /*fileName*/, int /*line*/, const char* /*func*/, const char* message)
bool GUIApplicationManager::OnPreError(
const char* /*window*/,
const char* /*fileName*/,
int /*line*/,
const char* /*func*/,
const char* message)
{
// We want to display errors during initialization, then let the MainWindow handle errors during runtime
if (m_isInitializing)
@@ -258,7 +268,12 @@ namespace AssetBundler
return false;
}
bool GUIApplicationManager::OnPreWarning(const char* /*window*/, const char* /*fileName*/, int /*line*/, const char* /*func*/, const char* /*message*/)
bool GUIApplicationManager::OnPreWarning(
const char* /*window*/,
const char* /*fileName*/,
int /*line*/,
const char* /*func*/,
const char* /*message*/)
{
// Don't handle warnings, let the MainWindow print them
return false;
+34 -38
View File
@@ -155,8 +155,10 @@ namespace AssetBundler
if (fileIO->Exists(platformDirectory.c_str()))
{
bool recurse = true;
AZ::Outcome<AZStd::list<AZStd::string>, AZStd::string> result = AzFramework::FileFunc::FindFileList(platformDirectory.String(),
AZStd::string::format("*.%s", AzToolsFramework::AssetSeedManager::GetSeedFileExtension()).c_str(), recurse);
AZ::Outcome<AZStd::list<AZStd::string>, AZStd::string> result = AzFramework::FileFunc::FindFileList(
platformDirectory.String(),
AZStd::string::format("*.%s", AzToolsFramework::AssetSeedManager::GetSeedFileExtension()).c_str(),
recurse);
if (result.IsSuccess())
{
@@ -233,8 +235,11 @@ namespace AssetBundler
return platformFlags;
}
AZStd::unordered_map<AZStd::string, AZStd::string> GetDefaultSeedListFiles(AZStd::string_view enginePath, AZStd::string_view projectPath,
const AZStd::vector<AzFramework::GemInfo>& gemInfoList, AzFramework::PlatformFlags platformFlag)
AZStd::unordered_map<AZStd::string, AZStd::string> GetDefaultSeedListFiles(
AZStd::string_view enginePath,
AZStd::string_view projectPath,
const AZStd::vector<AzFramework::GemInfo>& gemInfoList,
AzFramework::PlatformFlags platformFlag)
{
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
AZ_Assert(fileIO, "AZ::IO::FileIOBase must be ready for use.\n");
@@ -299,7 +304,9 @@ namespace AssetBundler
return relativeProductPath;
}
AZStd::unordered_map<AZStd::string, AZStd::string> GetGemSeedListFilePathToGemNameMap(const AZStd::vector<AzFramework::GemInfo>& gemInfoList, AzFramework::PlatformFlags platformFlags)
AZStd::unordered_map<AZStd::string, AZStd::string> GetGemSeedListFilePathToGemNameMap(
const AZStd::vector<AzFramework::GemInfo>& gemInfoList,
AzFramework::PlatformFlags platformFlags)
{
AZStd::unordered_map<AZStd::string, AZStd::string> filePathToGemNameMap;
for (const AzFramework::GemInfo& gemInfo : gemInfoList)
@@ -325,7 +332,11 @@ namespace AssetBundler
return filePathToGemNameMap;
}
bool IsGemSeedFilePathValid(AZStd::string_view engineRoot, AZStd::string seedAbsoluteFilePath, const AZStd::vector<AzFramework::GemInfo>& gemInfoList, AzFramework::PlatformFlags platformFlags)
bool IsGemSeedFilePathValid(
AZStd::string_view engineRoot,
AZStd::string seedAbsoluteFilePath,
const AZStd::vector<AzFramework::GemInfo>& gemInfoList,
AzFramework::PlatformFlags platformFlags)
{
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
AZ_Assert(fileIO, "AZ::IO::FileIOBase must be ready for use.\n");
@@ -369,7 +380,10 @@ namespace AssetBundler
return false;
}
AzFramework::PlatformFlags GetEnabledPlatformFlags(AZStd::string_view engineRoot, AZStd::string_view assetRoot, AZStd::string_view projectPath)
AzFramework::PlatformFlags GetEnabledPlatformFlags(
AZStd::string_view engineRoot,
AZStd::string_view assetRoot,
AZStd::string_view projectPath)
{
auto settingsRegistry = AZ::SettingsRegistry::Get();
if (settingsRegistry == nullptr)
@@ -391,7 +405,8 @@ namespace AssetBundler
}
else
{
AZ_Warning(AssetBundler::AppWindowName, false, "Platform Helper is not aware of the platform (%s).\n ", enabledPlatform.c_str());
AZ_Warning(AssetBundler::AppWindowName, false,
"Platform Helper is not aware of the platform (%s).\n ", enabledPlatform.c_str());
}
}
@@ -457,31 +472,6 @@ namespace AssetBundler
AZ::SettingsRegistryMergeUtils::FilePathKey_CacheProjectRootFolder));
}
AZ::Outcome<void, AZStd::string> GetPlatformNamesFromCacheFolder(AZStd::vector<AZStd::string>& platformNames)
{
AZ::Outcome<AZ::IO::Path, AZStd::string> projectCacheRootFolder = GetProjectCacheFolderPath();
if (!projectCacheRootFolder)
{
return AZ::Failure(projectCacheRootFolder.TakeError());
}
const AZStd::string& projectCacheRootPath = projectCacheRootFolder.GetValue().Native();
QDir projectCacheDir(QString::fromUtf8(projectCacheRootPath.c_str(), aznumeric_cast<int>(projectCacheRootPath.size())));
auto tempPlatformList = projectCacheDir.entryList(QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot);
if (tempPlatformList.empty())
{
return AZ::Failure(AZStd::string("Cache is empty. Please run the Open 3D Engine Asset Processor to generate a Cache and build assets."));
}
for (const QString& platform : tempPlatformList)
{
platformNames.push_back(AZStd::string(platform.toUtf8().data()));
}
return AZ::Success();
}
AZ::Outcome<AZ::IO::Path, AZStd::string> GetAssetCatalogFilePath()
{
AZ::IO::Path assetCatalogFilePath = GetPlatformSpecificCacheFolderPath();
@@ -501,7 +491,9 @@ namespace AssetBundler
AZ::IO::Path platformSpecificCacheFolderPath;
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
{
settingsRegistry->Get(platformSpecificCacheFolderPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_CacheProjectRootFolder);
settingsRegistry->Get(
platformSpecificCacheFolderPath.Native(),
AZ::SettingsRegistryMergeUtils::FilePathKey_CacheProjectRootFolder);
}
return platformSpecificCacheFolderPath;
}
@@ -701,7 +693,8 @@ namespace AssetBundler
m_errors.swap(AZStd::vector<AZStd::string>());
}
AZ::Outcome<AzToolsFramework::AssetFileInfoListComparison::ComparisonType, AZStd::string> ParseComparisonType(const AZStd::string& comparisonType)
AZ::Outcome<AzToolsFramework::AssetFileInfoListComparison::ComparisonType, AZStd::string> ParseComparisonType(
const AZStd::string& comparisonType)
{
using namespace AzToolsFramework;
@@ -729,7 +722,8 @@ namespace AssetBundler
}
// Failure case
AZStd::string failureMessage = AZStd::string::format("Invalid Comparison Type ( %s ). Valid types are: ", comparisonType.c_str());
AZStd::string failureMessage = AZStd::string::format(
"Invalid Comparison Type ( %s ). Valid types are: ", comparisonType.c_str());
for (size_t i = 0; i < numTypes - 1; ++i)
{
failureMessage.append(AZStd::string::format("%s, ", AssetFileInfoListComparison::ComparisonTypeNames[i]));
@@ -738,7 +732,8 @@ namespace AssetBundler
return AZ::Failure(failureMessage);
}
AZ::Outcome<AzToolsFramework::AssetFileInfoListComparison::FilePatternType, AZStd::string> ParseFilePatternType(const AZStd::string& filePatternType)
AZ::Outcome<AzToolsFramework::AssetFileInfoListComparison::FilePatternType, AZStd::string> ParseFilePatternType(
const AZStd::string& filePatternType)
{
using namespace AzToolsFramework;
@@ -766,7 +761,8 @@ namespace AssetBundler
}
// Failure case
AZStd::string failureMessage = AZStd::string::format("Invalid File Pattern Type ( %s ). Valid types are: ", filePatternType.c_str());
AZStd::string failureMessage = AZStd::string::format(
"Invalid File Pattern Type ( %s ). Valid types are: ", filePatternType.c_str());
for (size_t i = 0; i < numTypes - 1; ++i)
{
failureMessage.append(AZStd::string::format("%s, ", AssetFileInfoListComparison::FilePatternTypeNames[i]));
+26 -19
View File
@@ -158,17 +158,6 @@ namespace AssetBundler
*/
AZ::Outcome<AZ::IO::Path, AZStd::string> GetProjectCacheFolderPath();
/**
* Calculates the list of enabled platforms for the input project by reading the folder names inside the project-specific cache folder.
* If the Asset Processor has not been run yet, or has not been run since the enabled platform list inside AssetProcessorPlatformConfig.setreg
* was changed, the output of this function will be incorrect.
*
* @param projectCacheFolder The directory of a project-specific cache folder: /ProjectPath/Cache
* @param platformNames [out] The list of platforms enabled in the project
* @return void on success, error message on failure
*/
AZ::Outcome<void, AZStd::string> GetPlatformNamesFromCacheFolder(AZStd::vector<AZStd::string>& platformNames);
/**
* Computes the absolute path to the Asset Catalog file for a specified project and platform.
* With platform set as "pc" and project as "ProjectName", the path will resemble: C:/ProjectPath/Cache/pc/assetcatalog.xml
@@ -204,8 +193,11 @@ namespace AssetBundler
AzFramework::PlatformFlags GetPlatformsOnDiskForPlatformSpecificFile(const AZStd::string& platformIndependentAbsolutePath);
//! Returns a map of <absolute file path, source folder display name> of all default Seed List files for the current game project.
AZStd::unordered_map<AZStd::string, AZStd::string> GetDefaultSeedListFiles(AZStd::string_view enginePath, AZStd::string_view projectPath,
const AZStd::vector<AzFramework::GemInfo>& gemInfoList, AzFramework::PlatformFlags platformFlags);
AZStd::unordered_map<AZStd::string, AZStd::string> GetDefaultSeedListFiles(
AZStd::string_view enginePath,
AZStd::string_view projectPath,
const AZStd::vector<AzFramework::GemInfo>& gemInfoList,
AzFramework::PlatformFlags platformFlags);
//! Returns a vector of relative paths to Assets that should be included as default Seeds, but are not already in a Seed List file.
AZStd::vector<AZStd::string> GetDefaultSeeds(AZStd::string_view projectPath, AZStd::string_view projectName);
@@ -217,15 +209,24 @@ namespace AssetBundler
AZ::IO::Path GetProjectDependenciesAssetPath(AZStd::string_view projectPath, AZStd::string_view projectName);
//! Returns the map from gem seed list file path to gem name
AZStd::unordered_map<AZStd::string, AZStd::string> GetGemSeedListFilePathToGemNameMap(const AZStd::vector<AzFramework::GemInfo>& gemInfoList, AzFramework::PlatformFlags platformFlags);
AZStd::unordered_map<AZStd::string, AZStd::string> GetGemSeedListFilePathToGemNameMap(
const AZStd::vector<AzFramework::GemInfo>& gemInfoList,
AzFramework::PlatformFlags platformFlags);
//! Given an absolute gem seed file path determines whether the file is valid for the current game project.
//! This method is for validating gem seed list files only.
bool IsGemSeedFilePathValid(AZStd::string_view enginePath, AZStd::string seedAbsoluteFilePath, const AZStd::vector<AzFramework::GemInfo>& gemInfoList, AzFramework::PlatformFlags platformFlags);
bool IsGemSeedFilePathValid(
AZStd::string_view enginePath,
AZStd::string seedAbsoluteFilePath,
const AZStd::vector<AzFramework::GemInfo>& gemInfoList,
AzFramework::PlatformFlags platformFlags);
//! Returns platformFlags of all enabled platforms by parsing all the asset processor config files.
//! Please note that the game project could be in a different location to the engine therefore we need the assetRoot param.
AzFramework::PlatformFlags GetEnabledPlatformFlags(AZStd::string_view enginePath, AZStd::string_view assetRoot, AZStd::string_view projectPath);
AzFramework::PlatformFlags GetEnabledPlatformFlags(
AZStd::string_view enginePath,
AZStd::string_view assetRoot,
AZStd::string_view projectPath);
QJsonObject ReadJson(const AZStd::string& filePath);
void SaveJson(const AZStd::string& filePath, const QJsonObject& jsonObject);
@@ -239,7 +240,11 @@ namespace AssetBundler
{
public:
AZ_CLASS_ALLOCATOR(FilePath, AZ::SystemAllocator, 0);
explicit FilePath(const AZStd::string& filePath, AZStd::string platformIdentifier = AZStd::string(), bool checkFileCase = false, bool ignoreFileCase = false);
explicit FilePath(
const AZStd::string& filePath,
AZStd::string platformIdentifier = AZStd::string(),
bool checkFileCase = false,
bool ignoreFileCase = false);
explicit FilePath(const AZStd::string& filePath, bool checkFileCase, bool ignoreFileCase);
FilePath() = default;
const AZStd::string& AbsolutePath() const;
@@ -279,8 +284,10 @@ namespace AssetBundler
bool m_reportingError = false;
};
AZ::Outcome<AzToolsFramework::AssetFileInfoListComparison::ComparisonType, AZStd::string> ParseComparisonType(const AZStd::string& comparisonType);
AZ::Outcome<AzToolsFramework::AssetFileInfoListComparison::FilePatternType, AZStd::string> ParseFilePatternType(const AZStd::string& filePatternType);
AZ::Outcome<AzToolsFramework::AssetFileInfoListComparison::ComparisonType, AZStd::string> ParseComparisonType(
const AZStd::string& comparisonType);
AZ::Outcome<AzToolsFramework::AssetFileInfoListComparison::FilePatternType, AZStd::string> ParseFilePatternType(
const AZStd::string& filePatternType);
bool LooksLikePath(const AZStd::string& inputString);
bool LooksLikeWildcardPattern(const AZStd::string& inputPattern);
}