@@ -89,15 +89,6 @@ namespace AZ
|
||||
result.Combine(componentLoadResult);
|
||||
}
|
||||
|
||||
{
|
||||
JSR::ResultCode dependencyReadyLoadResult =
|
||||
ContinueLoadingFromJsonObjectField(&entityInstance->m_isDependencyReady,
|
||||
azrtti_typeid<decltype(entityInstance->m_isDependencyReady)>(),
|
||||
inputValue, "IsDependencyReady", context);
|
||||
|
||||
result.Combine(dependencyReadyLoadResult);
|
||||
}
|
||||
|
||||
{
|
||||
JSR::ResultCode runtimeActiveLoadResult =
|
||||
ContinueLoadingFromJsonObjectField(&entityInstance->m_isRuntimeActiveByDefault,
|
||||
@@ -184,20 +175,6 @@ namespace AZ
|
||||
result.Combine(resultComponents);
|
||||
}
|
||||
|
||||
{
|
||||
AZ::ScopedContextPath subPathDependencyReady(context, "m_isDependencyReady");
|
||||
const bool* dependencyReady = &entityInstance->m_isDependencyReady;
|
||||
const bool* dependencyReadyDefault =
|
||||
defaultEntityInstance ? &defaultEntityInstance->m_isDependencyReady : nullptr;
|
||||
|
||||
JSR::ResultCode resultDependencyReady =
|
||||
ContinueStoringToJsonObjectField(outputValue, "IsDependencyReady",
|
||||
dependencyReady, dependencyReadyDefault,
|
||||
azrtti_typeid<decltype(entityInstance->m_isDependencyReady)>(), context);
|
||||
|
||||
result.Combine(resultDependencyReady);
|
||||
}
|
||||
|
||||
{
|
||||
AZ::ScopedContextPath subPathRuntimeActive(context, "m_isRuntimeActiveByDefault");
|
||||
const bool* runtimeActive = &entityInstance->m_isRuntimeActiveByDefault;
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/containers/stack.h>
|
||||
#include <AzCore/std/function/function_fwd.h>
|
||||
#include <AzCore/std/function/function_template.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <AzCore/Math/Transform.h>
|
||||
#include <AzCore/Math/Plane.h>
|
||||
#include <AzCore/Math/SimdMath.h>
|
||||
#include <AzCore/std/containers/array.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -13,9 +13,32 @@
|
||||
#include <AzCore/Math/Obb.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/MathScriptHelpers.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace
|
||||
{
|
||||
class TransformSerializer
|
||||
: public SerializeContext::IDataSerializer
|
||||
{
|
||||
public:
|
||||
// number of floats in the serialized representation, 4 for rotation, 1 for scale and 3 for translation
|
||||
static constexpr int NumFloats = 8;
|
||||
|
||||
// number of floats in version 1, which used 4 for rotation, 3 for scale and 3 for translation
|
||||
static constexpr int NumFloatsVersion1 = 10;
|
||||
|
||||
// number of floats in version 0, which stored a 3x4 matrix
|
||||
static constexpr int NumFloatsVersion0 = 12;
|
||||
|
||||
size_t Save(const void* classPtr, IO::GenericStream& stream, bool isDataBigEndian) override;
|
||||
size_t DataToText(IO::GenericStream& in, IO::GenericStream& out, bool isDataBigEndian) override;
|
||||
size_t TextToData(const char* text, unsigned int textVersion, IO::GenericStream& stream, bool isDataBigEndian) override;
|
||||
bool Load(void* classPtr, IO::GenericStream& stream, unsigned int version, bool isDataBigEndian) override;
|
||||
bool CompareValueData(const void* lhs, const void* rhs) override;
|
||||
};
|
||||
}
|
||||
namespace Internal
|
||||
{
|
||||
void TransformDefaultConstructor(Transform* thisPtr)
|
||||
|
||||
@@ -13,30 +13,9 @@
|
||||
#include <AzCore/Math/Vector4.h>
|
||||
#include <AzCore/Math/Quaternion.h>
|
||||
#include <AzCore/Math/MathUtils.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class TransformSerializer
|
||||
: public SerializeContext::IDataSerializer
|
||||
{
|
||||
public:
|
||||
// number of floats in the serialized representation, 4 for rotation, 1 for scale and 3 for translation
|
||||
static constexpr int NumFloats = 8;
|
||||
|
||||
// number of floats in version 1, which used 4 for rotation, 3 for scale and 3 for translation
|
||||
static constexpr int NumFloatsVersion1 = 10;
|
||||
|
||||
// number of floats in version 0, which stored a 3x4 matrix
|
||||
static constexpr int NumFloatsVersion0 = 12;
|
||||
|
||||
size_t Save(const void* classPtr, IO::GenericStream& stream, bool isDataBigEndian) override;
|
||||
size_t DataToText(IO::GenericStream& in, IO::GenericStream& out, bool isDataBigEndian) override;
|
||||
size_t TextToData(const char* text, unsigned int textVersion, IO::GenericStream& stream, bool isDataBigEndian) override;
|
||||
bool Load(void* classPtr, IO::GenericStream& stream, unsigned int version, bool isDataBigEndian) override;
|
||||
bool CompareValueData(const void* lhs, const void* rhs) override;
|
||||
};
|
||||
|
||||
//! Limits for transform scale values.
|
||||
//! The scale should not be zero to avoid problems with inverting.
|
||||
//! @{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <AzCore/Math/Internal/MathTypes.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/EntityId.h>
|
||||
#include <AzCore/Math/Transform.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/containers/stack.h>
|
||||
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
|
||||
|
||||
namespace UnitTest
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <AzFramework/Visibility/OctreeSystemComponent.h>
|
||||
#include <AzCore/Math/ShapeIntersection.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
|
||||
+6
-1
@@ -9,7 +9,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class ReflectContext;
|
||||
} // namespace Az
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
namespace AzFramework
|
||||
|
||||
+28
-1
@@ -6,6 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
@@ -13,6 +14,9 @@
|
||||
|
||||
#include <Psapi.h>
|
||||
|
||||
AZ_CVAR(bool, ap_tether_lifetime, false, nullptr, AZ::ConsoleFunctorFlags::Null,
|
||||
"If enabled, a parent process that launches the AP will terminate the AP on exit");
|
||||
|
||||
namespace AzFramework::AssetSystem::Platform
|
||||
{
|
||||
void AllowAssetProcessorToForeground()
|
||||
@@ -100,6 +104,21 @@ namespace AzFramework::AssetSystem::Platform
|
||||
fullLaunchCommand += '"';
|
||||
}
|
||||
|
||||
// Create or retrieve the job handle associated with the asset processor
|
||||
HANDLE apJob = nullptr;
|
||||
|
||||
if (ap_tether_lifetime)
|
||||
{
|
||||
apJob = ::CreateJobObjectA(nullptr, "AssetProcessorJob");
|
||||
if (apJob && GetLastError() != ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
// We're creating the job for the first time. Configure it to close child processes when this process exits.
|
||||
JOBOBJECT_EXTENDED_LIMIT_INFORMATION info = {};
|
||||
info.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
|
||||
::SetInformationJobObject(apJob, JobObjectExtendedLimitInformation, &info, sizeof(info));
|
||||
}
|
||||
}
|
||||
|
||||
STARTUPINFO si;
|
||||
ZeroMemory(&si, sizeof(si));
|
||||
si.cb = sizeof(si);
|
||||
@@ -107,6 +126,14 @@ namespace AzFramework::AssetSystem::Platform
|
||||
si.wShowWindow = SW_MINIMIZE;
|
||||
PROCESS_INFORMATION pi;
|
||||
|
||||
return ::CreateProcessA(nullptr, fullLaunchCommand.data(), nullptr, nullptr, FALSE, 0, nullptr, AZ::IO::FixedMaxPathString{ executableDirectory }.c_str(), &si, &pi) != 0;
|
||||
bool createResult = ::CreateProcessA(nullptr, fullLaunchCommand.data(), nullptr, nullptr, FALSE, 0, nullptr, AZ::IO::FixedMaxPathString{ executableDirectory }.c_str(), &si, &pi) != 0;
|
||||
|
||||
if (ap_tether_lifetime && apJob && createResult)
|
||||
{
|
||||
// Save process and thread handle to terminate AP when the parent process exits
|
||||
::AssignProcessToJobObject(apJob, pi.hProcess);
|
||||
}
|
||||
|
||||
return createResult;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,9 @@ class QString;
|
||||
|
||||
namespace AzToolsFramework::AssetUtils
|
||||
{
|
||||
static constexpr const char* AssetImporterSettingsKey{ "/O3DE/SceneAPI/AssetImporter" };
|
||||
static constexpr const char* AssetImporterSupportedFileTypeKey{ "SupportedFileTypeExtensions" };
|
||||
|
||||
//! Reads the "/Amazon/AssetProcessor/Settings/Platforms" entry from the settings registry
|
||||
//! to retrieve all enabled platforms
|
||||
void ReadEnabledPlatformsFromSettingsRegistry(AZ::SettingsRegistryInterface& settingsRegistry,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
#include <AzCore/Math/Transform.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
-20
@@ -67,14 +67,6 @@ namespace AzToolsFramework
|
||||
result.Combine(isStaticLoadResult);
|
||||
}
|
||||
|
||||
{
|
||||
JSR::ResultCode netSyncEnabledLoadResult = ContinueLoadingFromJsonObjectField(
|
||||
&transformComponentInstance->m_netSyncEnabled, azrtti_typeid<decltype(transformComponentInstance->m_netSyncEnabled)>(),
|
||||
inputValue, "Sync Enabled", context);
|
||||
|
||||
result.Combine(netSyncEnabledLoadResult);
|
||||
}
|
||||
|
||||
{
|
||||
JSR::ResultCode interpolatePositionLoadResult = ContinueLoadingFromJsonObjectField(
|
||||
&transformComponentInstance->m_interpolatePosition, azrtti_typeid<decltype(transformComponentInstance->m_interpolatePosition)>(),
|
||||
@@ -172,18 +164,6 @@ namespace AzToolsFramework
|
||||
result.Combine(resultIsStatic);
|
||||
}
|
||||
|
||||
{
|
||||
AZ::ScopedContextPath subPathName(context, "m_netSyncEnabled");
|
||||
const bool* netSyncEnabled = &transformComponentInstance->m_netSyncEnabled;
|
||||
const bool* defaultNetSyncEnabled = defaultTransformComponentInstance ? &defaultTransformComponentInstance->m_netSyncEnabled : nullptr;
|
||||
|
||||
JSR::ResultCode resultNetSyncEnabled = ContinueStoringToJsonObjectField(
|
||||
outputValue, "Sync Enabled", netSyncEnabled, defaultNetSyncEnabled, azrtti_typeid<decltype(transformComponentInstance->m_netSyncEnabled)>(),
|
||||
context);
|
||||
|
||||
result.Combine(resultNetSyncEnabled);
|
||||
}
|
||||
|
||||
{
|
||||
AZ::ScopedContextPath subPathName(context, "m_interpolatePosition");
|
||||
const AZ::InterpolationMode* interpolatePosition = &transformComponentInstance->m_interpolatePosition;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <Prefab/PrefabTestComponent.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
|
||||
@@ -238,6 +238,14 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
OUTPUT_SUBDIRECTORY
|
||||
testdata/DummyProject
|
||||
)
|
||||
ly_add_target_files(
|
||||
TARGETS
|
||||
AssetProcessor.Tests
|
||||
FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_metadata/AssetProcessorPlatformConfig.setreg
|
||||
OUTPUT_SUBDIRECTORY
|
||||
testdata/config_metadata
|
||||
)
|
||||
|
||||
# Have the AssetProcessorTest use the LY_CMAKE_TARGET define of AssetProcessorBatch for the purpose
|
||||
# of looking up the generated cmake build dependencies settings registry .setreg file
|
||||
|
||||
@@ -12,6 +12,7 @@ set(FILES
|
||||
testdata/config_broken_noscans/AssetProcessorPlatformConfig.setreg
|
||||
testdata/config_broken_recognizers/AssetProcessorPlatformConfig.setreg
|
||||
testdata/config_regular/AssetProcessorPlatformConfig.setreg
|
||||
testdata/config_metadata/AssetProcessorPlatformConfig.setreg
|
||||
testdata/config_regular_platform_scanfolder/AssetProcessorPlatformConfig.setreg
|
||||
testdata/EmptyDummyProject/AssetProcessorGamePlatformConfig.setreg
|
||||
testdata/DummyProject/AssetProcessorGamePlatformConfig.setreg
|
||||
|
||||
@@ -263,9 +263,15 @@ namespace AssetProcessor
|
||||
return;
|
||||
}
|
||||
|
||||
using FixedValueString = AZ::SettingsRegistryInterface::FixedValueString;
|
||||
// Placeholder Key used by the local Settings Registry for storing all Gems SourcePaths
|
||||
// array entries.
|
||||
constexpr auto PlaceholderGemKey = FixedValueString(AZ::SettingsRegistryMergeUtils::OrganizationRootKey)
|
||||
+ "/Gems/__SettingsRegistryBuilderPlaceholder";
|
||||
|
||||
AZ::SettingsRegistryImpl registry;
|
||||
|
||||
// Seed the local settings registry using the AssetProcessor settings registry
|
||||
// Seed the local settings registry using the AssetProcessor Settings Registry
|
||||
if (auto settingsRegistry = AZ::Interface<AZ::SettingsRegistryInterface>::Get(); settingsRegistry != nullptr)
|
||||
{
|
||||
AZStd::array settingsToCopy{
|
||||
@@ -279,18 +285,55 @@ namespace AssetProcessor
|
||||
|
||||
for (const auto& settingsKey : settingsToCopy)
|
||||
{
|
||||
AZ::SettingsRegistryInterface::FixedValueString settingsValue;
|
||||
FixedValueString settingsValue;
|
||||
[[maybe_unused]] bool settingsCopied = settingsRegistry->Get(settingsValue, settingsKey)
|
||||
&& registry.Set(settingsKey, settingsValue);
|
||||
AZ_Warning("Settings Registry Builder", settingsCopied, "Unable to copy setting %s from AssetProcessor settings registry"
|
||||
" to local settings registry", settingsKey.c_str());
|
||||
}
|
||||
|
||||
// The purpose of this section is to copy the Gem's SourcePaths from the Global Settings Registry
|
||||
// the local SettingsRegistry. The reason this is needed is so that the call to
|
||||
// `MergeSettingsToRegistry_GemRegistries` below is able to locate each gem's "<gem-root>/Registry" folder
|
||||
// that will be merged into the bootstrap.game.<configuration>.<platform>.setreg file
|
||||
// This is used by the GameLauncher applications to read from a single merged .setreg file
|
||||
// containing the settings needed to run a game/simulation without have access to the source code base registry
|
||||
AZStd::vector<AzFramework::GemInfo> gemInfos;
|
||||
size_t pathIndex{};
|
||||
if (AzFramework::GetGemsInfo(gemInfos, *settingsRegistry))
|
||||
{
|
||||
AZStd::vector<AZ::IO::PathView> sourcePaths;
|
||||
for (const AzFramework::GemInfo& gemInfo : gemInfos)
|
||||
{
|
||||
for (const AZ::IO::Path& absoluteSourcePath : gemInfo.m_absoluteSourcePaths)
|
||||
{
|
||||
if (auto foundIt = AZStd::find(sourcePaths.begin(), sourcePaths.end(), absoluteSourcePath);
|
||||
foundIt == sourcePaths.end())
|
||||
{
|
||||
sourcePaths.emplace_back(absoluteSourcePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const AZ::IO::Path& sourcePath : sourcePaths)
|
||||
{
|
||||
// Use JSON Pointer to append elements to the SourcePaths array
|
||||
registry.Set(FixedValueString::format("%s/SourcePaths/%zu", PlaceholderGemKey.c_str(), pathIndex++),
|
||||
sourcePath.Native());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_EngineRegistry(registry, platform, specialization, &scratchBuffer);
|
||||
// This function iterates over each path for each the "/Amazon/Gems/<gem-name>/SourcePaths" key and attempts
|
||||
// to merge the "Registry" directory in each path.
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_GemRegistries(registry, platform, specialization, &scratchBuffer);
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_ProjectRegistry(registry, platform, specialization, &scratchBuffer);
|
||||
|
||||
// The Placeholder Key is removed now that each gem's "<gem-root>/Registry" directory have been merged to
|
||||
// the local Settings Registry instance via `MergeSettingsToRegistry_GemRegistries`
|
||||
registry.Remove(PlaceholderGemKey);
|
||||
|
||||
// Merge the Project User and User home settings registry only in non-release builds
|
||||
constexpr bool executeRegDumpCommands = false;
|
||||
AZ::CommandLine* commandLine{};
|
||||
|
||||
@@ -76,6 +76,7 @@ public:
|
||||
friend class GTEST_TEST_CLASS_NAME_(ModtimeScanningTest, ModtimeSkipping_ModifyMetadataFile);
|
||||
friend class GTEST_TEST_CLASS_NAME_(ModtimeScanningTest, ModtimeSkipping_DeleteFile);
|
||||
friend class GTEST_TEST_CLASS_NAME_(DeleteTest, DeleteFolderSharedAcrossTwoScanFolders_CorrectFileAndFolderAreDeletedFromCache);
|
||||
friend class GTEST_TEST_CLASS_NAME_(MetadataFileTest, MetadataFile_SourceFileExtensionDifferentCase);
|
||||
|
||||
friend class AssetProcessorManagerTest;
|
||||
friend struct ModtimeScanningTest;
|
||||
@@ -5241,3 +5242,59 @@ void DuplicateProcessTest::SetUp()
|
||||
m_sharedConnection = m_assetProcessorManager->m_stateData.get();
|
||||
ASSERT_TRUE(m_sharedConnection);
|
||||
}
|
||||
|
||||
void MetadataFileTest::SetUp()
|
||||
{
|
||||
AssetProcessorManagerTest::SetUp();
|
||||
m_config->AddMetaDataType("foo", "txt");
|
||||
}
|
||||
|
||||
TEST_F(MetadataFileTest, MetadataFile_SourceFileExtensionDifferentCase)
|
||||
{
|
||||
|
||||
using namespace AzToolsFramework::AssetSystem;
|
||||
using namespace AssetProcessor;
|
||||
|
||||
QDir tempPath(m_tempDir.path());
|
||||
|
||||
QString relFileName("Dummy.TXT");
|
||||
QString absPath(tempPath.absoluteFilePath("subfolder1/Dummy.TXT"));
|
||||
QString watchFolder = tempPath.absoluteFilePath("subfolder1");
|
||||
UnitTestUtils::CreateDummyFile(absPath, "dummy");
|
||||
|
||||
JobEntry entry;
|
||||
entry.m_watchFolderPath = watchFolder;
|
||||
entry.m_databaseSourceName = entry.m_pathRelativeToWatchFolder = relFileName;
|
||||
entry.m_jobKey = "txt";
|
||||
entry.m_platformInfo = { "pc", {"host", "renderer", "desktop"} };
|
||||
entry.m_jobRunKey = 1;
|
||||
|
||||
QString productPath(m_normalizedCacheRootDir.absoluteFilePath("outputfile.TXT"));
|
||||
UnitTestUtils::CreateDummyFile(productPath);
|
||||
|
||||
AssetBuilderSDK::ProcessJobResponse jobResponse;
|
||||
jobResponse.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
jobResponse.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(productPath.toUtf8().data()));
|
||||
|
||||
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, entry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, jobResponse));
|
||||
|
||||
ASSERT_TRUE(BlockUntilIdle(5000));
|
||||
|
||||
// Creating a metadata file for the source assets
|
||||
// APM should process the source asset if a metadafile is detected
|
||||
// We are intentionally having a source file with a different file extension casing than the one specified in the metadata rule.
|
||||
QString metadataFile(tempPath.absoluteFilePath("subfolder1/Dummy.foo"));
|
||||
UnitTestUtils::CreateDummyFile(metadataFile, "dummy");
|
||||
|
||||
// Capture the job details as the APM inspects the file.
|
||||
JobDetails jobDetails;
|
||||
auto connection = QObject::connect(m_assetProcessorManager.get(), &AssetProcessorManager::AssetToProcess, [&jobDetails](JobDetails job)
|
||||
{
|
||||
jobDetails = job;
|
||||
});
|
||||
|
||||
m_assetProcessorManager->AssessAddedFile(tempPath.absoluteFilePath(metadataFile));
|
||||
|
||||
ASSERT_TRUE(BlockUntilIdle(5000));
|
||||
ASSERT_EQ(jobDetails.m_jobEntry.m_pathRelativeToWatchFolder, relFileName);
|
||||
}
|
||||
|
||||
@@ -179,6 +179,13 @@ struct ModtimeScanningTest
|
||||
AZStd::unique_ptr<StaticData> m_data;
|
||||
};
|
||||
|
||||
|
||||
struct MetadataFileTest
|
||||
: public AssetProcessorManagerTest
|
||||
{
|
||||
void SetUp() override;
|
||||
};
|
||||
|
||||
struct FingerprintTest
|
||||
: public AssetProcessorManagerTest
|
||||
{
|
||||
|
||||
+22
@@ -21,6 +21,7 @@ class UnitTestPlatformConfiguration : public AssetProcessor::PlatformConfigurati
|
||||
{
|
||||
friend class GTEST_TEST_CLASS_NAME_(PlatformConfigurationUnitTests, Test_GemHandling);
|
||||
friend class GTEST_TEST_CLASS_NAME_(PlatformConfigurationUnitTests, Test_MetaFileTypes);
|
||||
friend class GTEST_TEST_CLASS_NAME_(PlatformConfigurationUnitTests, Test_MetaFileTypes_AssetImporterExtensions);
|
||||
protected:
|
||||
};
|
||||
|
||||
@@ -665,3 +666,24 @@ TEST_F(PlatformConfigurationUnitTests, PlatformConfigFile_IsPresent_Found)
|
||||
ASSERT_TRUE(config.AddPlatformConfigFilePaths(platformConfigList));
|
||||
ASSERT_EQ(platformConfigList.size(), 1);
|
||||
}
|
||||
|
||||
TEST_F(PlatformConfigurationUnitTests, Test_MetaFileTypes_AssetImporterExtensions)
|
||||
{
|
||||
using namespace AssetProcessor;
|
||||
|
||||
const auto testExeFolder = AZ::IO::FileIOBase::GetInstance()->ResolvePath(TestAppRoot);
|
||||
auto configRoot = AZ::IO::FileIOBase::GetInstance()->ResolvePath("@exefolder@/testdata/config_metadata");
|
||||
ASSERT_TRUE(configRoot);
|
||||
UnitTestPlatformConfiguration config;
|
||||
m_absorber.Clear();
|
||||
ASSERT_FALSE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), EmptyDummyProjectName, false, false));
|
||||
ASSERT_GT(m_absorber.m_numErrorsAbsorbed, 0);
|
||||
ASSERT_TRUE(config.MetaDataFileTypesCount() == 2);
|
||||
|
||||
QStringList entriesToTest{ "aaa", "bbb" };
|
||||
for (int idx = 0; idx < entriesToTest.size(); idx++)
|
||||
{
|
||||
ASSERT_EQ(config.GetMetaDataFileTypeAt(idx).first, QString("%1.assetinfo").arg(entriesToTest[idx]));
|
||||
ASSERT_EQ(config.GetMetaDataFileTypeAt(idx).second, QString("%1").arg(entriesToTest[idx]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzFramework/Gem/GemInfo.h>
|
||||
#include <AzToolsFramework/Asset/AssetUtils.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -23,6 +24,21 @@ namespace
|
||||
|
||||
namespace AssetProcessor
|
||||
{
|
||||
|
||||
void AssetImporterPathsVisitor::Visit([[maybe_unused]] AZStd::string_view path, AZStd::string_view, AZ::SettingsRegistryInterface::Type,
|
||||
AZStd::string_view value)
|
||||
{
|
||||
auto found = value.find('.');
|
||||
if (found != AZStd::string::npos)
|
||||
{
|
||||
m_supportedFileExtensions.emplace_back(value.substr(found + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_supportedFileExtensions.emplace_back(value);
|
||||
}
|
||||
}
|
||||
|
||||
struct PlatformsInfoVisitor
|
||||
: AZ::SettingsRegistryInterface::Visitor
|
||||
{
|
||||
@@ -1126,6 +1142,17 @@ namespace AssetProcessor
|
||||
|
||||
MetaDataTypesVisitor visitor;
|
||||
settingsRegistry->Visit(visitor, AZ::SettingsRegistryInterface::FixedValueString(AssetProcessorSettingsKey) + "/MetaDataTypes");
|
||||
|
||||
using namespace AzToolsFramework::AssetUtils;
|
||||
AZStd::vector<AZStd::string> supportedFileExtensions;
|
||||
AssetImporterPathsVisitor assetImporterVisitor{ settingsRegistry, supportedFileExtensions };
|
||||
settingsRegistry->Visit(assetImporterVisitor, AZ::SettingsRegistryInterface::FixedValueString(AssetImporterSettingsKey) + "/" + AssetImporterSupportedFileTypeKey);
|
||||
|
||||
for (auto& entry : assetImporterVisitor.m_supportedFileExtensions)
|
||||
{
|
||||
visitor.m_metaDataTypes.push_back({ AZStd::string::format("%s.assetinfo", entry.c_str()), entry });
|
||||
}
|
||||
|
||||
for (const auto& metaDataType : visitor.m_metaDataTypes)
|
||||
{
|
||||
QString fileType = AssetUtilities::NormalizeFilePath(QString::fromUtf8(metaDataType.m_fileType.c_str(),
|
||||
|
||||
@@ -40,6 +40,21 @@ namespace AssetProcessor
|
||||
extern const char AssetConfigPlatformDir[];
|
||||
extern const char AssetProcessorPlatformConfigFileName[];
|
||||
|
||||
struct AssetImporterPathsVisitor
|
||||
: AZ::SettingsRegistryInterface::Visitor
|
||||
{
|
||||
AssetImporterPathsVisitor(AZ::SettingsRegistryInterface* settingsRegistry, AZStd::vector<AZStd::string>& supportedExtension)
|
||||
: m_settingsRegistry(settingsRegistry)
|
||||
, m_supportedFileExtensions(supportedExtension)
|
||||
{
|
||||
}
|
||||
|
||||
void Visit(AZStd::string_view path, AZStd::string_view, AZ::SettingsRegistryInterface::Type, AZStd::string_view value) override;
|
||||
|
||||
AZ::SettingsRegistryInterface* m_settingsRegistry;
|
||||
AZStd::vector<AZStd::string> m_supportedFileExtensions;
|
||||
};
|
||||
|
||||
//! Information for a given recognizer, on a specific platform
|
||||
//! essentially a plain data holder, but with helper funcs
|
||||
class AssetPlatformSpec
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"O3DE":
|
||||
{
|
||||
"SceneAPI":
|
||||
{
|
||||
"AssetImporter":
|
||||
{
|
||||
"SupportedFileTypeExtensions":
|
||||
[
|
||||
".aaa",
|
||||
".bbb"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <AzCore/Serialization/Json/JsonSerialization.h>
|
||||
#include <AzCore/Settings/SettingsRegistry.h>
|
||||
#include <AzCore/StringFunc/StringFunc.h>
|
||||
#include <AzToolsFramework/Asset/AssetUtils.h>
|
||||
#include <SceneAPI/SceneBuilder/SceneImportRequestHandler.h>
|
||||
#include <SceneAPI/SceneCore/Containers/Scene.h>
|
||||
#include <SceneAPI/SceneCore/Events/CallProcessorBus.h>
|
||||
@@ -23,19 +24,21 @@ namespace AZ
|
||||
{
|
||||
void SceneImporterSettings::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
using namespace AzToolsFramework::AssetUtils;
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context); serializeContext)
|
||||
{
|
||||
serializeContext->Class<SceneImporterSettings>()
|
||||
->Version(2)
|
||||
->Field("SupportedFileTypeExtensions", &SceneImporterSettings::m_supportedFileTypeExtensions);
|
||||
->Field(AssetImporterSupportedFileTypeKey, &SceneImporterSettings::m_supportedFileTypeExtensions);
|
||||
}
|
||||
}
|
||||
|
||||
void SceneImportRequestHandler::Activate()
|
||||
{
|
||||
using namespace AzToolsFramework::AssetUtils;
|
||||
if (auto* settingsRegistry = AZ::SettingsRegistry::Get())
|
||||
{
|
||||
settingsRegistry->GetObject(m_settings, "/O3DE/SceneAPI/AssetImporter");
|
||||
settingsRegistry->GetObject(m_settings, AssetImporterSettingsKey);
|
||||
}
|
||||
|
||||
BusConnect();
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <AzCore/Math/Transform.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/Math/Quaternion.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <SceneAPI/SceneCore/SceneCoreConfiguration.h>
|
||||
|
||||
namespace AZ::SceneAPI
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "DebugOutput.h"
|
||||
#include <AzCore/std/optional.h>
|
||||
|
||||
namespace AZ::SceneAPI::Utilities
|
||||
{
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <SceneAPI/SceneCore/SceneCoreConfiguration.h>
|
||||
#include <SceneAPI/SceneCore/DataTypes/MatrixType.h>
|
||||
#include <SceneAPI/SceneCore/Utilities/HashHelper.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <cinttypes>
|
||||
|
||||
namespace AZ::SceneAPI::Utilities
|
||||
|
||||
@@ -305,6 +305,11 @@ namespace AZ::SceneAPI::Behaviors
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
|
||||
// This behavior persists on the same AssetBuilder. Clear the script file name so that if
|
||||
// this builder processes a scene file with a script file name, and then later processes
|
||||
// a scene without a script file name, it won't run the old script on the new scene.
|
||||
m_scriptFilename.clear();
|
||||
|
||||
if (action != ManifestAction::Update)
|
||||
{
|
||||
return Events::ProcessingResult::Ignored;
|
||||
|
||||
Reference in New Issue
Block a user