Add UseAssetImportPathRelative to Editor options and use it by default to store imported asset path relative to the project folder

This commit is contained in:
Wojtek Figat
2023-01-01 18:55:09 +01:00
parent 9554636971
commit 084fe6f063
8 changed files with 38 additions and 3 deletions

View File

@@ -4,15 +4,16 @@
#include "Cache/AssetsCache.h"
#include "Storage/ContentStorageManager.h"
#include "Loading/Tasks/LoadAssetDataTask.h"
#include "Factories/BinaryAssetFactory.h"
#include "Engine/ContentImporters/AssetsImportingManager.h"
#include "Engine/Content/Content.h"
#include "Engine/Serialization/JsonTools.h"
#include "Engine/Debug/Exceptions/JsonParseException.h"
#include "Factories/BinaryAssetFactory.h"
#include "Engine/Threading/ThreadPoolTask.h"
#if USE_EDITOR
#include "Engine/Platform/FileSystem.h"
#include "Engine/Threading/Threading.h"
#include "Engine/Engine/Globals.h"
#endif
REGISTER_BINARY_ASSET_ABSTRACT(BinaryAsset, "FlaxEngine.BinaryAsset");
@@ -123,6 +124,12 @@ void BinaryAsset::GetImportMetadata(String& path, String& username) const
{
path = JsonTools::GetString(document, "ImportPath");
username = JsonTools::GetString(document, "ImportUsername");
if (path.HasChars() && FileSystem::IsRelative(path))
{
// Convert path back to thr absolute (eg. if stored in relative format)
path = Globals::ProjectFolder / path;
StringUtils::PathRemoveRelativeParts(path);
}
}
else
{