Changes to SDK wrappers and functions to allow more flexible scene file processing (#3112)
These changes allow for usage of different asset import SDKs to process scene files.
Move AssImp specific code out of node, scene & material wrapper parent classes and into child wrapper classes (AssImpNodeWrapper, etc.), allowing child classes to expose import SDK code. Allows for more convenient implementation of other import SDK's elsewhere (such as in a gem).
Add a loadingComponentUuid parameter to LoadSceneFromVerifiedPath to allow for usage of different loading components. Changed tests and all calls to this function accordingly.
* Move AssImp specific code out of wrapper parent classes and into child classes for gem usage
Signed-off-by: Victor Huang <huavicto@amazon.com>
* Add loadingComponentUuid parameter to LoadSceneFromVerifiedPath function
Signed-off-by: Victor Huang <huavicto@amazon.com>
* Make wrapper members protected, change pointer cast
Signed-off-by: Victor Huang <huavicto@amazon.com>
* Adding spaces to fix style
Signed-off-by: Victor Huang <huavicto@amazon.com>
* Fix for pointer cast causing test failures
Signed-off-by: Victor Huang <huavicto@amazon.com>
This commit is contained in:
@@ -104,7 +104,7 @@ namespace AZ
|
||||
}
|
||||
|
||||
AZStd::shared_ptr<Containers::Scene> AssetImportRequest::LoadSceneFromVerifiedPath(const AZStd::string& assetFilePath, const Uuid& sourceGuid,
|
||||
RequestingApplication requester)
|
||||
RequestingApplication requester, const Uuid& loadingComponentUuid)
|
||||
{
|
||||
AZStd::string sceneName;
|
||||
AzFramework::StringFunc::Path::GetFileName(assetFilePath.c_str(), sceneName);
|
||||
@@ -113,7 +113,7 @@ namespace AZ
|
||||
|
||||
// Unique pointer, will deactivate and clean up once going out of scope.
|
||||
SceneCore::EntityConstructor::EntityPointer loaders =
|
||||
SceneCore::EntityConstructor::BuildEntity("Scene Loading", SceneCore::LoadingComponent::TYPEINFO_Uuid());
|
||||
SceneCore::EntityConstructor::BuildEntity("Scene Loading", loadingComponentUuid);
|
||||
|
||||
ProcessingResultCombiner areAllPrepared;
|
||||
AssetImportRequestBus::BroadcastResult(areAllPrepared, &AssetImportRequestBus::Events::PrepareForAssetLoading, *scene, requester);
|
||||
|
||||
@@ -102,8 +102,9 @@ namespace AZ
|
||||
//! @param sourceGuid The guid assigned to the source file (not the manifest).
|
||||
//! @param requester The application making the request to load the file. This can be used to optimize the type and amount of data
|
||||
//! to load.
|
||||
//! @param loadingComponentUuid The UUID assigned to the loading component.
|
||||
static AZStd::shared_ptr<Containers::Scene> LoadSceneFromVerifiedPath(const AZStd::string& assetFilePath,
|
||||
const Uuid&sourceGuid, RequestingApplication requester);
|
||||
const Uuid& sourceGuid, RequestingApplication requester, const Uuid& loadingComponentUuid);
|
||||
|
||||
//! Utility function to determine if a given file path points to a scene manifest file (.assetinfo).
|
||||
//! @param filePath A relative or absolute path to the file to check.
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <AzCore/Math/Guid.h>
|
||||
#include <SceneAPI/SceneCore/Containers/Scene.h>
|
||||
#include <SceneAPI/SceneCore/Events/AssetImportRequest.h>
|
||||
#include <SceneAPI/SceneCore/Components/LoadingComponent.h>
|
||||
#include <SceneAPI/SceneCore/Mocks/Events/MockAssetImportRequest.h>
|
||||
|
||||
namespace AZ
|
||||
@@ -184,7 +185,7 @@ namespace AZ
|
||||
EXPECT_CALL(handler, UpdateManifest(_, _, _)).Times(0);
|
||||
|
||||
AZStd::shared_ptr<Containers::Scene> result =
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath("test.asset", m_testId, Events::AssetImportRequest::RequestingApplication::Generic);
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath("test.asset", m_testId, Events::AssetImportRequest::RequestingApplication::Generic, SceneCore::LoadingComponent::TYPEINFO_Uuid());
|
||||
EXPECT_EQ(nullptr, result);
|
||||
}
|
||||
|
||||
@@ -207,7 +208,7 @@ namespace AZ
|
||||
EXPECT_CALL(handler, UpdateManifest(_, _, _)).Times(0);
|
||||
|
||||
AZStd::shared_ptr<Containers::Scene> result =
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath("test.asset", m_testId, Events::AssetImportRequest::RequestingApplication::Generic);
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath("test.asset", m_testId, Events::AssetImportRequest::RequestingApplication::Generic, SceneCore::LoadingComponent::TYPEINFO_Uuid());
|
||||
EXPECT_EQ(nullptr, result);
|
||||
}
|
||||
|
||||
@@ -230,7 +231,7 @@ namespace AZ
|
||||
EXPECT_CALL(handler, UpdateManifest(_, _, _)).Times(0);
|
||||
|
||||
AZStd::shared_ptr<Containers::Scene> result =
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath("test.asset", m_testId, Events::AssetImportRequest::RequestingApplication::Generic);
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath("test.asset", m_testId, Events::AssetImportRequest::RequestingApplication::Generic, SceneCore::LoadingComponent::TYPEINFO_Uuid());
|
||||
EXPECT_EQ(nullptr, result);
|
||||
}
|
||||
|
||||
@@ -253,7 +254,7 @@ namespace AZ
|
||||
EXPECT_CALL(handler, UpdateManifest(_, _, _)).Times(0);
|
||||
|
||||
AZStd::shared_ptr<Containers::Scene> result =
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath("test.asset", m_testId, Events::AssetImportRequest::RequestingApplication::Generic);
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath("test.asset", m_testId, Events::AssetImportRequest::RequestingApplication::Generic, SceneCore::LoadingComponent::TYPEINFO_Uuid());
|
||||
EXPECT_EQ(nullptr, result);
|
||||
}
|
||||
|
||||
@@ -285,7 +286,7 @@ namespace AZ
|
||||
EXPECT_CALL(manifestHandler, UpdateManifest(_, _, _)).Times(1);
|
||||
|
||||
AZStd::shared_ptr<Containers::Scene> result =
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath("test.asset", m_testId, Events::AssetImportRequest::RequestingApplication::Generic);
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath("test.asset", m_testId, Events::AssetImportRequest::RequestingApplication::Generic, SceneCore::LoadingComponent::TYPEINFO_Uuid());
|
||||
EXPECT_EQ(nullptr, result);
|
||||
}
|
||||
|
||||
@@ -313,7 +314,7 @@ namespace AZ
|
||||
EXPECT_CALL(manifestHandler, UpdateManifest(_, _, _)).Times(1);
|
||||
|
||||
AZStd::shared_ptr<Containers::Scene> result =
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath("test.asset", m_testId, Events::AssetImportRequest::RequestingApplication::Generic);
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath("test.asset", m_testId, Events::AssetImportRequest::RequestingApplication::Generic, SceneCore::LoadingComponent::TYPEINFO_Uuid());
|
||||
EXPECT_NE(nullptr, result);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user