Integrating latest from github/staging
Integrating up through commit 5e1bdae
This commit is contained in:
@@ -12,11 +12,12 @@
|
||||
|
||||
#include "native/AssetManager/AssetCatalog.h"
|
||||
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/std/string/wildcard.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzToolsFramework/API/AssetDatabaseBus.h>
|
||||
#include <AzFramework/FileTag/FileTagBus.h>
|
||||
#include <AzFramework/FileTag/FileTag.h>
|
||||
#include <AzToolsFramework/API/AssetDatabaseBus.h>
|
||||
|
||||
#include <QElapsedTimer>
|
||||
#include "PathDependencyManager.h"
|
||||
@@ -45,14 +46,12 @@ namespace AssetProcessor
|
||||
m_absoluteDevFolderPath[0] = 0;
|
||||
m_absoluteDevGameFolderPath[0] = 0;
|
||||
|
||||
AZStd::string appRoot;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(appRoot, &AzFramework::ApplicationRequests::GetAppRoot);
|
||||
azstrcpy(m_absoluteDevFolderPath, AZ_MAX_PATH_LEN, appRoot.c_str());
|
||||
|
||||
AZStd::string gameFolderPath;
|
||||
AzFramework::StringFunc::Path::Join(appRoot.c_str(), AssetUtilities::ComputeGameName().toUtf8().constData(), gameFolderPath);
|
||||
azstrcpy(m_absoluteDevGameFolderPath, AZ_MAX_PATH_LEN, gameFolderPath.c_str());
|
||||
AZStd::string engineRoot;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
|
||||
azstrcpy(m_absoluteDevFolderPath, AZ_MAX_PATH_LEN, engineRoot.c_str());
|
||||
|
||||
AZStd::string gameFolderPath{AssetUtilities::ComputeProjectPath().toUtf8().constData()};
|
||||
azstrcpy(m_absoluteDevGameFolderPath, AZ_MAX_PATH_LEN, gameFolderPath.c_str());
|
||||
|
||||
AssetUtilities::ComputeProjectCacheRoot(m_cacheRootDir);
|
||||
|
||||
@@ -340,9 +339,13 @@ namespace AssetProcessor
|
||||
}
|
||||
else
|
||||
{
|
||||
auto settingsRegistry = AZ::SettingsRegistry::Get();
|
||||
AZ::SettingsRegistryInterface::FixedValueString cacheRootFolder;
|
||||
settingsRegistry->Get(cacheRootFolder, AZ::SettingsRegistryMergeUtils::FilePathKey_CacheRootFolder);
|
||||
|
||||
QString tempRegistryFile = QString("%1/%2").arg(workSpace).arg("assetcatalog.xml.tmp");
|
||||
QString platformGameDir = QString("%1/%2/").arg(m_cacheRoot.absoluteFilePath(platform)).arg(AssetUtilities::ComputeGameName().toLower());
|
||||
QString actualRegistryFile = QString("%1%2").arg(platformGameDir).arg("assetcatalog.xml");
|
||||
QString platformCacheDir = QString::fromUtf8(cacheRootFolder.c_str(), aznumeric_cast<int>(cacheRootFolder.size()));
|
||||
QString actualRegistryFile = QString("%1/%2").arg(platformCacheDir).arg("assetcatalog.xml");
|
||||
|
||||
AZ_TracePrintf(AssetProcessor::DebugChannel, "Creating asset catalog: %s --> %s\n", tempRegistryFile.toUtf8().constData(), actualRegistryFile.toUtf8().constData());
|
||||
AZ::IO::HandleType fileHandle = AZ::IO::InvalidHandle;
|
||||
@@ -352,12 +355,12 @@ namespace AssetProcessor
|
||||
AZ::IO::FileIOBase::GetInstance()->Close(fileHandle);
|
||||
|
||||
// Make sure that the destination folder of the registry file exists
|
||||
QDir registryDir(platformGameDir);
|
||||
QDir registryDir(platformCacheDir);
|
||||
if (!registryDir.exists())
|
||||
{
|
||||
QString absPath = registryDir.absolutePath();
|
||||
bool makeDirResult = AZ::IO::SystemFile::CreateDir(absPath.toUtf8().constData());
|
||||
AZ_Warning(AssetProcessor::ConsoleChannel, makeDirResult, "Failed create folder %s", platformGameDir.toUtf8().constData());
|
||||
AZ_Warning(AssetProcessor::ConsoleChannel, makeDirResult, "Failed create folder %s", platformCacheDir.toUtf8().constData());
|
||||
}
|
||||
|
||||
// if we succeeded in doing this, then use "rename" to move the file over the previous copy.
|
||||
@@ -488,9 +491,7 @@ namespace AssetProcessor
|
||||
AZ::Data::AssetId assetId(combined.m_sourceGuid, combined.m_subID);
|
||||
|
||||
// relative file path is gotten by removing the platform and game from the product name
|
||||
QString relativeProductPath = combined.m_productName.c_str();
|
||||
relativeProductPath = relativeProductPath.right(relativeProductPath.length() - relativeProductPath.indexOf('/') - 1); // remove PLATFORM and an extra slash
|
||||
relativeProductPath = relativeProductPath.right(relativeProductPath.length() - relativeProductPath.indexOf('/') - 1); // remove GAMENAME and an extra slash
|
||||
QString relativeProductPath = AssetUtilities::StripAssetPlatform(combined.m_productName);
|
||||
QString fullProductPath = m_cacheRoot.absoluteFilePath(combined.m_productName.c_str());
|
||||
|
||||
AZ::Data::AssetInfo info;
|
||||
@@ -1133,31 +1134,17 @@ namespace AssetProcessor
|
||||
return assetInfo;
|
||||
}
|
||||
|
||||
bool ConvertDatabaseProductPathToProductFileName(QString dbPath, QString& productFileName)
|
||||
bool ConvertDatabaseProductPathToProductFilename(AZStd::string_view dbPath, QString& productFileName)
|
||||
{
|
||||
QString gameName = AssetUtilities::ComputeGameName();
|
||||
bool result = false;
|
||||
int gameNameIndex = dbPath.indexOf(gameName, 0, Qt::CaseInsensitive);
|
||||
if (gameNameIndex != -1)
|
||||
// Always strip the leading directory from the product path
|
||||
// The leading directory can be either an asset platform path or a subfolder
|
||||
AZ::StringFunc::TokenizeNext(dbPath, AZ_CORRECT_AND_WRONG_FILESYSTEM_SEPARATOR);
|
||||
if (!dbPath.empty())
|
||||
{
|
||||
//we will now remove the gameName and the native separator to get the assetId
|
||||
dbPath.remove(0, gameNameIndex + gameName.length() + 1); // adding one for the native separator also
|
||||
result = true;
|
||||
productFileName = QString::fromUtf8(dbPath.data(), aznumeric_cast<int>(dbPath.size()));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//we will just remove the platform and the native separator to get the assetId
|
||||
int separatorIndex = dbPath.indexOf("/");
|
||||
if (separatorIndex != -1)
|
||||
{
|
||||
dbPath.remove(0, separatorIndex + 1); // adding one for the native separator
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
productFileName = dbPath;
|
||||
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
|
||||
void AssetCatalog::ProcessGetRelativeProductPathFromFullSourceOrProductPathRequest(const AZStd::string& fullPath, AZStd::string& relativeProductPath)
|
||||
@@ -1166,7 +1153,7 @@ namespace AssetProcessor
|
||||
QString normalizedSourceOrProductPath = AssetUtilities::NormalizeFilePath(sourceOrProductPath);
|
||||
|
||||
QString productFileName;
|
||||
int resultCode = 0;
|
||||
bool resultCode = false;
|
||||
QDir inputPath(normalizedSourceOrProductPath);
|
||||
|
||||
AZ_TracePrintf(AssetProcessor::DebugChannel, "ProcessGetRelativeProductPath: %s...\n", sourceOrProductPath.toUtf8().constData());
|
||||
@@ -1175,7 +1162,7 @@ namespace AssetProcessor
|
||||
{
|
||||
//if the path coming in is already a relative path,we just send it back
|
||||
productFileName = sourceOrProductPath;
|
||||
resultCode = 1;
|
||||
resultCode = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1196,7 +1183,7 @@ namespace AssetProcessor
|
||||
// Now after removing the cache root,normalizedInputAssetPath can either be $Platform/$Game/xxx/yyy or something like $Platform/zzz
|
||||
// and the corresponding assetId have to be either xxx/yyy or zzz
|
||||
|
||||
resultCode = ConvertDatabaseProductPathToProductFileName(normalizedSourceOrProductPath, productFileName);
|
||||
resultCode = ConvertDatabaseProductPathToProductFilename(normalizedSourceOrProductPath.toUtf8().data(), productFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1224,12 +1211,12 @@ namespace AssetProcessor
|
||||
|
||||
if (m_db->GetProductsBySourceName(relativeName, products))
|
||||
{
|
||||
resultCode = ConvertDatabaseProductPathToProductFileName(products[0].m_productName.c_str(), productFileName);
|
||||
resultCode = ConvertDatabaseProductPathToProductFilename(products[0].m_productName, productFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
productFileName = relativeName;
|
||||
resultCode = 1;
|
||||
resultCode = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1242,7 +1229,6 @@ namespace AssetProcessor
|
||||
}
|
||||
|
||||
relativeProductPath = productFileName.toUtf8().data();
|
||||
|
||||
}
|
||||
|
||||
void AssetCatalog::ProcessGetFullSourcePathFromRelativeProductPathRequest(const AZStd::string& relPath, AZStd::string& fullSourcePath)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace AssetProcessor
|
||||
PathDependencyManager::PathDependencyManager(AZStd::shared_ptr<AssetDatabaseConnection> stateData, PlatformConfiguration* platformConfig)
|
||||
: m_stateData(stateData), m_platformConfig(platformConfig)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void PathDependencyManager::SaveUnresolvedDependenciesToDatabase(AssetBuilderSDK::ProductPathDependencySet& unresolvedDependencies, const AzToolsFramework::AssetDatabase::ProductDatabaseEntry& productEntry, const AZStd::string& platform)
|
||||
@@ -55,7 +55,7 @@ namespace AssetProcessor
|
||||
// other problems. This string says that something went wrong in this function.
|
||||
AZStd::string("INVALID_PATH"),
|
||||
dependencyType);
|
||||
|
||||
|
||||
AZStd::string path = AssetUtilities::NormalizeFilePath(unresolvedPathDep.m_dependencyPath.c_str()).toUtf8().constData();
|
||||
bool isExactDependency = IsExactDependency(path);
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace AssetProcessor
|
||||
dependencyContainer.push_back(placeholderDependency);
|
||||
}
|
||||
|
||||
if(!m_stateData->UpdateProductDependencies(dependencyContainer))
|
||||
if (!m_stateData->UpdateProductDependencies(dependencyContainer))
|
||||
{
|
||||
AZ_Error(AssetProcessor::ConsoleChannel, false, "Failed to save unresolved dependencies to database for product %d (%s)",
|
||||
productEntry.m_productID, productEntry.m_productName.c_str());
|
||||
@@ -111,8 +111,8 @@ namespace AssetProcessor
|
||||
const DependencyProductMap& excludedPathDependencyIds = handleProductDependencies ? exclusionMaps.m_productPathDependencyIds : exclusionMaps.m_sourcePathDependencyIds;
|
||||
const DependencyProductMap& excludedWildcardPathDependencyIds = handleProductDependencies ? exclusionMaps.m_wildcardProductPathDependencyIds : exclusionMaps.m_wildcardSourcePathDependencyIds;
|
||||
|
||||
// strip path of /<platform>/<project>/
|
||||
AZStd::string strippedPath = handleProductDependencies ? StripPlatformAndProject(assetName) : sourceEntry.m_sourceName;
|
||||
// strip asset platform from path
|
||||
AZStd::string strippedPath = handleProductDependencies ? AssetUtilities::StripAssetPlatform(assetName).toUtf8().constData() : sourceEntry.m_sourceName;
|
||||
SanitizeForDatabase(strippedPath);
|
||||
|
||||
auto unresolvedIter = excludedPathDependencyIds.find(ExcludedDependenciesSymbol + strippedPath);
|
||||
@@ -137,13 +137,6 @@ namespace AssetProcessor
|
||||
}
|
||||
}
|
||||
|
||||
AZStd::string PathDependencyManager::StripPlatformAndProject(AZStd::string_view productName)
|
||||
{
|
||||
auto nextSlash = productName.find('/'); // platform/
|
||||
nextSlash = productName.find('/', nextSlash + 1) + 1; // project/
|
||||
return productName.substr(nextSlash, productName.size() - nextSlash);
|
||||
}
|
||||
|
||||
PathDependencyManager::DependencyProductMap& PathDependencyManager::SelectMap(MapSet& mapSet, bool wildcard, AzToolsFramework::AssetDatabase::ProductDependencyDatabaseEntry::DependencyType type)
|
||||
{
|
||||
const bool isSource = type == AzToolsFramework::AssetDatabase::ProductDependencyDatabaseEntry::DependencyType::ProductDep_SourceFile;
|
||||
@@ -193,7 +186,7 @@ namespace AssetProcessor
|
||||
|
||||
void PathDependencyManager::NotifyResolvedDependencies(const AzToolsFramework::AssetDatabase::ProductDependencyDatabaseEntryContainer& dependencyContainer) const
|
||||
{
|
||||
if(!m_dependencyResolvedCallback)
|
||||
if (!m_dependencyResolvedCallback)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -226,7 +219,7 @@ namespace AssetProcessor
|
||||
const bool isExactDependency = IsExactDependency(productDependencyDatabaseEntry.m_unresolvedPath);
|
||||
AZ::s64 dependencyId = isExactDependency ? productDependencyDatabaseEntry.m_productDependencyID : AzToolsFramework::AssetDatabase::InvalidEntryId;
|
||||
|
||||
if(isSourceDependency && !isExactDependency && matchedPath == sourceNameWithScanFolder)
|
||||
if (isSourceDependency && !isExactDependency && matchedPath == sourceNameWithScanFolder)
|
||||
{
|
||||
// Since we did a search for the source 2 different ways, filter one out
|
||||
// Scanfolder-prefixes are only for exact dependencies
|
||||
@@ -239,14 +232,14 @@ namespace AssetProcessor
|
||||
AZStd::vector<AZStd::pair<DependencyProductIdInfo, bool>> exclusions; // bool = is exact dependency
|
||||
GetMatchedExclusions(sourceEntry, matchedProduct, exclusions, productDependencyDatabaseEntry.m_dependencyType, exclusionMaps);
|
||||
|
||||
if(!exclusions.empty())
|
||||
if (!exclusions.empty())
|
||||
{
|
||||
bool isExclusionForThisProduct = false;
|
||||
bool isExclusionExact = false;
|
||||
|
||||
for (const auto& exclusionPair : exclusions)
|
||||
{
|
||||
if(exclusionPair.first.m_productId == productDependencyDatabaseEntry.m_productPK && exclusionPair.first.m_platform == productDependencyDatabaseEntry.m_platform)
|
||||
if (exclusionPair.first.m_productId == productDependencyDatabaseEntry.m_productPK && exclusionPair.first.m_platform == productDependencyDatabaseEntry.m_platform)
|
||||
{
|
||||
isExclusionExact = exclusionPair.second;
|
||||
isExclusionForThisProduct = true;
|
||||
@@ -254,7 +247,7 @@ namespace AssetProcessor
|
||||
}
|
||||
}
|
||||
|
||||
if(isExclusionForThisProduct)
|
||||
if (isExclusionForThisProduct)
|
||||
{
|
||||
if (isExactDependency && isExclusionExact)
|
||||
{
|
||||
@@ -314,8 +307,8 @@ namespace AssetProcessor
|
||||
{
|
||||
const AZStd::string& productName = productEntry.m_productName;
|
||||
|
||||
// strip path of /<platform>/<project>/
|
||||
AZStd::string strippedPath = StripPlatformAndProject(productName);
|
||||
// strip path of the <platform>/
|
||||
AZStd::string strippedPath = AssetUtilities::StripAssetPlatform(productName).toUtf8().constData();
|
||||
SanitizeForDatabase(strippedPath);
|
||||
|
||||
searchPaths.push_back(strippedPath);
|
||||
@@ -347,7 +340,7 @@ namespace AssetProcessor
|
||||
AzToolsFramework::AssetDatabase::ProductDatabaseEntryContainer matchedProducts;
|
||||
|
||||
// Figure out the list of products to work with, for a source match, use all the products, otherwise just use the matched products
|
||||
if(isSourceDependency)
|
||||
if (isSourceDependency)
|
||||
{
|
||||
matchedProducts = products;
|
||||
}
|
||||
@@ -357,11 +350,11 @@ namespace AssetProcessor
|
||||
{
|
||||
const AZStd::string& productName = productEntry.m_productName;
|
||||
|
||||
// strip path of /<platform>/<project>/
|
||||
AZStd::string strippedPath = StripPlatformAndProject(productName);
|
||||
// strip path of the leading asset platform /<platform>
|
||||
AZStd::string strippedPath = AssetUtilities::StripAssetPlatform(productName).toUtf8().constData();
|
||||
SanitizeForDatabase(strippedPath);
|
||||
|
||||
if(strippedPath == matchedPath)
|
||||
if (strippedPath == matchedPath)
|
||||
{
|
||||
matchedProducts.push_back(productEntry);
|
||||
}
|
||||
@@ -373,7 +366,7 @@ namespace AssetProcessor
|
||||
}
|
||||
|
||||
// Save everything to the db
|
||||
if(!m_stateData->UpdateProductDependencies(dependencyContainer))
|
||||
if (!m_stateData->UpdateProductDependencies(dependencyContainer))
|
||||
{
|
||||
AZ_Error("PathDependencyManager", false, "Failed to update product dependencies");
|
||||
}
|
||||
@@ -386,7 +379,7 @@ namespace AssetProcessor
|
||||
|
||||
void CleanupPathDependency(AssetBuilderSDK::ProductPathDependency& pathDependency)
|
||||
{
|
||||
if(pathDependency.m_dependencyType == AssetBuilderSDK::ProductPathDependencyType::SourceFile)
|
||||
if (pathDependency.m_dependencyType == AssetBuilderSDK::ProductPathDependencyType::SourceFile)
|
||||
{
|
||||
// Nothing to cleanup if the dependency type was already pointing at source.
|
||||
return;
|
||||
@@ -411,7 +404,7 @@ namespace AssetProcessor
|
||||
{
|
||||
const AZ::Data::ProductDependencyInfo::ProductDependencyFlags productDependencyFlags =
|
||||
AZ::Data::ProductDependencyInfo::CreateFlags(AZ::Data::AssetLoadBehavior::NoLoad);
|
||||
const QString gameName = AssetUtilities::ComputeGameName();
|
||||
|
||||
AZStd::vector<AssetBuilderSDK::ProductDependency> excludedDeps;
|
||||
|
||||
// Check the path dependency set and find any conflict (include and exclude the same path dependency)
|
||||
@@ -458,9 +451,8 @@ namespace AssetProcessor
|
||||
{
|
||||
AzToolsFramework::AssetDatabase::ProductDatabaseEntryContainer productInfoContainer;
|
||||
QString productNameWithPlatform = QString("%1%2%3").arg(platform.c_str(), AZ_CORRECT_DATABASE_SEPARATOR_STRING, dependencyPathSearch.c_str());
|
||||
QString productNameWithPlatformAndGameName = QString("%1%2%3%2%4").arg(platform.c_str(), AZ_CORRECT_DATABASE_SEPARATOR_STRING, gameName, dependencyPathSearch.c_str());
|
||||
|
||||
if (AzFramework::StringFunc::Equal(productNameWithPlatformAndGameName.toUtf8().data(), productName.c_str()))
|
||||
if (AzFramework::StringFunc::Equal(productNameWithPlatform.toUtf8().data(), productName.c_str()))
|
||||
{
|
||||
AZ_Warning(AssetProcessor::ConsoleChannel, false,
|
||||
"Invalid dependency: Product Asset ( %s ) has listed itself as one of its own Product Dependencies.",
|
||||
@@ -471,18 +463,15 @@ namespace AssetProcessor
|
||||
|
||||
if (isExactDependency)
|
||||
{
|
||||
m_stateData->GetProductsByProductName(productNameWithPlatformAndGameName, productInfoContainer);
|
||||
// Not all products will be in the game subfolder.
|
||||
// Items in dev, like bootstrap.cfg, end up in just the root platform folder.
|
||||
// These two checks search for products in both location.
|
||||
// Example: If a path dependency was just "bootstrap.cfg" in SamplesProject on PC, this would search both
|
||||
// "cache/SamplesProject/pc/bootstrap.cfg" and "cache/SamplesProject/pc/SamplesProject/bootstrap.cfg".
|
||||
// Search for products in the cache platform folder
|
||||
// Example: If a path dependency is "test1.asset" in SamplesProject on PC, this would search
|
||||
// "SamplesProject/Cache/pc/test1.asset"
|
||||
m_stateData->GetProductsByProductName(productNameWithPlatform, productInfoContainer);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stateData->GetProductsLikeProductName(productNameWithPlatformAndGameName, AzToolsFramework::AssetDatabase::AssetDatabaseConnection::LikeType::Raw, productInfoContainer);
|
||||
m_stateData->GetProductsLikeProductName(productNameWithPlatform, AzToolsFramework::AssetDatabase::AssetDatabaseConnection::LikeType::Raw, productInfoContainer);
|
||||
}
|
||||
|
||||
// See if path matches any product files
|
||||
|
||||
@@ -76,9 +76,6 @@ namespace AssetProcessor
|
||||
/// Returns false if a path contains wildcards, true otherwise
|
||||
static bool IsExactDependency(AZStd::string_view path);
|
||||
|
||||
/// Removes /platform/project/ from the start of a product path
|
||||
static AZStd::string StripPlatformAndProject(AZStd::string_view relativeProductPath);
|
||||
|
||||
/// Prefixes the scanFolderId to the relativePath
|
||||
AZStd::string ToScanFolderPrefixedPath(int scanFolderId, const char* relativePath) const;
|
||||
|
||||
|
||||
@@ -67,8 +67,7 @@ namespace AssetProcessor
|
||||
if (AssetUtilities::ComputeAssetRoot(assetRoot))
|
||||
{
|
||||
azstrcpy(m_absoluteDevFolderPath, AZ_MAX_PATH_LEN, assetRoot.absolutePath().toUtf8().constData());
|
||||
QString absoluteDevGameFolderPath = assetRoot.absoluteFilePath(AssetUtilities::ComputeGameName());
|
||||
azstrcpy(m_absoluteDevGameFolderPath, AZ_MAX_PATH_LEN, absoluteDevGameFolderPath.toUtf8().constData());
|
||||
azstrcpy(m_absoluteDevGameFolderPath, AZ_MAX_PATH_LEN, AssetUtilities::ComputeProjectPath().toUtf8().constData());
|
||||
}
|
||||
|
||||
using namespace AZStd::placeholders;
|
||||
@@ -1067,7 +1066,7 @@ namespace AssetProcessor
|
||||
AZStd::vector<AZStd::vector<AZ::u32> > newLegacySubIDs; // each product has a vector of legacy subids;
|
||||
for (const AssetBuilderSDK::JobProduct& product : processedAsset.m_response.m_outputProducts)
|
||||
{
|
||||
// prior products, if present, will be in the form "platform/game/subfolders/productfile", convert
|
||||
// prior products, if present, will be in the form "platform/subfolders/productfile", convert
|
||||
// our new products to the same thing by removing the cache root
|
||||
QString newProductName = product.m_productFileName.c_str();
|
||||
newProductName = AssetUtilities::NormalizeFilePath(newProductName);
|
||||
@@ -1093,7 +1092,8 @@ namespace AssetProcessor
|
||||
//This is the legacy product guid, its only use is for backward compatibility as before the asset id's guid was created off of the relative product name.
|
||||
// Right now when we query for an asset guid we first match on the source guid which is correct and secondarily match on the product guid. Eventually this will go away.
|
||||
newProductName = newProductName.right(newProductName.length() - newProductName.indexOf('/') - 1); // remove PLATFORM and an extra slash
|
||||
newProductName = newProductName.right(newProductName.length() - newProductName.indexOf('/') - 1); // remove GAMENAME and an extra slash
|
||||
// Strip the <asset_platform> from the front of a relative product path
|
||||
newProductName = AssetUtilities::StripAssetPlatform(newProductName.toUtf8().constData());
|
||||
newProduct.m_legacyGuid = AZ::Uuid::CreateName(newProductName.toUtf8().constData());
|
||||
|
||||
//push back the new product into the new products list
|
||||
@@ -1115,7 +1115,7 @@ namespace AssetProcessor
|
||||
// we need to delete these product files from the disk as they no longer exist and inform everyone we did so
|
||||
for (const auto& priorProduct : priorProducts)
|
||||
{
|
||||
// product name will be in the form "platform/game/relativeProductPath"
|
||||
// product name will be in the form "platform/relativeProductPath"
|
||||
// and will always already be a lowercase string, because its relative to the cache.
|
||||
QString productName = priorProduct.m_productName.c_str();
|
||||
|
||||
@@ -1123,10 +1123,8 @@ namespace AssetProcessor
|
||||
// this is case sensitive since it refers to a real location on disk.
|
||||
QString fullProductPath = m_cacheRootDir.absoluteFilePath(productName);
|
||||
|
||||
// relative file path is gotten by removing the platform and game from the product name
|
||||
QString relativeProductPath = productName;
|
||||
relativeProductPath = relativeProductPath.right(relativeProductPath.length() - relativeProductPath.indexOf('/') - 1); // remove PLATFORM and an extra slash
|
||||
relativeProductPath = relativeProductPath.right(relativeProductPath.length() - relativeProductPath.indexOf('/') - 1); // remove GAMENAME and an extra slash
|
||||
// Strip the <asset_platform> from the front of a relative product path
|
||||
QString relativeProductPath = AssetUtilities::StripAssetPlatform(priorProduct.m_productName);
|
||||
|
||||
AZ::Data::AssetId assetId(source.m_sourceGuid, priorProduct.m_subID);
|
||||
|
||||
@@ -1302,16 +1300,15 @@ namespace AssetProcessor
|
||||
AzToolsFramework::AssetDatabase::ProductDatabaseEntry& newProduct = pair.first;
|
||||
AZStd::vector<AZ::u32>& subIds = newLegacySubIDs[productIdx];
|
||||
|
||||
// product name will be in the form "platform/game/relativeProductPath"
|
||||
// product name will be in the form "platform/relativeProductPath"
|
||||
QString productName = QString::fromUtf8(newProduct.m_productName.c_str());
|
||||
|
||||
// the full file path is gotten by adding the product name to the cache root
|
||||
QString fullProductPath = m_cacheRootDir.absoluteFilePath(productName);
|
||||
|
||||
// relative file path is gotten by removing the platform and game from the product name
|
||||
QString relativeProductPath = productName;
|
||||
relativeProductPath = relativeProductPath.right(relativeProductPath.length() - relativeProductPath.indexOf('/') - 1); // remove PLATFORM and an extra slash
|
||||
relativeProductPath = relativeProductPath.right(relativeProductPath.length() - relativeProductPath.indexOf('/') - 1); // remove GAMENAME and an extra slash
|
||||
// Strip the <asset_platform> from the front of a relative product path
|
||||
QString relativeProductPath = AssetUtilities::StripAssetPlatform(productName.toUtf8().constData());
|
||||
|
||||
AssetNotificationMessage message(relativeProductPath.toUtf8().constData(), AssetNotificationMessage::AssetChanged, newProduct.m_assetType, processedAsset.m_entry.m_platformInfo.m_identifier.c_str());
|
||||
AZ::Data::AssetId assetId(source.m_sourceGuid, newProduct.m_subID);
|
||||
@@ -1572,10 +1569,10 @@ namespace AssetProcessor
|
||||
// this might be interesting, but only if its a known product!
|
||||
// the dictionary in statedata stores only the relative path, not the platform.
|
||||
// which means right now we have, for example
|
||||
// d:/game/root/Cache/SamplesProject/IOS/SamplesProject/textures/favorite.tga
|
||||
// ^^^^^^^^^^^^ engine root
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cache root
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ platform root
|
||||
// d:/SamplesProject/Cache/ios/textures/favorite.tga
|
||||
// ^^^^^^^^^ projectroot
|
||||
// ^^^^^^^^^^^^^^^^^^^^^ cache root
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^ platform root
|
||||
{
|
||||
QMutexLocker locker(&m_processingJobMutex);
|
||||
auto found = m_processingProductInfoList.find(fullProductFile.toUtf8().constData());
|
||||
@@ -1596,7 +1593,7 @@ namespace AssetProcessor
|
||||
QString relativeProductFile = m_cacheRootDir.relativeFilePath(fullProductFile);
|
||||
|
||||
//platform
|
||||
QString platform = relativeProductFile;// currently <platform>/<gamename>/<relative_asset_path>
|
||||
QString platform = relativeProductFile;// currently <platform>/<relative_asset_path>
|
||||
platform = platform.left(platform.indexOf('/')); // also consume the extra slash - remove PLATFORM
|
||||
|
||||
//we are going to force the processor to re process the source file associated with this product
|
||||
@@ -1652,11 +1649,8 @@ namespace AssetProcessor
|
||||
}
|
||||
}
|
||||
|
||||
// currently <platform>/<gamename>/<relative_asset_path>
|
||||
// remove PLATFORM and GAMENAME so that we only have the relative asset path which should match the db
|
||||
QString relativePath(relativeProductFile);
|
||||
relativePath = relativePath.right(relativePath.length() - relativePath.indexOf('/') - 1); // also consume the extra slash - remove PLATFORM
|
||||
relativePath = relativePath.right(relativePath.length() - relativePath.indexOf('/') - 1); // also consume the extra slash - remove GAMENAME
|
||||
// Strip the <asset_platform> from the front of a relative product path
|
||||
QString relativePath = AssetUtilities::StripAssetPlatform(relativeProductFile.toUtf8().constData());
|
||||
|
||||
//set the fingerprint on the job that made this product
|
||||
for (auto& job : jobs)
|
||||
@@ -1687,9 +1681,9 @@ namespace AssetProcessor
|
||||
{
|
||||
bool successfullyRemoved = true;
|
||||
// delete the products.
|
||||
// products have names like "pc/SamplesProject/textures/blah.dds" and do include platform roots!
|
||||
// products have names like "pc/textures/blah.dds" and do include platform roots!
|
||||
// this means the actual full path is something like
|
||||
// [cache root] / [platform] / [product name]
|
||||
// [cache root] / [platform]
|
||||
for (const auto& product : products)
|
||||
{
|
||||
//get the source for this product
|
||||
@@ -1700,9 +1694,7 @@ namespace AssetProcessor
|
||||
}
|
||||
|
||||
QString fullProductPath = m_cacheRootDir.absoluteFilePath(product.m_productName.c_str());
|
||||
QString relativeProductPath(product.m_productName.c_str());
|
||||
relativeProductPath = relativeProductPath.right(relativeProductPath.length() - relativeProductPath.indexOf('/') - 1); // also consume the extra slash - remove PLATFORM
|
||||
relativeProductPath = relativeProductPath.right(relativeProductPath.length() - relativeProductPath.indexOf('/') - 1); // also consume the extra slash - remove GAMENAME
|
||||
QString relativeProductPath(AssetUtilities::StripAssetPlatform(product.m_productName));
|
||||
QFileInfo productFileInfo(fullProductPath);
|
||||
if (productFileInfo.exists())
|
||||
{
|
||||
@@ -2144,15 +2136,7 @@ namespace AssetProcessor
|
||||
pathRel = QString();
|
||||
}
|
||||
|
||||
if (jobDetails.m_scanFolder->IsRoot())
|
||||
{
|
||||
// stuff which is found in the root continues to go to the root, rather than GAMENAME folder...
|
||||
lowerCasePath += pathRel;
|
||||
}
|
||||
else
|
||||
{
|
||||
lowerCasePath += "/" + AssetUtilities::ComputeGameName() + pathRel;
|
||||
}
|
||||
lowerCasePath += pathRel;
|
||||
|
||||
lowerCasePath = lowerCasePath.toLower();
|
||||
jobDetails.m_destinationPath = m_cacheRootDir.absoluteFilePath(lowerCasePath);
|
||||
@@ -3471,8 +3455,16 @@ namespace AssetProcessor
|
||||
AssetProcessor::BuilderConfigurationRequestBus::Broadcast(&AssetProcessor::BuilderConfigurationRequests::UpdateJobDescriptor, jobDescriptor.m_jobKey, jobDescriptor);
|
||||
|
||||
const AssetBuilderSDK::PlatformInfo* const infoForPlatform = m_platformConfig->GetPlatformByIdentifier(jobDescriptor.GetPlatformIdentifier().c_str());
|
||||
AZ_Assert(infoForPlatform, "Somehow, a platform for a job was created in createjobs which cannot be found in the list of enabled platforms.");
|
||||
if (infoForPlatform)
|
||||
|
||||
if (!infoForPlatform)
|
||||
{
|
||||
AZ_Warning(AssetProcessor::ConsoleChannel, infoForPlatform,
|
||||
"CODE BUG: Builder %s emitted jobs for a platform that isn't enabled (%s). This job will be "
|
||||
"discarded. Builders should check the input list of platforms and only emit jobs for platforms "
|
||||
"in that list", builderInfo.m_name.c_str(), jobDescriptor.GetPlatformIdentifier().c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
{
|
||||
JobDetails newJob;
|
||||
newJob.m_assetBuilderDesc = builderInfo;
|
||||
@@ -4614,7 +4606,7 @@ namespace AssetProcessor
|
||||
QString metaDataFileName;
|
||||
QDir assetRoot;
|
||||
AssetUtilities::ComputeAssetRoot(assetRoot);
|
||||
QString gameName = AssetUtilities::ComputeGameName();
|
||||
QString projectPath = AssetUtilities::ComputeProjectPath();
|
||||
QString fullPathToFile(absolutePathToFileToCheck);
|
||||
|
||||
if (!m_cachedMetaFilesExistMap)
|
||||
@@ -4624,7 +4616,7 @@ namespace AssetProcessor
|
||||
for (int idx = 0; idx < m_platformConfig->MetaDataFileTypesCount(); idx++)
|
||||
{
|
||||
QPair<QString, QString> metaDataFileType = m_platformConfig->GetMetaDataFileTypeAt(idx);
|
||||
QString fullMetaPath = assetRoot.filePath(gameName + "/" + metaDataFileType.first);
|
||||
QString fullMetaPath = QDir(projectPath).filePath(metaDataFileType.first);
|
||||
if (QFileInfo::exists(fullMetaPath))
|
||||
{
|
||||
m_metaFilesWhichActuallyExistOnDisk.insert(metaDataFileType.first);
|
||||
@@ -4644,7 +4636,7 @@ namespace AssetProcessor
|
||||
|
||||
if (m_metaFilesWhichActuallyExistOnDisk.find(metaDataFileType.first) != m_metaFilesWhichActuallyExistOnDisk.end())
|
||||
{
|
||||
QString fullMetaPath = assetRoot.filePath(gameName + "/" + metaDataFileType.first);
|
||||
QString fullMetaPath = QDir(projectPath).filePath(metaDataFileType.first);
|
||||
metaDataFileName = fullMetaPath;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user