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
@@ -853,7 +853,7 @@ const char* ScriptSystemComponent::GetGroup() const
const char* AZ::ScriptSystemComponent::GetBrowserIcon() const
{
return "Editor/Icons/Components/LuaScript.svg";
return "Icons/Components/LuaScript.svg";
}
AZ::Uuid AZ::ScriptSystemComponent::GetComponentTypeId() const
@@ -654,7 +654,6 @@ namespace AZ::SettingsRegistryMergeUtils
if (registry.Get(engineRootPath, FilePathKey_EngineRootFolder))
{
AZ::IO::FixedMaxPath mergePath{ AZStd::move(engineRootPath) };
mergePath /= "Engine";
mergePath /= SettingsRegistryInterface::RegistryFolder;
registry.MergeSettingsFolder(mergePath.Native(), specializations, platform, "", scratchBuffer);
}
@@ -809,7 +809,7 @@ namespace AzFramework
#if defined(AZ_ENABLE_TRACING)
if (message.m_assetType == AZ::Data::s_invalidAssetType)
{
AZ_TracePrintf("AssetCatalog", "Registering asset \"%s\" via AssetSystem message, but type is not set.", relativePath.c_str());
AZ_TracePrintf("AssetCatalog", "Registering asset \"%s\" via AssetSystem message, but type is not set.\n", relativePath.c_str());
}
#endif
@@ -12,11 +12,13 @@
#include <AzCore/Serialization/Utils.h>
#include <AzCore/IO/FileIO.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/IO/SystemFile.h>
#include <AzCore/std/algorithm.h>
#include <AzCore/std/string/wildcard.h>
#include <AzCore/std/string/regex.h>
#include <AzCore/std/string/conversions.h>
#include <AzCore/Utils/Utils.h>
#include <AzCore/XML/rapidxml.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <AzFramework/Asset/FileTagAsset.h>
@@ -31,7 +33,7 @@ namespace AzFramework
const char* ExcludeFileName = "exclude";
const char* IncludeFileName = "include";
const char* FileTags[] = { "ignore", "error", "productdependency", "editoronly", "shader" };
const char EngineName[] = "Engine";
constexpr AZ::IO::PathView EngineAssetSourceRelPath = "Assets/Engine";
void LowerCaseFileTags(AZStd::vector<AZStd::string>& fileTags)
{
@@ -107,7 +109,7 @@ namespace AzFramework
}
AZ::Outcome<AZStd::string, AZStd::string> FileTagManager::AddTagsInternal(AZStd::string filePath, FileTagType fileTagType, AZStd::vector<AZStd::string> fileTags, AzFramework::FileTag::FilePatternType filePatternType)
{
{
if (!NormalizeFileAndLowerCaseTags(filePath, filePatternType, fileTags))
{
return AZ::Failure(AZStd::string::format("Unable to normalize file (%s). Unable to remove the file.\n", filePath.c_str()));
@@ -243,11 +245,10 @@ namespace AzFramework
AZStd::string FileTagQueryManager::GetDefaultFileTagFilePath(FileTagType fileTagType)
{
AZStd::string destinationFilePath;
const char* engineRoot = nullptr;
AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
AzFramework::StringFunc::Path::ConstructFull(engineRoot, EngineName, fileTagType == FileTagType::Exclude ? ExcludeFileName : IncludeFileName, AzFramework::FileTag::FileTagAsset::Extension(), destinationFilePath, true);
return destinationFilePath;
auto destinationFilePath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / EngineAssetSourceRelPath;
destinationFilePath /= fileTagType == FileTagType::Exclude ? ExcludeFileName : IncludeFileName;
destinationFilePath.ReplaceExtension(AzFramework::FileTag::FileTagAsset::Extension());
return destinationFilePath.String();
}
bool FileTagQueryManager::Load(const AZStd::string& filePath)
@@ -44,8 +44,8 @@ namespace AzFramework
"Network Binding", "The Network Binding component marks an entity as able to be replicated across the network")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Category, "Networking")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/NetBinding.svg")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/NetBinding.png")
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/NetBinding.svg")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/NetBinding.png")
->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://docs.aws.amazon.com/lumberyard/latest/userguide/component-network-binding.html")
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c));
}
@@ -81,7 +81,7 @@ namespace AzFramework
const char* SpawnableAssetHandler::GetBrowserIcon() const
{
return "Editor/Icons/Components/Viewport/EntityInSlice.png";
return "Icons/Components/Viewport/EntityInSlice.png";
}
void SpawnableAssetHandler::GetAssetTypeExtensions(AZStd::vector<AZStd::string>& extensions)
@@ -250,9 +250,9 @@ namespace AzQtComponents
// STYLESHEETIMAGES:something.txt
// UI:blah/blah.png
// EDITOR:blah/something.txt
QDir::addSearchPath("STYLESHEETIMAGES", appPath.filePath("Editor/Styles/StyleSheetImages"));
QDir::addSearchPath("UI", appPath.filePath("Editor/UI"));
QDir::addSearchPath("EDITOR", appPath.filePath("Editor"));
QDir::addSearchPath("STYLESHEETIMAGES", appPath.filePath("Assets/Editor/Styles/StyleSheetImages"));
QDir::addSearchPath("UI", appPath.filePath("Assets/Editor/UI"));
QDir::addSearchPath("EDITOR", appPath.filePath("Assets/Editor"));
}
}
@@ -388,8 +388,8 @@
<file>img/line.png</file>
</qresource>
<qresource>
<file alias="Editor/Style/EditorStylesheetVariables_Dark.json">../../../../Sandbox/Editor/Style/EditorStylesheetVariables_Dark.json</file>
<file alias="Editor/Style/NewEditorStylesheet.qss">../../../../Sandbox/Editor/Style/NewEditorStylesheet.qss</file>
<file alias="Assets/Editor/Style/EditorStylesheetVariables_Dark.json">../../../../Sandbox/Editor/Style/EditorStylesheetVariables_Dark.json</file>
<file alias="Assets/Editor/Style/NewEditorStylesheet.qss">../../../../Sandbox/Editor/Style/NewEditorStylesheet.qss</file>
</qresource>
<qresource prefix="/Cards">
<file>img/UI20/Cards/point_hand.png</file>
@@ -216,14 +216,9 @@ namespace AzToolsFramework::AssetUtils
constexpr const char* AssetProcessorGamePlatformConfigFileName = "AssetProcessorGamePlatformConfig.ini";
constexpr const char* AssetProcessorGamePlatformConfigSetreg = "AssetProcessorGamePlatformConfig.setreg";
AZStd::vector<AZ::IO::Path> configFiles;
AZ::IO::Path configRoot(engineRoot);
AZ::IO::Path rootConfigFile = configRoot / AssetProcessorPlatformConfigFileName;
configFiles.push_back(rootConfigFile);
// Add a file entry for the Engine Root AssetProcessor setreg file
rootConfigFile = configRoot / AssetProcessorPlatformConfigSetreg;
configFiles.push_back(rootConfigFile);
// Add the AssetProcessorPlatformConfig setreg file at the engine root
configFiles.push_back(AZ::IO::Path(engineRoot) / AssetProcessorPlatformConfigSetreg);
if (addPlatformConfigs)
{
@@ -200,67 +200,67 @@ namespace AzToolsFramework
{
if (AzFramework::StringFunc::Equal(extension.c_str(), ".abc"))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/ABC_16.svg");
return SourceFileDetails("Icons/AssetBrowser/ABC_16.svg");
}
if (AzFramework::StringFunc::Equal(extension.c_str(), ".bnk"))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/Audio_16.svg");
return SourceFileDetails("Icons/AssetBrowser/Audio_16.svg");
}
if (AzFramework::StringFunc::Equal(extension.c_str(), ".cgf"))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/LegacyMesh_16.svg");
return SourceFileDetails("Icons/AssetBrowser/LegacyMesh_16.svg");
}
if (AzFramework::StringFunc::Equal(extension.c_str(), ".font"))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/Font_16.svg");
return SourceFileDetails("Icons/AssetBrowser/Font_16.svg");
}
if (AzFramework::StringFunc::Equal(extension.c_str(), ".fontfamily"))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/Font_16.svg");
return SourceFileDetails("Icons/AssetBrowser/Font_16.svg");
}
if (AzFramework::StringFunc::Equal(extension.c_str(), ".i_caf"))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/LegacyAnimation_16.svg");
return SourceFileDetails("Icons/AssetBrowser/LegacyAnimation_16.svg");
}
if (AzFramework::StringFunc::Equal(extension.c_str(), ".inputbindings"))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/InputBindings_16.svg");
return SourceFileDetails("Icons/AssetBrowser/InputBindings_16.svg");
}
if (AzFramework::StringFunc::Equal(extension.c_str(), ".lua"))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/Lua_16.svg");
return SourceFileDetails("Icons/AssetBrowser/Lua_16.svg");
}
if (AzFramework::StringFunc::Equal(extension.c_str(), ".mtl"))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/Material_16.svg");
return SourceFileDetails("Icons/AssetBrowser/Material_16.svg");
}
if (AzFramework::StringFunc::Equal(extension.c_str(), AzToolsFramework::SliceUtilities::GetSliceFileExtension().c_str()))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/Slice_16.svg");
return SourceFileDetails("Icons/AssetBrowser/Slice_16.svg");
}
if (AzFramework::StringFunc::Equal(extension.c_str(), ".skin"))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/LegacySkin_16.svg");
return SourceFileDetails("Icons/AssetBrowser/LegacySkin_16.svg");
}
if (AzFramework::StringFunc::Equal(extension.c_str(), ".ttf"))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/Font_16.svg");
return SourceFileDetails("Icons/AssetBrowser/Font_16.svg");
}
if (AzFramework::StringFunc::Equal(extension.c_str(), ".xml"))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/XML_16.svg");
return SourceFileDetails("Icons/AssetBrowser/XML_16.svg");
}
@@ -272,7 +272,7 @@ namespace AzToolsFramework
const char* sourceFormatExtension = sourceFormats[sourceImageFormatIndex];
if (AzFramework::StringFunc::Equal(extension.c_str(), sourceFormatExtension))
{
return SourceFileDetails("Editor/Icons/AssetBrowser/Image_16.svg");
return SourceFileDetails("Icons/AssetBrowser/Image_16.svg");
}
}
}
@@ -52,17 +52,16 @@ namespace AzToolsFramework
return AssetEntryType::Root;
}
void RootAssetBrowserEntry::Update(const char* devPath)
void RootAssetBrowserEntry::Update(const char* enginePath)
{
RemoveChildren();
EntryCache::GetInstance()->Clear();
m_scanFolderOutputPrefixMap.clear();
m_devPath = devPath;
m_enginePath = enginePath;
// there is no "Gems" scan folder registered in db, create one manually
auto gemFolder = aznew FolderAssetBrowserEntry();
gemFolder->m_name = m_devPath + AZ_CORRECT_DATABASE_SEPARATOR + GEMS_FOLDER_NAME;
gemFolder->m_name = m_enginePath + AZ_CORRECT_DATABASE_SEPARATOR + GEMS_FOLDER_NAME;
gemFolder->m_displayName = GEMS_FOLDER_NAME;
gemFolder->m_isGemsFolder = true;
AddChild(gemFolder);
@@ -90,11 +89,6 @@ namespace AzToolsFramework
scanFolder->m_displayName = QString::fromUtf8(scanFolderDatabaseEntry.m_displayName.c_str());
EntryCache::GetInstance()->m_scanFolderIdMap[scanFolderDatabaseEntry.m_scanFolderID] = scanFolder;
}
if (!scanFolderDatabaseEntry.m_outputPrefix.empty())
{
m_scanFolderOutputPrefixMap[scanFolderDatabaseEntry.m_scanFolderID] = scanFolderDatabaseEntry.m_outputPrefix;
}
}
void RootAssetBrowserEntry::AddFile(const AssetDatabase::FileDatabaseEntry& fileDatabaseEntry)
@@ -132,7 +126,7 @@ namespace AzToolsFramework
return;
}
const char* filePath = GetScanFolderOutputAdjustedPath(fileDatabaseEntry, scanFolder);
const char* filePath = fileDatabaseEntry.m_fileName.c_str();
AssetBrowserEntry* file;
// file can be either folder or actual file
@@ -441,33 +435,5 @@ namespace AzToolsFramework
{
return MAKE_TKEY(ThumbnailKey);
}
const char* RootAssetBrowserEntry::GetScanFolderOutputAdjustedPath(const AssetDatabase::FileDatabaseEntry& fileDatabaseEntry, const AssetBrowserEntry* scanFolder)
{
Q_UNUSED(scanFolder);
const char* filePath = fileDatabaseEntry.m_fileName.c_str();
// adjust for output prefixes on scan folders (i.e. "editor")
auto itScanFolderOutputPrefix = m_scanFolderOutputPrefixMap.find(fileDatabaseEntry.m_scanFolderPK);
if (itScanFolderOutputPrefix != m_scanFolderOutputPrefixMap.end())
{
const AZStd::string& outputPrefix = itScanFolderOutputPrefix->second;
// Check if the input path starts with the output prefix.
// If it doesn't, something probably went seriously wrong,
// or someone is calling this function with an absolute path.
bool pathStartsWithPrefix = ((strncmp(filePath, outputPrefix.c_str(), outputPrefix.length()) == 0) && (fileDatabaseEntry.m_fileName.length() > (outputPrefix.length() + 1)));
AZ_Warning("Asset Browser", pathStartsWithPrefix, "Entry %s reported as under a ScanFolder (%s) with an 'output=%s', but the new entry does not begin with the output prefix! RootAssetBrowserEntry::GetScanFolderOutputAdjustedPath expects relative paths, not absolute; treating the input path as if it does not contain the ScanFolder output prefix.", filePath, scanFolder->m_name.c_str(), outputPrefix.c_str());
if (pathStartsWithPrefix)
{
// move the beginning ahead by the output prefix plus the separator
filePath += (outputPrefix.length() + 1);
}
}
return filePath;
}
} // namespace AssetBrowser
} // namespace AzToolsFramework
@@ -60,8 +60,8 @@ namespace AzToolsFramework
AssetEntryType GetEntryType() const override;
//! Update root node to new dev location
void Update(const char* devPath);
//! Update root node to new engine location
void Update(const char* enginePath);
void AddScanFolder(const AssetDatabase::ScanFolderDatabaseEntry& scanFolderDatabaseEntry);
void AddFile(const AssetDatabase::FileDatabaseEntry& fileDatabaseEntry);
@@ -82,15 +82,12 @@ namespace AzToolsFramework
private:
AZ_DISABLE_COPY_MOVE(RootAssetBrowserEntry);
AZStd::string m_devPath;
AZStd::unordered_map<AZ::s64, AZStd::string> m_scanFolderOutputPrefixMap;
AZStd::string m_enginePath;
//! Create folder entry child
FolderAssetBrowserEntry* CreateFolder(const char* folderName, AssetBrowserEntry* parent);
//! Recursively create folder structure leading to relative path from parent
AssetBrowserEntry* CreateFolders(const char* relativePath, AssetBrowserEntry* parent);
//! Get the path for the fileDatabaseEntry, offset by the output prefix for the scan folder ancestor, if it's been specified and if it's appropriate
const char* GetScanFolderOutputAdjustedPath(const AssetDatabase::FileDatabaseEntry& fileDatabaseEntry, const AssetBrowserEntry* scanFolder);
bool m_isInitialUpdate = false;
};
@@ -50,8 +50,8 @@ namespace AzToolsFramework
//////////////////////////////////////////////////////////////////////////
// FolderThumbnail
//////////////////////////////////////////////////////////////////////////
static constexpr const char* FolderIconPath = "Editor/Icons/AssetBrowser/Folder_16.svg";
static constexpr const char* GemIconPath = "Editor/Icons/AssetBrowser/GemFolder_16.svg";
static constexpr const char* FolderIconPath = "Icons/AssetBrowser/Folder_16.svg";
static constexpr const char* GemIconPath = "Icons/AssetBrowser/GemFolder_16.svg";
FolderThumbnail::FolderThumbnail(SharedThumbnailKey key)
: Thumbnail(key)
@@ -55,7 +55,7 @@ namespace AzToolsFramework
//////////////////////////////////////////////////////////////////////////
// ProductThumbnail
//////////////////////////////////////////////////////////////////////////
static const char* DEFAULT_PRODUCT_ICON_PATH = "Editor/Icons/AssetBrowser/DefaultProduct_16.svg";
static const char* DEFAULT_PRODUCT_ICON_PATH = "Icons/AssetBrowser/DefaultProduct_16.svg";
ProductThumbnail::ProductThumbnail(Thumbnailer::SharedThumbnailKey key)
: Thumbnail(key)
@@ -55,7 +55,7 @@ namespace AzToolsFramework
//////////////////////////////////////////////////////////////////////////
// SourceThumbnail
//////////////////////////////////////////////////////////////////////////
static constexpr const char* DefaultFileIconPath = "Editor/Icons/AssetBrowser/Default_16.svg";
static constexpr const char* DefaultFileIconPath = "Icons/AssetBrowser/Default_16.svg";
QMutex SourceThumbnail::m_mutex;
SourceThumbnail::SourceThumbnail(SharedThumbnailKey key)
@@ -943,10 +943,8 @@ namespace AzToolsFramework
const char* scanFolder,
const char* displayName,
const char* portableKey,
const char* outputPrefix,
int isRoot)
: m_scanFolderID(scanFolderID)
, m_outputPrefix(outputPrefix)
, m_isRoot(isRoot)
{
if (scanFolder)
@@ -967,10 +965,8 @@ namespace AzToolsFramework
const char* scanFolder,
const char* displayName,
const char* portableKey,
const char* outputPrefix,
int isRoot)
: m_outputPrefix(outputPrefix)
, m_isRoot(isRoot)
: m_isRoot(isRoot)
{
if (scanFolder)
{
@@ -993,7 +989,6 @@ namespace AzToolsFramework
, m_scanFolder(other.m_scanFolder)
, m_displayName(other.m_displayName)
, m_portableKey(other.m_portableKey)
, m_outputPrefix(other.m_outputPrefix)
, m_isRoot(other.m_isRoot)
{
}
@@ -1011,7 +1006,6 @@ namespace AzToolsFramework
m_scanFolderID = other.m_scanFolderID;
m_displayName = AZStd::move(other.m_displayName);
m_portableKey = AZStd::move(other.m_portableKey);
m_outputPrefix = AZStd::move(other.m_outputPrefix);
m_isRoot = other.m_isRoot;
}
return *this;
@@ -1023,7 +1017,6 @@ namespace AzToolsFramework
m_scanFolderID = other.m_scanFolderID;
m_displayName = other.m_displayName;
m_portableKey = other.m_portableKey;
m_outputPrefix = other.m_outputPrefix;
m_isRoot = other.m_isRoot;
return *this;
}
@@ -1050,7 +1043,6 @@ namespace AzToolsFramework
MakeColumn("ScanFolder", m_scanFolder),
MakeColumn("DisplayName", m_displayName),
MakeColumn("PortableKey", m_portableKey),
MakeColumn("OutputPrefix", m_outputPrefix),
MakeColumn("IsRoot", m_isRoot)
);
}
@@ -68,6 +68,7 @@ namespace AzToolsFramework
AddedLastScanTimeField = 28,
AddedScanTimeSecondsSinceEpochField = 29,
ChangedSortFunctionFromQSortToStdStableSort = 30,
RemoveOutputPrefixFromScanFolders,
//Add all new versions before this
DatabaseVersionCount,
LatestVersion = DatabaseVersionCount - 1
@@ -99,12 +100,10 @@ namespace AzToolsFramework
const char* scanFolder,
const char* displayName,
const char* portableKey,
const char* outputPrefix,
int isRoot = 0);
ScanFolderDatabaseEntry(const char* scanFolder,
const char* displayName,
const char* portableKey,
const char* outputPrefix,
int isRoot = 0);
ScanFolderDatabaseEntry(const ScanFolderDatabaseEntry& other);
ScanFolderDatabaseEntry(ScanFolderDatabaseEntry&& other);
@@ -120,7 +119,6 @@ namespace AzToolsFramework
AZStd::string m_scanFolder; // the actual local computer path to that scan folder.
AZStd::string m_displayName; // a display name, blank means it should not show up in UIs
AZStd::string m_portableKey; // a key that uniquely identifies a scan folder so that we can recognize the same one in other databases/computer
AZStd::string m_outputPrefix;
int m_isRoot = 0;
};
@@ -23,7 +23,7 @@ namespace AzToolsFramework
//////////////////////////////////////////////////////////////////////////
// LoadingThumbnail
//////////////////////////////////////////////////////////////////////////
static const char* LoadingIconPath = "Editor/Icons/AssetBrowser/in_progress.gif";
static const char* LoadingIconPath = "Icons/AssetBrowser/in_progress.gif";
LoadingThumbnail::LoadingThumbnail()
: Thumbnail(MAKE_TKEY(ThumbnailKey))
@@ -16,7 +16,7 @@ namespace AzToolsFramework
{
namespace Thumbnailer
{
static const char* MISSING_ICON_PATH = "Editor/Icons/AssetBrowser/Default_16.svg";
static const char* MISSING_ICON_PATH = "Icons/AssetBrowser/Default_16.svg";
MissingThumbnail::MissingThumbnail()
: Thumbnail(MAKE_TKEY(ThumbnailKey))
@@ -64,8 +64,8 @@ namespace AzToolsFramework
//////////////////////////////////////////////////////////////////////////
// SourceControlThumbnail
//////////////////////////////////////////////////////////////////////////
static const char* WRITABLE_ICON_PATH = "Editor/Icons/AssetBrowser/Writable_16.svg";
static const char* NONWRITABLE_ICON_PATH = "Editor/Icons/AssetBrowser/NonWritable_16.svg";
static const char* WRITABLE_ICON_PATH = "Icons/AssetBrowser/Writable_16.svg";
static const char* NONWRITABLE_ICON_PATH = "Icons/AssetBrowser/NonWritable_16.svg";
bool SourceControlThumbnail::m_readyForUpdate = true;
@@ -101,8 +101,8 @@ namespace AzToolsFramework
{
editContext->Class<EditorLayerComponent>("Layer", "The layer component allows entities to be saved to different files on disk.")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Layers.svg")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Layers.svg")
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Layers.svg")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Layers.svg")
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Layer", 0xe4db211a))
->Attribute(AZ::Edit::Attributes::AddableByUser, false)
->Attribute(AZ::Edit::Attributes::RemoveableByUser, false)
@@ -1025,9 +1025,9 @@ namespace AzToolsFramework
->Attribute(AZ::Edit::Attributes::NameLabelOverride, &ScriptEditorComponent::m_customName)
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->Attribute(AZ::Edit::Attributes::Category, "Scripting")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/LuaScript.svg")
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/LuaScript.svg")
->Attribute(AZ::Edit::Attributes::PrimaryAssetType, AZ::AzTypeInfo<AZ::ScriptAsset>::Uuid())
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/Script.png")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Script.png")
->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://docs.aws.amazon.com/lumberyard/latest/userguide/component-lua-script.html")
->DataElement("AssetRef", &ScriptEditorComponent::m_scriptAsset, "Script", "Which script to use")
->Attribute(AZ::Edit::Attributes::ChangeNotify, &ScriptEditorComponent::ScriptHasChanged)
@@ -1224,8 +1224,8 @@ namespace AzToolsFramework
{
ptrEdit->Class<TransformComponent>("Transform", "Controls the placement of the entity in the world in 3d")->
ClassElement(AZ::Edit::ClassElements::EditorData, "")->
Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Transform.svg")->
Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/Transform.png")->
Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Transform.svg")->
Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Transform.png")->
Attribute(AZ::Edit::Attributes::AutoExpand, true)->
DataElement(AZ::Edit::UIHandlers::Default, &TransformComponent::m_parentEntityId, "Parent entity", "")->
Attribute(AZ::Edit::Attributes::ChangeValidate, &TransformComponent::ValidatePotentialParent)->
@@ -544,7 +544,7 @@ namespace AzToolsFramework
m_errorButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_errorButton->setFixedSize(QSize(16, 16));
m_errorButton->setMouseTracking(true);
m_errorButton->setIcon(QIcon("Editor/Icons/PropertyEditor/error_icon.png"));
m_errorButton->setIcon(QIcon("Icons/PropertyEditor/error_icon.png"));
m_errorButton->setToolTip("Show Errors");
// Insert the error button after the asset label
@@ -70,7 +70,7 @@ namespace AzToolsFramework
m_tagLabel->setMinimumSize(24, 22);
m_tagLabel->setAttribute(Qt::WA_TransparentForMouseEvents, true);
QIcon closeIcon("Editor/Icons/animation/close.png");
QIcon closeIcon("Icons/animation/close.png");
QPushButton* button = new QPushButton(this);
button->setStyleSheet(button->styleSheet() + "border: 0px;");
@@ -233,14 +233,14 @@ namespace AzToolsFramework
QPushButton* loadButton = new QPushButton(this);
loadButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
loadButton->setFixedSize(QSize(24, 24));
loadButton->setIcon(QIcon("Editor/UI/Icons/toolbar/libraryLoad.png"));
loadButton->setIcon(QIcon("UI/Icons/toolbar/libraryLoad.png"));
loadButton->setToolTip(tr("Load a saved filter"));
loadButton->setProperty("iconButton", "true");
m_saveButton = new QPushButton(this);
m_saveButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_saveButton->setFixedSize(QSize(24, 24));
m_saveButton->setIcon(QIcon("Editor/UI/Icons/toolbar/librarySave.png"));
m_saveButton->setIcon(QIcon("UI/Icons/toolbar/librarySave.png"));
m_saveButton->setToolTip(tr("Save the current filter"));
m_saveButton->setEnabled(false);
m_saveButton->setProperty("iconButton", "true");
@@ -248,7 +248,7 @@ namespace AzToolsFramework
m_toggleAllFiltersButton = new QPushButton(this);
m_toggleAllFiltersButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_toggleAllFiltersButton->setFixedSize(QSize(24, 24));
m_toggleAllFiltersButton->setIcon(QIcon("Editor/Icons/animation/filter_16.png"));
m_toggleAllFiltersButton->setIcon(QIcon("Icons/animation/filter_16.png"));
m_toggleAllFiltersButton->setVisible(false);
m_toggleAllFiltersButton->setToolTip(tr("Toggle all filters on/off"));
m_toggleAllFiltersButton->setProperty("iconButton", "true");
@@ -267,7 +267,7 @@ namespace AzToolsFramework
m_clearAllButton = new QPushButton(this);
m_clearAllButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_clearAllButton->setFixedSize(QSize(24, 24));
m_clearAllButton->setIcon(QIcon("Editor/Icons/animation/close.png"));
m_clearAllButton->setIcon(QIcon("Icons/animation/close.png"));
m_clearAllButton->setVisible(false);
m_clearAllButton->setToolTip(tr("Clear all filters"));
m_clearAllButton->setProperty("iconButton", "true");
@@ -49,8 +49,8 @@ namespace AzToolsFramework
->Attribute(AZ::Edit::Attributes::AddableByUser, true)
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game"))
->Attribute(AZ::Edit::Attributes::Category, "Entity Search Test Components")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Tag.png")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/Tag.png")
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Tag.png")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Tag.png")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://www.amazongames.com/")
->DataElement(AZ::Edit::UIHandlers::Default, &EntitySearch_TestComponent1::m_boolValue, "Bool", "")
@@ -108,8 +108,8 @@ namespace AzToolsFramework
->Attribute(AZ::Edit::Attributes::AddableByUser, true)
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game"))
->Attribute(AZ::Edit::Attributes::Category, "Entity Search Test Components")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Tag.png")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/Tag.png")
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Tag.png")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Tag.png")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://www.amazongames.com/")
->DataElement(AZ::Edit::UIHandlers::Default, &EntitySearch_TestComponent2::m_floatValue, "Float", "")
@@ -125,8 +125,8 @@ namespace UnitTest
->Attribute(AZ::Edit::Attributes::AddableByUser, true)
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game"))
->Attribute(AZ::Edit::Attributes::Category, "Inspector Test Components")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Tag.png")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/Tag.png")
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Tag.png")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Tag.png")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://www.amazongames.com/")
->DataElement(AZ::Edit::UIHandlers::Default, &Inspector_TestComponent2::m_data, "Data", "The component's Data");
@@ -194,8 +194,8 @@ namespace UnitTest
->Attribute(AZ::Edit::Attributes::AddableByUser, true)
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
->Attribute(AZ::Edit::Attributes::Category, "Inspector Test Components")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Tag.png")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/Tag.png")
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Tag.png")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Tag.png")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://www.amazongames.com/")
->DataElement(AZ::Edit::UIHandlers::Default, &Inspector_TestComponent3::m_data, "Data", "The component's Data");
+2 -7
View File
@@ -449,18 +449,14 @@ namespace O3DELauncher
// Non-host platforms cannot use the project path that is #defined within the launcher.
// In this case the the result of AZ::Utils::GetDefaultAppRoot is used instead
#if !AZ_TRAIT_OS_IS_HOST_OS_PLATFORM
AZStd::string_view projectPath;
#if AZ_TRAIT_OS_IS_HOST_OS_PLATFORM
// Insert the project_path option to the front of the command line arguments
projectPath = GetProjectPath();
#else
// Make sure the defaultAppRootPath variable is in scope long enough until the projectPath string_view is used below
AZStd::optional<AZ::IO::FixedMaxPathString> defaultAppRootPath = AZ::Utils::GetDefaultAppRootPath();
if (defaultAppRootPath.has_value())
{
projectPath = *defaultAppRootPath;
}
#endif
if (!projectPath.empty())
{
const auto projectPathKey = FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)
@@ -471,15 +467,14 @@ namespace O3DELauncher
// For non-host platforms set the engine root to be the project root
// Since the directories available during execution are limited on those platforms
#if !AZ_TRAIT_OS_IS_HOST_OS_PLATFORM
AZStd::string_view enginePath = projectPath;
const auto enginePathKey = FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)
+ "/engine_path";
enginePathOptionOverride = FixedValueString ::format(R"(--regset="%s=%.*s")",
enginePathKey.c_str(), aznumeric_cast<int>(enginePath.size()), enginePath.data());
argContainer.emplace_back(enginePathOptionOverride.data());
#endif
}
#endif
AzGameFramework::GameApplication gameApplication(aznumeric_cast<int>(argContainer.size()), argContainer.data());
// The settings registry has been created by the AZ::ComponentApplication constructor at this point
-11
View File
@@ -36,15 +36,4 @@ namespace O3DELauncher
#endif
return { LY_PROJECT_NAME };
}
AZStd::string_view GetProjectPath()
{
// The Project CMake path optional and not required
// It is used as fall back project root path
#if defined LY_PROJECT_CMAKE_PATH
return { LY_PROJECT_CMAKE_PATH };
#else
return {};
#endif
}
}
@@ -130,9 +130,6 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC
PRIVATE
# Adds the name of the project/game
LY_PROJECT_NAME="${project_name}"
# Adds the project path supplied to CMake during configuration
# This is used as a fallback to launch the AssetProcessor
LY_PROJECT_CMAKE_PATH="${project_path}"
# Adds the ${project_name}_GameLauncher target as a define so for the Settings Registry to use
# when loading .setreg file specializations
# This is needed so that only gems for the project game launcher are loaded
@@ -174,9 +171,6 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC
PRIVATE
# Adds the name of the project/game
LY_PROJECT_NAME="${project_name}"
# Adds the project path supplied to CMake during configuration
# This is used as a fallback to launch the AssetProcessor
LY_PROJECT_CMAKE_PATH="${project_path}"
# Adds the ${project_name}_ServerLauncher target as a define so for the Settings Registry to use
# when loading .setreg file specializations
# This is needed so that only gems for the project server launcher are loaded
@@ -19,6 +19,8 @@
#include <QPushButton>
// AzCore
#include <AzCore/Utils/Utils.h>
#include <Pak/CryPakUtils.h>
// Editor
@@ -70,12 +72,13 @@ void CAlembicCompileDialog::OnInitDialog()
SDirectoryEnumeratorHelper dirHelper;
dirHelper.ScanDirectoryRecursive(gEnv->pCryPak, "@engroot@/", "Editor/Presets/GeomCache", filePattern, presetFiles);
auto engineAssetSourceRoot = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Assets";
dirHelper.ScanDirectoryRecursive(gEnv->pCryPak, engineAssetSourceRoot.c_str(), "Editor/Presets/GeomCache", filePattern, presetFiles);
for (auto iter = presetFiles.begin(); iter != presetFiles.end(); ++iter)
{
const auto& file = *iter;
const AZStd::string filePath = "@engroot@/" + file;
const AZ::IO::FixedMaxPath filePath = engineAssetSourceRoot / file;
m_presets.push_back(LoadConfig(Path::GetFileName(file.c_str()), XmlHelpers::LoadXmlFromFile(filePath.c_str())));
m_ui->m_presetComboBox->addItem(m_presets.back().m_name);
}
+4 -4
View File
@@ -1154,9 +1154,9 @@ BOOL CCryEditApp::CheckIfAlreadyRunning()
m_mutexApplication = new QSharedMemory(O3DEApplicationName);
if (!m_mutexApplication->create(16))
{
// Don't prompt the user in non-interactive export mode. Instead, default to allowing multiple instances to
// run simultaneously, so that multiple level exports can be run in parallel on the same machine.
// NOTE: If you choose to do this, be sure to export *different* levels, since nothing prevents multiple runs
// Don't prompt the user in non-interactive export mode. Instead, default to allowing multiple instances to
// run simultaneously, so that multiple level exports can be run in parallel on the same machine.
// NOTE: If you choose to do this, be sure to export *different* levels, since nothing prevents multiple runs
// from trying to write to the same level at the same time.
// If we're running interactively, let's ask and make sure the user actually intended to do this.
if (!m_bExportMode && QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Too many apps"), QObject::tr("There is already an Open 3D Engine application running\nDo you want to start another one?")) != QMessageBox::Yes)
@@ -1717,7 +1717,7 @@ BOOL CCryEditApp::InitInstance()
AzQtComponents::StyleManager::addSearchPaths(
QStringLiteral("style"),
engineRoot.filePath(QStringLiteral("Code/Sandbox/Editor/Style")),
QStringLiteral(":/Editor/Style"),
QStringLiteral(":/Assets/Editor/Style"),
engineRootPath);
AzQtComponents::StyleManager::setStyleSheet(mainWindow, QStringLiteral("style:Editor.qss"));
+9 -8
View File
@@ -83,7 +83,7 @@ static const char* kHoldFolder = "$tmp_hold"; // conform to the ignored file typ
static const char* kSaveBackupFolder = "_savebackup";
static const char* kResizeTempFolder = "$tmp_resize"; // conform to the ignored file types $tmp[0-9]*_ regex
static const char* kBackupOrTempFolders[] =
static const char* kBackupOrTempFolders[] =
{
kAutoBackupFolder,
kHoldFolder,
@@ -1164,7 +1164,7 @@ bool CCryEditDoc::OnSaveDocument(const QString& lpszPathName)
{
DoSaveDocument(lpszPathName, context);
saveSuccess = AfterSaveDocument(lpszPathName, context);
}
}
}
return saveSuccess;
@@ -1436,7 +1436,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
// Save AZ entities to the editor level.
bool contentsAllSaved = false; // abort level save if anything within it fails
auto tempFilenameStrData = tempSaveFile.toStdString();
auto filenameStrData = fullPathName.toStdString();
@@ -1458,7 +1458,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
}
}
AZStd::vector<AZ::Entity*> editorEntities;
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
&AzToolsFramework::EditorEntityContextRequestBus::Events::GetLooseEditorEntities,
@@ -1815,7 +1815,7 @@ bool CCryEditDoc::LoadLevel(TDocMultiArchive& arrXmlAr, const QString& absoluteC
AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
auto pIPak = GetIEditor()->GetSystem()->GetIPak();
QString folderPath = QFileInfo(absoluteCryFilePath).absolutePath();
OnStartLevelResourceList();
@@ -2391,7 +2391,8 @@ void CCryEditDoc::InitEmptyLevel(int /*resolution*/, int /*unitSize*/, bool /*bU
GetIEditor()->GetGameEngine()->SetLevelCreated(false);
// Default time of day.
XmlNodeRef root = GetISystem()->LoadXmlFromFile("@engroot@/Editor/default_time_of_day.xml");
auto defaultTimeOfDayPath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Assets" / "Editor" / "default_time_of_day.xml";
XmlNodeRef root = GetISystem()->LoadXmlFromFile(defaultTimeOfDayPath.c_str());
if (root)
{
ITimeOfDay* pTimeOfDay = gEnv->p3DEngine ? gEnv->p3DEngine->GetTimeOfDay() : nullptr;
@@ -2454,7 +2455,7 @@ void CCryEditDoc::CreateDefaultLevelAssets(int resolution, int unitSize)
AZ::Transform worldTransform = AZ::Transform::CreateIdentity();
worldTransform = AZ::Transform::CreateTranslation(AZ::Vector3(halfTerrainSize, halfTerrainSize, m_envProbeHeight / 2));
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusConnect();
GetIEditor()->SuspendUndo();
AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::Broadcast(
@@ -2613,7 +2614,7 @@ void CCryEditDoc::OnSliceInstantiated(const AZ::Data::AssetId& sliceAssetId, AZ:
sliceAddress.SetReference(nullptr);
SetModifiedFlag(true);
SetModifiedModules(eModifiedEntities);
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusDisconnect();
//save after level default slice fully instantiated
@@ -71,24 +71,8 @@ CPythonScriptsDialog::CPythonScriptsDialog(QWidget* parent)
AzQtComponents::LineEdit::applySearchStyle(ui->searchField);
QStringList scriptFolders;
const auto editorEnvStr = gSettings.strEditorEnv.toLocal8Bit();
AZStd::string editorScriptsPath = AZStd::string::format("@engroot@/%s", editorEnvStr.constData());
XmlNodeRef envNode = XmlHelpers::LoadXmlFromFile(editorScriptsPath.c_str());
if (envNode)
{
QString scriptPath;
int childrenCount = envNode->getChildCount();
for (int idx = 0; idx < childrenCount; ++idx)
{
XmlNodeRef child = envNode->getChild(idx);
if (child->haveAttr("scriptPath"))
{
scriptPath = child->getAttr("scriptPath");
scriptFolders.push_back(scriptPath);
}
}
}
auto engineScriptPath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Assets" / "Editor" / "Scripts";
scriptFolders.push_back(engineScriptPath.c_str());
AZ::IO::FixedMaxPathString projectPath = AZ::Utils::GetProjectPath();
ScanFolderForScripts(QString("%1/Editor/Scripts").arg(projectPath.c_str()), scriptFolders);
+4 -1
View File
@@ -16,6 +16,8 @@
#include "EditorPanelUtils.h"
#include <AzCore/Utils/Utils.h>
// Qt
#include <QInputDialog>
#include <QFileDialog>
@@ -147,7 +149,8 @@ public:
virtual void HotKey_Export() override
{
QString filepath = QFileDialog::getSaveFileName(nullptr, "Select shortcut configuration to load", "Editor/Plugins/ParticleEditorPlugin/settings", "HotKey Config Files (*.hkxml)");
auto settingDir = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Editor" / "Plugins" / "ParticleEditorPlugin" / "settings";
QString filepath = QFileDialog::getSaveFileName(nullptr, "Select shortcut configuration to load", settingDir.c_str(), "HotKey Config Files (*.hkxml)");
QFile file(filepath);
if (!file.open(QIODevice::WriteOnly))
{
+11 -11
View File
@@ -27,27 +27,27 @@
#include "Util/ImageUtil.h"
#define HELPER_MATERIAL "Editor/Objects/Helper"
#define HELPER_MATERIAL "Objects/Helper"
namespace
{
// Object names in this array must correspond to EObject enumeration.
const char* g_ObjectNames[eStatObject_COUNT] =
{
"Editor/Objects/Arrow.cgf",
"Editor/Objects/Axis.cgf",
"Editor/Objects/Sphere.cgf",
"Editor/Objects/Anchor.cgf",
"Editor/Objects/entrypoint.cgf",
"Editor/Objects/hidepoint.cgf",
"Editor/Objects/hidepoint_sec.cgf",
"Editor/Objects/reinforcement_point.cgf",
"Objects/Arrow.cgf",
"Objects/Axis.cgf",
"Objects/Sphere.cgf",
"Objects/Anchor.cgf",
"Objects/entrypoint.cgf",
"Objects/hidepoint.cgf",
"Objects/hidepoint_sec.cgf",
"Objects/reinforcement_point.cgf",
};
const char* g_IconNames[eIcon_COUNT] =
{
"Editor/Icons/ScaleWarning.png",
"Editor/Icons/RotationWarning.png",
"Icons/ScaleWarning.png",
"Icons/RotationWarning.png",
};
};
@@ -26,7 +26,7 @@
// ...
// return previousValue;
// }
// REGISTER_RESOURCE_SELECTOR("Sound", SoundFileSelector, "Editor/icons/sound_16x16.png")
// REGISTER_RESOURCE_SELECTOR("Sound", SoundFileSelector, "Icons/sound_16x16.png")
//
// To expose it to serialization:
//
@@ -228,7 +228,7 @@ AzToolsFramework::AssetBrowser::SourceFileDetails CLensFlareManager::GetSourceFi
{
if (IsLensFlareLibraryXML(fullSourceFileName))
{
return AzToolsFramework::AssetBrowser::SourceFileDetails("Editor/Icons/AssetBrowser/LensFlare_16.png");
return AzToolsFramework::AssetBrowser::SourceFileDetails("Icons/AssetBrowser/LensFlare_16.png");
}
return AzToolsFramework::AssetBrowser::SourceFileDetails();
}
+4 -4
View File
@@ -96,25 +96,25 @@ void CMatEditPreviewDlg::SetupMenuBar()
//////////////////////////////////////////////////////////////////////////
void CMatEditPreviewDlg::OnPreviewSphere()
{
m_previewCtrl->LoadModelFile("Editor/Objects/MtlSphere.cgf");
m_previewCtrl->LoadModelFile("Objects/MtlSphere.cgf");
}
//////////////////////////////////////////////////////////////////////////
void CMatEditPreviewDlg::OnPreviewBox()
{
m_previewCtrl->LoadModelFile("Editor/Objects/MtlBox.cgf");
m_previewCtrl->LoadModelFile("Objects/MtlBox.cgf");
}
//////////////////////////////////////////////////////////////////////////
void CMatEditPreviewDlg::OnPreviewTeapot()
{
m_previewCtrl->LoadModelFile("Editor/Objects/MtlTeapot.cgf");
m_previewCtrl->LoadModelFile("Objects/MtlTeapot.cgf");
}
//////////////////////////////////////////////////////////////////////////
void CMatEditPreviewDlg::OnPreviewPlane()
{
m_previewCtrl->LoadModelFile("Editor/Objects/MtlPlane.cgf");
m_previewCtrl->LoadModelFile("Objects/MtlPlane.cgf");
}
//////////////////////////////////////////////////////////////////////////
@@ -25,26 +25,26 @@
#include "MaterialBrowser.h"
#include "Util/Image.h"
#define ME_BG_TEXTURE "Editor/Materials/Stripes.dds"
#define ME_BG_TEXTURE "Materials/Stripes.dds"
#define MATERIAL_EDITOR_SPHERE_MODEL_FILE "Editor/Objects/MtlSphere.cgf"
#define MATERIAL_EDITOR_SPHERE_MODEL_FILE "Objects/MtlSphere.cgf"
#define MATERIAL_EDITOR_SPHERE_CAMERA_RADIUS 1.6f
#define MATERIAL_EDITOR_SPHERE_CAMERA_FROM_DIRECTION Vec3(0.1f, -1.0f, -0.1f)
#define MATERIAL_EDITOR_BOX_MODEL_FILE "Editor/Objects/MtlBox.cgf"
#define MATERIAL_EDITOR_BOX_MODEL_FILE "Objects/MtlBox.cgf"
#define MATERIAL_EDITOR_BOX_CAMERA_RADIUS 2.0f
#define MATERIAL_EDITOR_BOX_CAMERA_FROM_DIRECTION Vec3(0.75f, -0.75f, -0.5f)
#define MATERIAL_EDITOR_TEAPOT_MODEL_FILE "Editor/Objects/MtlTeapot.cgf"
#define MATERIAL_EDITOR_TEAPOT_MODEL_FILE "Objects/MtlTeapot.cgf"
#define MATERIAL_EDITOR_TEAPOT_CAMERA_RADIUS 1.6f
#define MATERIAL_EDITOR_TEAPOT_CAMERA_FROM_DIRECTION Vec3(0.1f, -0.75f, -0.25f)
#define MATERIAL_EDITOR_PLANE_MODEL_FILE "Editor/Objects/MtlPlane.cgf"
#define MATERIAL_EDITOR_PLANE_MODEL_FILE "Objects/MtlPlane.cgf"
#define MATERIAL_EDITOR_PLANE_CAMERA_RADIUS 1.6f
#define MATERIAL_EDITOR_PLANE_CAMERA_FROM_DIRECTION Vec3(-0.5f, 0.5f, -0.5f)
#define MATERIAL_EDITOR_SWATCH_MODEL_FILE "Editor/Objects/MtlSwatch.cgf"
#define MATERIAL_EDITOR_SWATCH_MODEL_FILE "Objects/MtlSwatch.cgf"
#define MATERIAL_EDITOR_SWATCH_CAMERA_RADIUS 1.0f
#define MATERIAL_EDITOR_SWATCH_CAMERA_FROM_DIRECTION Vec3(0.0f, 0.0f, -1.0f)
+2 -2
View File
@@ -298,7 +298,7 @@ namespace
AZ::IO::FixedMaxPathString engineRoot = AZ::Utils::GetEnginePath();
QDir engineDir = !engineRoot.empty() ? QDir(QString(engineRoot.c_str())) : QDir::current();
QString scriptFolder = engineDir.absoluteFilePath("Editor/Scripts/");
QString scriptFolder = engineDir.absoluteFilePath("Assets/Editor/Scripts/");
Path::ConvertBackSlashToSlash(scriptFolder);
path = scriptFolder + pFile;
@@ -524,7 +524,7 @@ namespace
// for example: Hello
return AZStd::make_any<AZStd::string>(stringValue.toUtf8().data());
}
else // then it looks like an integer
else // then it looks like an integer
{
// for example: 456
return AZStd::make_any<AZ::s64>(stringValue.toInt());
+1 -4
View File
@@ -196,7 +196,6 @@ SEditorSettings::SEditorSettings()
enableSceneInspector = false;
strStandardTempDirectory = "Temp";
strEditorEnv = "Editor/Editor.env";
// Init source safe params.
enableSourceControl = true;
@@ -532,7 +531,6 @@ void SEditorSettings::Save()
SaveValue("Settings", "editorConfigSpec", editorConfigSpec);
SaveValue("Settings", "TemporaryDirectory", strStandardTempDirectory);
SaveValue("Settings", "EditorEnv", strEditorEnv);
SaveValue("Settings", "ConsoleBackgroundColorThemeV2", (int)consoleBackgroundColorTheme);
@@ -747,7 +745,6 @@ void SEditorSettings::Load()
LoadValue("Settings", "TemporaryDirectory", strStandardTempDirectory);
LoadValue("Settings", "EditorEnv", strEditorEnv);
int consoleBackgroundColorThemeInt = (int)consoleBackgroundColorTheme;
LoadValue("Settings", "ConsoleBackgroundColorThemeV2", consoleBackgroundColorThemeInt);
@@ -760,7 +757,7 @@ void SEditorSettings::Load()
LoadValue("Settings", "ShowTimeInConsole", bShowTimeInConsole);
LoadValue("Settings", "EnableSceneInspector", enableSceneInspector);
//////////////////////////////////////////////////////////////////////////
// Viewport Settings.
//////////////////////////////////////////////////////////////////////////
-1
View File
@@ -419,7 +419,6 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
// This directory is related to the editor root.
QString strStandardTempDirectory;
QString strEditorEnv;
SGUI_Settings gui;
+1 -1
View File
@@ -25,7 +25,7 @@
#include "QtViewPaneManager.h"
#define TOOLBOX_FILE "Editor/ToolBox.xml"
#define TOOLBOX_FILE "ToolBox.xml"
#define TOOLBOX_NODE "ToolBox"
CSettingsManager::CSettingsManager(EditorSettingsManagerType managerType)
+3 -3
View File
@@ -19,8 +19,8 @@
class QByteArray;
#define EDITOR_LAYOUT_FILE_PATH "@engroot@/Editor/EditorLayout.xml"
#define EDITOR_SETTINGS_FILE_PATH "@engroot@/Editor/EditorSettings.xml"
#define EDITOR_LAYOUT_FILE_PATH "@user@/Editor/EditorLayout.xml"
#define EDITOR_SETTINGS_FILE_PATH "@user@/Editor/EditorSettings.xml"
#define EDITOR_LAYOUT_ROOT_NODE "EditorLayout"
#define EDITOR_SETTINGS_ROOT_NODE "EditorSettings"
#define EDITOR_SETTINGS_CONTENT_NODE "EditorSettingsContent"
@@ -30,7 +30,7 @@ class QByteArray;
#define CVARS_NODE "CVars"
#define CVAR_NODE "CVar"
#define EDITOR_EVENT_LOG_FILE_PATH "@engroot@/Editor/EditorEventLog.xml"
#define EDITOR_EVENT_LOG_FILE_PATH "@user@/Editor/EditorEventLog.xml"
#define EDITOR_EVENT_LOG_ROOT_NODE "EventRecorder"
#define EVENT_LOG_EVENT_NAME "eventName"
#define EDITOR_EVENT_LOG_ATTRIB_NAME "value"
+1 -1
View File
@@ -71,7 +71,7 @@ int CShaderEnum::EnumShaders()
m_shaders.push_back(sd);
}
XmlNodeRef root = GetISystem()->GetXmlUtils()->LoadXmlFromFile("Editor/Materials/ShaderList.xml");
XmlNodeRef root = GetISystem()->GetXmlUtils()->LoadXmlFromFile("Materials/ShaderList.xml");
if (root)
{
for (int i = 0; i < root->getChildCount(); ++i)
-488
View File
@@ -1,488 +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.
*
*/
#ResourceManagement QLabel
{
/*
This sets the indent Q_PROPERTY on QLabel to 0. The default value is -1,
which triggers some computation based on the font size. But that only
happens under some cicumstances, such as when using a stylesheet to set
margins or padding on the QLabel. Adding such styling suddenly causes
the indent to be applied, causing the left alignment of the text to break.
*/
qproperty-indent: 0
}
#ResourceManagement #TreeTitle
{
font-size: 12px;
font-weight: bold;
}
#ResourceManagement #ButtonBar {
margin-top: 6px;
}
#ResourceManagement #ButtonBar QPushButton {
padding: 6px 9px 6px 9px;
margin-right: 6px;
}
#ResourceManagement #Message, #ResourceManagement *[class='Message'] {
font-size: 12px;
margin-top: 6;
}
#ResourceManagement #Title {
font-size: 14px;
font-weight: bold;
}
#ResourceManagement #Refreshing {
color: #F0C32D;
}
#ResourceManagement #LinkButton, #ResourceManagement *[class='Link'] {
border: none;
color: #00A1C9;
margin-top: 6px;
font-weight: bold;
}
#ResourceManagement QHeaderView::section {
color: #999999;
font-weight: bold;
border: none;
padding-top: 0px;
padding-bottom: 3px;
padding-right: 3px;
padding-left: 3px;
}
#ResourceManagement #Table {
qproperty-showGrid: false;
border: none;
}
#ResourceManagement #Table::item {
padding-right: 12px;
padding-top: 3px;
padding-bottom: 3px;
}
#ResourceManagement #TextContentHelp
{
margin: 0px;
padding: 12px;
border-style: outset;
border-width: 1px;
border-color: #303030;
}
#ResourceManagement #TextContentEdit
{
}
#ResourceManagement #TextContentFooter
{
padding: 6px 12px 6px 12px;
border-style: outset;
border-width: 1px;
border-color: #303030;
}
#ResourceManagement #TextContentFooter QLabel
{
min-width: 48px;
max-width: 48px;
margin-right: 12px;
color: #999999;
}
#ResourceManagement #TextContentFooter QPushButton
{
padding: 6px 9px 6px 9px;
margin-left: 6px;
}
#ResourceManagement #Action {
padding: 12px;
background-color: #404040;
}
#ResourceManagement #Action #ButtonBar {
background-color: #404040;
}
#ResourceManagement #Action #Heading {
background-color: #404040;
}
#ResourceManagement #Heading #RefreshButton {
margin-left: 12px;
padding: 3px;
}
#ResourceManagement #Action #Heading #Title {
border: 0px solid #404040;
}
#ResourceManagement #Action #Heading #Message {
border: 0px solid #404040;
}
#ResourceManagement #Action #LearnMore {
background-color: #404040;
}
#ResourceManagement #Action #LearnMore #Title {
font-size: 12px;
margin-top: 24px;
font-weight:bold;
}
#ResourceManagement #Action #LearnMore #LinkButton {
background-color: #404040;
}
#ResourceManagement #Action #Title, #ResourceManagement #Action #Message {
background-color: #404040;
}
#ResourceManagement #Top {
padding: 12px;
border-style: outset;
border-width: 1px;
border-color: #303030;
}
#ResourceManagement #Bottom {
background-color: #404040;
padding: 12px;
}
#ResourceManagement #Bottom #Title {
background-color: #404040;
font-size: 12px;
font-weight: bold;
}
#ResourceManagement #Bottom #Message {
background-color: #404040;
margin-bottom: 6px;
}
#ResourceManagement #Bottom #Table {
background-color: #404040;
qproperty-alternatingRowColors: true;
}
#ResourceManagement #Bottom #Table QHeaderView {
background-color: #404040;
}
#ResourceManagement #Bottom #Table QHeaderView::section {
background-color: #404040;
}
#ResourceManagement #Bottom #Table::item {
background-color: #393a3c;
}
#ResourceManagement #Bottom #Table::item:alternate {
background-color: #303030;
}
#ResourceManagement #Bottom #Resources {
background-color: #404040;
}
#ResourceManagement #Bottom #Refreshing {
background-color: #404040;
}
#ResourceManagement #Stack #Heading #Message
{
margin-top: 0;
}
#ResourceManagement #Stack #Status #Title
{
font-size: 12px;
font-weight: bold;
margin-top: 6px;
margin-bottom: 6px;
}
#ResourceManagement #StackEvents #TitleBar {
color: #CCCCCC;
background-color: #393a3c;
border-style: outset;
border-width: 1px;
border-color: #303030;
}
#ResourceManagement #StackEvents #TitleBar * {
font-size:12px;
}
#ResourceManagement #StackEvents #TitleBar #Title {
font-weight:bold;
margin-right: 12px;
}
#ResourceManagement #StackEvents #TitleBar #InProgress #Text {
color: #F0C32D;
}
#ResourceManagement #StackEvents #TitleBar #Succeeded {
color: #43d96a;
}
#ResourceManagement #StackEvents #TitleBar #Failed {
color: #f44642;
}
#ResourceManagement #StackEvents #Content {
border-style: inset;
border-width: 1px;
border-color: #303030;
padding: 12px;
}
#ResourceManagement #StackEvents #Table {
qproperty-alternatingRowColors: true;
qproperty-showGrid: false;
}
#ResourceManagement #StackEvents QTableView::item {
background-color: #303030;
}
#ResourceManagement #StackEvents QTableView::item:focus {
selection-color: #FFFFFF;
selection-background-color: rgba(255, 153, 0, 128);
}
#ResourceManagement #StackEvents QTableView::item:alternate {
background-color: #393a3c;
}
#ResourceManagement #CreateDeployment #LearnMore
{
margin-bottom: 12px;
}
#ResourceManagement #CreateDeployment #WarningMessage
{
margin-top: 12px;
margin-bottom: 12px;
}
#ResourceManagement #LoadingError, #ResourceManagement #LoadingError #Title, #ResourceManagement #LoadingError #Message, #ResourceManagement #LoadingError #ErrorText
{
background: #404040;
}
#ResourceManagement #LoadingError #ErrorText
{
padding: 12px;
color: #f44642;
}
#ResourceManagement #Loading, #ResourceManagement #Loading #Title, #ResourceManagement #Loading #Message
{
background: #404040;
}
#ResourceManagement #Loading, #ResourceManagement #LoadingError
{
padding: 12px;
}
#ResourceManagement #MainToolbar
{
padding: 6px;
border-style: inset;
border-width: 1px;
border-color: #303030;
}
#ResourceManagement #MainToolbar QPushButton
{
border: none;
padding: 0px;
}
#ResourceManagement #MainToolbar #AddNewButton
{
margin-left: 12px;
margin-right: 12px;
}
#ResourceManagement #ResourceImporter #RegionBox:disabled
{
color: #555555;
}
#ResourceManagement #ResourceImporter #ListTable
{
qproperty-alternatingRowColors: true;
qproperty-showGrid: false;
border: none;
}
#ResourceManagement #ResourceImporter #ListTable::item
{
padding-right: 12px;
padding-top: 3px;
padding-bottom: 3px;
background-color: #333436;
}
#ResourceManagement #ResourceImporter #ListTable::item:alternate
{
background-color: #303030;
}
#ResourceManagement #ResourceImporter #SelectionTable
{
qproperty-showGrid: false;
border: none;
gridline-color: #393a3c;
}
#ResourceManagement #ResourceImporter #SelectionTable::item
{
padding: 1px 1px 1px 1px;
}
#ResourceManagement #ResourceImporter #LoadingLabel
{
color : #F0C32D;
}
#ResourceManagement #MainToolbar #SaveButton,
#ResourceManagement #MainToolbar #DeleteButton,
#ResourceManagement #MainToolbar #SourceControlButton,
#ResourceManagement #MainToolbar #AddNewButton
{
qproperty-flat: true;
}
#ResourceManagement #MainToolbar #CurrentProfile
{
margin-right: 12px;
}
#ResourceManagement #MainToolbar #CurrentDeployment
{
margin-right: 12px;
margin-left: 12px;
}
#ResourceManagement #UpdateStack #Refreshing
{
margin-top: 12px;
margin-left: 12px;
}
#ResourceManagement #UpdateStack #Message
{
margin-bottom: 6px;
}
#ResourceManagement #UpdateStack #Table {
qproperty-alternatingRowColors: true;
qproperty-showGrid: false;
}
#ResourceManagement #UpdateStack #Table::item {
background-color: #303030;
}
#ResourceManagement #UpdateStack #Table::item:alternate {
background-color: #393a3c;
}
#ResourceManagement #UpdateStack #Status {
color: #F0C32D;
}
#ProfileSelector #DeleteProfile {
width: 38px;
height: 11px;
border: none;
}
#ProfileSelector #EditSelectedProfile {
color: #00A1C9;
}
#InitializeCloudCanvasProject #Profiles QRadioButton {
margin-left: 5px;
}
#InitializeCloudCanvasProject #ProfileEditButtons {
}
#InitializeCloudCanvasProject #ProfileEditButtons QPushButton {
}
#InitializeCloudCanvasProject #ContentFrame {
x-margin: 6px;
x-padding: 6px;
border: 1px solid rgb(34, 35, 38);
x-background-color: purple;
}
#LoginDialog
{
background-color: #F8F8F8;
}
#LoginDialog Amazon--LoginWelcomeTitle
{
color: #444444;
background-color: #F8F8F8;
font-size: 21px;
qproperty-alignment: AlignCenter;
font-family: "Open Sans Semibold";
}
#LoginDialog Amazon--LoginWelcomeText
{
color: #444444;
background-color: #F8F8F8;
font-size: 13px;
qproperty-alignment: AlignLeft;
}
#LoginDialog Amazon--LoginFooterText
{
color: #999999;
background-color: #F8F8F8;
font-size: 13px;
qproperty-alignment: AlignCenter;
}
#LoginDialog Amazon--LoginWebViewFrame
{
border: 2px solid #EEEEEE;
}
#LoginDialog Amazon--LoginWebView
{
background-color: #F8F8F8;
}
+5 -6
View File
@@ -1,10 +1,9 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file alias="Editor/Style/Editor.qss">Editor.qss</file>
<file alias="Editor/Style/EditorPreferencesDialog.qss">EditorPreferencesDialog.qss</file>
<file alias="Editor/Style/CloudCanvas.qss">CloudCanvas.qss</file>
<file alias="Editor/Style/LayoutConfigDialog.qss">LayoutConfigDialog.qss</file>
<file alias="Editor/Style/GraphicsSettingsDialog.qss">GraphicsSettingsDialog.qss</file>
<file alias="Editor/Style/LensFlareEditor.qss">LensFlareEditor.qss</file>
<file alias="Assets/Editor/Style/Editor.qss">Editor.qss</file>
<file alias="Assets/Editor/Style/EditorPreferencesDialog.qss">EditorPreferencesDialog.qss</file>
<file alias="Assets/Editor/Style/LayoutConfigDialog.qss">LayoutConfigDialog.qss</file>
<file alias="Assets/Editor/Style/GraphicsSettingsDialog.qss">GraphicsSettingsDialog.qss</file>
<file alias="Assets/Editor/Style/LensFlareEditor.qss">LensFlareEditor.qss</file>
</qresource>
</RCC>
+1 -1
View File
@@ -1088,7 +1088,7 @@ void CTimeOfDayDialog::OnResetToDefaultValues()
ITimeOfDay* pTimeOfDay = gEnv->p3DEngine->GetTimeOfDay();
// Load the default time of day settings and use those to reset the time of day.
XmlNodeRef root = GetISystem()->LoadXmlFromFile("Editor/default_time_of_day.xml");
XmlNodeRef root = GetISystem()->LoadXmlFromFile("default_time_of_day.xml");
if (root)
{
pTimeOfDay->Serialize(root, true);
+3 -15
View File
@@ -335,21 +335,9 @@ void CToolBoxManager::Load(ActionManager* actionManager)
if (actionManager)
{
QByteArray array = gSettings.strEditorEnv.toUtf8();
AZStd::string actualPath = AZStd::string::format("@engroot@/%s", array.constData());
XmlNodeRef envNode = XmlHelpers::LoadXmlFromFile(actualPath.c_str());
if (envNode)
{
int childrenCount = envNode->getChildCount();
for (int idx = 0; idx < childrenCount; ++idx)
{
XmlNodeRef child = envNode->getChild(idx);
if (child->haveAttr("scriptPath") && child->haveAttr("shelvesPath"))
{
LoadShelves(child->getAttr("scriptPath"), child->getAttr("shelvesPath"), actionManager);
}
}
}
auto engineSourceAssetPath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Assets";
LoadShelves((engineSourceAssetPath / "Editor" / "Scripts").c_str(),
(engineSourceAssetPath / "Editor" / "Scripts" / "Shelves").c_str(), actionManager);
}
}
@@ -376,9 +376,9 @@ private:
// Tracks new entities that have not yet been saved.
AZStd::unordered_set<AZ::EntityId> m_unsavedEntities;
const AZStd::string m_defaultComponentIconLocation = "Editor/Icons/Components/Component_Placeholder.svg";
const AZStd::string m_defaultComponentViewportIconLocation = "Editor/Icons/Components/Viewport/Component_Placeholder.png";
const AZStd::string m_defaultEntityIconLocation = "Editor/Icons/Components/Viewport/Transform.png";
const AZStd::string m_defaultComponentIconLocation = "Icons/Components/Component_Placeholder.svg";
const AZStd::string m_defaultComponentViewportIconLocation = "Icons/Components/Viewport/Component_Placeholder.png";
const AZStd::string m_defaultEntityIconLocation = "Icons/Components/Viewport/Transform.png";
bool m_debugDisplayBusImplementationActive = false;
@@ -33,8 +33,8 @@ void ComponentCategoryList::Init()
headers << tr("Categories");
setHeaderLabels(headers);
const QString parentCategoryIconPath = QString("Editor/Icons/PropertyEditor/Browse_on.png");
const QString categoryIconPath = QString("Editor/Icons/PropertyEditor/Browse.png");
const QString parentCategoryIconPath = QString("Icons/PropertyEditor/Browse_on.png");
const QString categoryIconPath = QString("Icons/PropertyEditor/Browse.png");
QTreeWidgetItem* allCategory = new QTreeWidgetItem(this);
allCategory->setText(0, "All");
@@ -94,7 +94,7 @@ namespace AZ
{
if (AzFramework::StringFunc::Equal(extensionString.c_str(), potentialExtension.c_str()))
{
return AzToolsFramework::AssetBrowser::SourceFileDetails("Editor/Icons/AssetBrowser/FBX_16.png");
return AzToolsFramework::AssetBrowser::SourceFileDetails("Icons/AssetBrowser/FBX_16.png");
}
}
}
@@ -1,17 +1,17 @@
<RCC>
<qresource prefix="/Icons">
<file alias="Browse.png">../../../../Editor/Icons/PropertyEditor/Browse.png</file>
<file alias="Browse_On.png">../../../../Editor/Icons/PropertyEditor/Browse_on.png</file>
<file alias="DeleteRule.png">../../../../Editor/Icons/PropertyEditor/remove.png</file>
<file alias="DeleteGroup.png">../../../../Editor/Icons/PropertyEditor/remove.png</file>
<file alias="Error.png">../../../../Editor/Icons/PropertyEditor/error_icon.png</file>
<file alias="RefreshGroup.png">../../../../Editor/Icons/PropertyEditor/reset_icon.png</file>
<file alias="MeshSelectorBrowse.png">../../../../Editor/Icons/AssetImporter/mesh.png</file>
<file alias="MeshSelectorBrowse_On.png">../../../../Editor/Icons/AssetImporter/mesh_on.png</file>
<file alias="MeshTreeIcon.png">../../../../Editor/Icons/AssetImporter/mesh_on.png</file>
<file alias="GroupTreeIcon.png">../../../../Editor/Icons/AssetImporter/group_icon.png</file>
<file alias="CheckMark_Checked.png">../../../../Editor/Icons/checkmark_checked.png</file>
<file alias="CheckMark_Hover.png">../../../../Editor/Icons/checkmark_checked_hover.png</file>
<file alias="CheckMark_Unchecked_Hover.png">../../../../Editor/Icons/checkmark_unchecked_hover.png</file>
<file alias="Browse.png">../../../../Assets/Editor/Icons/PropertyEditor/Browse.png</file>
<file alias="Browse_On.png">../../../../Assets/Editor/Icons/PropertyEditor/Browse_on.png</file>
<file alias="DeleteRule.png">../../../../Assets/Editor/Icons/PropertyEditor/remove.png</file>
<file alias="DeleteGroup.png">../../../../Assets/Editor/Icons/PropertyEditor/remove.png</file>
<file alias="Error.png">../../../../Assets/Editor/Icons/PropertyEditor/error_icon.png</file>
<file alias="RefreshGroup.png">../../../../Assets/Editor/Icons/PropertyEditor/reset_icon.png</file>
<file alias="MeshSelectorBrowse.png">../../../../Assets/Editor/Icons/AssetImporter/mesh.png</file>
<file alias="MeshSelectorBrowse_On.png">../../../../Assets/Editor/Icons/AssetImporter/mesh_on.png</file>
<file alias="MeshTreeIcon.png">../../../../Assets/Editor/Icons/AssetImporter/mesh_on.png</file>
<file alias="GroupTreeIcon.png">../../../../Assets/Editor/Icons/AssetImporter/group_icon.png</file>
<file alias="CheckMark_Checked.png">../../../../Assets/Editor/Icons/checkmark_checked.png</file>
<file alias="CheckMark_Hover.png">../../../../Assets/Editor/Icons/checkmark_checked_hover.png</file>
<file alias="CheckMark_Unchecked_Hover.png">../../../../Assets/Editor/Icons/checkmark_unchecked_hover.png</file>
</qresource>
</RCC>
@@ -175,7 +175,7 @@ CDockTitleBarWidget::CDockTitleBarWidget(QDockWidget* dockWidget)
m_layout->addLayout(m_buttonLayout, 0);
m_floatButton = new CDockWidgetTitleButton(dockWidget);
m_floatButton->setIcon(QIcon("Editor/Icons/float.png"));
m_floatButton->setIcon(QIcon("Icons/float.png"));
m_floatButton->setVisible(opt.floatable);
m_floatButton->setToolTip("Toggle Floating");
connect(m_floatButton, SIGNAL(clicked()), SLOT(OnFloatButtonPressed()));
@@ -185,7 +185,7 @@ CDockTitleBarWidget::CDockTitleBarWidget(QDockWidget* dockWidget)
// close.png is a standard icon that looks similar to one in Fusion theme but
// uses alpha so it can be used on dark theme as well.
// style()->standardIcon(QStyle::SP_TitleBarCloseButton, &opt, dockWidget)
QIcon closeIcon("Editor/Icons/close.png");
QIcon closeIcon("Icons/close.png");
m_closeButton->setIcon(closeIcon);
m_closeButton->setVisible(opt.closable);
m_closeButton->setToolTip("Close");
@@ -80,7 +80,7 @@ void PropertyRowLocalFrameBase::reset(QPropertyTree* tree)
void PropertyRowLocalFrameBase::redraw(const PropertyDrawContext& context)
{
static QIcon gizmo("Editor/Icons/animation/gizmo_location.png");
static QIcon gizmo("Icons/animation/gizmo_location.png");
gizmo.paint(context.painter, context.widgetRect.adjusted(1, 1, 1, 1), Qt::AlignRight);
}
@@ -292,7 +292,7 @@ const QIcon& PropertyRowResourceSelector::buttonIcon(const QPropertyTree* tree,
}
case BUTTON_CREATE:
{
static QIcon addIcon("Editor/Icons/animation/add.png");
static QIcon addIcon("Icons/animation/add.png");
;
return addIcon;
}
@@ -1,9 +0,0 @@
[Platforms]
;pc=enabled
es3=enabled
;ios=enabled
;osx_gl=enabled
;provo=enabled
;server=enabled
@@ -0,0 +1,11 @@
{
"Amazon": {
"AssetProcessor": {
"Settings": {
"Platforms": {
"es3": "enabled"
}
}
}
}
}
@@ -1,7 +0,0 @@
[Platforms]
;pc=enabled
;es3=enabled
ios=enabled
;osx_gl=enabled
;provo=enabled
;server=enabled
@@ -0,0 +1,11 @@
{
"Amazon": {
"AssetProcessor": {
"Settings": {
"Platforms": {
"ios": "enabled"
}
}
}
}
}
@@ -1,9 +0,0 @@
[Platforms]
;pc=enabled
;es3=enabled
;ios=enabled
;osx_gl=enabled
provo=enabled
;server=enabled
@@ -0,0 +1,11 @@
{
"Amazon": {
"AssetProcessor": {
"Settings": {
"Platforms": {
"provo": "enabled"
}
}
}
}
}
+8 -8
View File
@@ -178,7 +178,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
TARGETS
AssetProcessor.Tests
FILES
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_badplatform/AssetProcessorPlatformConfig.ini
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_badplatform/AssetProcessorPlatformConfig.setreg
OUTPUT_SUBDIRECTORY
testdata/config_broken_badplatform
)
@@ -186,7 +186,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
TARGETS
AssetProcessor.Tests
FILES
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_noscans/AssetProcessorPlatformConfig.ini
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_noscans/AssetProcessorPlatformConfig.setreg
OUTPUT_SUBDIRECTORY
testdata/config_broken_noscans
)
@@ -194,7 +194,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
TARGETS
AssetProcessor.Tests
FILES
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_recognizers/AssetProcessorPlatformConfig.ini
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_recognizers/AssetProcessorPlatformConfig.setreg
OUTPUT_SUBDIRECTORY
testdata/config_broken_recognizers
)
@@ -202,7 +202,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
TARGETS
AssetProcessor.Tests
FILES
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_noplatform/AssetProcessorPlatformConfig.ini
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_noplatform/AssetProcessorPlatformConfig.setreg
OUTPUT_SUBDIRECTORY
testdata/config_broken_noplatform
)
@@ -210,7 +210,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
TARGETS
AssetProcessor.Tests
FILES
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_regular/AssetProcessorPlatformConfig.ini
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_regular/AssetProcessorPlatformConfig.setreg
OUTPUT_SUBDIRECTORY
testdata/config_regular
)
@@ -218,7 +218,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
TARGETS
AssetProcessor.Tests
FILES
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_regular_platform_scanfolder/AssetProcessorPlatformConfig.ini
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_regular_platform_scanfolder/AssetProcessorPlatformConfig.setreg
OUTPUT_SUBDIRECTORY
testdata/config_regular_platform_scanfolder
)
@@ -226,7 +226,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
TARGETS
AssetProcessor.Tests
FILES
${CMAKE_CURRENT_SOURCE_DIR}/testdata/EmptyDummyProject/AssetProcessorGamePlatformConfig.ini
${CMAKE_CURRENT_SOURCE_DIR}/testdata/EmptyDummyProject/AssetProcessorGamePlatformConfig.setreg
OUTPUT_SUBDIRECTORY
testdata/EmptyDummyProject
)
@@ -234,7 +234,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
TARGETS
AssetProcessor.Tests
FILES
${CMAKE_CURRENT_SOURCE_DIR}/testdata/DummyProject/AssetProcessorGamePlatformConfig.ini
${CMAKE_CURRENT_SOURCE_DIR}/testdata/DummyProject/AssetProcessorGamePlatformConfig.setreg
OUTPUT_SUBDIRECTORY
testdata/DummyProject
)
@@ -10,14 +10,14 @@
#
set(FILES
testdata/config_broken_badplatform/AssetProcessorPlatformConfig.ini
testdata/config_broken_noplatform/AssetProcessorPlatformConfig.ini
testdata/config_broken_noscans/AssetProcessorPlatformConfig.ini
testdata/config_broken_recognizers/AssetProcessorPlatformConfig.ini
testdata/config_regular/AssetProcessorPlatformConfig.ini
testdata/config_regular_platform_scanfolder/AssetProcessorPlatformConfig.ini
testdata/EmptyDummyProject/AssetProcessorGamePlatformConfig.ini
testdata/DummyProject/AssetProcessorGamePlatformConfig.ini
testdata/config_broken_badplatform/AssetProcessorPlatformConfig.setreg
testdata/config_broken_noplatform/AssetProcessorPlatformConfig.setreg
testdata/config_broken_noscans/AssetProcessorPlatformConfig.setreg
testdata/config_broken_recognizers/AssetProcessorPlatformConfig.setreg
testdata/config_regular/AssetProcessorPlatformConfig.setreg
testdata/config_regular_platform_scanfolder/AssetProcessorPlatformConfig.setreg
testdata/EmptyDummyProject/AssetProcessorGamePlatformConfig.setreg
testdata/DummyProject/AssetProcessorGamePlatformConfig.setreg
native/tests/AssetProcessorTest.h
native/tests/AssetProcessorTest.cpp
native/tests/BaseAssetProcessorTest.h
@@ -45,7 +45,6 @@ namespace AssetProcessor
" ScanFolder TEXT NOT NULL collate nocase, "
" DisplayName TEXT NOT NULL collate nocase, "
" PortableKey TEXT NOT NULL collate nocase, "
" OutputPrefix TEXT NOT NULL collate nocase, "
" IsRoot INTEGER NOT NULL);";
static const char* CREATE_SOURCES_TABLE = "AssetProcessor::CreateSourceTable";
@@ -254,14 +253,13 @@ namespace AssetProcessor
static const char* INSERT_SCANFOLDER = "AssetProcessor::InsertScanFolder";
static const char* INSERT_SCANFOLDER_STATEMENT =
"INSERT INTO ScanFolders (ScanFolder, DisplayName, PortableKey, OutputPrefix, IsRoot) "
"VALUES (:scanfolder, :displayname, :portablekey, :outputprefix, :isroot);";
"INSERT INTO ScanFolders (ScanFolder, DisplayName, PortableKey, IsRoot) "
"VALUES (:scanfolder, :displayname, :portablekey, :isroot);";
static const auto s_InsertScanfolderQuery = MakeSqlQuery(INSERT_SCANFOLDER, INSERT_SCANFOLDER_STATEMENT, LOG_NAME,
SqlParam<const char*>(":scanfolder"),
SqlParam<const char*>(":displayname"),
SqlParam<const char*>(":portablekey"),
SqlParam<const char*>(":outputprefix"),
SqlParam<AZ::s32>(":isroot"));
static const char* UPDATE_SCANFOLDER = "AssetProcessor::UpdateScanFolder";
@@ -270,7 +268,6 @@ namespace AssetProcessor
"ScanFolder = :scanfolder, "
"DisplayName = :displayname, "
"PortableKey = :portablekey, "
"OutputPrefix = :outputprefix, "
"IsRoot = :isroot "
"WHERE "
"ScanFolderID = :scanfolderid;";
@@ -279,7 +276,6 @@ namespace AssetProcessor
SqlParam<const char*>(":scanfolder"),
SqlParam<const char*>(":displayname"),
SqlParam<const char*>(":portablekey"),
SqlParam<const char*>(":outputprefix"),
SqlParam<AZ::s32>(":isroot"),
SqlParam<AZ::s64>(":scanfolderid"));
@@ -1051,6 +1047,10 @@ namespace AssetProcessor
}
}
// Nothing to do for version `AssetDatabase::DatabaseVersion::RemoveOutputPrefixFromScanFolders`
// sqlite doesn't not support altering a table to remove a column
// This is fine as the extra OutputPrefix column will not be queried
if (foundVersion == CurrentDatabaseVersion())
{
dropAllTables = false;
@@ -1433,7 +1433,7 @@ namespace AssetProcessor
//its not in the database, add it
// it is a single statement, do not wrap it in a transaction, this wastes a lot of time.
if (!s_InsertScanfolderQuery.BindAndStep(*m_databaseConnection, entry.m_scanFolder.c_str(), entry.m_displayName.c_str(), entry.m_portableKey.c_str(), entry.m_outputPrefix.c_str(), entry.m_isRoot))
if (!s_InsertScanfolderQuery.BindAndStep(*m_databaseConnection, entry.m_scanFolder.c_str(), entry.m_displayName.c_str(), entry.m_portableKey.c_str(), entry.m_isRoot))
{
return false;
}
@@ -1457,7 +1457,7 @@ namespace AssetProcessor
return false;
}
return s_UpdateScanfolderQuery.BindAndStep(*m_databaseConnection, entry.m_scanFolder.c_str(), entry.m_displayName.c_str(), entry.m_portableKey.c_str(), entry.m_outputPrefix.c_str(), entry.m_isRoot, entry.m_scanFolderID);
return s_UpdateScanfolderQuery.BindAndStep(*m_databaseConnection, entry.m_scanFolder.c_str(), entry.m_displayName.c_str(), entry.m_portableKey.c_str(), entry.m_isRoot, entry.m_scanFolderID);
}
}
@@ -951,17 +951,7 @@ namespace AssetProcessor
// the subId part of the assetId will always be set to zero.
assetInfo.m_assetId = AZ::Data::AssetId(entry.m_sourceGuid, 0);
// the Scan Folder may have an output prefix, so we must remove it from the relpath.
// this involves deleting the output prefix and the first slash ('editor/') which is why
// we remove the length of outputPrefix and one extra character.
if (!scanEntry.m_outputPrefix.empty())
{
assetInfo.m_relativePath = entry.m_sourceName.substr(static_cast<int>(scanEntry.m_outputPrefix.size()) + 1);
}
else
{
assetInfo.m_relativePath = entry.m_sourceName;
}
assetInfo.m_relativePath = entry.m_sourceName;
AZStd::string absolutePath;
AzFramework::StringFunc::Path::Join(scanEntry.m_scanFolder.c_str(), assetInfo.m_relativePath.c_str(), absolutePath);
assetInfo.m_sizeBytes = AZ::IO::SystemFile::Length(absolutePath.c_str());
@@ -1375,17 +1365,7 @@ namespace AssetProcessor
AzToolsFramework::AssetDatabase::ScanFolderDatabaseEntry scanEntry;
if (m_db->GetScanFolderByScanFolderID(entry.m_scanFolderPK, scanEntry))
{
// the Scan Folder may have an output prefix, so we must remove it from the relpath.
// this involves deleting the output prefix and the first slash ('editor/') which is why
// we remove the length of outputPrefix and one extra character.
if (!scanEntry.m_outputPrefix.empty())
{
relativePath = entry.m_sourceName.substr(static_cast<int>(scanEntry.m_outputPrefix.size()) + 1);
}
else
{
relativePath = entry.m_sourceName;
}
relativePath = entry.m_sourceName;
watchFolder = scanEntry.m_scanFolder;
@@ -1530,28 +1510,7 @@ namespace AssetProcessor
watchFolder = sourceInfo.m_watchFolder.toStdString().c_str();
AZStd::string sourceNameStr(sourceInfo.m_sourceName.toStdString().c_str());
// the Scan Folder may have an output prefix, so we must remove it from the relpath.
// this involves deleting the output prefix and the first slash ('editor/') which is why
// we remove the length of outputPrefix and one extra character.
const AssetProcessor::ScanFolderInfo* info = m_platformConfig->GetScanFolderByPath(watchFolder.c_str());
if ((info)&&(!info->GetOutputPrefix().isEmpty()))
{
const int prefixLength = static_cast<int>(info->GetOutputPrefix().length()) + 1;
AZ_Assert(sourceNameStr.length() > prefixLength, "Source name [%s] was invalid compared to the output prefix.", sourceNameStr.c_str() != nullptr ? sourceNameStr.c_str() : "");
if (sourceNameStr.length() > prefixLength)
{
assetInfo.m_relativePath = sourceNameStr.substr(prefixLength);
}
else
{
assetInfo.m_relativePath.swap(sourceNameStr);
}
}
else
{
assetInfo.m_relativePath.swap(sourceNameStr);
}
assetInfo.m_relativePath.swap(sourceNameStr);
assetInfo.m_assetId = foundSource->first;
@@ -1598,15 +1557,7 @@ namespace AssetProcessor
return false;
}
QString databasePath = QString::fromUtf8(sourceDatabaseName);
if (!scanFolderInfo->GetOutputPrefix().isEmpty() && databasePath.startsWith(scanFolderInfo->GetOutputPrefix(), Qt::CaseInsensitive))
{
QString relativePath = databasePath.right(databasePath.length() - scanFolderInfo->GetOutputPrefix().length() - 1); // also eat the slash, hence -1
assetInfo.m_relativePath = relativePath.toUtf8().data();
}
else
{
assetInfo.m_relativePath = sourceDatabaseName;
}
assetInfo.m_relativePath = sourceDatabaseName;
AZStd::string absolutePath;
AzFramework::StringFunc::Path::Join(watchFolder, assetInfo.m_relativePath.c_str(), absolutePath);
@@ -65,7 +65,7 @@ namespace AssetProcessor
if (!AzFramework::StringFunc::Path::IsRelative(path.c_str()))
{
if (m_platformConfig->ConvertToRelativePath(QString::fromUtf8(path.c_str()), relativePath, scanFolder, true))
if (m_platformConfig->ConvertToRelativePath(QString::fromUtf8(path.c_str()), relativePath, scanFolder))
{
auto* scanFolderInfo = m_platformConfig->GetScanFolderByPath(scanFolder);
@@ -156,7 +156,7 @@ Please note that only those seed files will get updated that are active for your
else
{
QString relativePathQString;
if (!PlatformConfiguration::ConvertToRelativePath(normalizedSource.c_str(), scanFolderInfo, relativePathQString, false))
if (!PlatformConfiguration::ConvertToRelativePath(normalizedSource.c_str(), scanFolderInfo, relativePathQString))
{
return AZ::Failure(AZStd::string::format("Failed to convert path to relative path. %s\n", normalizedSource.c_str()));
}
@@ -167,16 +167,6 @@ Please note that only those seed files will get updated that are active for your
return AZ::Success();
}
AZStd::string SourceFileRelocator::RemoveDatabasePrefix(const ScanFolderInfo* scanFolder, AZStd::string sourceName)
{
if (!scanFolder->GetOutputPrefix().isEmpty())
{
return sourceName.substr(scanFolder->GetOutputPrefix().size() + 1); //+1 to remove the slash after the prefix
}
return sourceName;
}
QHash<QString, int> SourceFileRelocator::GetSources(QStringList pathMatches, const ScanFolderInfo* scanFolderInfo,
SourceFileRelocationContainer& sources) const
{
@@ -188,7 +178,7 @@ Please note that only those seed files will get updated that are active for your
PlatformConfiguration::ConvertToRelativePath(file, scanFolderInfo, databaseSourceName);
m_stateData->QuerySourceBySourceNameScanFolderID(databaseSourceName.toUtf8().constData(), scanFolderInfo->ScanFolderID(), [this, &sources, &scanFolderInfo, &sourceIndexMap, &databaseSourceName](const AzToolsFramework::AssetDatabase::SourceDatabaseEntry& entry)
{
sources.emplace_back(entry, GetProductMapForSource(entry.m_sourceID), RemoveDatabasePrefix(scanFolderInfo, entry.m_sourceName), scanFolderInfo);
sources.emplace_back(entry, GetProductMapForSource(entry.m_sourceID), entry.m_sourceName, scanFolderInfo);
sourceIndexMap[databaseSourceName] = aznumeric_cast<int> (sources.size() - 1);
return true;
});
@@ -357,12 +347,6 @@ Please note that only those seed files will get updated that are active for your
QString relativeFileName(normalizedSource.c_str());
//if relative path starts with the output prefix than remove it first
if (!scanFolderInfo->GetOutputPrefix().isEmpty() && relativeFileName.startsWith(scanFolderInfo->GetOutputPrefix(), Qt::CaseInsensitive))
{
relativeFileName = relativeFileName.right(relativeFileName.length() - (scanFolderInfo->GetOutputPrefix().length() + 1)); // adding 1 for slash
}
QDir rooted(scanFolderInfo->ScanPath());
QString absolutePath = rooted.absoluteFilePath(relativeFileName);
@@ -620,7 +604,7 @@ Please note that only those seed files will get updated that are active for your
{
QString relativePath;
QString scanFolderName;
m_platformConfig->ConvertToRelativePath(newDestinationPath.c_str(), relativePath, scanFolderName, false);
m_platformConfig->ConvertToRelativePath(newDestinationPath.c_str(), relativePath, scanFolderName);
relocationInfo.m_newAbsolutePath = newDestinationPath;
relocationInfo.m_newRelativePath = relativePath.toUtf8().constData();
@@ -96,7 +96,7 @@ namespace AssetProcessor
SourceFileRelocationInfo(const AZStd::string& filePath, const ScanFolderInfo* scanFolder)
{
QString relFilePath;
PlatformConfiguration::ConvertToRelativePath(filePath.c_str(), scanFolder, relFilePath, true);
PlatformConfiguration::ConvertToRelativePath(filePath.c_str(), scanFolder, relFilePath);
m_oldRelativePath = relFilePath.toUtf8().data();
AzFramework::StringFunc::Path::ConstructFull(scanFolder->ScanPath().toUtf8().constData(), m_oldRelativePath.c_str(), m_oldAbsolutePath, false);
m_oldAbsolutePath = AssetUtilities::NormalizeFilePath(m_oldAbsolutePath.c_str()).toUtf8().constData();
@@ -191,7 +191,6 @@ namespace AssetProcessor
SourceFileRelocator(AZStd::shared_ptr<AzToolsFramework::AssetDatabase::AssetDatabaseConnection> stateData, PlatformConfiguration* platformConfiguration);
~SourceFileRelocator();
static AZStd::string RemoveDatabasePrefix(const ScanFolderInfo* scanFolder, AZStd::string sourceName);
static void MakePathRelative(const AZStd::string& parentPath, const AZStd::string& childPath, AZStd::string& parentRelative, AZStd::string& childRelative);
static AZ::Outcome<AZStd::string, AZStd::string> HandleWildcard(AZStd::string_view absFile, AZStd::string_view absSearch, AZStd::string destination);
@@ -142,11 +142,6 @@ namespace AssetProcessor
QString databaseSourceName = QString::fromUtf8(entry.m_sourceName.c_str());
QString scanFolderPath = QString::fromUtf8(entry.m_scanFolder.c_str());
QString relativeToScanFolderPath = databaseSourceName;
if (!entry.m_outputPrefix.empty())
{
relativeToScanFolderPath = relativeToScanFolderPath.remove(0, static_cast<int>(entry.m_outputPrefix.size()) + 1);
}
QString finalAbsolute = (QString("%1/%2").arg(scanFolderPath).arg(relativeToScanFolderPath));
m_sourceFilesInDatabase[finalAbsolute] = { scanFolderPath, relativeToScanFolderPath, databaseSourceName, entry.m_analysisFingerprint.c_str() };
@@ -173,12 +168,6 @@ namespace AssetProcessor
if (scanFolderInfo.ScanFolderID() == entry.m_scanFolderPK)
{
scanFolderPath = scanFolderInfo.ScanPath();
if (!scanFolderInfo.GetOutputPrefix().isEmpty())
{
relativeToScanFolderPath = relativeToScanFolderPath.remove(0, static_cast<int>(scanFolderInfo.GetOutputPrefix().size()) + 1);
}
break;
}
}
@@ -470,12 +459,12 @@ namespace AssetProcessor
return;
}
// note that m_SourceFilesInDatabase is a map from (full absolute path) --> (database name for file, which includes outputprefix)
// note that m_SourceFilesInDatabase is a map from (full absolute path) --> (database name for file)
for (auto iter = m_sourceFilesInDatabase.begin(); iter != m_sourceFilesInDatabase.end(); iter++)
{
// CheckDeletedSourceFile actually expects the database name as the second value
// iter.key is the full path normalized. iter.value is the database path.
// we need the relative path too, which involves removing the scan folder outputprefix it present:
// we need the relative path too:
CheckDeletedSourceFile(
iter.key(), iter.value().m_sourceRelativeToWatchFolder, iter.value().m_sourceDatabaseName,
AZStd::chrono::system_clock::now());
@@ -1633,27 +1622,7 @@ namespace AssetProcessor
AzToolsFramework::AssetDatabase::ScanFolderDatabaseEntry scanfolder;
if (m_stateData->GetScanFolderByScanFolderID(source.m_scanFolderPK, scanfolder))
{
// there's one more thing to account for here, and thats the fact that the sourceName may have an outputPrefix appended on to it
// so for example, the scan folder might be c:/ly/dev/Gems/Clouds/Assets
// but the outputPrefix might be Clouds/Assets, meaning "put it in that folder in the cache instead of just at the root"
// When we have an outputprefix, we prepend it to SourceName so that its a unique source
// so for example, the sourceName might be Clouds/Assets/blah.tif
// if you were to blindly concatenate them you'd end up with c:/ly/dev/Gems/Clouds/Assets/Clouds/Assets/blah.tif
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// The watch folder is here
// ^^^^^^^^^^^^^^
// Prefix prepended
// ^^^^^^^^
// actual name
// so remove the output prefix from sourcename if present before doing any source ops on it.
AZStd::string sourceName(source.m_sourceName);
if (!scanfolder.m_outputPrefix.empty())
{
sourceName = sourceName.substr(scanfolder.m_outputPrefix.size() + 1);
}
AZStd::string fullSourcePath = AZStd::string::format("%s/%s", scanfolder.m_scanFolder.c_str(), sourceName.c_str());
AZStd::string fullSourcePath = AZStd::string::format("%s/%s", scanfolder.m_scanFolder.c_str(), source.m_sourceName.c_str());
AssessFileInternal(fullSourcePath.c_str(), false);
}
@@ -2001,18 +1970,7 @@ namespace AssetProcessor
//remove the jobs associated with these products
m_stateData->RemoveJob(oldJobInfo.m_jobID);
// note that JobRemoved is supposed to emit a jobinfo that is not output-prefixed
if (!scanFolder->GetOutputPrefix().isEmpty())
{
JobInfo newJobInfo(oldJobInfo);
QString sourcePathWithPrefix = QString::fromUtf8(oldJobInfo.m_sourceFile.c_str());
newJobInfo.m_sourceFile = (sourcePathWithPrefix.right(sourcePathWithPrefix.length() - (scanFolder->GetOutputPrefix().length() + 1))).toUtf8().constData();
Q_EMIT JobRemoved(newJobInfo);
}
else
{
Q_EMIT JobRemoved(oldJobInfo);
}
Q_EMIT JobRemoved(oldJobInfo);
}
}
@@ -2239,7 +2197,7 @@ namespace AssetProcessor
}
AzToolsFramework::AssetDatabase::SourceDatabaseEntryContainer sources;
QString sourceName = scanFolderInfo->GetOutputPrefix().isEmpty() ? relativePath : QDir::cleanPath(scanFolderInfo->GetOutputPrefix() + QDir::separator() + relativePath);
QString sourceName = relativePath;
m_stateData->GetSourcesLikeSourceName(sourceName, AzToolsFramework::AssetDatabase::AssetDatabaseConnection::StartsWith, sources);
AZ_TracePrintf(AssetProcessor::DebugChannel, "CheckDeletedSourceFolder: %i matching files.\n", sources.size());
@@ -2250,11 +2208,6 @@ namespace AssetProcessor
// reconstruct full path:
QString actualRelativePath = source.m_sourceName.c_str();
if (!scanFolderInfo->GetOutputPrefix().isEmpty())
{
actualRelativePath = actualRelativePath.right(actualRelativePath.length() - (scanFolderInfo->GetOutputPrefix().length() + 1)); // adding one for separator
}
QString finalPath = scanFolder.absoluteFilePath(actualRelativePath);
if (!QFile::exists(finalPath))
@@ -2513,11 +2466,6 @@ namespace AssetProcessor
const ScanFolderInfo* scanFolderInfo = m_platformConfig->GetScanFolderForFile(normalizedPath);
relativePathToFile = databasePathToFile;
// remove output prefix if present to generate relative path
if ((scanFolderInfo)&&(!scanFolderInfo->GetOutputPrefix().isEmpty()))
{
relativePathToFile = relativePathToFile.remove(0, static_cast<int>(scanFolderInfo->GetOutputPrefix().length()) + 1);
}
if (normalizedPath.length() >= AP_MAX_PATH_LEN)
{
@@ -2537,7 +2485,7 @@ namespace AssetProcessor
job.m_jobEntry = JobEntry(
QString::fromUtf8(jobInfo.m_watchFolder.c_str()),
relativePathToFile,
databasePathToFile, // with outputprefix
databasePathToFile,
jobInfo.m_builderGuid,
*platformFromInfo,
jobInfo.m_jobKey.c_str(), 0, GenerateNewJobRunKey(),
@@ -2646,7 +2594,7 @@ namespace AssetProcessor
// to call the expensive function to discover correct case.
QString pathRelativeToScanFolder;
QString scanFolderPath;
m_platformConfig->ConvertToRelativePath(overrider, pathRelativeToScanFolder, scanFolderPath, false /*include output prefix*/);
m_platformConfig->ConvertToRelativePath(overrider, pathRelativeToScanFolder, scanFolderPath);
AssetUtilities::UpdateToCorrectCase(scanFolderPath, pathRelativeToScanFolder);
overrider = QDir(scanFolderPath).absoluteFilePath(pathRelativeToScanFolder);
}
@@ -3367,10 +3315,6 @@ namespace AssetProcessor
newSourceInfo.m_watchFolder = scanFolder->ScanPath();
newSourceInfo.m_sourceDatabaseName = databasePathToFile;
newSourceInfo.m_sourceRelativeToWatchFolder = databasePathToFile;
if (!scanFolder->GetOutputPrefix().isEmpty())
{
newSourceInfo.m_sourceRelativeToWatchFolder = newSourceInfo.m_sourceRelativeToWatchFolder.remove(0, static_cast<int>(scanFolder->GetOutputPrefix().length()) + 1);
}
{
// this scope exists only to narrow the range of m_sourceUUIDToSourceNameMapMutex
@@ -3644,12 +3588,6 @@ namespace AssetProcessor
continue;
}
//if relative path starts with the output prefix then remove it first
if (!scanFolderInfo->GetOutputPrefix().isEmpty() && knownPathBeforeWildcard.startsWith(scanFolderInfo->GetOutputPrefix(), Qt::CaseInsensitive))
{
knownPathBeforeWildcard = knownPathBeforeWildcard.right(knownPathBeforeWildcard.length() - (scanFolderInfo->GetOutputPrefix().length() + 1)); // adding 1 for slash
}
QDir rooted(scanFolderInfo->ScanPath());
QString absolutePath = rooted.absoluteFilePath(knownPathBeforeWildcard);
@@ -3950,7 +3888,6 @@ namespace AssetProcessor
scanFolderFromConfigFile.ScanPath().toUtf8().constData(),
scanFolderFromConfigFile.GetDisplayName().toUtf8().constData(),
scanFolderFromConfigFile.GetPortableKey().toUtf8().constData(),
scanFolderFromConfigFile.GetOutputPrefix().toUtf8().constData(),
scanFolderFromConfigFile.IsRoot());
//remove this scan path from the scan folders so what is left can deleted
m_scanFoldersInDatabase.erase(found);
@@ -3962,7 +3899,6 @@ namespace AssetProcessor
scanFolderFromConfigFile.ScanPath().toUtf8().constData(),
scanFolderFromConfigFile.GetDisplayName().toUtf8().constData(),
scanFolderFromConfigFile.GetPortableKey().toUtf8().constData(),
scanFolderFromConfigFile.GetOutputPrefix().toUtf8().constData(),
scanFolderFromConfigFile.IsRoot());
}
@@ -4006,11 +3942,7 @@ namespace AssetProcessor
result.m_sourceDatabaseName = QString::fromUtf8(sourceDatabaseEntry.m_sourceName.c_str());
result.m_watchFolder = QString::fromUtf8(scanFolder.m_scanFolder.c_str());
result.m_sourceRelativeToWatchFolder = result.m_sourceDatabaseName;
if (!scanFolder.m_outputPrefix.empty())
{
result.m_sourceRelativeToWatchFolder = result.m_sourceRelativeToWatchFolder.remove(0, static_cast<int>(scanFolder.m_outputPrefix.size()) + 1);
}
{
// this scope exists to restrict the duration of the below lock.
AZStd::lock_guard<AZStd::mutex> lock(m_sourceUUIDToSourceInfoMapMutex);
@@ -4088,16 +4020,7 @@ namespace AssetProcessor
{
sourceDatabaseEntry.m_scanFolderPK = scanFolder->ScanFolderID();
if (!scanFolder->GetOutputPrefix().isEmpty())
{
// replace the "output prefix" part of the file name with the one from the ini file to sort out case sensitivity problems.
QString withoutOutputPrefix = relativeSourceFilePath.remove(0, scanFolder->GetOutputPrefix().length() + 1);
sourceDatabaseEntry.m_sourceName = AZStd::string::format("%s/%s", scanFolder->GetOutputPrefix().toUtf8().constData(), withoutOutputPrefix.toUtf8().data());
}
else
{
sourceDatabaseEntry.m_sourceName = relativeSourceFilePath.toUtf8().constData();
}
sourceDatabaseEntry.m_sourceName = relativeSourceFilePath.toUtf8().constData();
sourceDatabaseEntry.m_sourceGuid = AssetUtilities::CreateSafeSourceUUIDFromName(sourceDatabaseEntry.m_sourceName.c_str());
@@ -4709,7 +4632,7 @@ namespace AssetProcessor
QString databasePath;
QString scanFolderPath;
m_platformConfig->ConvertToRelativePath(metaDataFileName, databasePath, scanFolderPath, true);
m_platformConfig->ConvertToRelativePath(metaDataFileName, databasePath, scanFolderPath);
outFilesToFingerprint.insert(AZStd::make_pair(metaDataFileName.toUtf8().constData(), databasePath.toUtf8().constData()));
}
}
@@ -163,7 +163,7 @@ namespace AssetProcessor
//! Internal structure that will hold all the necessary source info
struct SourceFileInfo
{
QString m_databasePath; // clarification: this is the database path (ie, includes outputprefix)
QString m_databasePath; // clarification: this is the database path
QString m_pathRelativeToScanFolder;
AZ::Uuid m_uuid;
const ScanFolderInfo* m_scanFolder{ nullptr };
@@ -222,7 +222,7 @@ namespace AssetProcessor
//! Emit whenever a new asset is found or an existing asset is updated
void AssetMessage(AzFramework::AssetSystem::AssetNotificationMessage message);
// InputAssetProcessed - uses absolute asset path of input file - no outputprefix
// InputAssetProcessed - uses absolute asset path of input file
void InputAssetProcessed(QString fullAssetPath, QString platform);
void RequestInputAssetStatus(QString inputAssetPath, QString platform, QString jobDescription);
@@ -28,7 +28,6 @@ namespace AssetProcessor
QString path,
QString displayName,
QString portableKey,
QString prefix,
bool isRoot,
bool recurseSubFolders,
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms = AZStd::vector<AssetBuilderSDK::PlatformInfo>{},
@@ -38,7 +37,6 @@ namespace AssetProcessor
: m_scanPath(path)
, m_displayName(displayName)
, m_portableKey (portableKey)
, m_outputPrefix(prefix)
, m_isRoot(isRoot)
, m_recurseSubFolders(recurseSubFolders)
, m_order(order)
@@ -62,11 +60,6 @@ namespace AssetProcessor
return m_displayName;
}
QString GetOutputPrefix() const
{
return m_outputPrefix;
}
bool IsRoot() const
{
return m_isRoot;
@@ -110,7 +103,6 @@ namespace AssetProcessor
private:
QString m_scanPath; // the local path to scan ("C:\\whatever")
QString m_displayName; // the display name to show in GUIs that show it.
QString m_outputPrefix; // the output prefix to target results into (eg, put things in a certain subfolder of @assets@ rather than the relative to assets itself)
QString m_portableKey; // a key that remains the same even if the asset database is moved from computer to computer.
bool m_isRoot = false; // is it 'the' root folder?
bool m_recurseSubFolders = true;
@@ -126,7 +126,7 @@ void AssetScannerWorker::ScanForSourceFiles(const ScanFolderInfo& scanFolderInfo
{
//Entry is a directory
m_folderList.insert(AZStd::move(assetFileInfo));
ScanFolderInfo tempScanFolderInfo(absPath, "", "", "", false, true);
ScanFolderInfo tempScanFolderInfo(absPath, "", "", false, true);
ScanForSourceFiles(tempScanFolderInfo, rootScanFolder);
}
else
@@ -41,7 +41,7 @@ namespace AssetProcessor
public:
QueueElementID() = default;
///! note that inputAssetName is a database name (so includes outputprefix), not a relative path.
///! note that inputAssetName is a database name, not a relative path.
QueueElementID(QString inputAssetName, QString platform, QString jobDescriptor);
@@ -96,7 +96,7 @@ namespace AssetProcessor
RCJob* getItem(int index) const;
int GetIndexOfProcessingJob(const QueueElementID& elementId);
///! EraseJobs expects the database name of the source file. (So with outputprefix)
///! EraseJobs expects the database name of the source file.
void EraseJobs(QString sourceFileDatabaseName, AZStd::vector<RCJob*>& pendingJobs);
private:
@@ -217,7 +217,6 @@ namespace AssetProcessor
scanFolderInfo.ScanPath().toStdString().c_str(),
scanFolderInfo.GetDisplayName().toStdString().c_str(),
scanFolderInfo.GetPortableKey().toStdString().c_str(),
scanFolderInfo.GetOutputPrefix().toStdString().c_str(),
scanFolderInfo.IsRoot());
dbConn->SetScanFolder(newScanFolder);
}
@@ -230,12 +229,12 @@ namespace AssetProcessor
config.EnablePlatform({ "fandango" ,{ "console", "renderer" } }, false);
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
config.PopulatePlatformsForScanFolder(platforms);
// PATH DisplayName PortKey outputfolder root recurse platforms order
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", "", false, false, platforms, -6), config, dbConn); // subfolder 4 overrides subfolder3
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", "", false, false, platforms, -5), config, dbConn); // subfolder 3 overrides subfolder2
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", "", false, true, platforms, -2), config, dbConn); // subfolder 2 overrides subfolder1
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, platforms, -1), config, dbConn); // subfolder1 overrides root
AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", "", true, false, platforms, 0), config, dbConn); // add the root
// PATH DisplayName PortKey root recurse platforms order
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, false, platforms, -6), config, dbConn); // subfolder 4 overrides subfolder3
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, false, platforms, -5), config, dbConn); // subfolder 3 overrides subfolder2
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", false, true, platforms, -2), config, dbConn); // subfolder 2 overrides subfolder1
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms, -1), config, dbConn); // subfolder1 overrides root
AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0), config, dbConn); // add the root
config.AddMetaDataType("exportsettings", QString());
@@ -317,7 +317,7 @@ namespace AssetProcessorMessagesTests
using namespace AzToolsFramework::AssetDatabase;
// Setup the database with all needed info
ScanFolderDatabaseEntry scanfolder1("scanfolder1", "scanfolder1", "scanfolder1", "");
ScanFolderDatabaseEntry scanfolder1("scanfolder1", "scanfolder1", "scanfolder1");
ASSERT_TRUE(m_dbConn.SetScanFolder(scanfolder1));
SourceDatabaseEntry source1(scanfolder1.m_scanFolderID, "source1.png", AZ::Uuid::CreateRandom(), "Fingerprint");
@@ -46,10 +46,10 @@ namespace UnitTests
m_data->m_fileProcessor = AZStd::make_unique<FileProcessor>(m_data->m_config.get());
m_data->m_scanFolder = { m_data->m_temporarySourceDir.absolutePath().toUtf8().constData(), "dev", "rootportkey", "" };
m_data->m_scanFolder = { m_data->m_temporarySourceDir.absolutePath().toUtf8().constData(), "dev", "rootportkey" };
ASSERT_TRUE(m_data->m_connection.SetScanFolder(m_data->m_scanFolder));
m_data->m_config->AddScanFolder(ScanFolderInfo(m_data->m_temporarySourceDir.absolutePath(), "dev", "rootportkey", "", false, true, m_data->m_config->GetEnabledPlatforms(), 0, m_data->m_scanFolder.m_scanFolderID));
m_data->m_config->AddScanFolder(ScanFolderInfo(m_data->m_temporarySourceDir.absolutePath(), "dev", "rootportkey", false, true, m_data->m_config->GetEnabledPlatforms(), 0, m_data->m_scanFolder.m_scanFolderID));
for (int index = 0; index < 10; ++index)
{
@@ -84,8 +84,8 @@ namespace UnitTests
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
m_data->m_platformConfig.PopulatePlatformsForScanFolder(platforms);
m_data->m_scanFolder1 = { tempPath.absoluteFilePath("dev").toUtf8().constData(), "dev", "devKey", ""};
m_data->m_scanFolder2 = { tempPath.absoluteFilePath("folder").toUtf8().constData(), "folder", "folderKey", "prefix" };
m_data->m_scanFolder1 = { tempPath.absoluteFilePath("dev").toUtf8().constData(), "dev", "devKey"};
m_data->m_scanFolder2 = { tempPath.absoluteFilePath("folder").toUtf8().constData(), "folder", "folderKey"};
ASSERT_TRUE(m_data->m_connection->SetScanFolder(m_data->m_scanFolder1));
ASSERT_TRUE(m_data->m_connection->SetScanFolder(m_data->m_scanFolder2));
@@ -93,21 +93,19 @@ namespace UnitTests
ScanFolderInfo scanFolder1(m_data->m_scanFolder1.m_scanFolder.c_str(),
m_data->m_scanFolder1.m_displayName.c_str(),
m_data->m_scanFolder1.m_portableKey.c_str(),
m_data->m_scanFolder1.m_outputPrefix.c_str(),
false, true, platforms, 0, m_data->m_scanFolder1.m_scanFolderID);
m_data->m_platformConfig.AddScanFolder(scanFolder1);
ScanFolderInfo scanFolder2(m_data->m_scanFolder2.m_scanFolder.c_str(),
m_data->m_scanFolder2.m_displayName.c_str(),
m_data->m_scanFolder2.m_portableKey.c_str(),
m_data->m_scanFolder2.m_outputPrefix.c_str(),
false, true, platforms, 0, m_data->m_scanFolder2.m_scanFolderID);
m_data->m_platformConfig.AddScanFolder(scanFolder2);
SourceDatabaseEntry sourceFile1 = { m_data->m_scanFolder1.m_scanFolderID, "subfolder1/somefile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
SourceDatabaseEntry sourceFile2 = { m_data->m_scanFolder1.m_scanFolderID, "subfolder1/otherfile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
SourceDatabaseEntry sourceFile3 = { m_data->m_scanFolder2.m_scanFolderID, "prefix/otherfile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
SourceDatabaseEntry sourceFile4 = { m_data->m_scanFolder2.m_scanFolderID, "prefix/a/b/c/d/otherfile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
SourceDatabaseEntry sourceFile3 = { m_data->m_scanFolder2.m_scanFolderID, "otherfile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
SourceDatabaseEntry sourceFile4 = { m_data->m_scanFolder2.m_scanFolderID, "a/b/c/d/otherfile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
SourceDatabaseEntry sourceFile5 = { m_data->m_scanFolder1.m_scanFolderID, "duplicate/file1.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
SourceDatabaseEntry sourceFile6 = { m_data->m_scanFolder2.m_scanFolderID, "duplicate/file1.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
SourceDatabaseEntry sourceFile7 = { m_data->m_scanFolder1.m_scanFolderID, "subfolder2/file.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
@@ -128,7 +126,7 @@ namespace UnitTests
ASSERT_TRUE(m_data->m_connection->SetSource(sourceFile11));
SourceFileDependencyEntry dependency1 = { AZ::Uuid::CreateRandom(), "subfolder1/somefile.tif", "subfolder1/otherfile.tif", SourceFileDependencyEntry::TypeOfDependency::DEP_SourceToSource, false };
SourceFileDependencyEntry dependency2 = { AZ::Uuid::CreateRandom(), "subfolder1/otherfile.tif", "prefix/otherfile.tif", SourceFileDependencyEntry::TypeOfDependency::DEP_JobToJob, false };
SourceFileDependencyEntry dependency2 = { AZ::Uuid::CreateRandom(), "subfolder1/otherfile.tif", "otherfile.tif", SourceFileDependencyEntry::TypeOfDependency::DEP_JobToJob, false };
ASSERT_TRUE(m_data->m_connection->SetSourceFileDependency(dependency1));
ASSERT_TRUE(m_data->m_connection->SetSourceFileDependency(dependency2));
@@ -252,7 +250,7 @@ namespace UnitTests
const ScanFolderInfo* info;
auto result = m_data->m_reporter->GetSourcesByPath(source, relocationContainer, info, excludeMetaDataFiles);
ASSERT_EQ(result.IsSuccess(), expectSuccess) << result.GetError().c_str();
ASSERT_EQ(result.IsSuccess(), expectSuccess) << (!result.IsSuccess() ? result.GetError().c_str() : "");
if (expectSuccess)
{
@@ -423,13 +421,13 @@ namespace UnitTests
TEST_F(SourceFileRelocatorTest, GetSources_PrefixedFile_Succeeds)
{
TestGetSourcesByPath("otherfile.tif", { "prefix/otherfile.tif" });
TestGetSourcesByPath("otherfile.tif", { "otherfile.tif" });
}
TEST_F(SourceFileRelocatorTest, GetSources_PrefixedAbsFile_Succeeds)
{
QDir tempDir(m_tempDir.path());
TestGetSourcesByPath( tempDir.absoluteFilePath("folder/otherfile.tif").toUtf8().constData(), { "prefix/otherfile.tif" });
TestGetSourcesByPath(tempDir.absoluteFilePath("folder/otherfile.tif").toUtf8().constData(), { "otherfile.tif" });
}
TEST_F(SourceFileRelocatorTest, GetSources_Folder_Fails)
@@ -664,7 +662,7 @@ namespace UnitTests
ASSERT_TRUE(m_data->m_reporter->GetSourcesByPath(tempPath.absoluteFilePath(AZStd::string("folder/o*").c_str()).toUtf8().constData(), entryContainer, info));
ASSERT_EQ(entryContainer.size(), 1);
ASSERT_STREQ(entryContainer[0].m_sourceEntry.m_sourceName.c_str(), "prefix/otherfile.tif");
ASSERT_STREQ(entryContainer[0].m_sourceEntry.m_sourceName.c_str(), "otherfile.tif");
m_data->m_reporter->PopulateDependencies(entryContainer);
@@ -803,7 +801,7 @@ namespace UnitTests
FileUpdateTasks updateTasks;
ASSERT_TRUE(m_data->m_reporter->GetSourcesByPath(tempPath.absoluteFilePath("folder/*").toUtf8().constData(), entryContainer, info));
ASSERT_EQ(entryContainer.size(), 2);
ASSERT_EQ(entryContainer.size(), 3);
m_data->m_reporter->ComputeDestination(entryContainer, info, "*", "someOtherPlace/*", destInfo);
m_data->m_reporter->PopulateDependencies(entryContainer);
@@ -81,7 +81,7 @@ namespace UnitTests
// Product: "someproduct4.dds" subid: 4
void CreateCoverageTestData()
{
m_data->m_scanFolder = { "c:/O3DE/dev", "dev", "rootportkey", "" };
m_data->m_scanFolder = { "c:/O3DE/dev", "dev", "rootportkey" };
ASSERT_TRUE(m_data->m_connection.SetScanFolder(m_data->m_scanFolder));
m_data->m_sourceFile1 = { m_data->m_scanFolder.m_scanFolderID, "somefile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint1"};
@@ -239,7 +239,7 @@ namespace UnitTests
// we'll create all of those first (except product) before starting the product test.
//add a scanfolder. None of this has to exist in real disk, this is a db test only.
ScanFolderDatabaseEntry scanFolder {"c:/O3DE/dev", "dev", "rootportkey", ""};
ScanFolderDatabaseEntry scanFolder{ "c:/O3DE/dev", "dev", "rootportkey" };
EXPECT_TRUE(m_data->m_connection.SetScanFolder(scanFolder));
ASSERT_NE(scanFolder.m_scanFolderID, AzToolsFramework::AssetDatabase::InvalidEntryId);
@@ -278,7 +278,7 @@ namespace UnitTests
// to add a product legitimately you have to have a full chain of primary keys, chain is:
// ScanFolder --> Source --> job --> product.
// we'll create all of those first (except product) before starting the product test.
ScanFolderDatabaseEntry scanFolder{ "c:/O3DE/dev", "dev", "rootportkey", "" };
ScanFolderDatabaseEntry scanFolder{ "c:/O3DE/dev", "dev", "rootportkey" };
ASSERT_TRUE(m_data->m_connection.SetScanFolder(scanFolder));
SourceDatabaseEntry sourceEntry{ scanFolder.m_scanFolderID, "somefile.tif", AZ::Uuid::CreateRandom(), "fingerprint1" };
@@ -323,7 +323,7 @@ namespace UnitTests
// this is actually a very common case (same job id, same subID)
TEST_F(AssetDatabaseTest, SetProduct_SpecificPK_Succeeds_SameSubID_SameJobID)
{
ScanFolderDatabaseEntry scanFolder{ "c:/O3DE/dev", "dev", "rootportkey", "" };
ScanFolderDatabaseEntry scanFolder{ "c:/O3DE/dev", "dev", "rootportkey"};
ASSERT_TRUE(m_data->m_connection.SetScanFolder(scanFolder));
SourceDatabaseEntry sourceEntry{ scanFolder.m_scanFolderID, "somefile.tif", AZ::Uuid::CreateRandom(), "fingerprint1" };
ASSERT_TRUE(m_data->m_connection.SetSource(sourceEntry));
@@ -63,13 +63,6 @@ public:
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WildcardMissingFiles_ByName_UpdatesWhenTheyAppear);
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, JobDependencyOrderOnce_MultipleJobs_EmitOK);
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_BasicTest);
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_UpdateTest);
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByUuid);
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByName);
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByUuid_UpdatesWhenTheyAppear);
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByName_UpdatesWhenTheyAppear);
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, SourceFileProcessFailure_ClearsFingerprint);
friend class GTEST_TEST_CLASS_NAME_(AbsolutePathProductDependencyTest, UnresolvedProductPathDependency_AssetProcessedTwice_DoesNotDuplicateDependency);
@@ -243,15 +236,10 @@ void AssetProcessorManagerTest::SetUp()
m_config->EnablePlatform({ "pc", { "host", "renderer", "desktop" } }, true);
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, m_config->GetEnabledPlatforms() ));
// add a scan folder that has an output prefix:
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", "redirected", false, true, m_config->GetEnabledPlatforms()));
//adding another scan folder with an output prefix
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", "dummy", false, true, m_config->GetEnabledPlatforms()));
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", "", false, true, m_config->GetEnabledPlatforms()));
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, m_config->GetEnabledPlatforms(), 1));
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2/redirected"), "subfolder2", "subfolder2", false, true, m_config->GetEnabledPlatforms()));
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, true, m_config->GetEnabledPlatforms(), 1));
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, true, m_config->GetEnabledPlatforms(), 1));
m_config->AddMetaDataType("assetinfo", "");
AssetRecognizer rec;
AssetPlatformSpec specpc;
@@ -459,72 +447,6 @@ TEST_F(AssetProcessorManagerTest, DeleteFolder_SignalsDeleteOfContainedFiles)
EXPECT_EQ(1, count);
}
TEST_F(AssetProcessorManagerTest, UnitTestForOutPutPrefix)
{
using namespace AssetProcessor;
QDir tempPath(m_tempDir.path());
UnitTestUtils::CreateDummyFile(tempPath.absoluteFilePath("subfolder2/test.txt"));
UnitTestUtils::CreateDummyFile(tempPath.absoluteFilePath("subfolder3/test.txt"));
int count = 0;
auto connection = QObject::connect(m_assetProcessorManager.get(), &AssetProcessorManager::AssetToProcess, [&count](JobDetails jobDetails)
{
if (jobDetails.m_jobEntry.m_databaseSourceName.compare("redirected/test.txt", Qt::CaseInsensitive) == 0 ||
jobDetails.m_jobEntry.m_databaseSourceName.compare("dummy/test.txt", Qt::CaseInsensitive) == 0 )
{
count++;
}
});
m_isIdling = false;
// tell the APM about the files:
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder2/test.txt")));
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder3/test.txt")));
ASSERT_TRUE(BlockUntilIdle(5000));
EXPECT_EQ(2, count);
EXPECT_TRUE(QFile::remove(tempPath.absoluteFilePath("subfolder2/test.txt")));
EXPECT_TRUE(QFile::remove(tempPath.absoluteFilePath("subfolder3/test.txt")));
}
TEST_F(AssetProcessorManagerTest, UnitTestForOutPutPrefixWithMultipleNotification)
{
using namespace AssetProcessor;
QDir tempPath(m_tempDir.path());
UnitTestUtils::CreateDummyFile(tempPath.absoluteFilePath("subfolder2/test.txt"));
UnitTestUtils::CreateDummyFile(tempPath.absoluteFilePath("subfolder3/test.txt"));
int count = 0;
auto connection = QObject::connect(m_assetProcessorManager.get(), &AssetProcessorManager::AssetToProcess, [&count](JobDetails jobDetails)
{
if (jobDetails.m_jobEntry.m_databaseSourceName.compare("redirected/test.txt", Qt::CaseInsensitive) == 0 ||
jobDetails.m_jobEntry.m_databaseSourceName.compare("dummy/test.txt", Qt::CaseInsensitive) == 0)
{
count++;
}
});
m_isIdling = false;
// we are putting multiple entries in the pipeline here and testing that we still receive only unique notifications for processing those assets
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder2/test.txt")));
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder2/test.txt")));
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder2/test.txt")));
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder3/test.txt")));
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder3/test.txt")));
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder3/test.txt")));
ASSERT_TRUE(BlockUntilIdle(5000));
EXPECT_EQ(2, count);
EXPECT_TRUE(QFile::remove(tempPath.absoluteFilePath("subfolder2/test.txt")));
EXPECT_TRUE(QFile::remove(tempPath.absoluteFilePath("subfolder3/test.txt")));
}
TEST_F(AssetProcessorManagerTest, UnitTestForGettingJobInfoBySourceUUIDFailure)
{
using namespace AzToolsFramework::AssetSystem;
@@ -1191,7 +1113,7 @@ TEST_F(AssetProcessorManagerTest, BuilderSDK_API_CreateJobs_HasValidParameters_W
{
QDir tempPath(m_tempDir.path());
// here we push a file change through APM and make sure that "CreateJobs" has correct parameters, with no output redirection
QString absPath(tempPath.absoluteFilePath("subfolder2/test_text.txt"));
QString absPath(tempPath.absoluteFilePath("subfolder2/redirected/test_text.txt"));
UnitTestUtils::CreateDummyFile(absPath);
m_mockApplicationManager->ResetMockBuilderCreateJobCalls();
@@ -1212,7 +1134,7 @@ TEST_F(AssetProcessorManagerTest, BuilderSDK_API_CreateJobs_HasValidParameters_W
// subfolder2 has its output redirected in the cache
// this test makes sure that the CreateJobs API is completely unaffected by that and none of the internal database stuff
// is reflected by the API.
EXPECT_STREQ(req.m_watchFolder.c_str(), tempPath.absoluteFilePath("subfolder2").toUtf8().constData());
EXPECT_STREQ(req.m_watchFolder.c_str(), tempPath.absoluteFilePath("subfolder2/redirected").toUtf8().constData());
EXPECT_STREQ(req.m_sourceFile.c_str(), "test_text.txt"); // only the name should be there, no output prefix.
EXPECT_NE(req.m_sourceFileUUID, AZ::Uuid::CreateNull());
@@ -2354,7 +2276,7 @@ TEST_F(PathDependencyTest, AbsoluteDependencies_Deferred_ResolveCorrectly)
// When an absolute path matches a scan folder, the portion of the path matching that scan folder
// is replaced with the scan folder's ID.
AZStd::string absPathDep1WithScanfolder(AZStd::string::format("$4$%s", relativePathDep1.c_str()));
QString absPathDep2(tempPath.absoluteFilePath("subfolder2/dep2.txt"));
QString absPathDep2(tempPath.absoluteFilePath("subfolder2/redirected/dep2.txt"));
QString absPathDep3(tempPath.absoluteFilePath("subfolder1/dep3.txt"));
// -------- Make main test asset, with dependencies on products that don't exist yet -----
@@ -2375,7 +2297,7 @@ TEST_F(PathDependencyTest, AbsoluteDependencies_Deferred_ResolveCorrectly)
// Different scanfolder, same relative file name. This should *not* trigger the dependency. We can't test with another asset in the proper scanfolder because AssetIds are based on relative file name,
// which means both assets have the same AssetId and there would be no way to tell which one matched
ASSERT_TRUE(ProcessAsset(dep1, { {".asset1"}, {".asset2"} }, {}, "subfolder1/"));
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/")); // subfolder2 has a prefix of "redirected"
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/redirected/"));
ASSERT_TRUE(ProcessAsset(dep3, { {".asset1"}, {".asset2"} }, {}, "subfolder1/")); // test a normal dependency with no prefix
// ---------- Verify that the dependency was recorded, and did not keep the path after resolution ----------
@@ -2550,14 +2472,14 @@ TEST_F(PathDependencyTest, AssetProcessed_Impl_DeferredPathResolution_CorrectlyM
// -------- Make main test asset, with dependencies on products that don't exist yet -----
TestAsset primaryFile("test_text");
ASSERT_TRUE(ProcessAsset(primaryFile, { { ".asset" }, {} }, { {"test.asset1", ProductPathDependencyType::ProductFile}, {"redirected/test.asset2", ProductPathDependencyType::ProductFile} }));
ASSERT_TRUE(ProcessAsset(primaryFile, { { ".asset" }, {} }, { {"test.asset1", ProductPathDependencyType::ProductFile}, {"test.asset2", ProductPathDependencyType::ProductFile} }));
// create dependees
TestAsset dep1("test");
TestAsset dep2("test");
ASSERT_TRUE(ProcessAsset(dep1, { {".asset1"}, {".asset2"} }, {}, "subfolder1/"));
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/")); // subfolder2 has a prefix of "redirected"
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/redirected/"));
// ---------- Verify that the dependency was recorded, and did not keep the path after resolution ----------
AzToolsFramework::AssetDatabase::ProductDependencyDatabaseEntryContainer dependencyContainer;
@@ -2575,14 +2497,14 @@ TEST_F(PathDependencyTest, SourceFileDependencyWithPrefix_Deferred_ResolvesCorre
// -------- Make main test asset, with dependencies on products that don't exist yet -----
TestAsset primaryFile("test_text");
ASSERT_TRUE(ProcessAsset(primaryFile, { { ".asset" }, {} }, { {"redirected/test.txt", ProductPathDependencyType::SourceFile} }));
ASSERT_TRUE(ProcessAsset(primaryFile, { { ".asset" }, {} }, { {"test.txt", ProductPathDependencyType::SourceFile} }));
// create dependees
TestAsset dep1("test");
TestAsset dep2("test");
ASSERT_TRUE(ProcessAsset(dep1, { {".asset1"}, {".asset2"} }, {}, "subfolder1/"));
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/")); // subfolder2 has a prefix of "redirected"
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/redirected/"));
// ---------- Verify that the dependency was recorded, and did not keep the path after resolution ----------
AzToolsFramework::AssetDatabase::ProductDependencyDatabaseEntryContainer dependencyContainer;
@@ -2606,12 +2528,12 @@ TEST_F(PathDependencyTest, SourceFileDependencyWithPrefix_Existing_ResolvesCorre
TestAsset dep2("test");
ASSERT_TRUE(ProcessAsset(dep1, { {".asset1"}, {".asset2"} }, {}, "subfolder1/"));
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/")); // subfolder2 has a prefix of "redirected"
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/redirected/"));
// -------- Make main test asset, with dependencies on products we just created -----
TestAsset primaryFile("test_text");
ASSERT_TRUE(ProcessAsset(primaryFile, { { ".asset" }, {} }, { {"redirected/test.txt", ProductPathDependencyType::SourceFile} }));
ASSERT_TRUE(ProcessAsset(primaryFile, { { ".asset" }, {} }, { {"test.txt", ProductPathDependencyType::SourceFile} }));
// ---------- Verify that the dependency was recorded, and did not keep the path after resolution ----------
AzToolsFramework::AssetDatabase::ProductDependencyDatabaseEntryContainer dependencyContainer;
@@ -2633,13 +2555,9 @@ void MultiplatformPathDependencyTest::SetUp()
m_config->EnablePlatform({ "provo",{ "console" } }, true);
QDir tempPath(m_tempDir.path());
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, m_config->GetEnabledPlatforms() ));
// add a scan folder that has an output prefix:
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", "redirected", false, true, m_config->GetEnabledPlatforms()));
//adding another scan folder with an output prefix
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", "dummy", false, true, m_config->GetEnabledPlatforms()));
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, m_config->GetEnabledPlatforms() ));
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", false, true, m_config->GetEnabledPlatforms()));
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, true, m_config->GetEnabledPlatforms()));
m_assetProcessorManager = nullptr; // we need to destroy the previous instance before creating a new one
m_assetProcessorManager = AZStd::make_unique<AssetProcessorManager_Test>(m_config.get());
@@ -3741,577 +3659,6 @@ TEST_F(AssetProcessorManagerTest, JobDependencyOrderOnce_MultipleJobs_EmitOK)
EXPECT_EQ(jobDetails[1].m_jobDependencyList[0].m_jobDependency.m_sourceFile.m_sourceFileDependencyPath, secondRelSourceFile); // there should only be one job dependency
}
// ------------------------------------------------------------------------------------------------------------
// The same suite of tests as above, but using a folder with an output prefix instead
// ------------------------------------------------------------------------------------------------------------
TEST_F(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_BasicTest)
{
// make sure that if we publish some dependencies, they appear:
AZ::Uuid dummyBuilderUUID = AZ::Uuid::CreateRandom();
QDir tempPath(m_tempDir.path());
QString inputDatabasePath = "redirected/outputprefixtest.txt";
UnitTestUtils::CreateDummyFile(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
QString absPath(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
QString watchFolderPath = tempPath.absoluteFilePath("subfolder2");
const ScanFolderInfo* scanFolder = m_config->GetScanFolderByPath(watchFolderPath);
ASSERT_NE(scanFolder, nullptr);
ASSERT_STREQ(scanFolder->GetOutputPrefix().toUtf8().constData(), "redirected");
// the above file (assetProcessorManagerTest.txt) will depend on these four files
QString dependsOnFile1_Source = tempPath.absoluteFilePath("subfolder2/a.txt");
QString dependsOnFile2_Source = tempPath.absoluteFilePath("subfolder2/b.txt");
QString dependsOnFile1_Job = tempPath.absoluteFilePath("subfolder2/c.txt");
QString dependsOnFile2_Job = tempPath.absoluteFilePath("subfolder2/d.txt");
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Source, QString("tempdata\n")));
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Source, QString("tempdata\n")));
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Job, QString("tempdata\n")));
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Job, QString("tempdata\n")));
// construct the dummy job to feed to the database updater function:
AssetProcessorManager::JobToProcessEntry job;
job.m_sourceFileInfo.m_databasePath = inputDatabasePath;
job.m_sourceFileInfo.m_pathRelativeToScanFolder = "outputprefixtest.txt";
job.m_sourceFileInfo.m_scanFolder = scanFolder;
job.m_sourceFileInfo.m_uuid = AssetUtilities::CreateSafeSourceUUIDFromName(job.m_sourceFileInfo.m_databasePath.toUtf8().data());
// note that we have to "prime" the map with the UUIDs to the source info for this to work:
AZ::Uuid uuidOfB = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/b.txt");
AZ::Uuid uuidOfD = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/d.txt");
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfB] = { watchFolderPath, "b.txt", "redirected/b.txt" };
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfD] = { watchFolderPath, "d.txt", "redirected/d.txt" };
// each file we will take a different approach to publishing: rel path, and UUID:
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "a.txt", AZ::Uuid::CreateNull() }));
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "", uuidOfB }));
// it is currently assumed that the only fields that we care about in JobDetails is the builder busId and the job dependencies themselves:
JobDetails newDetails;
newDetails.m_assetBuilderDesc.m_busId = dummyBuilderUUID;
AssetBuilderSDK::SourceFileDependency dep1 = { "c.txt", AZ::Uuid::CreateNull() };
AssetBuilderSDK::JobDependency jobDep1("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep1);
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep1));
AssetBuilderSDK::SourceFileDependency dep2 = { "",uuidOfD };
AssetBuilderSDK::JobDependency jobDep2("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep2);
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep2));
job.m_jobsToAnalyze.push_back(newDetails);
// this is the one line that this unit test is really testing:
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
// the rest of this test now performs a series of queries to verify the database was correctly set.
// this indirectly verifies the QueryAbsolutePathDependenciesRecursive function also but it has its own dedicated tests, above.
AssetProcessor::SourceFilesForFingerprintingContainer deps;
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_SourceToSource, false);
// the above function includes the actual source, as an absolute path.
EXPECT_EQ(deps.size(), 3);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end());
deps.clear();
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_JobToJob, false);
// the above function includes the actual source, as an absolute path.
EXPECT_EQ(deps.size(), 3);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end());
deps.clear();
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_Any, false);
// the above function includes the actual source, as an absolute path.
EXPECT_EQ(deps.size(), 5);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end());
// make sure the corresponding values in the map are also correct (ie, database path only)
EXPECT_STREQ(deps[absPath.toUtf8().constData()].c_str(), "redirected/outputprefixtest.txt");
EXPECT_STREQ(deps[dependsOnFile1_Source.toUtf8().constData()].c_str(), "redirected/a.txt");
EXPECT_STREQ(deps[dependsOnFile2_Source.toUtf8().constData()].c_str(), "redirected/b.txt");
EXPECT_STREQ(deps[dependsOnFile1_Job.toUtf8().constData()].c_str(), "redirected/c.txt");
EXPECT_STREQ(deps[dependsOnFile2_Job.toUtf8().constData()].c_str(), "redirected/d.txt");
}
TEST_F(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_UpdateTest)
{
// make sure that if we remove dependencies that are published, they disappear.
// so the first part of this test is to put some data in there, the same as before:
AZ::Uuid dummyBuilderUUID = AZ::Uuid::CreateRandom();
QDir tempPath(m_tempDir.path());
QString absPath(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
UnitTestUtils::CreateDummyFile(absPath);
QString inputDatabasePath = "redirected/outputprefixtest.txt";
QString watchFolderPath = tempPath.absoluteFilePath("subfolder2");
const ScanFolderInfo* scanFolder = m_config->GetScanFolderByPath(watchFolderPath);
ASSERT_NE(scanFolder, nullptr);
// the above file (assetProcessorManagerTest.txt) will depend on these four files:
QString dependsOnFile1_Source = tempPath.absoluteFilePath("subfolder2/a.txt");
QString dependsOnFile2_Source = tempPath.absoluteFilePath("subfolder2/b.txt");
QString dependsOnFile1_Job = tempPath.absoluteFilePath("subfolder2/c.txt");
QString dependsOnFile2_Job = tempPath.absoluteFilePath("subfolder2/d.txt");
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Source, QString("tempdata\n")));
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Source, QString("tempdata\n")));
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Job, QString("tempdata\n")));
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Job, QString("tempdata\n")));
// construct the dummy job to feed to the database updater function:
AssetProcessorManager::JobToProcessEntry job;
job.m_sourceFileInfo.m_databasePath = inputDatabasePath;
job.m_sourceFileInfo.m_pathRelativeToScanFolder = "outputprefixtest.txt";
job.m_sourceFileInfo.m_scanFolder = scanFolder;
job.m_sourceFileInfo.m_uuid = AssetUtilities::CreateSafeSourceUUIDFromName(job.m_sourceFileInfo.m_databasePath.toUtf8().data());
// note that we have to "prime" the map with the UUIDs to the source info for this to work:
AZ::Uuid uuidOfB = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/b.txt");
AZ::Uuid uuidOfD = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/d.txt");
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfB] = { watchFolderPath, "b.txt", "redirected/b.txt" };
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfD] = { watchFolderPath, "d.txt", "redirected/d.txt" };
// each file we will take a different approach to publishing: rel path, and UUID:
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "a.txt", AZ::Uuid::CreateNull() }));
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "", uuidOfB }));
// it is currently assumed that the only fields that we care about in JobDetails is the builder busId and the job dependencies themselves:
JobDetails newDetails;
newDetails.m_assetBuilderDesc.m_busId = dummyBuilderUUID;
AssetBuilderSDK::SourceFileDependency dep1 = { "c.txt", AZ::Uuid::CreateNull() };
AssetBuilderSDK::JobDependency jobDep1("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep1);
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep1));
AssetBuilderSDK::SourceFileDependency dep2 = { "",uuidOfD };
AssetBuilderSDK::JobDependency jobDep2("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep2);
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep2));
job.m_jobsToAnalyze.push_back(newDetails);
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
// in this test, though, we delete some after pushing them in there, and update it again:
job.m_sourceFileDependencies.pop_back(); // erase the 'b' dependency.
job.m_jobsToAnalyze[0].m_jobDependencyList.pop_back(); // erase the 'd' dependency, which is by guid.
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
// now make sure that the same queries omit b and d:
AssetProcessor::SourceFilesForFingerprintingContainer deps;
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_SourceToSource, false);
// the above function includes the actual source, as an absolute path.
EXPECT_EQ(deps.size(), 2);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end());
deps.clear();
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_JobToJob, false);
// the above function includes the actual source, as an absolute path.
EXPECT_EQ(deps.size(), 2);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end());
deps.clear();
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_Any, false);
// the above function includes the actual source, as an absolute path.
EXPECT_EQ(deps.size(), 3);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end());
}
TEST_F(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByUuid)
{
// make sure that if we publish some dependencies, they do not appear if missing.
AZ::Uuid dummyBuilderUUID = AZ::Uuid::CreateRandom();
QDir tempPath(m_tempDir.path());
QString absPath(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
UnitTestUtils::CreateDummyFile(absPath);
QString inputDatabasePath = "redirected/outputprefixtest.txt";
QString watchFolderPath = tempPath.absoluteFilePath("subfolder2");
const ScanFolderInfo* scanFolder = m_config->GetScanFolderByPath(watchFolderPath);
ASSERT_NE(scanFolder, nullptr);
// the above file (assetProcessorManagerTest.txt) will depend on these four files:
QString dependsOnFile1_Source = tempPath.absoluteFilePath("subfolder2/a.txt");
QString dependsOnFile2_Source = tempPath.absoluteFilePath("subfolder2/b.txt");
QString dependsOnFile1_Job = tempPath.absoluteFilePath("subfolder2/c.txt");
QString dependsOnFile2_Job = tempPath.absoluteFilePath("subfolder2/d.txt");
// in this case, we are only creating file b, and d (which are input by UUID)
// and we will be missing a and c, which are input by name.
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Source, QString("tempdata\n")));
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Job, QString("tempdata\n")));
// construct the dummy job to feed to the database updater function:
AssetProcessorManager::JobToProcessEntry job;
job.m_sourceFileInfo.m_databasePath = inputDatabasePath;
job.m_sourceFileInfo.m_pathRelativeToScanFolder = "outputprefixtest.txt";
job.m_sourceFileInfo.m_scanFolder = scanFolder;
job.m_sourceFileInfo.m_uuid = AssetUtilities::CreateSafeSourceUUIDFromName(job.m_sourceFileInfo.m_databasePath.toUtf8().data());
// note that we have to "prime" the map with the UUIDs to the source info for this to work:
AZ::Uuid uuidOfB = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/b.txt");
AZ::Uuid uuidOfD = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/d.txt");
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfB] = { watchFolderPath, "b.txt", "redirected/b.txt" };
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfD] = { watchFolderPath, "d.txt", "redirected/d.txt" };
// each file we will take a different approach to publishing: rel path, and UUID:
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "a.txt", AZ::Uuid::CreateNull() }));
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "", uuidOfB }));
// it is currently assumed that the only fields that we care about in JobDetails is the builder busId and the job dependencies themselves:
JobDetails newDetails;
newDetails.m_assetBuilderDesc.m_busId = dummyBuilderUUID;
AssetBuilderSDK::SourceFileDependency dep1 = { "c.txt", AZ::Uuid::CreateNull() };
AssetBuilderSDK::JobDependency jobDep1("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep1);
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep1));
AssetBuilderSDK::SourceFileDependency dep2 = { "",uuidOfD };
AssetBuilderSDK::JobDependency jobDep2("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep2);
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep2));
job.m_jobsToAnalyze.push_back(newDetails);
// this is the one line that this unit test is really testing:
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
// the rest of this test now performs a series of queries to verify the database was correctly set.
// this indirectly verifies the QueryAbsolutePathDependenciesRecursive function also but it has its own dedicated tests, above.
AssetProcessor::SourceFilesForFingerprintingContainer deps;
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_SourceToSource, false);
EXPECT_EQ(deps.size(), 2);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end()); // b
deps.clear();
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_JobToJob, false);
// the above function includes the actual source, as an absolute path.
EXPECT_EQ(deps.size(), 2);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end()); // d
deps.clear();
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_Any, false);
// the above function includes the actual source, as an absolute path.
EXPECT_EQ(deps.size(), 3);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end()); // b
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end()); // d
}
TEST_F(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByName)
{
AZ::Uuid dummyBuilderUUID = AZ::Uuid::CreateRandom();
QDir tempPath(m_tempDir.path());
QString absPath(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
UnitTestUtils::CreateDummyFile(absPath);
QString inputDatabasePath = "redirected/outputprefixtest.txt";
QString watchFolderPath = tempPath.absoluteFilePath("subfolder2");
const ScanFolderInfo* scanFolder = m_config->GetScanFolderByPath(watchFolderPath);
ASSERT_NE(scanFolder, nullptr);
// the above file (assetProcessorManagerTest.txt) will depend on these four files:
QString dependsOnFile1_Source = tempPath.absoluteFilePath("subfolder2/a.txt");
QString dependsOnFile2_Source = tempPath.absoluteFilePath("subfolder2/b.txt");
QString dependsOnFile1_Job = tempPath.absoluteFilePath("subfolder2/c.txt");
QString dependsOnFile2_Job = tempPath.absoluteFilePath("subfolder2/d.txt");
// in this case, we are only creating file a, and c, which are input by name
// and we we will be making b and d missing, which are input by UUID.
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Source, QString("tempdata\n")));
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Job, QString("tempdata\n")));
// construct the dummy job to feed to the database updater function:
AssetProcessorManager::JobToProcessEntry job;
job.m_sourceFileInfo.m_databasePath = inputDatabasePath;
job.m_sourceFileInfo.m_pathRelativeToScanFolder = "outputprefixtest.txt";
job.m_sourceFileInfo.m_scanFolder = scanFolder;
job.m_sourceFileInfo.m_uuid = AssetUtilities::CreateSafeSourceUUIDFromName(job.m_sourceFileInfo.m_databasePath.toUtf8().data());
// note that we have to "prime" the map with the UUIDs to the source info for this to work:
AZ::Uuid uuidOfB = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/b.txt");
AZ::Uuid uuidOfD = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/d.txt");
// each file we will take a different approach to publishing: rel path, and UUID:
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "a.txt", AZ::Uuid::CreateNull() }));
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "", uuidOfB }));
// it is currently assumed that the only fields that we care about in JobDetails is the builder busId and the job dependencies themselves:
JobDetails newDetails;
newDetails.m_assetBuilderDesc.m_busId = dummyBuilderUUID;
AssetBuilderSDK::SourceFileDependency dep1 = { "c.txt", AZ::Uuid::CreateNull() };
AssetBuilderSDK::JobDependency jobDep1("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep1);
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep1));
AssetBuilderSDK::SourceFileDependency dep2 = { "",uuidOfD };
AssetBuilderSDK::JobDependency jobDep2("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep2);
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep2));
job.m_jobsToAnalyze.push_back(newDetails);
// this is the one line that this unit test is really testing:
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
// the rest of this test now performs a series of queries to verify the database was correctly set.
// this indirectly verifies the QueryAbsolutePathDependenciesRecursive function also but it has its own dedicated tests, above.
AssetProcessor::SourceFilesForFingerprintingContainer deps;
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_SourceToSource, false);
// we should find all of the deps, but none of the placeholder
EXPECT_EQ(deps.size(), 2);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end()); // a
deps.clear();
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_JobToJob, false);
EXPECT_EQ(deps.size(), 2);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end()); // c
deps.clear();
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_Any, false);
EXPECT_EQ(deps.size(), 3);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end()); // a
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end()); // c
}
TEST_F(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByUuid_UpdatesWhenTheyAppear)
{
// this test makes sure that when files DO appear that were previously placeholders, the database is updated
// so the strategy here is to have files b, and d missing, which are declared as dependencies by UUID.
// then, we make them re-appear later, and check that the database has updated them appropriately.
AZ::Uuid dummyBuilderUUID = AZ::Uuid::CreateRandom();
QDir tempPath(m_tempDir.path());
QString absPath(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
UnitTestUtils::CreateDummyFile(absPath);
QString inputDatabasePath = "redirected/outputprefixtest.txt";
QString watchFolderPath = tempPath.absoluteFilePath("subfolder2");
const ScanFolderInfo* scanFolder = m_config->GetScanFolderByPath(watchFolderPath);
ASSERT_NE(scanFolder, nullptr);
// the above file (assetProcessorManagerTest.txt) will depend on these four files:
QString dependsOnFile1_Source = tempPath.absoluteFilePath("subfolder2/a.txt");
QString dependsOnFile2_Source = tempPath.absoluteFilePath("subfolder2/b.txt");
QString dependsOnFile1_Job = tempPath.absoluteFilePath("subfolder2/c.txt");
QString dependsOnFile2_Job = tempPath.absoluteFilePath("subfolder2/d.txt");
// in this case, we are only creating file b, and d, which are addressed by UUID.
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Source, QString("tempdata\n")));
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Job, QString("tempdata\n")));
// construct the dummy job to feed to the database updater function:
AssetProcessorManager::JobToProcessEntry job;
job.m_sourceFileInfo.m_databasePath = inputDatabasePath;
job.m_sourceFileInfo.m_pathRelativeToScanFolder = "outputprefixtest.txt";
job.m_sourceFileInfo.m_scanFolder = scanFolder;
job.m_sourceFileInfo.m_uuid = AssetUtilities::CreateSafeSourceUUIDFromName(job.m_sourceFileInfo.m_databasePath.toUtf8().data());
AZ::Uuid uuidOfD = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/d.txt");
AZ::Uuid uuidOfB = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/b.txt");
// each file we will take a different approach to publishing: rel path, and UUID:
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "a.txt", AZ::Uuid::CreateNull() }));
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "", uuidOfB }));
// it is currently assumed that the only fields that we care about in JobDetails is the builder busId and the job dependencies themselves:
JobDetails newDetails;
newDetails.m_assetBuilderDesc.m_busId = dummyBuilderUUID;
AssetBuilderSDK::SourceFileDependency dep1 = { "c.txt", AZ::Uuid::CreateNull() };
AssetBuilderSDK::JobDependency jobDep1("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep1);
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep1));
AssetBuilderSDK::SourceFileDependency dep2 = { "",uuidOfD };
AssetBuilderSDK::JobDependency jobDep2("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep2);
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep2));
job.m_jobsToAnalyze.push_back(newDetails);
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
// so at this point, the database should be in the same state as after the UpdateSourceFileDependenciesDatabase_MissingFiles_ByUuid test
// which was already verified, by that test.
// now that the database has placeholders, we expect them to resolve themselves when we provide the actual files:
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Source, QString("tempdata\n")));
// now that B exists, we pretend a job came in to process B. (it doesn't require dependencies to be declared)
// note that we have to "prime" the map with the UUIDs to the source info for this to work:
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfB] = { watchFolderPath, "b.txt", "redirected/b.txt" };
AssetProcessorManager::JobToProcessEntry job2;
job2.m_sourceFileInfo.m_databasePath = "redirected/b.txt";
job2.m_sourceFileInfo.m_pathRelativeToScanFolder = "b.txt";
job2.m_sourceFileInfo.m_scanFolder = scanFolder;
job2.m_sourceFileInfo.m_uuid = uuidOfB;
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job2);
// b should no longer be a placeholder, so both A and B should be present as their actual path.
AssetProcessor::SourceFilesForFingerprintingContainer deps;
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_SourceToSource, false);
EXPECT_EQ(deps.size(), 3);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end()); // a
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end()); // b
// but d should still be a placeholder, since we have not declared it yet.
deps.clear();
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_JobToJob, false);
EXPECT_EQ(deps.size(), 2);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end()); // c
// in addition, we expect to have the original file that depends on B appear in the analysis queue, since something it depends on appeared:
QString normalizedSourcePath = AssetUtilities::NormalizeFilePath(absPath);
EXPECT_TRUE(m_assetProcessorManager->m_alreadyActiveFiles.contains(normalizedSourcePath));
// now make d exist too and pretend a job came in to process it:
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Job, QString("tempdata\n"))); // create file D
AssetProcessorManager::JobToProcessEntry job3;
job3.m_sourceFileInfo.m_databasePath = "redirected/d.txt";
job3.m_sourceFileInfo.m_pathRelativeToScanFolder = "d.txt";
job3.m_sourceFileInfo.m_scanFolder = scanFolder;
job3.m_sourceFileInfo.m_uuid = uuidOfD;
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfD] = { watchFolderPath, "d.txt", "redirected/d.txt" };
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job3);
// all files should now be present:
deps.clear();
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_Any, false);
EXPECT_EQ(deps.size(), 5);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end());
}
TEST_F(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByName_UpdatesWhenTheyAppear)
{
// this test makes sure that when files DO appear that were previously placeholders, the database is updated
// so the strategy here is to have files a, and c missing, which are declared as dependencies by name.
// then, we make them re-appear later, and check that the database has updated them appropriately.
AZ::Uuid dummyBuilderUUID = AZ::Uuid::CreateRandom();
QDir tempPath(m_tempDir.path());
QString absPath(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
UnitTestUtils::CreateDummyFile(absPath);
QString inputDatabasePath = "redirected/outputprefixtest.txt";
QString watchFolderPath = tempPath.absoluteFilePath("subfolder2");
const ScanFolderInfo* scanFolder = m_config->GetScanFolderByPath(watchFolderPath);
ASSERT_NE(scanFolder, nullptr);
// the above file (assetProcessorManagerTest.txt) will depend on these four files:
QString dependsOnFile1_Source = tempPath.absoluteFilePath("subfolder2/a.txt");
QString dependsOnFile2_Source = tempPath.absoluteFilePath("subfolder2/b.txt");
QString dependsOnFile1_Job = tempPath.absoluteFilePath("subfolder2/c.txt");
QString dependsOnFile2_Job = tempPath.absoluteFilePath("subfolder2/d.txt");
// in this case, we are only creating file b, and d, which are addressed by UUID.
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Source, QString("tempdata\n")));
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Job, QString("tempdata\n")));
// construct the dummy job to feed to the database updater function:
AssetProcessorManager::JobToProcessEntry job;
job.m_sourceFileInfo.m_databasePath = inputDatabasePath;
job.m_sourceFileInfo.m_pathRelativeToScanFolder = "outputprefixtest.txt";
job.m_sourceFileInfo.m_scanFolder = scanFolder;
job.m_sourceFileInfo.m_uuid = AssetUtilities::CreateSafeSourceUUIDFromName(job.m_sourceFileInfo.m_databasePath.toUtf8().data());
// note that we have to "prime" the map with the UUIDs to the source info for this to work:
AZ::Uuid uuidOfB = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/b.txt");
AZ::Uuid uuidOfD = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/d.txt");
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfB] = { watchFolderPath, "b.txt", "redirected/b.txt" };
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfD] = { watchFolderPath, "d.txt", "redirected/d.txt" };
// each file we will take a different approach to publishing: rel path, and UUID:
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "a.txt", AZ::Uuid::CreateNull() }));
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "", uuidOfB }));
// it is currently assumed that the only fields that we care about in JobDetails is the builder busId and the job dependencies themselves:
JobDetails newDetails;
newDetails.m_assetBuilderDesc.m_busId = dummyBuilderUUID;
AssetBuilderSDK::SourceFileDependency dep1 = { "c.txt", AZ::Uuid::CreateNull() };
AssetBuilderSDK::JobDependency jobDep1("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep1);
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep1));
AssetBuilderSDK::SourceFileDependency dep2 = { "",uuidOfD };
AssetBuilderSDK::JobDependency jobDep2("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep2);
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep2));
job.m_jobsToAnalyze.push_back(newDetails);
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
// so at this point, the database should be in the same state as after the UpdateSourceFileDependenciesDatabase_MissingFiles_ByUuid test
// which was already verified, by that test.
// now that the database has placeholders, we expect them to resolve themselves when we provide the actual files:
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Source, QString("tempdata\n")));
// now that A exists, we pretend a job came in to process a. (it doesn't require dependencies to be declared)
AZ::Uuid uuidOfA = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/a.txt");
AssetProcessorManager::JobToProcessEntry job2;
job2.m_sourceFileInfo.m_databasePath = "redirected/a.txt";
job2.m_sourceFileInfo.m_pathRelativeToScanFolder = "a.txt";
job2.m_sourceFileInfo.m_scanFolder = scanFolder;
job2.m_sourceFileInfo.m_uuid = uuidOfA;
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job2);
// a should no longer be a placeholder
AssetProcessor::SourceFilesForFingerprintingContainer deps;
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_SourceToSource, false);
EXPECT_EQ(deps.size(), 3);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end()); // a
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end()); // b
deps.clear();
// c should still be a placeholder and thus should not appear in the results.
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_JobToJob, false);
EXPECT_EQ(deps.size(), 2);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end()); // d
// in addition, we expect to have the original file that depends on A appear in the analysis queue, since something it depends on appeared:
QString normalizedSourcePath = AssetUtilities::NormalizeFilePath(absPath);
EXPECT_TRUE(m_assetProcessorManager->m_alreadyActiveFiles.contains(normalizedSourcePath));
// now make c exist too and pretend a job came in to process it:
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Job, QString("tempdata\n")));
AZ::Uuid uuidOfC = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/c.txt");
AssetProcessorManager::JobToProcessEntry job3;
job3.m_sourceFileInfo.m_databasePath = "redirected/c.txt";
job3.m_sourceFileInfo.m_pathRelativeToScanFolder = "c.txt";
job3.m_sourceFileInfo.m_scanFolder = scanFolder;
job3.m_sourceFileInfo.m_uuid = uuidOfC;
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job3);
// all files should now be present:
deps.clear();
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_Any, false);
EXPECT_EQ(deps.size(), 5);
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end());
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end());
}
TEST_F(AssetProcessorManagerTest, SourceFile_With_NonASCII_Characters_Fail_Job_OK)
{
// This test ensures that asset processor manager detects a source file that has non-ASCII characters
@@ -74,10 +74,10 @@ namespace AssetProcessor
m_platformConfig.reset(new AssetProcessor::PlatformConfiguration());
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
m_platformConfig.get()->PopulatePlatformsForScanFolder(platforms);
// PATH DisplayName PortKey outputfolder root recurse platforms
m_platformConfig.get()->AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "", "ap1", "", true, false, platforms));
m_platformConfig.get()->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "", "ap2", "", false, true, platforms));
m_platformConfig.get()->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "", "ap3", "", false, true, platforms));
// PATH DisplayName PortKey root recurse platforms
m_platformConfig.get()->AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "", "ap1", true, false, platforms));
m_platformConfig.get()->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "", "ap2", false, true, platforms));
m_platformConfig.get()->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "", "ap3", false, true, platforms));
m_assetScanner.reset(new AssetScanner_Test(m_platformConfig.get()));
@@ -170,7 +170,7 @@ TEST_F(PlatformConfigurationUnitTests, TestReadScanFolderRoot_FromSettingsRegist
EXPECT_TRUE(settingsRegistry->Get(scanOrder, AZ::SettingsRegistryInterface::FixedValueString(AssetProcessor::AssetProcessorSettingsKey)
+ "/ScanFolder SettingsRegistryTest/order"));
// These test values come from the <dev_root>/Engine/Registry/AssetProcessorPlatformConfig.setreg file
// These test values come from the <dev_root>/Registry/AssetProcessorPlatformConfig.setreg file
EXPECT_STREQ("_TestPath", watchPath.c_str());
EXPECT_FALSE(recurseScanFolder);
EXPECT_EQ(20000, scanOrder);
@@ -200,7 +200,7 @@ public:
m_config.reset();
PlatformConfigurationUnitTests::TearDown();
}
AZStd::vector<AssetBuilderSDK::PlatformInfo> m_platforms;
AZStd::unique_ptr<UnitTestPlatformConfiguration> m_config;
AZStd::unique_ptr<QTemporaryDir> m_tempEngineRoot = nullptr; // this actually creates the folder in its constructor, so hold off until setup..
@@ -213,8 +213,8 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, GetScanFolderForFile_Roo
using namespace AzToolsFramework::AssetSystem;
using namespace AssetProcessor;
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1"), "ScanFolder1", "sf1", "", true, false, m_platforms), true); // a root folder that has watched subfolders, not recursive
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1/Editor"), "Editor", "sf2", "", false, true, m_platforms), true); // a child folder that exists within that scan folder.
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1"), "ScanFolder1", "sf1", true, false, m_platforms), true); // a root folder that has watched subfolders, not recursive
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1/Editor"), "Editor", "sf2", false, true, m_platforms), true); // a child folder that exists within that scan folder.
const ScanFolderInfo* info = m_config->GetScanFolderForFile(m_tempPath.filePath("scanfolder1/something.txt"));
@@ -229,8 +229,8 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, GetScanFolderForFile_Sub
using namespace AzToolsFramework::AssetSystem;
using namespace AssetProcessor;
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1"), "ScanFolder1", "sf1", "", true, false, m_platforms), true); // a root folder that has watched subfolders, not recursive
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1/Editor"), "Editor ScanFolder", "sf2", "", false, true, m_platforms), true); // a child folder that exists within that scan folder.
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1"), "ScanFolder1", "sf1", true, false, m_platforms), true); // a root folder that has watched subfolders, not recursive
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1/Editor"), "Editor ScanFolder", "sf2", false, true, m_platforms), true); // a child folder that exists within that scan folder.
const ScanFolderInfo* info = m_config->GetScanFolderForFile(m_tempPath.filePath("scanfolder1/Editor/something.txt"));
@@ -254,8 +254,8 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, GetOverridingFile_Exists
QString differentCaseDummyFileName = m_tempPath.absoluteFilePath("scanfolder2/testcase.txt");
UnitTestUtils::CreateDummyFile(caseSensitiveDummyFileName, QString("testcase1\n"));
UnitTestUtils::CreateDummyFile(differentCaseDummyFileName, QString("testcase2\n"));
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", "", false, true, m_platforms), true);
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", "", false, true, m_platforms), true);
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", false, true, m_platforms), true);
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", false, true, m_platforms), true);
// Perform the test by asking it whether anyone overrides "testcase" (lowercase) in scanfolder 2.
QString overrider = m_config->GetOverridingFile("testcase.txt", scanfolder2Path);
@@ -278,9 +278,9 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, GetOverridingFile_Exists
QString differentCaseDummyFileName = m_tempPath.absoluteFilePath("scanfolder2/testcase.txt");
UnitTestUtils::CreateDummyFile(caseSensitiveDummyFileName, QString("testcase1\n"));
UnitTestUtils::CreateDummyFile(differentCaseDummyFileName, QString("testcase2\n"));
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", "", false, true, m_platforms), true);
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", "", false, true, m_platforms), true);
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", false, true, m_platforms), true);
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", false, true, m_platforms), true);
// Perform the test by asking it whether the existing real winning file is being overridden by anyone.
QString overrider = m_config->GetOverridingFile("TestCase.tXt", scanfolder1Path);
@@ -297,8 +297,8 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, GetOverridingFile_DoesNo
QString scanfolder1Path = m_tempPath.filePath("scanfolder1");
QString scanfolder2Path = m_tempPath.filePath("scanfolder2");
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", "", false, true, m_platforms), true);
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", "", false, true, m_platforms), true);
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", false, true, m_platforms), true);
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", false, true, m_platforms), true);
// Perform the test by asking it whether anyone overrides "testcase" (lowercase) in scanfolder 2.
QString overrider = m_config->GetOverridingFile("doesntExist.txt", scanfolder2Path);
@@ -314,8 +314,8 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, FindFirstMatchingFile_Do
// create two scan folders, since its order dependent, the ScanFolder1 is the "winner" in tie breakers.
QString scanfolder1Path = m_tempPath.filePath("scanfolder1");
QString scanfolder2Path = m_tempPath.filePath("scanfolder2");
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", "", false, true, m_platforms), true);
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", "", false, true, m_platforms), true);
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", false, true, m_platforms), true);
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", false, true, m_platforms), true);
// Perform the test by asking it whether anyone overrides "testcase" (lowercase) in scanfolder 2.
QString foundFile = m_config->FindFirstMatchingFile("doesntExist.txt");
@@ -325,7 +325,7 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, FindFirstMatchingFile_Do
// note that we do not guarantee that FindFirstMatchingFile always returns the correct case, as it is a super hot path
// function, and the only time case could be incorrect is in the situation where a file with different case overrides
// an underlying file, ie,
// an underlying file, ie,
// Engine/EngineAssets/Textures/StartScreen.tif
// MyGame/EngineAssets/textures/startscreen.tif <-- would override the above because game has higher / more important priority.
@@ -335,8 +335,8 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, GetScanFolderForFile_Sub
using namespace AzToolsFramework::AssetSystem;
using namespace AssetProcessor;
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1"), "ScanFolder1", "sf1", "", true, false, m_platforms), true); // a root folder that has watched subfolders, not recursive
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1/Editor"), "Editor ScanFolder", "sf2", "", false, true, m_platforms), true); // a child folder that exists within that scan folder.
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1"), "ScanFolder1", "sf1", true, false, m_platforms), true); // a root folder that has watched subfolders, not recursive
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1/Editor"), "Editor ScanFolder", "sf2", false, true, m_platforms), true); // a child folder that exists within that scan folder.
const ScanFolderInfo* info = m_config->GetScanFolderForFile(m_tempPath.filePath("scanfolder1/Editor"));
ASSERT_TRUE(info);
@@ -363,20 +363,17 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_RegularScanfolder)
ASSERT_EQ(config.GetScanFolderCount(), 3); // the two, and then the one that has the same data as prior but different identifier.
QString scanName = AssetUtilities::ComputeProjectPath() + " Scan Folder";
ASSERT_EQ(config.GetScanFolderAt(0).GetDisplayName(), scanName);
ASSERT_EQ(config.GetScanFolderAt(0).GetOutputPrefix(), QString());
ASSERT_EQ(config.GetScanFolderAt(0).RecurseSubFolders(), true);
ASSERT_EQ(config.GetScanFolderAt(0).GetOrder(), 0);
ASSERT_EQ(config.GetScanFolderAt(0).GetPortableKey(), QString("Game"));
ASSERT_EQ(config.GetScanFolderAt(1).GetDisplayName(), QString("FeatureTests"));
ASSERT_EQ(config.GetScanFolderAt(1).GetOutputPrefix(), QString("featuretestsoutputfolder")); // to prove its not related to display name
ASSERT_EQ(config.GetScanFolderAt(1).RecurseSubFolders(), false);
ASSERT_EQ(config.GetScanFolderAt(1).GetOrder(), 5000);
// this proves that the featuretests name is used instead of the output prefix
ASSERT_EQ(config.GetScanFolderAt(1).GetPortableKey(), QString("FeatureTests"));
ASSERT_EQ(config.GetScanFolderAt(2).GetDisplayName(), QString("FeatureTests2"));
ASSERT_EQ(config.GetScanFolderAt(2).GetOutputPrefix(), QString("featuretestsoutputfolder")); // to prove its not related to display name
ASSERT_EQ(config.GetScanFolderAt(2).RecurseSubFolders(), false);
ASSERT_EQ(config.GetScanFolderAt(2).GetOrder(), 6000);
// this proves that the featuretests name is used instead of the output prefix
@@ -613,7 +610,6 @@ TEST_F(PlatformConfigurationUnitTests, Test_GemHandling)
ASSERT_EQ(2, config.GetScanFolderCount());
EXPECT_FALSE(config.GetScanFolderAt(0).IsRoot());
EXPECT_TRUE(config.GetScanFolderAt(0).GetOutputPrefix().isEmpty());
EXPECT_TRUE(config.GetScanFolderAt(0).RecurseSubFolders());
// the first one is a game gem, so its order should be above 1 but below 100.
EXPECT_GE(config.GetScanFolderAt(0).GetOrder(), 100);
@@ -623,7 +619,6 @@ TEST_F(PlatformConfigurationUnitTests, Test_GemHandling)
expectedScanFolder = tempPath.absoluteFilePath("Gems/LmbrCentral/v2/Assets");
EXPECT_FALSE(config.GetScanFolderAt(1).IsRoot() );
EXPECT_TRUE(config.GetScanFolderAt(1).GetOutputPrefix().isEmpty());
EXPECT_TRUE(config.GetScanFolderAt(1).RecurseSubFolders());
EXPECT_GT(config.GetScanFolderAt(1).GetOrder(), config.GetScanFolderAt(0).GetOrder());
EXPECT_EQ(0, config.GetScanFolderAt(1).ScanPath().compare(expectedScanFolder, Qt::CaseInsensitive));
@@ -247,54 +247,3 @@ TEST_F(RCcontrollerTest_Simple, SameJobIsCompletedMultipleTimes_CompletesWithout
ASSERT_EQ(m_errorAbsorber->m_numAssertsAbsorbed, 4); // Expected that there are 4 errors related to the files not existing on disk. Error message: GenerateFingerprint was called but no input files were requested for fingerprinting.
ASSERT_EQ(m_errorAbsorber->m_numErrorsAbsorbed, 0);
}
// makes sure to expose parts of RCJob to the unit test
class TestRCJob : public AssetProcessor::RCJob
{
friend class GTEST_TEST_CLASS_NAME_(RCcontrollerTest, BuilderSDK_API_ProcessJob_HasValidParameters_WithOutputFolder);
public:
explicit TestRCJob(QObject* parent = 0) : AssetProcessor::RCJob(parent) {};
};
TEST_F(RCcontrollerTest, BuilderSDK_API_ProcessJob_HasValidParameters_WithOutputFolder)
{
// this test makes sure that the BuilderSDK API is not exposed to any database internals.
AZ::Uuid sourceUUID = AZ::Uuid::CreateRandom();
AZ::Uuid builderGuid = AZ::Uuid::CreateRandom();
AssetBuilderSDK::ProcessJobRequest req;
{
// note that this scope is intentional. job.Init(jobDetails) below is actually a by-ref operation that destroys JobDetails in the process.
AssetProcessor::JobDetails jobDetails;
// the crux of this test: the database source name differs from the relative path to watch folder:
jobDetails.m_jobEntry.m_pathRelativeToWatchFolder = "SomeThing.tif"; // case sensitive
// Note that while this is an OS-SPECIFIC path, this unit test does not actually invoke the file system at all
// and only operates on in-memory structures, so it should work on every platform.
jobDetails.m_jobEntry.m_watchFolderPath = "c:/test/a/B/c"; // just to make sure case is preserved
jobDetails.m_jobEntry.m_databaseSourceName = "somepath/SomeThing.tif"; // case sensitive but outputprefixes are generally lowcase
jobDetails.m_jobEntry.m_sourceFileUUID = sourceUUID;
jobDetails.m_jobEntry.m_platformInfo = { "ios",{ "mobile", "renderer" } };
jobDetails.m_jobEntry.m_jobRunKey = 1;
jobDetails.m_jobEntry.m_jobKey = "tiff";
jobDetails.m_jobEntry.m_builderGuid = builderGuid;
TestRCJob job;
job.Init(jobDetails);
job.PopulateProcessJobRequest(req);
}
EXPECT_STREQ(req.m_sourceFile.c_str(), "SomeThing.tif");
EXPECT_STREQ(req.m_watchFolder.c_str(), "c:/test/a/B/c");
// the crux of the test, tested: make sure that it does not contain 'somepath' in there just becuase its part of the Database Source Name.
EXPECT_STREQ(req.m_fullPath.c_str(), "c:/test/a/B/c/SomeThing.tif");
EXPECT_EQ(req.m_builderGuid, builderGuid);
EXPECT_TRUE(req.m_platformInfo.HasTag("renderer"));
EXPECT_TRUE(req.m_platformInfo.HasTag("mobile"));
EXPECT_STREQ(req.m_platformInfo.m_identifier.c_str(), "ios");
EXPECT_EQ(req.m_sourceFileUUID, sourceUUID);
}
@@ -54,13 +54,6 @@ namespace AssetProcessor
QDir scanFolder(file->m_scanFolderInfo.m_scanFolder.c_str());
QString sourceName = file->m_sourceInfo.m_sourceName.c_str();
// If a scan folder has a prefix, then source files in those scan folders will have that
// prefix prepended in the asset database. Strip that prefix off for building the actual absolute path to the file.
if (!file->m_scanFolderInfo.m_outputPrefix.empty())
{
QRegExp prefixRemovalRegex(QString("^%1/").arg(file->m_scanFolderInfo.m_outputPrefix.c_str()));
sourceName.remove(prefixRemovalRegex);
}
return scanFolder.filePath(sourceName);
}
@@ -14,6 +14,7 @@
#include "SourceAssetTreeItemData.h"
#include <AzCore/Component/TickBus.h>
#include <AzCore/IO/Path/Path.h>
#include <native/utilities/assetUtils.h>
@@ -62,19 +63,8 @@ namespace AssetProcessor
}
AZStd::string fullPath = source.m_sourceName;
auto fullPath = AZ::IO::Path(scanFolder.m_scanFolder) / source.m_sourceName;
// The source assets should look like they do on disk.
// If the scan folder has an output prefix, strip it from the source file's path in the database, before
// the scan folder path is prepended to the source file.
if (!scanFolder.m_outputPrefix.empty())
{
AZStd::string prefixPath = scanFolder.m_outputPrefix;
AzFramework::StringFunc::Append(prefixPath, AZ_CORRECT_DATABASE_SEPARATOR);
AzFramework::StringFunc::Replace(fullPath, prefixPath.c_str(), "", false, true);
}
AzFramework::StringFunc::AssetDatabasePath::Join(scanFolder.m_scanFolder.c_str(), fullPath.c_str(), fullPath, true, false);
// It's common for Open 3D Engine game projects and scan folders to be in a subfolder
// of the engine install. To improve readability of the source files, strip out
@@ -85,7 +75,7 @@ namespace AssetProcessor
}
if (m_assetRootSet)
{
AzFramework::StringFunc::Replace(fullPath, m_assetRoot.absolutePath().toUtf8(), "");
AzFramework::StringFunc::Replace(fullPath.Native(), m_assetRoot.absolutePath().toUtf8(), "");
}
@@ -148,7 +148,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
scanFolders.clear();
//add a scanfolder
scanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev", "dev", "rootportkey", "");
scanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev", "dev", "rootportkey");
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(scanFolder));
if (scanFolder.m_scanFolderID == AzToolsFramework::AssetDatabase::InvalidEntryId)
{
@@ -158,7 +158,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
//add the same folder again, should not add another because it already exists, so we should get the same id
// not only that, but the path should update.
ScanFolderDatabaseEntry dupeScanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev2", "dev", "rootportkey", "");
ScanFolderDatabaseEntry dupeScanFolder("c:/O3DE/dev2", "dev", "rootportkey");
dupeScanFolder.m_scanFolderID = AzToolsFramework::AssetDatabase::InvalidEntryId;
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(dupeScanFolder));
if (!(dupeScanFolder == scanFolder))
@@ -200,7 +200,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
}
//add another folder
ScanFolderDatabaseEntry gameScanFolderEntry("c:/O3DE/game", "game", "gameportkey", "");
ScanFolderDatabaseEntry gameScanFolderEntry("c:/O3DE/game", "game", "gameportkey");
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(gameScanFolderEntry));
if (gameScanFolderEntry.m_scanFolderID == AzToolsFramework::AssetDatabase::InvalidEntryId ||
gameScanFolderEntry.m_scanFolderID == scanFolder.m_scanFolderID)
@@ -230,7 +230,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
UNIT_TEST_EXPECT_TRUE(ScanFoldersContainScanFolderID(scanFolders, scanFolder.m_scanFolderID));
//add another folder again
gameScanFolderEntry = ScanFolderDatabaseEntry("c:/O3DE/game", "game", "gameportkey2", "");
gameScanFolderEntry = ScanFolderDatabaseEntry("c:/O3DE/game", "game", "gameportkey2");
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(gameScanFolderEntry));
if (gameScanFolderEntry.m_scanFolderID == AzToolsFramework::AssetDatabase::InvalidEntryId ||
gameScanFolderEntry.m_scanFolderID == scanFolder.m_scanFolderID)
@@ -258,7 +258,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
///////////////////////////////////////////////////////////
//setup for sources tests
//for the rest of the test lets add the original scan folder
scanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev", "dev", "devkey2", "");
scanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev", "dev", "devkey2");
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(scanFolder));
///////////////////////////////////////////////////////////
@@ -370,7 +370,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
UNIT_TEST_EXPECT_TRUE(SourcesContainSourceGuid(sources, source.m_sourceGuid));
//add the same source again, but change the scan folder. This should NOT add a new source - even if we don't know what the sourceID is:
ScanFolderDatabaseEntry scanfolder2 = ScanFolderDatabaseEntry("c:/O3DE/dev2", "dev2", "devkey3", "");
ScanFolderDatabaseEntry scanfolder2 = ScanFolderDatabaseEntry("c:/O3DE/dev2", "dev2", "devkey3");
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(scanfolder2));
SourceDatabaseEntry dupeSource2(source);
@@ -554,7 +554,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
////////////////////////////////////////////////////////////////
//Setup for jobs tests by having a scan folder and some sources
//Add a scan folder
scanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev", "dev", "devkey3", "");
scanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev", "dev", "devkey3");
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(scanFolder));
//Add some sources
@@ -46,7 +46,6 @@ namespace AssetProcessor
friend class AssetProcessorManagerUnitTests;
friend class AssetProcessorManagerUnitTests_JobKeys;
friend class AssetProcessorManagerUnitTests_JobDependencies_Fingerprint;
friend class AssetProcessorManagerUnitTests_CheckOutputFolders;
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
public:
@@ -64,7 +63,6 @@ namespace AssetProcessor
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests)
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests_JobKeys)
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests_JobDependencies_Fingerprint)
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests_CheckOutputFolders)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
@@ -247,11 +245,11 @@ namespace AssetProcessor
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
config.PopulatePlatformsForScanFolder(platforms);
// PATH DisplayName PortKey outputfolder root recurse platforms order
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", "", false, false, platforms, -6)); // subfolder 4 overrides subfolder3
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", "", false, false, platforms,-5)); // subfolder 3 overrides subfolder2
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", "", false, true, platforms, -2)); // subfolder 2 overrides subfolder1
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, platforms, -1)); // subfolder1 overrides root
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", "", true, false, platforms, 0)); // add the root
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, false, platforms, -6)); // subfolder 4 overrides subfolder3
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, false, platforms,-5)); // subfolder 3 overrides subfolder2
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", false, true, platforms, -2)); // subfolder 2 overrides subfolder1
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms, -1)); // subfolder1 overrides root
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0)); // add the root
config.AddMetaDataType("exportsettings", QString());
@@ -2325,8 +2323,8 @@ namespace AssetProcessor
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
config.PopulatePlatformsForScanFolder(platforms);
// PATH DisplayName PortKey outputfolder root recurse order
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, platforms,-1)); // subfolder1 overrides root
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", "", true, false, platforms, 0)); // add the root
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms,-1)); // subfolder1 overrides root
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0)); // add the root
AssetProcessorManager_Test apm(&config);
@@ -2534,11 +2532,11 @@ namespace AssetProcessor
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
config.PopulatePlatformsForScanFolder(platforms);
// PATH DisplayName PortKey outputfolder root recurse platforms order
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", "", false, false, platforms, -6)); // subfolder 4 overrides subfolder3
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", "", false, false, platforms, -5)); // subfolder 3 overrides subfolder2
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", "", false, true, platforms, -2)); // subfolder 2 overrides subfolder1
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, platforms, -1)); // subfolder1 overrides root
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", "", true, false, platforms, 0)); // add the root
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, false, platforms, -6)); // subfolder 4 overrides subfolder3
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, false, platforms, -5)); // subfolder 3 overrides subfolder2
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", false, true, platforms, -2)); // subfolder 2 overrides subfolder1
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms, -1)); // subfolder1 overrides root
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0)); // add the root
{
// create this, which will write those scan folders into the db as-is
@@ -2584,13 +2582,13 @@ namespace AssetProcessor
config2.PopulatePlatformsForScanFolder(platforms2);
// PATH DisplayName PortKey outputfolder root recurse platforms order
// case 1: same absolute path, but the same portable key - should use same ID as before.
config2.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", "", false, false, platforms2, -6)); // subfolder 4 overrides subfolder3
config2.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, false, platforms2, -6)); // subfolder 4 overrides subfolder3
// case 2: A new absolute path, but same portable key - should use same id as before
config2.AddScanFolder(ScanFolderInfo(tempPath.filePath("newfolder3"), "subfolder3", "subfolder3", "", false, false, platforms2, -5)); // subfolder 3 overrides subfolder2
config2.AddScanFolder(ScanFolderInfo(tempPath.filePath("newfolder3"), "subfolder3", "subfolder3", false, false, platforms2, -5)); // subfolder 3 overrides subfolder2
// case 3: same absolute path, new portable key - should use a new ID
config2.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder3", "newfolder3", "", false, false, platforms2, -5)); // subfolder 3 overrides subfolder2
config2.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder3", "newfolder3", false, false, platforms2, -5)); // subfolder 3 overrides subfolder2
// case 4: subfolder2 is missing - it should be gone.
@@ -2775,8 +2773,8 @@ namespace AssetProcessor
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
config.PopulatePlatformsForScanFolder(platforms);
// PATH DisplayName PortKey outputfolder root recurse order
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, platforms, -1)); // subfolder1 overrides root
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", "", true, false, platforms, 0)); // add the root
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms, -1)); // subfolder1 overrides root
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0)); // add the root
AssetProcessorManager_Test apm(&config);
@@ -3083,255 +3081,6 @@ namespace AssetProcessor
Q_EMIT UnitTestPassed();
}
void AssetProcessorManagerUnitTests_CheckOutputFolders::StartTest()
{
MockAssetBuilderInfoHandler mockAssetBuilderInfoHandler;
QDir oldRoot;
AssetUtilities::ComputeAssetRoot(oldRoot);
AssetUtilities::ResetAssetRoot();
// the canonicalization of the path here is to get around the fact that on some platforms
// the "temporary" folder location could be junctioned into some other folder and getting "QDir::current()"
// and other similar functions may actually return a different string but still be referring to the same folder
QTemporaryDir dir;
QDir tempPath(dir.path());
QString canonicalTempDirPath = AssetUtilities::NormalizeDirectoryPath(tempPath.canonicalPath());
UnitTestUtils::ScopedDir changeDir(canonicalTempDirPath);
tempPath = QDir(canonicalTempDirPath);
QString gameName = AssetUtilities::ComputeProjectName(AssetProcessorManagerTestGameProject);
// update the engine root
AssetUtilities::ResetAssetRoot();
QDir newRoot;
AssetUtilities::ComputeAssetRoot(newRoot, &tempPath);
UNIT_TEST_EXPECT_FALSE(gameName.isEmpty());
PlatformConfiguration config;
config.EnablePlatform({ "pc",{ "desktop", "renderer" } }, true);
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
config.PopulatePlatformsForScanFolder(platforms);
// PATH DisplayName PortKey outputfolder root recurse platforms order
// note: the crux of this test is that we ar redirecting output into the cache at a different location instead of default.
// so our scan folder has a "redirected" folder.
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "redirected", false, true, platforms, -1));
AssetProcessorManager_Test apm(&config);
QDir cacheRoot;
UNIT_TEST_EXPECT_TRUE(AssetUtilities::ComputeProjectCacheRoot(cacheRoot));
QList<JobDetails> processResults;
QList<QPair<QString, QString> > changedInputResults;
QList< AzFramework::AssetSystem::AssetNotificationMessage > assetMessages;
bool idling = false;
connect(&apm, &AssetProcessorManager::AssetToProcess,
this, [&processResults](JobDetails details)
{
processResults.push_back(AZStd::move(details));
});
connect(&apm, &AssetProcessorManager::AssetMessage,
this, [&assetMessages](AzFramework::AssetSystem::AssetNotificationMessage message)
{
assetMessages.push_back( message);
});
connect(&apm, &AssetProcessorManager::InputAssetProcessed,
this, [&changedInputResults](QString relativePath, QString platform)
{
changedInputResults.push_back(QPair<QString, QString>(relativePath, platform));
});
connect(&apm, &AssetProcessorManager::AssetProcessorManagerIdleState,
this, [&idling](bool state)
{
idling = state;
}
);
QString sourceFile = tempPath.absoluteFilePath("subfolder1/basefile.foo");
CreateDummyFile(sourceFile);
mockAssetBuilderInfoHandler.m_numberOfJobsToCreate = 1; //Create two jobs for this file
QMetaObject::invokeMethod(&apm, "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, sourceFile));
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
// block until no more events trickle in:
QCoreApplication::processEvents(QEventLoop::AllEvents);
UNIT_TEST_EXPECT_TRUE(processResults.size() == 1);
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "pc"));
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_databaseSourceName == "redirected/basefile.foo");
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_pathRelativeToWatchFolder == "basefile.foo");
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_watchFolderPath == tempPath.filePath("subfolder1"));
QStringList pcouts;
pcouts.push_back(cacheRoot.filePath(QString("pc/redirected/basefile.arc1")));
// Create the product files for the first job
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(pcouts[0], "product1"));
// Invoke Asset Processed for pc platform for the first job
AssetBuilderSDK::ProcessJobResponse response;
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(pcouts[0].toUtf8().constData()));
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[0].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
// let events bubble through:
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
UNIT_TEST_EXPECT_TRUE(assetMessages.size() == 1);
UNIT_TEST_EXPECT_TRUE(changedInputResults.size() == 1);
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "pc");
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_data == "redirected/basefile.arc1");
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_type == AzFramework::AssetSystem::AssetNotificationMessage::AssetChanged);
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(changedInputResults[0].first) == AssetUtilities::NormalizeFilePath(sourceFile));
// ------------- TEST 1: Modified source file
processResults.clear();
pcouts.clear();
assetMessages.clear();
changedInputResults.clear();
// now, the test is set up. we can now start poking that file and make sure we emit the appropriate messages.
// first, lets modify the file and make sure we get the build request.
#if defined(AZ_PLATFORM_WINDOWS)
QThread::msleep(30); // give at least some milliseconds so that the files never share the same timestamp exactly
#else
// on some file systems such as HFS (commonly used on Apple devices, the file time resolution is only a second.
// We are forcing a wait here of at least a second to make sure that the file modtime
// actually changes.
QThread::msleep(1001);
#endif // defined (AZ_PLATFORM_WINDOWS)
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(sourceFile, "new data!"));
QMetaObject::invokeMethod(&apm, "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, sourceFile));
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
// block until no more events trickle in:
QCoreApplication::processEvents(QEventLoop::AllEvents);
UNIT_TEST_EXPECT_TRUE(processResults.size() == 1);
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "pc"));
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_pathRelativeToWatchFolder == "basefile.foo");
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_databaseSourceName == "redirected/basefile.foo");
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_watchFolderPath == tempPath.absoluteFilePath("subfolder1"));
pcouts.push_back(cacheRoot.filePath(QString("pc/redirected/basefile.arc1")));
// Create the product files for the first job
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(pcouts[0], "product1"));
// Invoke Asset Processed for pc platform for the first job
response.m_outputProducts.clear();
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(pcouts[0].toUtf8().constData()));
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[0].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
// let events bubble through:
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
UNIT_TEST_EXPECT_TRUE(assetMessages.size() == 1);
UNIT_TEST_EXPECT_TRUE(changedInputResults.size() == 1);
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "pc");
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_data == "redirected/basefile.arc1");
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_type == AzFramework::AssetSystem::AssetNotificationMessage::AssetChanged);
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(changedInputResults[0].first) == AssetUtilities::NormalizeFilePath(sourceFile));
// ------------- TEST 2: Deleted product
processResults.clear();
pcouts.clear();
assetMessages.clear();
changedInputResults.clear();
QString deletedProductPath = cacheRoot.filePath(QString("pc/redirected/basefile.arc1"));
QFile::remove(deletedProductPath);
QMetaObject::invokeMethod(&apm, "AssessDeletedFile", Qt::QueuedConnection, Q_ARG(QString, deletedProductPath));
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
// block until no more events trickle in:
QCoreApplication::processEvents(QEventLoop::AllEvents);
UNIT_TEST_EXPECT_TRUE(assetMessages.size() == 0); // asset removed is delayed until actual processing occurs.
UNIT_TEST_EXPECT_TRUE(processResults.size() == 1);
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "pc"));
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_pathRelativeToWatchFolder == "basefile.foo");
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_databaseSourceName == "redirected/basefile.foo");
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_watchFolderPath == tempPath.absoluteFilePath("subfolder1"));
pcouts.push_back(cacheRoot.filePath(QString("pc/redirected/basefile.arc1")));
// Create the product files for the first job
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(pcouts[0], "product1"));
// Invoke Asset Processed for pc platform for the first job
response.m_outputProducts.clear();
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(pcouts[0].toUtf8().constData()));
changedInputResults.clear();
assetMessages.clear();
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[0].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
// let events bubble through:
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
UNIT_TEST_EXPECT_TRUE(assetMessages.size() == 1);
UNIT_TEST_EXPECT_TRUE(changedInputResults.size() == 1);
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "pc");
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_data == "redirected/basefile.arc1");
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_type == AzFramework::AssetSystem::AssetNotificationMessage::AssetChanged);
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(changedInputResults[0].first) == AssetUtilities::NormalizeFilePath(sourceFile));
// ------------- TEST 3: Deleted source - the products should end up deleted!
processResults.clear();
pcouts.clear();
assetMessages.clear();
changedInputResults.clear();
QString deletedSourcePath = sourceFile;
QFile::remove(deletedSourcePath);
QMetaObject::invokeMethod(&apm, "AssessDeletedFile", Qt::QueuedConnection, Q_ARG(QString, deletedSourcePath));
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
// block until no more events trickle in:
QCoreApplication::processEvents(QEventLoop::AllEvents);
UNIT_TEST_EXPECT_TRUE(assetMessages.size() == 1);
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "pc");
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_data == "redirected/basefile.arc1");
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_type == AzFramework::AssetSystem::AssetNotificationMessage::AssetRemoved);
// also ensure file is actually gone!
UNIT_TEST_EXPECT_TRUE(!QFile::exists(deletedProductPath));
Q_EMIT UnitTestPassed();
}
void AssetProcessorManagerUnitTests_JobDependencies_Fingerprint::GetMatchingBuildersInfo(const AZStd::string& assetPath, AssetProcessor::BuilderInfoList& builderInfoList)
{
AZ_UNUSED(assetPath);
@@ -45,14 +45,6 @@ Q_SIGNALS:
virtual void StartTest() override;
};
class AssetProcessorManagerUnitTests_CheckOutputFolders
: public UnitTestRun
{
Q_OBJECT
public:
virtual void StartTest() override;
};
class AssetProcessorManagerUnitTests_JobDependencies_Fingerprint
: public UnitTestRun
, public AssetProcessor::AssetBuilderInfoBus::Handler
@@ -65,10 +65,10 @@ void AssetScannerUnitTest::StartTest()
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
config.PopulatePlatformsForScanFolder(platforms);
// PATH DisplayName PortKey outputfolder root recurse platforms
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "ap1", "", true, false, platforms)); // note: "Recurse" set to false.
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "", "ap2", "", false, true, platforms));
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "", "ap3", "", false, true, platforms));
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "", "ap4", "", false, false, platforms)); // note: "Recurse" set to false.
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "ap1", true, false, platforms)); // note: "Recurse" set to false.
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "", "ap2", false, true, platforms));
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "", "ap3", false, true, platforms));
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "", "ap4", false, false, platforms)); // note: "Recurse" set to false.
AssetScanner scanner(&config);
QList<AssetFileInfo> filesFound;
@@ -69,20 +69,20 @@ void PlatformConfigurationTests::StartTest()
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
config.PopulatePlatformsForScanFolder(platforms);
// PATH DisplayName PortKey outputfolder root recurse platforms, isunittesting
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "", "sf3", "", false, false, platforms), true); // subfolder 3 overrides subfolder2
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "", "sf4", "", false, true, platforms), true); // subfolder 2 overrides subfolder1
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "", "sf1", "subfolder1", false, true, platforms), true); // subfolder1 overrides root
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "", "sf4", "", false, true, platforms), true); // subfolder4 overrides subfolder5
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder5"), "", "sf5", "b/c", false, true, platforms), true); // subfolder5 overrides subfolder6
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder6"), "", "sf6", "b/c", false, true, platforms), true); // subfolder6 overrides subfolder7
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder7"), "", "sf7", "", false, true, platforms), true); // subfolder7 overrides subfolder8
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder8/x"), "", "sf8", "", false, true, platforms), true); // subfolder8 overrides root
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "temp", "", true, false, platforms), true); // add the root
// PATH DisplayName PortKey root recurse platforms, isunittesting
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "", "sf3", false, false, platforms), true); // subfolder 3 overrides subfolder2
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "", "sf4", false, true, platforms), true); // subfolder 2 overrides subfolder1
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "", "sf1", false, true, platforms), true); // subfolder1 overrides root
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "", "sf4", false, true, platforms), true); // subfolder4 overrides subfolder5
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder5"), "", "sf5", false, true, platforms), true); // subfolder5 overrides subfolder6
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder6"), "", "sf6", false, true, platforms), true); // subfolder6 overrides subfolder7
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder7"), "", "sf7", false, true, platforms), true); // subfolder7 overrides subfolder8
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder8/x"), "", "sf8", false, true, platforms), true); // subfolder8 overrides root
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "temp", true, false, platforms), true); // add the root
// these are checked for later.
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("GameName"), "gn", "", "", false, true, platforms), true);
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("GameNameButWithExtra"), "gnbwe", "", "WithExtra", false, true, platforms), true);
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("GameName"), "gn", "", false, true, platforms), true);
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("GameNameButWithExtra"), "gnbwe", "", false, true, platforms), true);
@@ -151,7 +151,7 @@ void PlatformConfigurationTests::StartTest()
UNIT_TEST_EXPECT_TRUE(config.GetOverridingFile("rootfile3.txt", tempPath.absolutePath()) == tempPath.absoluteFilePath("subfolder3/rootfile3.txt"));
UNIT_TEST_EXPECT_TRUE(config.GetOverridingFile("subfolder1/whatever.txt", tempPath.filePath("subfolder1")) == QString());
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(config.GetOverridingFile("subfolder1/override.txt", tempPath.filePath("subfolder1"))) == AssetUtilities::NormalizeFilePath(tempPath.absoluteFilePath("subfolder2/subfolder1/override.txt")));
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(config.GetOverridingFile("b/c/a/testfile.txt", tempPath.filePath("subfolder6"))) == AssetUtilities::NormalizeFilePath(tempPath.absoluteFilePath("subfolder5/a/testfile.txt")));
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(config.GetOverridingFile("a/testfile.txt", tempPath.filePath("subfolder6"))) == AssetUtilities::NormalizeFilePath(tempPath.absoluteFilePath("subfolder4/a/testfile.txt")));
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(config.GetOverridingFile("a/testfile.txt", tempPath.filePath("subfolder7"))) == AssetUtilities::NormalizeFilePath(tempPath.absoluteFilePath("subfolder4/a/testfile.txt")));
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(config.GetOverridingFile("a/testfile.txt", tempPath.filePath("subfolder8/x"))) == AssetUtilities::NormalizeFilePath(tempPath.absoluteFilePath("subfolder4/a/testfile.txt")));
@@ -183,7 +183,6 @@ void PlatformConfigurationTests::StartTest()
// different regex rule should not interfere
UNIT_TEST_EXPECT_TRUE(config.FindFirstMatchingFile("test/test.format") == tempPath.filePath("subfolder1/test/test.format"));
UNIT_TEST_EXPECT_TRUE(config.FindFirstMatchingFile("b/c/a/testfile.txt") == tempPath.filePath("subfolder5/a/testfile.txt"));
UNIT_TEST_EXPECT_TRUE(config.FindFirstMatchingFile("a/testfile.txt") == tempPath.filePath("subfolder4/a/testfile.txt"));
// ---------------------------- GetScanFolderForFile -----------------
@@ -198,15 +197,6 @@ void PlatformConfigurationTests::StartTest()
UNIT_TEST_EXPECT_TRUE(config.GetScanFolderForFile(tempPath.filePath("rootfile2.txt")));
UNIT_TEST_EXPECT_TRUE(config.GetScanFolderForFile(tempPath.filePath("rootfile2.txt"))->ScanPath() == tempPath.absolutePath());
// test of output prefix lookup
UNIT_TEST_EXPECT_TRUE(config.GetScanFolderForFile(tempPath.filePath("subfolder1/whatever.txt"))->GetOutputPrefix() == "subfolder1");
// make sure that it does not mistake the GameName folder and the GameNameWithExtra folder for each other.
UNIT_TEST_EXPECT_TRUE(config.GetScanFolderForFile(tempPath.filePath("GameNameButWithExtra/somefile.meo"))->GetOutputPrefix() == "WithExtra");
UNIT_TEST_EXPECT_TRUE(config.GetScanFolderForFile(tempPath.filePath("GameName/otherfile.meo"))->GetOutputPrefix() == "");
// -------------------------- ConvertToRelativePath ------------------------------
QString fileName;
@@ -238,9 +228,9 @@ void PlatformConfigurationTests::StartTest()
UNIT_TEST_EXPECT_TRUE(fileName == "aaa/bbb/ccc/ddd/basefile.txt");
UNIT_TEST_EXPECT_TRUE(scanFolderPath == tempPath.filePath("subfolder2"));
// verify that output relative paths include output prefix
// verify that output relative paths
UNIT_TEST_EXPECT_TRUE(config.ConvertToRelativePath(tempPath.absoluteFilePath("subfolder1/whatever.txt"), fileName, scanFolderPath));
UNIT_TEST_EXPECT_TRUE(fileName == "subfolder1/whatever.txt");
UNIT_TEST_EXPECT_TRUE(fileName == "whatever.txt");
UNIT_TEST_EXPECT_TRUE(scanFolderPath == tempPath.filePath("subfolder1"));
}
@@ -520,7 +520,7 @@ void RCcontrollerUnitTests::RunRCControllerTests()
AZ::Uuid uuidOfSource = AZ::Uuid("{D013122E-CF2C-4534-A87D-F82570FBC2CD}");
MockRCJob rcJob;
ScanFolderInfo scanFolderInfo("samplepath", "sampledisplayname", "samplekey", "", false, false);
ScanFolderInfo scanFolderInfo("samplepath", "sampledisplayname", "samplekey", false, false);
AssetProcessor::JobDetails jobDetailsToInitWith;
jobDetailsToInitWith.m_jobEntry.m_watchFolderPath = tempPath.absoluteFilePath("subfolder4");
jobDetailsToInitWith.m_jobEntry.m_databaseSourceName = jobDetailsToInitWith.m_jobEntry.m_pathRelativeToWatchFolder = "needsLock.tiff";
@@ -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();
@@ -1,19 +0,0 @@
; this is an override config that should "add" the provo platform
; and "remove" the server platform.
[Platform provo]
tags=console, renderer
[Platforms]
server=disabled
provo=enabled
; this ONLY overrides the "provo" value
; becuase this is being loaded on top of the defaults, this should LEAVE the others
; as they are.
[RC i_caf]
provo=copy
; this will remove "mov" from the default configuration
[RC mov]
ignore=true
@@ -0,0 +1,21 @@
{
"Amazon": {
"AssetProcessor": {
"Settings": {
"Platform provo": {
"tags": "console, renderer"
},
"Platforms": {
"server": "disabled",
"provo": "enabled"
},
"RC i_caf": {
"provo": "copy"
},
"RC mov": {
"ignore": true
}
}
}
}
}

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