LYN-2537 engine assets (#254)

* LYN-2537 Moved the Engine and Editor folder to be within the EngineAssets folder

* Fixed Documentation in bootstrap.cfg to correct the path to the user project specific registry file

* Adding a newline to the output of AssetCatalog 'Registering asset..., but type is not set' message

* Updating the AssetProcessorPlatformConfig.setreg Scan Folder to detect
the @ENGINEROOT@/EngineAssets/Engine path for engine runtime assets and
@ENGINEROOT@/EngineAssets/Editor path for engine tool assets

* Updating references to Icons and other assets to account for moving the
Engine and Editor folder under a single EngineAssets folder

* Moving the Engine Settings Registry folder from Engine/Registry -> Registry

* Removed the LY_PROJECT_CMAKE_PATH define as it is not portable to other locations. It is hard coded to the project location that was used for the CMake configuration. Furthermore it paths with backslashes within it are treated as escape characters and not a path separator

* Updated the LyTestTools asset_processor.py script to copy the exclude.filetag from the EngineAssets/Engine directory now

* Fixed Atom Shader Preprocessing when running using an External Project

* Updated the TSGenerateAction.cpp to fix the build error with using a renamed variable

* Updated the Install_Common.cmake ly_setup_others function to install the
EngineAssets directory and the each of the Gem's Assets directory while
maintaining the relative directory structure to the Engine Root
Also updated the install step to install the Registry folder at the
engine root

* Fixed the copying of the Registry folder to be in the install root, instead of under a second 'Registry' folder

* Moving the AssetProcessorPlatformConfig.setreg file over to the Registry folder

* Updated the LyTestTools and C++ code to point that the new location of
the AssetProcessorPlatformConfig.setreg file inside of the Registry
folder

* Renamed Test AssetProcessor*Config.ini files to have the .setreg extension

* Converted the AssetProcessor test setreg files from ini format to json
format using the SerializeContextTools convert-ini command

* Updated the AssetProcessor CMakeLists.txt to copy over the test setreg files to the build folder

* Updated the assetprocessor test file list to point at the renamed AsssetProcessor*Config setreg filenames

* Removed the Output Prefix code from the AssetProcessor. The complexity that it brought to the AP code is not needed, as users can replicate the behavior by just moving there assets underneath a another folder, underneath the scan folder

* Adding back support to read the AssetProcessorPlatformConfig.setreg file from the asset root. This is only needed for C++ UnitTests as they run in an environment where the accessing the Engine Settings Registry is not available

* Updating the Install_common.cmake logic to copy any "Assets" folder to
the install layout.
The Script has also been updated to copy over the "Assets" folder in the
Engine Root to the install layout instead of an "EngineAssets" folder

* Updating References to EngineAssets source asset folder in code to be the Assets source folder

* Moved the Engine Source Asset folder of 'EngineAssets' to a new folder name of 'Assets'. This is inline with the naming scheme we use for Gem asset folders

* Adding the EngineFinder.cmake to the AutomatedTesting project to allow it to work in a project centric manner

* Updating the LyTestTools copy_assets_to_project function to be able to copy assets with folders to the temporary project root
Fixed an issue in LyTestTools where the temporary log directory could have shutil.rmtree being called twice on it leading to an exception which fails an automated test

Updated the asset_procesor_gui_tests_2 AddScanFolder test to not use the
output prefix, but instead place the source asset root into a
subdirectory

* Correct the AssetProcessorPlatformConfig Scan Folders for the EngineAssets directory to point at the Assets directory

* Updated the asset procesor batch dependency test scan folder to point at the 'Assets' folder instead of 'EngineAssets'
This commit is contained in:
lumberyard-employee-dm
2021-04-28 21:38:43 -05:00
committed by GitHub
parent ed74bb9166
commit 3dec5d3b71
2087 changed files with 1208 additions and 3655 deletions
@@ -470,7 +470,7 @@ void ApplicationManager::PopulateApplicationDependencies()
QDir assetRoot;
AssetUtilities::ComputeAssetRoot(assetRoot);
QString globalConfigPath = assetRoot.filePath("AssetProcessorPlatformConfig.setreg");
QString globalConfigPath = assetRoot.filePath("Registry/AssetProcessorPlatformConfig.setreg");
m_filesOfInterest.push_back(globalConfigPath);
QString gamePlatformConfigPath = QDir(AssetUtilities::ComputeProjectPath()).filePath("AssetProcessorGamePlatformConfig.setreg");
@@ -216,10 +216,6 @@ namespace AssetProcessor
{
scanFolderEntry.m_watchPath = value;
}
else if (valueName == "output")
{
scanFolderEntry.m_outputPrefix = value;
}
else if (valueName == "display" && !value.empty())
{
scanFolderEntry.m_scanFolderDisplayName = value;
@@ -784,7 +780,6 @@ namespace AssetProcessor
scanFolder,
AZStd::string::format("ScanFolderParam %zu", idx).c_str(),
AZStd::string::format("SF%zu", idx).c_str(),
"",
false,
true,
platforms,
@@ -1079,10 +1074,6 @@ namespace AssetProcessor
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
PopulatePlatformsForScanFolder(platforms, includeIdentifiers, excludeIdentifiers);
// Normalize the OutputPrefix to use PosixPathSeparators
scanFolderEntry.m_outputPrefix = AZ::IO::PathView(scanFolderEntry.m_outputPrefix, AZ::IO::PosixPathSeparator).LexicallyNormal().String();
const bool isEngineRoot = scanFolderEntry.m_watchPath == engineRoot;
// If the scan folder happens to be the engine root, it is not recursive
scanFolderEntry.m_isRecursive = scanFolderEntry.m_isRecursive && !isEngineRoot;
@@ -1093,7 +1084,6 @@ namespace AssetProcessor
QString::fromUtf8(scanFolderEntry.m_watchPath.c_str(), aznumeric_cast<int>(scanFolderEntry.m_watchPath.Native().size())),
QString::fromUtf8(scanFolderEntry.m_scanFolderDisplayName.c_str(), aznumeric_cast<int>(scanFolderEntry.m_scanFolderDisplayName.size())),
QString::fromUtf8(scanFolderEntry.m_scanFolderIdentifier.c_str(), aznumeric_cast<int>(scanFolderEntry.m_scanFolderIdentifier.size())),
QString::fromUtf8(scanFolderEntry.m_outputPrefix.c_str(), aznumeric_cast<int>(scanFolderEntry.m_outputPrefix.size())),
isEngineRoot,
scanFolderEntry.m_isRecursive,
platforms,
@@ -1318,7 +1308,7 @@ namespace AssetProcessor
}
}
bool PlatformConfiguration::ConvertToRelativePath(QString fullFileName, QString& databaseSourceName, QString& scanFolderName, bool includeOutputPrefix) const
bool PlatformConfiguration::ConvertToRelativePath(QString fullFileName, QString& databaseSourceName, QString& scanFolderName) const
{
const ScanFolderInfo* info = GetScanFolderForFile(fullFileName);
@@ -1327,13 +1317,13 @@ namespace AssetProcessor
scanFolderName = info->ScanPath();
scanFolderName.replace(AZ_WRONG_DATABASE_SEPARATOR, AZ_CORRECT_DATABASE_SEPARATOR);
return ConvertToRelativePath(fullFileName, info, databaseSourceName, includeOutputPrefix);
return ConvertToRelativePath(fullFileName, info, databaseSourceName);
}
// did not find it.
return false;
}
bool PlatformConfiguration::ConvertToRelativePath(const QString& fullFileName, const ScanFolderInfo* scanFolderInfo, QString& databaseSourceName, bool includeOutputPrefix)
bool PlatformConfiguration::ConvertToRelativePath(const QString& fullFileName, const ScanFolderInfo* scanFolderInfo, QString& databaseSourceName)
{
if(!scanFolderInfo)
{
@@ -1346,20 +1336,7 @@ namespace AssetProcessor
relPath = fullFileName.right(fullFileName.length() - scanFolderInfo->ScanPath().length() - 1); // also eat the slash, hence -1
}
if ((scanFolderInfo->GetOutputPrefix().isEmpty()) || (!includeOutputPrefix))
{
databaseSourceName = relPath;
}
else
{
databaseSourceName = scanFolderInfo->GetOutputPrefix();
if (!relPath.isEmpty())
{
databaseSourceName += '/';
databaseSourceName += relPath;
}
}
databaseSourceName = relPath;
databaseSourceName.replace(AZ_WRONG_DATABASE_SEPARATOR, AZ_CORRECT_DATABASE_SEPARATOR);
@@ -1380,11 +1357,6 @@ namespace AssetProcessor
return QString();
}
QString tempRelativeName(relativeName);
//if relative path starts with the output prefix than remove it first
if (!scanFolderInfo.GetOutputPrefix().isEmpty() && tempRelativeName.startsWith(scanFolderInfo.GetOutputPrefix(), Qt::CaseInsensitive))
{
tempRelativeName = tempRelativeName.right(tempRelativeName.length() - scanFolderInfo.GetOutputPrefix().length() - 1); // also eat the slash, hence -1
}
if ((!scanFolderInfo.RecurseSubFolders()) && (tempRelativeName.contains('/')))
{
@@ -1418,11 +1390,6 @@ namespace AssetProcessor
QString tempRelativeName(relativeName);
//if relative path starts with the output prefix than remove it first
if (!scanFolderInfo.GetOutputPrefix().isEmpty() && tempRelativeName.startsWith(scanFolderInfo.GetOutputPrefix(), Qt::CaseInsensitive))
{
tempRelativeName = tempRelativeName.right(tempRelativeName.length() - scanFolderInfo.GetOutputPrefix().length() - 1); // also eat the slash, hence -1
}
if ((!scanFolderInfo.RecurseSubFolders()) && (tempRelativeName.contains('/')))
{
// the name is a deeper relative path, but we don't recurse this scan folder, so it can't win
@@ -1566,7 +1533,6 @@ namespace AssetProcessor
// Watched folder: (absolute path to the gem /Assets/ folder) MUST BE CORRECT CASE
// Display name: "Gems/GemName/Assets" // uppercase, for human eyes
// portable Key: "gemassets-(UUID Of Gem)"
// Output Prefix: "" // empty string - this means put it in @assets@ as per default
// Is Root: False
// Recursive: True
QString gemFolder = gemDir.absoluteFilePath(AzFramework::GemInfo::GetGemAssetFolder());
@@ -1576,7 +1542,6 @@ namespace AssetProcessor
QString assetBrowserDisplayName = AzFramework::GemInfo::GetGemAssetFolder(); // Gems always use assets folder as their displayname...
QString portableKey = QString("gemassets-%1").arg(gemNameAsUuid);
QString outputPrefix; // empty intentionally here
bool isRoot = false;
bool isRecursive = true;
gemOrder++;
@@ -1586,7 +1551,6 @@ namespace AssetProcessor
gemFolder,
assetBrowserDisplayName,
portableKey,
outputPrefix,
isRoot,
isRecursive,
platforms,
@@ -128,7 +128,6 @@ namespace AssetProcessor
AZ::IO::Path m_watchPath{ AZ::IO::PosixPathSeparator };
AZStd::vector<AZStd::string> m_includeIdentifiers;
AZStd::vector<AZStd::string> m_excludeIdentifiers;
AZStd::string m_outputPrefix;
int m_scanOrder{};
bool m_isRecursive{};
};
@@ -290,10 +289,9 @@ namespace AssetProcessor
//! ----> [textures/texture1.tga] found under [c:/dev/mygame]
//! c:/dev/engine/models/box01.mdl
//! ----> [models/box01.mdl] found under[c:/dev/engine]
//! note that this does return a database source path by default, which includes the output prefix of the scan folder if present
//! You can override this by setting includeOutputPrefix = false;
bool ConvertToRelativePath(QString fullFileName, QString& databaseSourceName, QString& scanFolderName, bool includeOutputPrefix = true) const;
static bool ConvertToRelativePath(const QString& fullFileName, const ScanFolderInfo* scanFolderInfo, QString& databaseSourceName, bool includeOutputPrefix = true);
//! note that this does return a database source path by default
bool ConvertToRelativePath(QString fullFileName, QString& databaseSourceName, QString& scanFolderName) const;
static bool ConvertToRelativePath(const QString& fullFileName, const ScanFolderInfo* scanFolderInfo, QString& databaseSourceName);
//! given a full file name (assumed already fed through the normalization funciton), return the first matching scan folder
const AssetProcessor::ScanFolderInfo* GetScanFolderForFile(const QString& fullFileName) const;
@@ -562,8 +562,8 @@ namespace AssetUtilities
}
else
{
AZ_Warning(AssetProcessor::ConsoleChannel, false, "Invalid server address, please check the AssetProcessorPlatformConfig.setreg file \
to ensure that the address is correct. Asset Processor won't be running in server mode.");
AZ_Warning(AssetProcessor::ConsoleChannel, false, "Invalid server address, please check the AssetProcessorPlatformConfig.setreg file"
" to ensure that the address is correct. Asset Processor won't be running in server mode.");
}
break;
@@ -804,7 +804,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
{
QThread::msleep(AssetUtilsInternal::g_RetryWaitInterval);
}
} while (!timer.hasExpired(waitTimeinSeconds * 1000));
AZ_TracePrintf(AssetProcessor::ConsoleChannel, "Failed to create output directory: %s after %d retries.\n", dir.absolutePath().toUtf8().data(), retries);
@@ -1075,7 +1075,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
{
// it is assumed that m_fingerprintFilesList contains the original file and all dependencies, and is in a stable order without duplicates
// CRC32 is not an effective hash for this purpose, so we will build a string and then use SHA1 on it.
// to avoid resizing and copying repeatedly we will keep track of the largest reserved capacity ever needed for this function, and reserve that much data
static size_t s_largestFingerprintCapacitySoFar = 1;
AZStd::string fingerprintString;
@@ -1207,7 +1207,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
// the navigation system can still be writing to this file when hashing begins, causing the EoF marker to change.
AZ::IO::SizeType remainingToRead = AZStd::min(readStream.GetLength() - readStream.GetCurPos(), aznumeric_cast<AZ::IO::SizeType>(AZ_ARRAY_SIZE(buffer)));
bytesRead = readStream.Read(remainingToRead, buffer);
if(bytesReadOut)
{
*bytesReadOut += bytesRead;
@@ -1234,7 +1234,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
}
std::uint64_t AdjustTimestamp(QDateTime timestamp)
{
{
timestamp = timestamp.toUTC();
auto timeMilliseconds = timestamp.toMSecsSinceEpoch();
@@ -1250,7 +1250,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
{
bool fileFound = false;
AssetProcessor::FileStateInfo fileStateInfo;
auto* fileStateInterface = AZ::Interface<AssetProcessor::IFileStateRequests>::Get();
if (fileStateInterface)
{
@@ -1277,7 +1277,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
{
fileIdentifier = AdjustTimestamp(lastModifiedTime);
}
// its possible that the dependency has moved to a different file with the same modtime/hash
// so we add the size of it too.
// its also possible that it moved to a different file with the same modtime/hash AND size,
@@ -1324,7 +1324,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
}
QDir tempRoot;
if (!CreateTempRootFolder(startFolder, tempRoot))
{
result.clear();