Merge remote-tracking branch 'origin' into MultiplayerComponents

This commit is contained in:
karlberg
2021-05-05 20:07:49 -07:00
773 changed files with 5555 additions and 37483 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);
}
+2 -2
View File
@@ -27,7 +27,7 @@ ly_add_target(
PUBLIC
.
PRIVATE
source
Source
BUILD_DEPENDENCIES
PRIVATE
@@ -38,4 +38,4 @@ ly_add_target(
AZ::AzFramework
AZ::AzToolsFramework
AZ::AzQtComponents
)
)
@@ -1,49 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <Qt/ProjectManagerWindow.h>
#include <Qt/FirstTimeUse.h>
#include <AzQtComponents/Components/StyleManager.h>
#include <AzCore/IO/Path/Path.h>
#include <QDir>
#include <Qt/ui_ProjectManagerWindow.h>
namespace ProjectManager
{
ProjectManagerWindow::ProjectManagerWindow(QWidget* parent, const AZ::IO::PathView& engineRootPath)
: QMainWindow(parent)
, m_ui(new Ui::ProjectManagerWindowClass())
{
m_ui->setupUi(this);
QDir rootDir = QString::fromUtf8(engineRootPath.Native().data(), aznumeric_cast<int>(engineRootPath.Native().size()));
const auto pathOnDisk = rootDir.absoluteFilePath("Code/Tools/ProjectManager/Resources");
const auto qrcPath = QStringLiteral(":/ProjectManagerWindow");
AzQtComponents::StyleManager::addSearchPaths("projectmanagerwindow", pathOnDisk, qrcPath, engineRootPath);
AzQtComponents::StyleManager::setStyleSheet(this, QStringLiteral("projectlauncherwindow:ProjectManagerWindow.qss"));
FirstTimeUse* firstTimeUse = new FirstTimeUse(m_ui->centralwidget);
firstTimeUse->show();
}
ProjectManagerWindow::~ProjectManagerWindow()
{
}
//#include <Qt/moc_ProjectManagerWindow.cpp>
} // namespace ProjectManager
@@ -0,0 +1,35 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <EngineSettings.h>
#include <Source/ui_EngineSettings.h>
namespace O3DE::ProjectManager
{
EngineSettings::EngineSettings(ProjectManagerWindow* window)
: ScreenWidget(window)
, m_ui(new Ui::EngineSettingsClass())
{
m_ui->setupUi(this);
}
EngineSettings::~EngineSettings()
{
}
void EngineSettings::ConnectSlotsAndSignals()
{
// Do nothing for now
}
} // namespace O3DE::ProjectManager
@@ -0,0 +1,39 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <ScreenWidget.h>
#endif
namespace Ui
{
class EngineSettingsClass;
}
namespace O3DE::ProjectManager
{
class EngineSettings
: public ScreenWidget
{
public:
explicit EngineSettings(ProjectManagerWindow* window);
~EngineSettings();
protected:
void ConnectSlotsAndSignals() override;
private:
QScopedPointer<Ui::EngineSettingsClass> m_ui;
};
} // namespace O3DE::ProjectManager
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EngineSettingsClass</class>
<widget class="QWidget" name="EngineSettingsClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>839</width>
<height>597</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>O3DE Settings</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Engine Version</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>v1.01</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>3rd Party Software Folder</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Restricted Folder</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_2"/>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Default Gems Folder</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_3"/>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Default Project Templates Folder</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_4"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,47 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <FirstTimeUse.h>
#include <Source/ui_FirstTimeUse.h>
namespace O3DE::ProjectManager
{
FirstTimeUse::FirstTimeUse(ProjectManagerWindow* window)
: ScreenWidget(window)
, m_ui(new Ui::FirstTimeUseClass())
{
m_ui->setupUi(this);
ConnectSlotsAndSignals();
}
FirstTimeUse::~FirstTimeUse()
{
}
void FirstTimeUse::ConnectSlotsAndSignals()
{
QObject::connect(m_ui->createProjectButton, &QPushButton::pressed, this, &FirstTimeUse::HandleNewProjectButton);
QObject::connect(m_ui->openProjectButton, &QPushButton::pressed, this, &FirstTimeUse::HandleOpenProjectButton);
}
void FirstTimeUse::HandleNewProjectButton()
{
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::NewProjectSettings);
}
void FirstTimeUse::HandleOpenProjectButton()
{
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::ProjectsHome);
}
} // namespace O3DE::ProjectManager
@@ -12,7 +12,7 @@
#pragma once
#if !defined(Q_MOC_RUN)
#include <QWidget>
#include <ScreenWidget.h>
#endif
namespace Ui
@@ -20,17 +20,24 @@ namespace Ui
class FirstTimeUseClass;
}
namespace ProjectManager
namespace O3DE::ProjectManager
{
class FirstTimeUse : public QWidget
class FirstTimeUse
: public ScreenWidget
{
public:
explicit FirstTimeUse(QWidget* parent);
explicit FirstTimeUse(ProjectManagerWindow* window);
~FirstTimeUse();
protected:
void ConnectSlotsAndSignals() override;
protected slots:
void HandleNewProjectButton();
void HandleOpenProjectButton();
private:
QScopedPointer<Ui::FirstTimeUseClass> m_ui;
};
} // namespace ProjectManager
} // namespace O3DE::ProjectManager
@@ -0,0 +1,47 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <GemCatalog.h>
#include <Source/ui_GemCatalog.h>
namespace O3DE::ProjectManager
{
GemCatalog::GemCatalog(ProjectManagerWindow* window)
: ScreenWidget(window)
, m_ui(new Ui::GemCatalogClass())
{
m_ui->setupUi(this);
ConnectSlotsAndSignals();
}
GemCatalog::~GemCatalog()
{
}
void GemCatalog::ConnectSlotsAndSignals()
{
QObject::connect(m_ui->backButton, &QPushButton::pressed, this, &GemCatalog::HandleBackButton);
QObject::connect(m_ui->confirmButton, &QPushButton::pressed, this, &GemCatalog::HandleConfirmButton);
}
void GemCatalog::HandleBackButton()
{
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::NewProjectSettings);
}
void GemCatalog::HandleConfirmButton()
{
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::ProjectsHome);
}
} // namespace O3DE::ProjectManager
@@ -0,0 +1,44 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <ScreenWidget.h>
#endif
namespace Ui
{
class GemCatalogClass;
}
namespace O3DE::ProjectManager
{
class GemCatalog
: public ScreenWidget
{
public:
explicit GemCatalog(ProjectManagerWindow* window);
~GemCatalog();
protected:
void ConnectSlotsAndSignals() override;
protected slots:
void HandleBackButton();
void HandleConfirmButton();
private:
QScopedPointer<Ui::GemCatalogClass> m_ui;
};
} // namespace O3DE::ProjectManager
@@ -0,0 +1,231 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GemCatalogClass</class>
<widget class="QWidget" name="GemCatalogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>806</width>
<height>566</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Gem Catalog</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<property name="text">
<string>Cart</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_2">
<property name="text">
<string>Hamburger Menu</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_2">
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_3">
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Atom</string>
</property>
</item>
<item>
<property name="text">
<string>Audio</string>
</property>
</item>
<item>
<property name="text">
<string>Camera</string>
</property>
</item>
<item>
<property name="text">
<string>PhysX</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="backButton">
<property name="text">
<string>Back</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="confirmButton">
<property name="text">
<string>Create Project</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,47 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <NewProjectSettings.h>
#include <Source/ui_NewProjectSettings.h>
namespace O3DE::ProjectManager
{
NewProjectSettings::NewProjectSettings(ProjectManagerWindow* window)
: ScreenWidget(window)
, m_ui(new Ui::NewProjectSettingsClass())
{
m_ui->setupUi(this);
ConnectSlotsAndSignals();
}
NewProjectSettings::~NewProjectSettings()
{
}
void NewProjectSettings::ConnectSlotsAndSignals()
{
QObject::connect(m_ui->backButton, &QPushButton::pressed, this, &NewProjectSettings::HandleBackButton);
QObject::connect(m_ui->nextButton, &QPushButton::pressed, this, &NewProjectSettings::HandleNextButton);
}
void NewProjectSettings::HandleBackButton()
{
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::FirstTimeUse);
}
void NewProjectSettings::HandleNextButton()
{
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::GemCatalog);
}
} // namespace O3DE::ProjectManager
@@ -0,0 +1,43 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <ScreenWidget.h>
#endif
namespace Ui
{
class NewProjectSettingsClass;
}
namespace O3DE::ProjectManager
{
class NewProjectSettings
: public ScreenWidget
{
public:
explicit NewProjectSettings(ProjectManagerWindow* window);
~NewProjectSettings();
protected:
void ConnectSlotsAndSignals() override;
protected slots:
void HandleBackButton();
void HandleNextButton();
private:
QScopedPointer<Ui::NewProjectSettingsClass> m_ui;
};
} // namespace O3DE::ProjectManager
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NewProjectSettingsClass</class>
<widget class="QWidget" name="NewProjectSettingsClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>880</width>
<height>546</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="projectNameLabel">
<property name="text">
<string>Project Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="projectNameLineEdit"/>
</item>
<item>
<widget class="QLabel" name="projectPathLabel">
<property name="text">
<string>Project Path</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="projectPathLineEdit"/>
</item>
<item>
<widget class="QLabel" name="projectTemplateLabel">
<property name="text">
<string>Project Template</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="projectTemplateStandardRadioButton">
<property name="text">
<string>Standard (Recommened)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="projectTemplateStandardEmptyButton">
<property name="text">
<string>Empty</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="backButton">
<property name="text">
<string>Back</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="nextButton">
<property name="text">
<string>Next</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,106 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <ProjectManagerWindow.h>
#include <ScreenFactory.h>
#include <AzQtComponents/Components/StyleManager.h>
#include <AzCore/IO/Path/Path.h>
#include <QDir>
#include <Source/ui_ProjectManagerWindow.h>
namespace O3DE::ProjectManager
{
ProjectManagerWindow::ProjectManagerWindow(QWidget* parent, const AZ::IO::PathView& engineRootPath)
: QMainWindow(parent)
, m_ui(new Ui::ProjectManagerWindowClass())
{
m_ui->setupUi(this);
ConnectSlotsAndSignals();
QDir rootDir = QString::fromUtf8(engineRootPath.Native().data(), aznumeric_cast<int>(engineRootPath.Native().size()));
const auto pathOnDisk = rootDir.absoluteFilePath("Code/Tools/ProjectManager/Resources");
const auto qrcPath = QStringLiteral(":/ProjectManagerWindow");
AzQtComponents::StyleManager::addSearchPaths("projectmanagerwindow", pathOnDisk, qrcPath, engineRootPath);
AzQtComponents::StyleManager::setStyleSheet(this, QStringLiteral("projectlauncherwindow:ProjectManagerWindow.qss"));
BuildScreens();
ChangeToScreen(ProjectManagerScreen::FirstTimeUse);
}
ProjectManagerWindow::~ProjectManagerWindow()
{
}
void ProjectManagerWindow::BuildScreens()
{
// Basically just iterate over the ProjectManagerScreen enum creating each screen
// Could add some fancy to do this but there are few screens right now
ResetScreen(ProjectManagerScreen::FirstTimeUse);
ResetScreen(ProjectManagerScreen::NewProjectSettings);
ResetScreen(ProjectManagerScreen::GemCatalog);
ResetScreen(ProjectManagerScreen::ProjectsHome);
ResetScreen(ProjectManagerScreen::ProjectSettings);
ResetScreen(ProjectManagerScreen::EngineSettings);
}
QStackedWidget* ProjectManagerWindow::GetScreenStack()
{
return m_ui->stackedScreens;
}
void ProjectManagerWindow::ChangeToScreen(ProjectManagerScreen screen)
{
int index = aznumeric_cast<int, ProjectManagerScreen>(screen);
m_ui->stackedScreens->setCurrentIndex(index);
}
void ProjectManagerWindow::ResetScreen(ProjectManagerScreen screen)
{
int index = aznumeric_cast<int, ProjectManagerScreen>(screen);
// Fine the old screen if it exists and get rid of it so we can start fresh
QWidget* oldScreen = m_ui->stackedScreens->widget(index);
if (oldScreen)
{
m_ui->stackedScreens->removeWidget(oldScreen);
oldScreen->deleteLater();
}
// Add new screen
QWidget* newScreen = BuildScreen(this, screen);
m_ui->stackedScreens->insertWidget(index, newScreen);
}
void ProjectManagerWindow::ConnectSlotsAndSignals()
{
QObject::connect(m_ui->projectsMenu, &QMenu::aboutToShow, this, &ProjectManagerWindow::HandleProjectsMenu);
QObject::connect(m_ui->engineMenu, &QMenu::aboutToShow, this, &ProjectManagerWindow::HandleEngineMenu);
}
void ProjectManagerWindow::HandleProjectsMenu()
{
ChangeToScreen(ProjectManagerScreen::ProjectsHome);
}
void ProjectManagerWindow::HandleEngineMenu()
{
ChangeToScreen(ProjectManagerScreen::EngineSettings);
}
} // namespace O3DE::ProjectManager
@@ -12,7 +12,10 @@
#pragma once
#if !defined(Q_MOC_RUN)
#include <ScreenDefs.h>
#include <QMainWindow>
#include <QStackedWidget>
#include <AzCore/IO/Path/Path_fwd.h>
#endif
@@ -22,17 +25,33 @@ namespace Ui
class ProjectManagerWindowClass;
}
namespace ProjectManager
namespace O3DE::ProjectManager
{
class ProjectManagerWindow : public QMainWindow
class ProjectManagerWindow
: public QMainWindow
{
Q_OBJECT
public:
explicit ProjectManagerWindow(QWidget* parent, const AZ::IO::PathView& engineRootPath);
~ProjectManagerWindow();
void BuildScreens();
QStackedWidget* GetScreenStack();
public slots:
void ChangeToScreen(ProjectManagerScreen screen);
void ResetScreen(ProjectManagerScreen screen);
protected:
void ConnectSlotsAndSignals();
protected slots:
void HandleProjectsMenu();
void HandleEngineMenu();
private:
QScopedPointer<Ui::ProjectManagerWindowClass> m_ui;
};
} // namespace ProjectManager
} // namespace O3DE::ProjectManager
@@ -13,8 +13,12 @@
<property name="windowTitle">
<string>O3DE Project Manager</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout"/>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QStackedWidget" name="stackedScreens"/>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
@@ -30,7 +34,7 @@
<pointsize>16</pointsize>
</font>
</property>
<widget class="QMenu" name="menuIcon">
<widget class="QMenu" name="iconMenu">
<property name="title">
<string>Icon</string>
</property>
@@ -39,19 +43,19 @@
<normaloff>:/Resources/o3de_editor.ico</normaloff>:/Resources/o3de_editor.ico</iconset>
</property>
</widget>
<widget class="QMenu" name="menuProjects">
<widget class="QMenu" name="projectsMenu">
<property name="title">
<string>Projects</string>
</property>
</widget>
<widget class="QMenu" name="menuSettings">
<widget class="QMenu" name="engineMenu">
<property name="title">
<string>Engine</string>
</property>
</widget>
<addaction name="menuIcon"/>
<addaction name="menuProjects"/>
<addaction name="menuSettings"/>
<addaction name="iconMenu"/>
<addaction name="projectsMenu"/>
<addaction name="engineMenu"/>
</widget>
</widget>
<resources>
@@ -0,0 +1,42 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <ProjectSettings.h>
#include <Source/ui_ProjectSettings.h>
namespace O3DE::ProjectManager
{
ProjectSettings::ProjectSettings(ProjectManagerWindow* window)
: ScreenWidget(window)
, m_ui(new Ui::ProjectSettingsClass())
{
m_ui->setupUi(this);
ConnectSlotsAndSignals();
}
ProjectSettings::~ProjectSettings()
{
}
void ProjectSettings::ConnectSlotsAndSignals()
{
QObject::connect(m_ui->gemsButton, &QPushButton::pressed, this, &ProjectSettings::HandleGemsButton);
}
void ProjectSettings::HandleGemsButton()
{
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::GemCatalog);
}
} // namespace O3DE::ProjectManager
@@ -0,0 +1,42 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <ScreenWidget.h>
#endif
namespace Ui
{
class ProjectSettingsClass;
}
namespace O3DE::ProjectManager
{
class ProjectSettings
: public ScreenWidget
{
public:
explicit ProjectSettings(ProjectManagerWindow* window);
~ProjectSettings();
protected:
void ConnectSlotsAndSignals() override;
protected slots:
void HandleGemsButton();
private:
QScopedPointer<Ui::ProjectSettingsClass> m_ui;
};
} // namespace O3DE::ProjectManager
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProjectSettingsClass</class>
<widget class="QWidget" name="ProjectSettingsClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>782</width>
<height>579</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="projectSettingsButton">
<property name="text">
<string>Project Settings</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="gemsButton">
<property name="text">
<string>Gems</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>761</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Project Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Project Location</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_2"/>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Project Image Location</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_3"/>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Project Background Image Location</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_4"/>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,52 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <ProjectsHome.h>
#include <Source/ui_ProjectsHome.h>
namespace O3DE::ProjectManager
{
ProjectsHome::ProjectsHome(ProjectManagerWindow* window)
: ScreenWidget(window)
, m_ui(new Ui::ProjectsHomeClass())
{
m_ui->setupUi(this);
ConnectSlotsAndSignals();
}
ProjectsHome::~ProjectsHome()
{
}
void ProjectsHome::ConnectSlotsAndSignals()
{
QObject::connect(m_ui->newProjectButton, &QPushButton::pressed, this, &ProjectsHome::HandleNewProjectButton);
QObject::connect(m_ui->addProjectButton, &QPushButton::pressed, this, &ProjectsHome::HandleAddProjectButton);
QObject::connect(m_ui->editProjectButton, &QPushButton::pressed, this, &ProjectsHome::HandleEditProjectButton);
}
void ProjectsHome::HandleNewProjectButton()
{
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::NewProjectSettings);
}
void ProjectsHome::HandleAddProjectButton()
{
//Do nothing for now
}
void ProjectsHome::HandleEditProjectButton()
{
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::ProjectSettings);
}
} // namespace O3DE::ProjectManager
@@ -0,0 +1,45 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <ScreenWidget.h>
#endif
namespace Ui
{
class ProjectsHomeClass;
}
namespace O3DE::ProjectManager
{
class ProjectsHome
: public ScreenWidget
{
public:
explicit ProjectsHome(ProjectManagerWindow* window);
~ProjectsHome();
protected:
void ConnectSlotsAndSignals() override;
protected slots:
void HandleNewProjectButton();
void HandleAddProjectButton();
void HandleEditProjectButton();
private:
QScopedPointer<Ui::ProjectsHomeClass> m_ui;
};
} // namespace O3DE::ProjectManager
@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProjectsHomeClass</class>
<widget class="QWidget" name="ProjectsHomeClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>826</width>
<height>585</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>My Projects</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="currentProjectButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="newProjectButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../project_manager.qrc">
<normaloff>:/Resources/Add.svg</normaloff>:/Resources/Add.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addProjectButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../project_manager.qrc">
<normaloff>:/Resources/Select_Folder.svg</normaloff>:/Resources/Select_Folder.svg</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QToolButton" name="editProjectButton">
<property name="text">
<string>Edit Project</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Open a Project</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="../project_manager.qrc"/>
</resources>
<connections/>
</ui>
@@ -9,23 +9,17 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <Qt/FirstTimeUse.h>
#include <Qt/ui_FirstTimeUse.h>
namespace ProjectManager
namespace O3DE::ProjectManager
{
FirstTimeUse::FirstTimeUse(QWidget* parent)
: QWidget(parent)
, m_ui(new Ui::FirstTimeUseClass())
enum class ProjectManagerScreen
{
m_ui->setupUi(this);
}
FirstTimeUse::~FirstTimeUse()
{
}
//#include <Qt/moc_FirstTimeUse.cpp>
} // namespace ProjectManager
FirstTimeUse,
NewProjectSettings,
GemCatalog,
ProjectsHome,
ProjectSettings,
EngineSettings
};
} // namespace O3DE::ProjectManager
@@ -0,0 +1,43 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <ScreenFactory.h>
#include <FirstTimeUse.h>
#include <NewProjectSettings.h>
#include <GemCatalog.h>
#include <ProjectsHome.h>
#include <ProjectSettings.h>
#include <EngineSettings.h>
namespace O3DE::ProjectManager
{
QWidget* BuildScreen(ProjectManagerWindow* window, ProjectManagerScreen screen)
{
switch(screen)
{
case (ProjectManagerScreen::FirstTimeUse):
return new FirstTimeUse(window);
case (ProjectManagerScreen::NewProjectSettings):
return new NewProjectSettings(window);
case (ProjectManagerScreen::GemCatalog):
return new GemCatalog(window);
case (ProjectManagerScreen::ProjectsHome):
return new ProjectsHome(window);
case (ProjectManagerScreen::ProjectSettings):
return new ProjectSettings(window);
case (ProjectManagerScreen::EngineSettings):
return new EngineSettings(window);
default:
return new QWidget(window->GetScreenStack());
}
}
} // namespace O3DE::ProjectManager
@@ -0,0 +1,24 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <ScreenDefs.h>
#include <ProjectManagerWindow.h>
#include <QWidget>
namespace O3DE::ProjectManager
{
QWidget* BuildScreen(ProjectManagerWindow* window, ProjectManagerScreen screen);
} // namespace O3DE::ProjectManager
@@ -0,0 +1,38 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <ProjectManagerWindow.h>
#include <QWidget>
#endif
namespace O3DE::ProjectManager
{
class ScreenWidget
: public QWidget
{
public:
explicit ScreenWidget(ProjectManagerWindow* window)
: QWidget(window->GetScreenStack())
, m_projectManagerWindow(window)
{
}
protected:
virtual void ConnectSlotsAndSignals() = 0;
ProjectManagerWindow* m_projectManagerWindow;
};
} // namespace O3DE::ProjectManager
@@ -16,7 +16,7 @@
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/IO/Path/Path.h>
#include <Qt/ProjectManagerWindow.h>
#include <ProjectManagerWindow.h>
#include <QApplication>
#include <QCoreApplication>
@@ -48,7 +48,7 @@ int main(int argc, char* argv[])
AzQtComponents::StyleManager styleManager(&app);
styleManager.initialize(&app, engineRootPath);
ProjectManager::ProjectManagerWindow window(nullptr, engineRootPath);
O3DE::ProjectManager::ProjectManagerWindow window(nullptr, engineRootPath);
window.show();
return app.exec();
@@ -11,11 +11,30 @@
set(FILES
project_manager.qrc
source/main.cpp
Qt/FirstTimeUse.h
Qt/FirstTimeUse.cpp
Qt/FirstTimeUse.ui
Qt/ProjectManagerWindow.h
Qt/ProjectManagerWindow.cpp
Qt/ProjectManagerWindow.ui
Source/main.cpp
Source/ScreenDefs.h
Source/ScreenFactory.h
Source/ScreenFactory.cpp
Source/ScreenWidget.h
Source/FirstTimeUse.h
Source/FirstTimeUse.cpp
Source/FirstTimeUse.ui
Source/ProjectManagerWindow.h
Source/ProjectManagerWindow.cpp
Source/ProjectManagerWindow.ui
Source/NewProjectSettings.h
Source/NewProjectSettings.cpp
Source/NewProjectSettings.ui
Source/GemCatalog.h
Source/GemCatalog.cpp
Source/GemCatalog.ui
Source/ProjectsHome.h
Source/ProjectsHome.cpp
Source/ProjectsHome.ui
Source/ProjectSettings.h
Source/ProjectSettings.cpp
Source/ProjectSettings.ui
Source/EngineSettings.h
Source/EngineSettings.cpp
Source/EngineSettings.ui
)
+1 -1
View File
@@ -10,7 +10,7 @@
#
add_subdirectory(FbxSceneBuilder)
add_subdirectory(FbxSDKWrapper)
add_subdirectory(SceneCore)
add_subdirectory(SceneData)
add_subdirectory(SceneUI)
add_subdirectory(SDKWrapper)
@@ -1,47 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/std/smart_ptr/make_shared.h>
#include "FbxAnimCurveNodeWrapper.h"
#include "FbxAnimCurveWrapper.h"
#include "fbxsdk.h"
namespace AZ
{
namespace FbxSDKWrapper
{
FbxAnimCurveNodeWrapper::FbxAnimCurveNodeWrapper(FbxAnimCurveNode* fbxAnimCurveNode)
: m_fbxAnimCurveNode(fbxAnimCurveNode)
{
}
const char* FbxAnimCurveNodeWrapper::GetName() const
{
return m_fbxAnimCurveNode->GetName();
}
int FbxAnimCurveNodeWrapper::GetChannelCount() const
{
return m_fbxAnimCurveNode->GetChannelsCount();
}
int FbxAnimCurveNodeWrapper::GetCurveCount(int channelID) const
{
return m_fbxAnimCurveNode->GetCurveCount(channelID);
}
AZStd::shared_ptr<const FbxAnimCurveWrapper> FbxAnimCurveNodeWrapper::GetCurveWrapper(int channelID, int index) const
{
return AZStd::make_shared<const FbxAnimCurveWrapper>(static_cast<FbxAnimCurve*>(m_fbxAnimCurveNode->GetCurve(channelID, index)));
}
}
}
@@ -1,40 +0,0 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include "fbxsdk.h"
#include "FbxTimeWrapper.h"
#include <AzCore/std/smart_ptr/shared_ptr.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxAnimCurveWrapper;
class FbxAnimCurveNodeWrapper
{
public:
FbxAnimCurveNodeWrapper(FbxAnimCurveNode* fbxAnimCurveNode);
~FbxAnimCurveNodeWrapper() = default;
const char* GetName() const;
int GetChannelCount() const;
int GetCurveCount(int channelID) const;
AZStd::shared_ptr<const FbxAnimCurveWrapper> GetCurveWrapper(int channelID, int index) const;
protected:
FbxAnimCurveNode* m_fbxAnimCurveNode;
};
}
}
@@ -1,34 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <SceneAPI/FbxSDKWrapper/FbxAnimCurveWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxAnimCurveWrapper::FbxAnimCurveWrapper(FbxAnimCurve* fbxAnimCurve)
: m_fbxAnimCurve(fbxAnimCurve)
{
}
const char* FbxAnimCurveWrapper::GetName() const
{
return m_fbxAnimCurve->GetName();
}
float FbxAnimCurveWrapper::Evaluate(FbxTimeWrapper& time) const
{
return m_fbxAnimCurve->Evaluate(time.m_fbxTime);
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,34 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxAnimCurveWrapper
{
public:
FbxAnimCurveWrapper(FbxAnimCurve* fbxAnimCurve);
~FbxAnimCurveWrapper() = default;
const char* GetName() const;
float Evaluate(FbxTimeWrapper& time) const;
protected:
FbxAnimCurve* m_fbxAnimCurve;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,49 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/Casting/numeric_cast.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimLayerWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimCurveNodeWrapper.h>
#include "fbxsdk.h"
namespace AZ
{
namespace FbxSDKWrapper
{
FbxAnimLayerWrapper::FbxAnimLayerWrapper(FbxAnimLayer* fbxAnimLayer)
: m_fbxAnimLayer(fbxAnimLayer)
{
}
const char* FbxAnimLayerWrapper::GetName() const
{
return m_fbxAnimLayer->GetName();
}
u32 FbxAnimLayerWrapper::GetCurveNodeCount() const
{
return static_cast<u32>(m_fbxAnimLayer->GetMemberCount());
}
FbxAnimLayer* FbxAnimLayerWrapper::GetFbxLayer() const
{
return m_fbxAnimLayer;
}
AZStd::shared_ptr<const FbxAnimCurveNodeWrapper> FbxAnimLayerWrapper::GetCurveNodeWrapper(u32 index) const
{
return AZStd::make_shared<const FbxAnimCurveNodeWrapper>(static_cast<FbxAnimCurveNode*>(m_fbxAnimLayer->GetMember(aznumeric_cast<int>(index))));
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,39 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxAnimCurveNodeWrapper;
class FbxAnimLayerWrapper
{
friend class FbxNodeWrapper;
public:
FbxAnimLayerWrapper(FbxAnimLayer* fbxAnimLayer);
~FbxAnimLayerWrapper() = default;
const char* GetName() const;
u32 GetCurveNodeCount() const ;
FbxAnimLayer* GetFbxLayer() const;
AZStd::shared_ptr<const FbxAnimCurveNodeWrapper> GetCurveNodeWrapper(u32 index) const;
protected:
FbxAnimLayer* m_fbxAnimLayer;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,55 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Debug/Trace.h>
#include <AzCore/std/smart_ptr/make_shared.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimStackWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimLayerWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTimeSpanWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxAnimStackWrapper::FbxAnimStackWrapper(FbxAnimStack* fbxAnimStack)
: m_fbxAnimStack(fbxAnimStack)
{
AZ_Assert(fbxAnimStack, "Invalid FbxAnimStack input to initialize FbxAnimStackWrapper");
}
FbxAnimStackWrapper::~FbxAnimStackWrapper()
{
m_fbxAnimStack = nullptr;
}
const char* FbxAnimStackWrapper::GetName() const
{
return m_fbxAnimStack->GetName();
}
int FbxAnimStackWrapper::GetAnimationLayerCount() const
{
return m_fbxAnimStack->GetMemberCount<FbxAnimLayer>();
}
const AZStd::shared_ptr<FbxAnimLayerWrapper> FbxAnimStackWrapper::GetAnimationLayerAt(int index) const
{
AZ_Assert(index < GetAnimationLayerCount(), "Invalid animation layer index %d for layer count %d", index, GetAnimationLayerCount());
return AZStd::make_shared<FbxAnimLayerWrapper>(m_fbxAnimStack->GetMember<FbxAnimLayer>(index));
}
FbxTimeSpanWrapper FbxAnimStackWrapper::GetLocalTimeSpan() const
{
return FbxTimeSpanWrapper(m_fbxAnimStack->GetLocalTimeSpan());
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,42 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <fbxsdk.h>
namespace AZ
{
namespace FbxSDKWrapper
{
using FbxSDKLongLong = FbxLongLong;
class FbxAnimLayerWrapper;
class FbxTimeSpanWrapper;
class FbxAnimStackWrapper
{
public:
FbxAnimStackWrapper(FbxAnimStack* fbxAnimStack);
virtual ~FbxAnimStackWrapper();
virtual const char* GetName() const;
virtual int GetAnimationLayerCount() const;
virtual const AZStd::shared_ptr<FbxAnimLayerWrapper> GetAnimationLayerAt(int index) const;
virtual FbxTimeSpanWrapper GetLocalTimeSpan() const;
protected:
FbxAnimStackWrapper() = default;
FbxAnimStack* m_fbxAnimStack;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,75 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Debug/Trace.h>
#include <AzToolsFramework/Debug/TraceContext.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxAxisSystemWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTypeConverter.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxAxisSystemWrapper::FbxAxisSystemWrapper(const FbxAxisSystem& fbxAxisSystem)
: m_fbxAxisSystem(fbxAxisSystem)
{
}
FbxAxisSystemWrapper::UpVector FbxAxisSystemWrapper::GetUpVector(int& sign) const
{
switch (m_fbxAxisSystem.GetUpVector(sign))
{
case FbxAxisSystem::eXAxis:
return X;
case FbxAxisSystem::eYAxis:
return Y;
case FbxAxisSystem::eZAxis:
return Z;
default:
AZ_TraceContext("Unknown value", m_fbxAxisSystem.GetUpVector(sign));
AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized axis up vector type");
return Unknown;
}
}
SceneAPI::DataTypes::MatrixType FbxAxisSystemWrapper::CalculateConversionTransform(UpVector targetUpAxis)
{
FbxAxisSystem targetSystem;
switch (targetUpAxis)
{
case Y:
// Maya YUp coordinate system (UpVector = +Y, FrontVector = +Z, CoordSystem = +X (RightHanded))
targetSystem = FbxAxisSystem::MayaYUp;
break;
case Z:
// CryTek ZUp coordinate system (UpVector = +Z, FrontVector = +Y, CoordSystem = -X (RightHanded))
targetSystem = FbxAxisSystem(FbxAxisSystem::eZAxis, FbxAxisSystem::eParityOdd, FbxAxisSystem::eRightHanded);
break;
case X:
// Default XUp coordinate system (UpVector = +X, FrontVector = +Z, CoordSystem = -Y (RightHanded))
targetSystem = FbxAxisSystem(FbxAxisSystem::eXAxis, FbxAxisSystem::eParityOdd, FbxAxisSystem::eRightHanded);
break;
default:
AZ_TraceContext("Unknown value", targetUpAxis);
AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized axis conversion target axis type");
return SceneAPI::DataTypes::MatrixType::CreateIdentity();
}
FbxAMatrix targetMatrix;
targetSystem.GetMatrix(targetMatrix);
FbxAMatrix currentMatrix;
m_fbxAxisSystem.GetMatrix(currentMatrix);
FbxAMatrix adjustMatrix = targetMatrix * currentMatrix.Inverse();
return FbxTypeConverter::ToTransform(adjustMatrix);
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,44 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <SceneAPI/SceneCore/DataTypes/MatrixType.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxAxisSystemWrapper
{
public:
enum UpVector
{
X,
Y,
Z,
Unknown
};
FbxAxisSystemWrapper() = default;
FbxAxisSystemWrapper(const FbxAxisSystem& fbxAxisSystem);
virtual ~FbxAxisSystemWrapper() = default;
virtual UpVector GetUpVector(int& sign) const;
virtual SceneAPI::DataTypes::MatrixType CalculateConversionTransform(UpVector targetUpAxis);
protected:
FbxAxisSystem m_fbxAxisSystem;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,100 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/Debug/Trace.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxBlendShapeChannelWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxBlendShapeChannelWrapper::FbxBlendShapeChannelWrapper(FbxBlendShapeChannel* fbxBlendShapeChannel)
: m_fbxBlendShapeChannel(fbxBlendShapeChannel)
{
AZ_Assert(fbxBlendShapeChannel, "Invalid FbxSkin input to initialize FbxBlendShapeChannelWrapper");
}
FbxBlendShapeChannelWrapper::~FbxBlendShapeChannelWrapper()
{
m_fbxBlendShapeChannel = nullptr;
}
const char* FbxBlendShapeChannelWrapper::GetName() const
{
return m_fbxBlendShapeChannel->GetName();
}
//The engine currently only supports one target shape. If there are more than one,
//code will ultimately end up just using the max index returned by this function.
int FbxBlendShapeChannelWrapper::GetTargetShapeCount() const
{
return m_fbxBlendShapeChannel->GetTargetShapeCount();
}
//While not strictly true that the target shapes are meshes, for the purposes of the engine's
//current runtime they must be meshes.
AZStd::shared_ptr<const FbxMeshWrapper> FbxBlendShapeChannelWrapper::GetTargetShape(int index) const
{
//we need to create a duplicate FbxMesh from the base mesh and the target data
//FbxMeshWrapper needs an FbxMesh to point to so we are generating one
//by cloning the mesh data and then replacing with the morph data.
FbxShape* fbxShape = m_fbxBlendShapeChannel->GetTargetShape(index);
if (!fbxShape)
{
return nullptr;
}
FbxGeometry* fbxGeom = fbxShape->GetBaseGeometry();
if (fbxGeom && fbxGeom->GetAttributeType() == FbxNodeAttribute::EType::eMesh)
{
FbxMesh* fbxMesh = static_cast<FbxMesh*>(fbxGeom);
FbxMesh* fbxBlendMesh = FbxMesh::Create(m_fbxBlendShapeChannel->GetScene(),"");
fbxBlendMesh->Copy(*fbxMesh);
//TODO: test that mesh is managed by the sdk
const int count = fbxBlendMesh->GetControlPointsCount();
//set control points from blend shape
for (int i = 0; i < count; i++)
{
fbxBlendMesh->SetControlPointAt(fbxShape->GetControlPointAt(i), i);
}
//source data
FbxLayerElementArrayTemplate<FbxVector4>* normalsTemplate;
if (fbxShape->GetNormals(&normalsTemplate))
{
int normalCount = normalsTemplate->GetCount();
//destination data
FbxLayer* normalLayer = fbxBlendMesh->GetLayer(0, FbxLayerElement::eNormal);
if (normalLayer)
{
FbxLayerElementNormal* normals = normalLayer->GetNormals();
if (normals)
{
//set normal data from blend shape
for (int j = 0; j < normalCount; j++)
{
FbxVector4 normal = normalsTemplate->GetAt(j);
normals->GetDirectArray().SetAt(j, normal);
}
}
}
}
return AZStd::make_shared<FbxMeshWrapper>(fbxBlendMesh);
}
return nullptr;
}
}
}
@@ -1,43 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxNodeWrapper;
class FbxMeshWrapper;
class FbxBlendShapeChannelWrapper
{
public:
FbxBlendShapeChannelWrapper(FbxBlendShapeChannel* fbxBlendShapeChannel);
virtual ~FbxBlendShapeChannelWrapper();
virtual const char* GetName() const;
virtual int GetTargetShapeCount() const;
//While not strictly true that the target shapes are meshes, for the purposes of the engine's
//current runtime they must be meshes.
virtual AZStd::shared_ptr<const FbxMeshWrapper> GetTargetShape(int index) const;
protected:
FbxBlendShapeChannelWrapper() = default;
FbxBlendShapeChannel* m_fbxBlendShapeChannel;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,74 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Debug/Trace.h>
#include <AzCore/std/smart_ptr/make_shared.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxMeshWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxBlendShapeWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxBlendShapeChannelWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxBlendShapeWrapper::FbxBlendShapeWrapper(FbxBlendShape* fbxBlendShape)
: m_fbxBlendShape(fbxBlendShape)
{
AZ_Assert(fbxBlendShape, "Invalid FbxBlendShape input to initialize FbxBlendShapeWrapper");
}
FbxBlendShapeWrapper::~FbxBlendShapeWrapper()
{
m_fbxBlendShape = nullptr;
}
const char* FbxBlendShapeWrapper::GetName() const
{
return m_fbxBlendShape->GetName();
}
//Technically Fbx returns a FbxGeometry off this interface, but we only support meshes in the engine runtime.
AZStd::shared_ptr<const FbxMeshWrapper> FbxBlendShapeWrapper::GetGeometry() const
{
FbxGeometry* fbxGeom = m_fbxBlendShape->GetGeometry();
if (fbxGeom && fbxGeom->GetAttributeType() == FbxNodeAttribute::EType::eMesh )
{
return AZStd::make_shared<FbxMeshWrapper>(static_cast<FbxMesh*>(fbxGeom));
}
else
{
return nullptr;
}
}
int FbxBlendShapeWrapper::GetBlendShapeChannelCount() const
{
return m_fbxBlendShape->GetBlendShapeChannelCount();
}
AZStd::shared_ptr<const FbxBlendShapeChannelWrapper> FbxBlendShapeWrapper::GetBlendShapeChannel(int index) const
{
FbxBlendShapeChannel* fbxBlendShapeChannel = m_fbxBlendShape->GetBlendShapeChannel(index);
if (fbxBlendShapeChannel)
{
return AZStd::make_shared<FbxBlendShapeChannelWrapper>(fbxBlendShapeChannel);
}
else
{
return nullptr;
}
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,43 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxBlendShapeChannelWrapper;
class FbxNodeWrapper;
class FbxMeshWrapper;
class FbxBlendShapeWrapper
{
public:
FbxBlendShapeWrapper(FbxBlendShape* fbxBlendShape);
virtual ~FbxBlendShapeWrapper();
virtual const char* GetName() const;
//Technically Fbx returns a FbxGeometry off this interface, but we only support meshes in the engine runtime.
virtual AZStd::shared_ptr<const FbxMeshWrapper> GetGeometry() const;
virtual int GetBlendShapeChannelCount() const;
virtual AZStd::shared_ptr<const FbxBlendShapeChannelWrapper> GetBlendShapeChannel(int index) const;
protected:
FbxBlendShapeWrapper() = default;
FbxBlendShape* m_fbxBlendShape;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,31 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxLayerElementUtilities
{
public:
template <typename ValueType, typename ElementArrayType>
static void GetGeometryElement(ValueType& value, const ElementArrayType* elementArray,
int polygonIndex, int polygonVertexIndex, int controlPointIndex);
};
} // namespace FbxSDKWrapper
} // namespace AZ
#include "FbxLayerElementUtilities.inl"
@@ -1,74 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Debug/Trace.h>
#include <AzToolsFramework/Debug/TraceContext.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
namespace AZ
{
namespace FbxSDKWrapper
{
template <typename ValueType, typename ElementArrayType>
void FbxLayerElementUtilities::GetGeometryElement( ValueType& value, const ElementArrayType* elementArray,
int polygonIndex, int polygonVertexIndex, int controlPointIndex)
{
if (!elementArray)
{
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Invalid ElementArrayType input");
return;
}
int fbxElementIndex;
switch (elementArray->GetMappingMode())
{
case FbxGeometryElement::eByControlPoint:
// One mapping coordinate for each surface control point/vertex.
fbxElementIndex = controlPointIndex;
break;
case FbxGeometryElement::eByPolygonVertex:
// One mapping coordinate for each vertex, for every polygon of which it is a part.
// This means that a vertex will have as many mapping coordinates as polygons of which it is a part.
fbxElementIndex = polygonVertexIndex;
break;
case FbxGeometryElement::eByPolygon:
// One mapping coordinate for the whole polygon.
fbxElementIndex = polygonIndex;
break;
default:
AZ_TraceContext("Unknown value", elementArray->GetMappingMode());
AZ_TracePrintf(AZ::SceneAPI::Utilities::ErrorWindow, "Invalid ElementArrayType mapping mode");
return;
}
if (elementArray->GetReferenceMode() == FbxGeometryElement::eIndexToDirect)
{
// Convert index from "index of value's index" to "index of value".
const FbxLayerElementArrayTemplate<int>& indices = elementArray->GetIndexArray();
AZ_Assert(fbxElementIndex < indices.GetCount(), "Invalid element index %d", fbxElementIndex);
if (fbxElementIndex >= indices.GetCount())
{
return;
}
fbxElementIndex = indices.GetAt(fbxElementIndex);
}
const FbxLayerElementArrayTemplate<ValueType>& elements = elementArray->GetDirectArray();
AZ_Assert(fbxElementIndex < elements.GetCount(), "Invalid element index %d", fbxElementIndex);
if (fbxElementIndex >= elements.GetCount())
{
return;
}
value = elements.GetAt(fbxElementIndex);
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,185 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Casting/numeric_cast.h>
#include <AzCore/Debug/Trace.h>
#include <AzCore/Math/MathUtils.h>
#include <AzToolsFramework/Debug/TraceContext.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxMaterialWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxPropertyWrapper.h>
namespace
{
const char* s_physicalisedAttributeName = "physicalize";
const char* s_proxyNoDraw = "ProxyNoDraw";
}
namespace AZ
{
namespace FbxSDKWrapper
{
FbxMaterialWrapper::FbxMaterialWrapper(FbxSurfaceMaterial* fbxMaterial)
: SDKMaterial::MaterialWrapper(fbxMaterial)
{
AZ_Assert(fbxMaterial, "Invalid FbxSurfaceMaterial input to initialize FbxMaterialWrapper");
}
AZStd::string FbxMaterialWrapper::GetName() const
{
return m_fbxMaterial->GetInitialName();
}
AZ::Vector3 FbxMaterialWrapper::GetDiffuseColor() const
{
if (m_fbxMaterial->GetClassId().Is(FbxSurfaceLambert::ClassId))
{
FbxSurfaceLambert* lambertMat = static_cast<FbxSurfaceLambert*>(m_fbxMaterial);
const FbxDouble3 fbxValue = lambertMat->Diffuse.Get();
const float power = static_cast<float>(lambertMat->DiffuseFactor.Get());
return power * AZ::Vector3(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1]), static_cast<float>(fbxValue[2]));
}
else if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId))
{
FbxSurfacePhong* phongMat = static_cast<FbxSurfacePhong*>(m_fbxMaterial);
const FbxDouble3 fbxValue = phongMat->Diffuse.Get();
const float power = static_cast<float>(phongMat->DiffuseFactor.Get());
return power * AZ::Vector3(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1]), static_cast<float>(fbxValue[2]));
}
return AZ::Vector3::CreateOne();
}
AZ::Vector3 FbxMaterialWrapper::GetSpecularColor() const
{
if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId))
{
FbxSurfacePhong* phongMat = static_cast<FbxSurfacePhong*>(m_fbxMaterial);
const FbxDouble3 fbxValue = phongMat->Specular.Get();
const float power = static_cast<float>(phongMat->SpecularFactor.Get());
return power * AZ::Vector3(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1]), static_cast<float>(fbxValue[2]));
}
return AZ::Vector3::CreateZero();
}
AZ::Vector3 FbxMaterialWrapper::GetEmissiveColor() const
{
if (m_fbxMaterial->GetClassId().Is(FbxSurfaceLambert::ClassId))
{
FbxSurfaceLambert* lambertMat = static_cast<FbxSurfaceLambert*>(m_fbxMaterial);
const FbxDouble3 fbxValue = lambertMat->Emissive.Get();
const float power = static_cast<float>(lambertMat->EmissiveFactor.Get());
return power * AZ::Vector3(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1]), static_cast<float>(fbxValue[2]));
}
else if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId))
{
FbxSurfacePhong* phongMat = static_cast<FbxSurfacePhong*>(m_fbxMaterial);
const FbxDouble3 fbxValue = phongMat->Emissive.Get();
const float power = static_cast<float>(phongMat->EmissiveFactor.Get());
return power * AZ::Vector3(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1]), static_cast<float>(fbxValue[2]));
}
return AZ::Vector3::CreateZero();
}
float FbxMaterialWrapper::GetShininess() const
{
if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId))
{
FbxSurfacePhong* phongMat = static_cast<FbxSurfacePhong*>(m_fbxMaterial);
return static_cast<float>(phongMat->Shininess.Get());
}
return 10.f;
}
AZ::u64 FbxMaterialWrapper::GetUniqueId() const
{
return m_fbxMaterial->GetUniqueID();
}
float FbxMaterialWrapper::GetOpacity() const
{
// FBX materials are erroneously reporting a TransparencyFactor of 1.0 (fully transparent)
// even for values that are 0.0 in Maya. It is instead storing it in the components
// for TransparentColor, so extract from there instead.
if (m_fbxMaterial->GetClassId().Is(FbxSurfaceLambert::ClassId))
{
FbxSurfaceLambert* lambertMat = static_cast<FbxSurfaceLambert*>(m_fbxMaterial);
const FbxDouble3 fbxValue = lambertMat->TransparentColor.Get();
return 1.f - AZ::GetMin<float>(AZ::GetMin<float>(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1])), static_cast<float>(fbxValue[2]));
}
else if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId))
{
FbxSurfacePhong* phongMat = static_cast<FbxSurfacePhong*>(m_fbxMaterial);
const FbxDouble3 fbxValue = phongMat->TransparentColor.Get();
return 1.f - AZ::GetMin<float>(AZ::GetMin<float>(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1])), static_cast<float>(fbxValue[2]));
}
return 1.f;
}
AZStd::string FbxMaterialWrapper::GetTextureFileName(const char* textureType) const
{
FbxFileTexture* fileTexture = nullptr;
FbxProperty property = m_fbxMaterial->FindProperty(textureType);
FbxDataType propertyType = property.GetPropertyDataType();
/// Engine currently doesn't support multiple textures. Right now we only use first texture of first layer.
int layeredTextureCount = property.GetSrcObjectCount<FbxLayeredTexture>();
if (layeredTextureCount > 0)
{
FbxLayeredTexture* layeredTexture = FbxCast<FbxLayeredTexture>(property.GetSrcObject<FbxLayeredTexture>(0));
int textureCount = layeredTexture->GetSrcObjectCount<FbxTexture>();
if (textureCount > 0)
{
fileTexture = FbxCast<FbxFileTexture>(layeredTexture->GetSrcObject<FbxTexture>(0));
}
}
else
{
int textureCount = property.GetSrcObjectCount<FbxTexture>();
if (textureCount > 0)
{
fileTexture = FbxCast<FbxFileTexture>(property.GetSrcObject<FbxTexture>(0));
}
}
return fileTexture ? fileTexture->GetFileName() : AZStd::string();
}
AZStd::string FbxMaterialWrapper::GetTextureFileName(const AZStd::string& textureType) const
{
return GetTextureFileName(textureType.c_str());
}
AZStd::string FbxMaterialWrapper::GetTextureFileName(MaterialMapType textureType) const
{
switch (textureType)
{
case MaterialMapType::Diffuse:
return GetTextureFileName(FbxSurfaceMaterial::sDiffuse);
case MaterialMapType::Specular:
return GetTextureFileName(FbxSurfaceMaterial::sSpecular);
case MaterialMapType::Bump:
return GetTextureFileName(FbxSurfaceMaterial::sBump);
case MaterialMapType::Normal:
return GetTextureFileName(FbxSurfaceMaterial::sNormalMap);
default:
AZ_TraceContext("Unknown value", aznumeric_cast<int>(textureType));
AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized MaterialMapType retrieved");
return AZStd::string();
}
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,44 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/std/string/string.h>
#include <SceneAPI/SDKWrapper/MaterialWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxMaterialWrapper : public SDKMaterial::MaterialWrapper
{
public:
AZ_RTTI(FbxMaterialWrapper, "{227582F6-93BC-4E44-823E-FB1D631443A7}", SDKMaterial::MaterialWrapper);
FbxMaterialWrapper(FbxSurfaceMaterial* fbxMaterial);
~FbxMaterialWrapper() override = default;
AZStd::string GetName() const override;
virtual AZStd::string GetTextureFileName(const char* textureType) const;
virtual AZStd::string GetTextureFileName(const AZStd::string& textureType) const;
AZStd::string GetTextureFileName(MaterialMapType textureType) const override;
AZ::Vector3 GetDiffuseColor() const override;
AZ::Vector3 GetSpecularColor() const override;
AZ::Vector3 GetEmissiveColor() const override;
float GetOpacity() const override;
float GetShininess() const override;
AZ::u64 GetUniqueId() const override;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,154 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Casting/numeric_cast.h>
#include <AzCore/std/smart_ptr/make_shared.h>
#include <SceneAPI/FbxSDKWrapper/FbxMeshWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxSkinWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxVertexTangentWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxVertexBitangentWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxBlendShapeWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTypeConverter.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxMeshWrapper::FbxMeshWrapper(FbxMesh* fbxMesh)
: m_fbxMesh(fbxMesh)
{
AZ_Assert(fbxMesh, "Invalid FbxMesh input to initialize FbxMeshWrapper");
}
FbxMeshWrapper::~FbxMeshWrapper()
{
m_fbxMesh = nullptr;
}
const char* FbxMeshWrapper::GetName() const
{
return m_fbxMesh->GetName();
}
int FbxMeshWrapper::GetDeformerCount() const
{
return m_fbxMesh->GetDeformerCount();
}
int FbxMeshWrapper::GetDeformerCount(int type) const
{
return m_fbxMesh->GetDeformerCount(static_cast<FbxDeformer::EDeformerType>(type));
}
int FbxMeshWrapper::GetControlPointsCount() const
{
return m_fbxMesh->GetControlPointsCount();
}
AZStd::vector<Vector3> FbxMeshWrapper::GetControlPoints() const
{
FbxVector4* controlPoints = m_fbxMesh->GetControlPoints();
AZStd::vector<Vector3> azControlPoints;
azControlPoints.reserve(aznumeric_caster(GetControlPointsCount()));
for (int i = 0; i < GetControlPointsCount(); ++i)
{
azControlPoints.push_back(FbxTypeConverter::ToVector3(controlPoints[i]));
}
return azControlPoints;
}
AZStd::shared_ptr<const FbxSkinWrapper> FbxMeshWrapper::GetSkin(int index) const
{
FbxSkin* skin = static_cast<FbxSkin*>(m_fbxMesh->GetDeformer(index, FbxDeformer::eSkin));
return skin ? AZStd::make_shared<const FbxSkinWrapper>(skin) : nullptr;
}
AZStd::shared_ptr<const FbxBlendShapeWrapper> FbxMeshWrapper::GetBlendShape(int index) const
{
FbxBlendShape* blendShape = static_cast<FbxBlendShape*>(m_fbxMesh->GetDeformer(index, FbxDeformer::eBlendShape));
return blendShape ? AZStd::make_shared<const FbxBlendShapeWrapper>(blendShape) : nullptr;
}
int FbxMeshWrapper::GetPolygonCount() const
{
return m_fbxMesh->GetPolygonCount();
}
int FbxMeshWrapper::GetPolygonSize(int polygonIndex) const
{
return m_fbxMesh->GetPolygonSize(polygonIndex);
}
int* FbxMeshWrapper::GetPolygonVertices() const
{
return m_fbxMesh->GetPolygonVertices();
}
int FbxMeshWrapper::GetPolygonVertexIndex(int polygonIndex) const
{
return m_fbxMesh->GetPolygonVertexIndex(polygonIndex);
}
bool FbxMeshWrapper::GetMaterialIndices(FbxLayerElementArrayTemplate<int>** lockableArray) const
{
return m_fbxMesh->GetMaterialIndices(lockableArray);
}
FbxUVWrapper FbxMeshWrapper::GetElementUV(int index)
{
return FbxUVWrapper(m_fbxMesh->GetElementUV(index));
}
FbxVertexTangentWrapper FbxMeshWrapper::GetElementTangent(int index)
{
return FbxVertexTangentWrapper(m_fbxMesh->GetElementTangent(index));
}
FbxVertexBitangentWrapper FbxMeshWrapper::GetElementBitangent(int index)
{
return FbxVertexBitangentWrapper(m_fbxMesh->GetElementBinormal(index));
}
int FbxMeshWrapper::GetElementUVCount() const
{
return m_fbxMesh->GetElementUVCount();
}
int FbxMeshWrapper::GetElementTangentCount() const
{
return m_fbxMesh->GetElementTangentCount();
}
int FbxMeshWrapper::GetElementBitangentCount() const
{
return m_fbxMesh->GetElementBinormalCount();
}
FbxVertexColorWrapper FbxMeshWrapper::GetElementVertexColor(int index)
{
return FbxVertexColorWrapper(m_fbxMesh->GetElementVertexColor(index));
}
int FbxMeshWrapper::GetElementVertexColorCount() const
{
return m_fbxMesh->GetElementVertexColorCount();
}
bool FbxMeshWrapper::GetPolygonVertexNormal(int polyIndex, int vertexIndex, Vector3& normal) const
{
FbxVector4 fbxNormal;
bool hasVertexNormal = m_fbxMesh->GetPolygonVertexNormal(polyIndex, vertexIndex, fbxNormal);
normal = FbxTypeConverter::ToVector3(fbxNormal);
return hasVertexNormal;
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,89 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <SceneAPI/FbxSDKWrapper/FbxVertexColorWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxUVWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxSkinWrapper;
class FbxBlendShapeWrapper;
class FbxVertexTangentWrapper;
class FbxVertexBitangentWrapper;
class FbxMeshWrapper
{
public:
FbxMeshWrapper(FbxMesh* fbxMesh);
virtual ~FbxMeshWrapper();
virtual const char* GetName() const;
virtual int GetDeformerCount() const;
virtual int GetDeformerCount(int type) const;
virtual AZStd::shared_ptr<const FbxSkinWrapper> GetSkin(int index) const;
virtual AZStd::shared_ptr<const FbxBlendShapeWrapper> GetBlendShape(int index) const;
virtual bool GetMaterialIndices(FbxLayerElementArrayTemplate<int>** lockableArray) const;
// Vertex positions access
// Get the control points number
virtual int GetControlPointsCount() const;
// Get the array of control points
virtual AZStd::vector<Vector3> GetControlPoints() const;
// Polygon data accesses
// Get the polygon count of this mesh
virtual int GetPolygonCount() const;
// Get the number of polygon vertices in a polygon
virtual int GetPolygonSize(int polygonIndex) const;
// Get the array of polygon vertices (i.e: indices to the control points)
virtual int* GetPolygonVertices() const;
// Gets the start index into the array returned by GetPolygonVertices() for the given polygon
virtual int GetPolygonVertexIndex(int polygonIndex) const;
// Vertex colors and UV textures accesses
// Returns this geometry's UV element
virtual FbxUVWrapper GetElementUV(int index = 0);
virtual int GetElementUVCount() const;
virtual int GetElementTangentCount() const;
virtual int GetElementBitangentCount() const;
virtual FbxVertexTangentWrapper GetElementTangent(int index = 0);
virtual FbxVertexBitangentWrapper GetElementBitangent(int index = 0);
// Returns this geometry's vertex color element
virtual FbxVertexColorWrapper GetElementVertexColor(int index = 0);
virtual int GetElementVertexColorCount() const;
// Get the normal associated with the specified polygon vertex
virtual bool GetPolygonVertexNormal(int polyIndex, int vertexIndex, Vector3& normal) const;
protected:
FbxMeshWrapper() = default;
FbxMesh* m_fbxMesh;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,220 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/std/smart_ptr/make_shared.h>
#include <SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxMaterialWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTypeConverter.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimLayerWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimCurveWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxNodeWrapper::FbxNodeWrapper(FbxNode* fbxNode)
: NodeWrapper(fbxNode)
{
AZ_Assert(fbxNode, "Invalid FbxNode to initialize FbxNodeWrapper");
}
FbxNodeWrapper::~FbxNodeWrapper()
{
}
int FbxNodeWrapper::GetMaterialCount() const
{
return m_fbxNode->GetMaterialCount();
}
const char* FbxNodeWrapper::GetMaterialName(int index) const
{
if (index < GetMaterialCount())
{
return m_fbxNode->GetMaterial(index)->GetName();
}
AZ_Assert(index < GetMaterialCount(), "Invalid material index %d", index);
return nullptr;
}
const std::shared_ptr<FbxMeshWrapper> FbxNodeWrapper::GetMesh() const
{
FbxMesh* mesh = m_fbxNode->GetMesh();
return mesh ? std::shared_ptr<FbxMeshWrapper>(new FbxMeshWrapper(mesh)) : nullptr;
}
const std::shared_ptr<FbxPropertyWrapper> FbxNodeWrapper::FindProperty(const char* name) const
{
FbxProperty propertyName = m_fbxNode->FindProperty(name);
return std::shared_ptr<FbxPropertyWrapper>(new FbxPropertyWrapper(&propertyName));
}
bool FbxNodeWrapper::IsBone() const
{
return (m_fbxNode->GetSkeleton() != nullptr);
}
bool FbxNodeWrapper::IsMesh() const
{
return (m_fbxNode->GetMesh() != nullptr);
}
const char* FbxNodeWrapper::GetName() const
{
return m_fbxNode->GetName();
}
AZ::u64 FbxNodeWrapper::GetUniqueId() const
{
return m_fbxNode->GetUniqueID();
}
SceneAPI::DataTypes::MatrixType FbxNodeWrapper::EvaluateGlobalTransform()
{
return FbxTypeConverter::ToTransform(m_fbxNode->EvaluateGlobalTransform());
}
Vector3 FbxNodeWrapper::EvaluateLocalTranslation()
{
return FbxTypeConverter::ToVector3(m_fbxNode->EvaluateLocalTranslation());
}
Vector3 FbxNodeWrapper::EvaluateLocalTranslation(FbxTimeWrapper& time)
{
return FbxTypeConverter::ToVector3(m_fbxNode->EvaluateLocalTranslation(time.m_fbxTime));
}
SceneAPI::DataTypes::MatrixType FbxNodeWrapper::EvaluateLocalTransform()
{
return FbxTypeConverter::ToTransform(m_fbxNode->EvaluateLocalTransform());
}
SceneAPI::DataTypes::MatrixType FbxNodeWrapper::EvaluateLocalTransform(FbxTimeWrapper& time)
{
return FbxTypeConverter::ToTransform(m_fbxNode->EvaluateLocalTransform(time.m_fbxTime));
}
Vector3 FbxNodeWrapper::EvaluateLocalRotation()
{
return FbxTypeConverter::ToVector3(m_fbxNode->EvaluateLocalTransform().GetR());
}
Vector3 FbxNodeWrapper::EvaluateLocalRotation(FbxTimeWrapper& time)
{
return FbxTypeConverter::ToVector3(m_fbxNode->EvaluateLocalTransform(time.m_fbxTime).GetR());
}
Vector3 FbxNodeWrapper::GetGeometricTranslation() const
{
return FbxTypeConverter::ToVector3(m_fbxNode->GetGeometricTranslation(FbxNode::eSourcePivot));
}
Vector3 FbxNodeWrapper::GetGeometricScaling() const
{
return FbxTypeConverter::ToVector3(m_fbxNode->GetGeometricScaling(FbxNode::eSourcePivot));
}
Vector3 FbxNodeWrapper::GetGeometricRotation() const
{
return FbxTypeConverter::ToVector3(m_fbxNode->GetGeometricRotation(FbxNode::eSourcePivot));
}
SceneAPI::DataTypes::MatrixType FbxNodeWrapper::GetGeometricTransform() const
{
FbxAMatrix geoTransform(m_fbxNode->GetGeometricTranslation(FbxNode::eSourcePivot),
m_fbxNode->GetGeometricRotation(FbxNode::eSourcePivot), m_fbxNode->GetGeometricScaling(FbxNode::eSourcePivot));
return FbxTypeConverter::ToTransform(geoTransform);
}
const AZStd::shared_ptr<FbxAnimCurveWrapper> FbxNodeWrapper::GetLocalTranslationCurve(const AZStd::shared_ptr<FbxAnimLayerWrapper>& layer,
CurveNodeComponent component) const
{
if (!layer)
{
return nullptr;
}
const char* componentString = nullptr;
switch (component)
{
case Component_X:
componentString = FBXSDK_CURVENODE_COMPONENT_X;
break;
case Component_Y:
componentString = FBXSDK_CURVENODE_COMPONENT_Y;
break;
case Component_Z:
componentString = FBXSDK_CURVENODE_COMPONENT_Z;
break;
default:
break;
}
// If there is available animation curve data of specified component/channel for translation, create and return a wrapped version of it.
return m_fbxNode->LclTranslation.GetCurve(layer->m_fbxAnimLayer, componentString) ?
AZStd::make_shared<FbxAnimCurveWrapper>(m_fbxNode->LclTranslation.GetCurve(layer->m_fbxAnimLayer, componentString)) : nullptr;
}
const AZStd::shared_ptr<FbxAnimCurveWrapper> FbxNodeWrapper::GetLocalRotationCurve(const AZStd::shared_ptr<FbxAnimLayerWrapper>& layer,
CurveNodeComponent component) const
{
if (!layer)
{
return nullptr;
}
const char* componentString = nullptr;
switch (component)
{
case Component_X:
componentString = FBXSDK_CURVENODE_COMPONENT_X;
break;
case Component_Y:
componentString = FBXSDK_CURVENODE_COMPONENT_Y;
break;
case Component_Z:
componentString = FBXSDK_CURVENODE_COMPONENT_Z;
break;
default:
break;
}
// If there is available animation curve data of specified component/channel for rotation, create and return a wrapped version of it.
return m_fbxNode->LclRotation.GetCurve(layer->m_fbxAnimLayer, componentString) ?
AZStd::make_shared<FbxAnimCurveWrapper>(m_fbxNode->LclRotation.GetCurve(layer->m_fbxAnimLayer, componentString)) : nullptr;
}
bool FbxNodeWrapper::IsAnimated() const
{
return FbxAnimUtilities::IsAnimated(m_fbxNode);
}
int FbxNodeWrapper::GetChildCount() const
{
return m_fbxNode->GetChildCount();
}
const std::shared_ptr<SDKNode::NodeWrapper> FbxNodeWrapper::GetChild(int childIndex) const
{
FbxNode* child = m_fbxNode->GetChild(childIndex);
AZ_Assert(child, "Cannot get child FbxNode at index %d", childIndex);
return child ? std::shared_ptr<SDKNode::NodeWrapper>(new FbxNodeWrapper(child)) : nullptr;
}
const std::shared_ptr<FbxMaterialWrapper> FbxNodeWrapper::GetMaterial(int index) const
{
if (index < GetMaterialCount())
{
return std::shared_ptr<FbxMaterialWrapper>(new FbxMaterialWrapper(m_fbxNode->GetMaterial(index)));
}
AZ_Assert(index < GetMaterialCount(), "Invalid material index %d", index);
return nullptr;
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,69 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxMeshWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxPropertyWrapper.h>
#include <SceneAPI/SceneCore/DataTypes/MatrixType.h>
#include <SceneAPI/SDKWrapper/NodeWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxMaterialWrapper;
class FbxAnimLayerWrapper;
class FbxAnimCurveWrapper;
class FbxNodeWrapper : public SDKNode::NodeWrapper
{
public:
AZ_RTTI(FbxNodeWrapper, "{5F1C09D1-791C-41CA-94DB-D7DD2810C859}", SDKNode::NodeWrapper);
FbxNodeWrapper(FbxNode* fbxNode);
~FbxNodeWrapper() override;
int GetMaterialCount() const override;
virtual const char* GetMaterialName(int index) const;
virtual const std::shared_ptr<FbxMaterialWrapper> GetMaterial(int index) const;
virtual const std::shared_ptr<FbxMeshWrapper> GetMesh() const;
virtual const std::shared_ptr<FbxPropertyWrapper> FindProperty(const char* name) const;
virtual bool IsBone() const;
virtual bool IsMesh() const;
const char* GetName() const override;
AZ::u64 GetUniqueId() const override;
virtual SceneAPI::DataTypes::MatrixType EvaluateGlobalTransform();
virtual Vector3 EvaluateLocalTranslation();
virtual Vector3 EvaluateLocalTranslation(FbxTimeWrapper& time);
virtual SceneAPI::DataTypes::MatrixType EvaluateLocalTransform();
virtual SceneAPI::DataTypes::MatrixType EvaluateLocalTransform(FbxTimeWrapper& time);
virtual Vector3 EvaluateLocalRotation();
virtual Vector3 EvaluateLocalRotation(FbxTimeWrapper& time);
virtual Vector3 GetGeometricTranslation() const;
virtual Vector3 GetGeometricScaling() const;
virtual Vector3 GetGeometricRotation() const;
virtual SceneAPI::DataTypes::MatrixType GetGeometricTransform() const;
virtual const AZStd::shared_ptr<FbxAnimCurveWrapper> GetLocalTranslationCurve(const AZStd::shared_ptr<FbxAnimLayerWrapper>& layer, CurveNodeComponent component) const;
virtual const AZStd::shared_ptr<FbxAnimCurveWrapper> GetLocalRotationCurve(const AZStd::shared_ptr<FbxAnimLayerWrapper>& layer, CurveNodeComponent component) const;
int GetChildCount() const override;
const std::shared_ptr<NodeWrapper> GetChild(int childIndex) const override;
virtual bool IsAnimated() const;
protected:
FbxNodeWrapper() = default;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,57 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Casting/numeric_cast.h>
#include <SceneAPI/FbxSDKWrapper/FbxPropertyWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTypeConverter.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxPropertyWrapper::FbxPropertyWrapper(FbxProperty* fbxProperty)
: m_fbxProperty(fbxProperty)
{
AZ_Assert(fbxProperty, "Invalid FbxProperty to initialize FbxPropertyWrapper");
}
FbxPropertyWrapper::~FbxPropertyWrapper()
{
m_fbxProperty = nullptr;
}
bool FbxPropertyWrapper::IsValid() const
{
return m_fbxProperty->IsValid();
}
Vector3 FbxPropertyWrapper::GetFbxVector3() const
{
return FbxTypeConverter::ToVector3(m_fbxProperty->Get<FbxVector4>());
}
int FbxPropertyWrapper::GetFbxInt() const
{
return aznumeric_caster(m_fbxProperty->Get<FbxInt>());
}
AZStd::string FbxPropertyWrapper::GetFbxString() const
{
return AZStd::string(m_fbxProperty->Get<FbxString>().Buffer());
}
const char* FbxPropertyWrapper::GetEnumValue(int index) const
{
return m_fbxProperty->GetEnumValue(index);
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,39 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/std/string/string.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxPropertyWrapper
{
public:
FbxPropertyWrapper(FbxProperty* fbxProperty);
virtual ~FbxPropertyWrapper();
virtual bool IsValid() const;
virtual Vector3 GetFbxVector3() const;
virtual int GetFbxInt() const;
virtual AZStd::string GetFbxString() const;
virtual const char* GetEnumValue(int index) const;
protected:
FbxProperty* m_fbxProperty;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,200 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzToolsFramework/Debug/TraceContext.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxSceneWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxSceneWrapper::FbxSceneWrapper()
: SceneWrapperBase()
, m_fbxManager(nullptr)
, m_fbxImporter(nullptr)
, m_fbxIOSettings(nullptr)
{
}
FbxSceneWrapper::FbxSceneWrapper(FbxScene* fbxScene)
: SceneWrapperBase(fbxScene)
, m_fbxManager(nullptr)
, m_fbxImporter(nullptr)
, m_fbxIOSettings(nullptr)
{
AZ_Assert(fbxScene, "FbxSceneWrapper should have a valid scene to initialize.");
}
FbxSceneWrapper::~FbxSceneWrapper()
{
if (m_fbxScene)
{
m_fbxScene->Destroy();
m_fbxScene = nullptr;
}
if (m_fbxImporter)
{
m_fbxImporter->Destroy();
m_fbxImporter = nullptr;
}
if (m_fbxIOSettings)
{
m_fbxIOSettings->Destroy();
m_fbxIOSettings = nullptr;
}
if (m_fbxManager)
{
m_fbxManager->Destroy();
m_fbxManager = nullptr;
}
}
AZStd::shared_ptr<FbxAxisSystemWrapper> FbxSceneWrapper::GetAxisSystem() const
{
return AZStd::make_shared<FbxAxisSystemWrapper>(m_fbxScene->GetGlobalSettings().GetAxisSystem());
}
AZStd::shared_ptr<FbxSystemUnitWrapper> FbxSceneWrapper::GetSystemUnit() const
{
return AZStd::make_shared<FbxSystemUnitWrapper>(m_fbxScene->GetGlobalSettings().GetSystemUnit());
}
FbxTimeWrapper FbxSceneWrapper::GetTimeLineDefaultDuration() const
{
FbxTimeSpan timeSpan;
m_fbxScene->GetGlobalSettings().GetTimelineDefaultTimeSpan(timeSpan);
return FbxTimeWrapper(timeSpan.GetDuration());
}
const char* FbxSceneWrapper::GetLastSavedApplicationName() const
{
if (m_fbxScene->GetDocumentInfo())
{
return m_fbxScene->GetDocumentInfo()->LastSaved_ApplicationName.Get().Buffer();
}
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Cannot get valid document info from FbxScene");
return nullptr;
}
const char* FbxSceneWrapper::GetLastSavedApplicationVersion() const
{
if (m_fbxScene->GetDocumentInfo())
{
return m_fbxScene->GetDocumentInfo()->LastSaved_ApplicationVersion.Get().Buffer();
}
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Cannot get valid document info from FbxScene");
return nullptr;
}
const std::shared_ptr<SDKNode::NodeWrapper> FbxSceneWrapper::GetRootNode() const
{
return std::shared_ptr<FbxNodeWrapper>(new FbxNodeWrapper(m_fbxScene->GetRootNode()));
}
std::shared_ptr<SDKNode::NodeWrapper> FbxSceneWrapper::GetRootNode()
{
return std::shared_ptr<FbxNodeWrapper>(new FbxNodeWrapper(m_fbxScene->GetRootNode()));
}
int FbxSceneWrapper::GetAnimationStackCount() const
{
return m_fbxScene->GetSrcObjectCount<FbxAnimStack>();
}
const std::shared_ptr<FbxAnimStackWrapper> FbxSceneWrapper::GetAnimationStackAt(int index) const
{
return std::shared_ptr<FbxAnimStackWrapper>(new FbxAnimStackWrapper(FbxCast<FbxAnimStack>(m_fbxScene->GetSrcObject<FbxAnimStack>(index))));
}
bool FbxSceneWrapper::LoadSceneFromFile(const char* fileName)
{
AZ_TracePrintf(SceneAPI::Utilities::LogWindow, "FbxSceneWrapper::LoadSceneFromFile %s", fileName);
AZ_TraceContext("Filename", fileName);
if (!m_fbxManager)
{
m_fbxManager = FbxManager::Create();
if (!m_fbxManager)
{
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to create FbxManager");
return false;
}
}
if (!m_fbxIOSettings)
{
m_fbxIOSettings = FbxIOSettings::Create(m_fbxManager, IOSROOT);
if (!m_fbxIOSettings)
{
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to create FbxIOSettings");
return false;
}
}
m_fbxManager->SetIOSettings(m_fbxIOSettings);
if (!m_fbxImporter)
{
m_fbxImporter = FbxImporter::Create(m_fbxManager, "");
if (!m_fbxImporter)
{
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to create FbxImporter with FbxManager");
return false;
}
}
if (!m_fbxImporter->Initialize(fileName, -1, m_fbxManager->GetIOSettings()))
{
FbxString error = m_fbxImporter->GetStatus().GetErrorString();
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to initialize FbxImporter with fbx file. Error returned: %s", error.Buffer());
return false;
}
// Create a new FBX scene so it can be populated by the imported file.
m_fbxScene = FbxScene::Create(m_fbxManager, s_defaultSceneName);
if (!m_fbxScene)
{
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to create FbxScene");
return false;
}
if (!m_fbxImporter->Import(m_fbxScene))
{
FbxString error = m_fbxImporter->GetStatus().GetErrorString();
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to import FbxScene. Error returned: %s", error.Buffer());
return false;
}
return true;
}
bool FbxSceneWrapper::LoadSceneFromFile(const AZStd::string& fileName)
{
return LoadSceneFromFile(fileName.c_str());
}
void FbxSceneWrapper::Clear()
{
if (m_fbxScene)
{
m_fbxScene->Clear();
}
}
}//namespace FbxSDKWrapper
} // namespace AZ
@@ -1,62 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// FBX SDK Wrapper
// provides isolation between AUTODESK FBX SDK and FBX Serializer
// provides necessary APIs for FBX Serializer
//
////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimStackWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxAxisSystemWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxSystemUnitWrapper.h>
#include <SceneAPI/SDKWrapper/SceneWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxSceneWrapper : public SDKScene::SceneWrapperBase
{
public:
AZ_RTTI(FbxSceneWrapper, "{63637E50-BB26-4BE9-AECD-D1168AE2355B}", SDKScene::SceneWrapperBase);
FbxSceneWrapper();
FbxSceneWrapper(fbxsdk::FbxScene* fbxScene);
~FbxSceneWrapper();
bool LoadSceneFromFile(const char* fileName) override;
bool LoadSceneFromFile(const AZStd::string& fileName) override;
virtual AZStd::shared_ptr<FbxSystemUnitWrapper> GetSystemUnit() const;
virtual AZStd::shared_ptr<FbxAxisSystemWrapper> GetAxisSystem() const;
virtual FbxTimeWrapper GetTimeLineDefaultDuration() const;
virtual const char* GetLastSavedApplicationName() const;
virtual const char* GetLastSavedApplicationVersion() const;
const std::shared_ptr<SDKNode::NodeWrapper> GetRootNode() const override;
std::shared_ptr<SDKNode::NodeWrapper> GetRootNode() override;
virtual int GetAnimationStackCount() const;
virtual const std::shared_ptr<FbxAnimStackWrapper> GetAnimationStackAt(int index) const;
void Clear() override;
protected:
FbxManager* m_fbxManager;
FbxImporter* m_fbxImporter;
FbxIOSettings* m_fbxIOSettings;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,86 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/Debug/Trace.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxSkinWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxSkinWrapper::FbxSkinWrapper(FbxSkin* fbxSkin)
: m_fbxSkin(fbxSkin)
{
AZ_Assert(fbxSkin, "Invalid FbxSkin input to initialize FbxSkinWrapper");
}
FbxSkinWrapper::~FbxSkinWrapper()
{
m_fbxSkin = nullptr;
}
const char* FbxSkinWrapper::GetName() const
{
return m_fbxSkin->GetName();
}
int FbxSkinWrapper::GetClusterCount() const
{
return m_fbxSkin->GetClusterCount();
}
int FbxSkinWrapper::GetClusterControlPointIndicesCount(int index) const
{
if (index < m_fbxSkin->GetClusterCount())
{
return m_fbxSkin->GetCluster(index)->GetControlPointIndicesCount();
}
AZ_Assert(index < m_fbxSkin->GetClusterCount(), "Invalid skin cluster index %d", index);
return 0;
}
int FbxSkinWrapper::GetClusterControlPointIndex(int clusterIndex, int pointIndex) const
{
bool validIndex = clusterIndex < m_fbxSkin->GetClusterCount() && pointIndex < m_fbxSkin->GetCluster(clusterIndex)->GetControlPointIndicesCount();
if (validIndex)
{
return m_fbxSkin->GetCluster(clusterIndex)->GetControlPointIndices()[pointIndex];
}
AZ_Assert(validIndex, "Invalid skin cluster control point index at cluster index %d control point index %d", clusterIndex, pointIndex);
return -1;
}
double FbxSkinWrapper::GetClusterControlPointWeight(int clusterIndex, int pointIndex) const
{
bool validIndex = clusterIndex < m_fbxSkin->GetClusterCount() && pointIndex < m_fbxSkin->GetCluster(clusterIndex)->GetControlPointIndicesCount();
if (validIndex)
{
return m_fbxSkin->GetCluster(clusterIndex)->GetControlPointWeights()[pointIndex];
}
AZ_Assert(validIndex, "Invalid skin cluster control point weight at cluster index %d control point index %d", clusterIndex, pointIndex);
return 0.0f;
}
AZStd::shared_ptr<const FbxNodeWrapper> FbxSkinWrapper::GetClusterLink(int index) const
{
if (index < m_fbxSkin->GetClusterCount())
{
return AZStd::make_shared<const FbxNodeWrapper>(m_fbxSkin->GetCluster(index)->GetLink());
}
AZ_Assert(index < m_fbxSkin->GetClusterCount(), "Invalid skin cluster index %d", index);
return nullptr;
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,42 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxNodeWrapper;
class FbxSkinWrapper
{
public:
FbxSkinWrapper(FbxSkin* fbxSkin);
virtual ~FbxSkinWrapper();
virtual const char* GetName() const;
virtual int GetClusterCount() const;
virtual int GetClusterControlPointIndicesCount(int index) const;
virtual int GetClusterControlPointIndex(int clusterIndex, int pointIndex) const;
virtual double GetClusterControlPointWeight(int clusterIndex, int pointIndex) const;
virtual AZStd::shared_ptr<const FbxNodeWrapper> GetClusterLink(int index) const;
protected:
FbxSkinWrapper() = default;
FbxSkin* m_fbxSkin;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,108 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Casting/numeric_cast.h>
#include <AzCore/Debug/Trace.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxSystemUnitWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxSystemUnitWrapper::FbxSystemUnitWrapper(const FbxSystemUnit& fbxSystemUnit)
: m_fbxSystemUnit(fbxSystemUnit)
{
}
FbxSystemUnitWrapper::Unit FbxSystemUnitWrapper::GetUnit() const
{
if (m_fbxSystemUnit == FbxSystemUnit::mm)
{
return mm;
}
if (m_fbxSystemUnit == FbxSystemUnit::dm)
{
return dm;
}
if (m_fbxSystemUnit == FbxSystemUnit::cm)
{
return cm;
}
if (m_fbxSystemUnit == FbxSystemUnit::m)
{
return m;
}
if (m_fbxSystemUnit == FbxSystemUnit::km)
{
return km;
}
if (m_fbxSystemUnit == FbxSystemUnit::Inch)
{
return inch;
}
if (m_fbxSystemUnit == FbxSystemUnit::Foot)
{
return foot;
}
if (m_fbxSystemUnit == FbxSystemUnit::Mile)
{
return mile;
}
if (m_fbxSystemUnit == FbxSystemUnit::Yard)
{
return yard;
}
AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized current unit type");
return unknown;
}
float FbxSystemUnitWrapper::GetConversionFactorTo(Unit to)
{
FbxSystemUnit targetUnit;
switch (to)
{
case mm:
targetUnit = FbxSystemUnit::mm;
break;
case dm:
targetUnit = FbxSystemUnit::dm;
break;
case cm:
targetUnit = FbxSystemUnit::cm;
break;
case m:
targetUnit = FbxSystemUnit::m;
break;
case km:
targetUnit = FbxSystemUnit::km;
break;
case inch:
targetUnit = FbxSystemUnit::Inch;
break;
case foot:
targetUnit = FbxSystemUnit::Foot;
break;
case mile:
targetUnit = FbxSystemUnit::Mile;
break;
case yard:
targetUnit = FbxSystemUnit::Yard;
break;
default:
AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized unit conversion target type");
targetUnit = FbxSystemUnit::m;
}
return aznumeric_caster(m_fbxSystemUnit.GetConversionFactorTo(targetUnit));
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,49 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxSystemUnitWrapper
{
public:
enum Unit
{
mm,
dm,
cm,
m,
km,
inch,
foot,
mile,
yard,
unknown
};
FbxSystemUnitWrapper() = default;
FbxSystemUnitWrapper(const FbxSystemUnit& fbxSystemUnit);
virtual ~FbxSystemUnitWrapper() = default;
virtual Unit GetUnit() const;
virtual float GetConversionFactorTo(Unit to);
protected:
FbxSystemUnit m_fbxSystemUnit;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,45 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Debug/Trace.h>
#include <SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTimeSpanWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxTimeSpanWrapper::FbxTimeSpanWrapper(const FbxTimeSpan& fbxTimeSpan)
: m_fbxTimeSpan(fbxTimeSpan)
{
}
FbxTimeWrapper FbxTimeSpanWrapper::GetStartTime() const
{
return FbxTimeWrapper(m_fbxTimeSpan.GetStart());
}
FbxTimeWrapper FbxTimeSpanWrapper::GetStopTime() const
{
return FbxTimeWrapper(m_fbxTimeSpan.GetStop());
}
double FbxTimeSpanWrapper::GetFrameRate() const
{
return FbxTimeWrapper(m_fbxTimeSpan.GetStart()).GetFrameRate();
}
int64_t FbxTimeSpanWrapper::GetNumFrames() const
{
return GetStopTime().GetFrameCount() - GetStartTime().GetFrameCount() + 1;
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,37 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h>
#include <fbxsdk.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxTimeSpanWrapper
{
public:
FbxTimeSpanWrapper(const FbxTimeSpan& fbxTimeSpan);
virtual ~FbxTimeSpanWrapper() = default;
virtual FbxTimeWrapper GetStartTime() const;
virtual FbxTimeWrapper GetStopTime() const;
virtual double GetFrameRate() const;
int64_t GetNumFrames() const;
protected:
FbxTimeSpan m_fbxTimeSpan;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -1,76 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Debug/Trace.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxTimeWrapper::FbxTimeWrapper() : m_fbxTime(FBXSDK_TIME_INFINITE)
{
}
FbxTimeWrapper::FbxTimeWrapper(const FbxTime& fbxTime) : m_fbxTime(fbxTime)
{
}
FbxTimeWrapper::~FbxTimeWrapper()
{
}
void FbxTimeWrapper::SetFrame(int64_t frames, TimeMode timeMode)
{
m_fbxTime.SetFrame(static_cast<FbxLongLong>(frames), GetFbxTimeMode(timeMode));
}
void FbxTimeWrapper::SetTime(double time)
{
m_fbxTime.SetSecondDouble(time);
}
double FbxTimeWrapper::GetFrameRate() const
{
return m_fbxTime.GetFrameRate(m_fbxTime.GetGlobalTimeMode());
}
int64_t FbxTimeWrapper::GetFrameCount() const
{
return static_cast<int64_t>(m_fbxTime.GetFrameCount());
}
double FbxTimeWrapper::GetTime() const
{
return m_fbxTime.GetSecondDouble();
}
FbxTime::EMode FbxTimeWrapper::GetFbxTimeMode(TimeMode timeMode) const
{
switch (timeMode)
{
case frames60:
return FbxTime::eFrames60;
case frames30:
return FbxTime::eFrames30;
case frames24:
return FbxTime::eFrames24;
case defaultMode:
return FbxTime::eDefaultMode;
default:
AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unsupported frame rate");
return FbxTime::eDefaultMode;
}
}
} // namespace FbxSDKWrapper
} // namespace AZ

Some files were not shown because too many files have changed in this diff Show More