Merge remote-tracking branch 'upstream/development' into Atom/santorac/OptionalSceneApiMaterialConversion3
This commit is contained in:
+1
-1
@@ -250,7 +250,7 @@ namespace AZ::MeshBuilder
|
||||
AZ::JobContext* jobContext = nullptr;
|
||||
AZ::Job* job = AZ::CreateJobFunction([&subMesh]()
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Animation, "MeshBuilder::GenerateSubMeshVertexOrders::SubMeshJob");
|
||||
AZ_PROFILE_SCOPE(Animation, "MeshBuilder::GenerateSubMeshVertexOrders::SubMeshJob");
|
||||
subMesh->GenerateVertexOrder();
|
||||
}, true, jobContext);
|
||||
|
||||
|
||||
+5
-3
@@ -379,10 +379,12 @@ namespace AZ::SceneGenerationComponents
|
||||
|
||||
auto [optimizedMesh, optimizedUVs, optimizedTangents, optimizedBitangents, optimizedVertexColors, optimizedSkinWeights] = OptimizeMesh(mesh, mesh, uvDatas, tangentDatas, bitangentDatas, colorDatas, skinWeightDatas, meshGroup, hasBlendShapes);
|
||||
|
||||
AZ_TracePrintf(AZ::SceneAPI::Utilities::LogWindow, "Base mesh: %zu vertices, optimized mesh: %zu vertices, %0.02f%% of the original",
|
||||
AZ_TracePrintf(AZ::SceneAPI::Utilities::LogWindow, "Optimized mesh '%s': Original: %zu vertices -> optimized: %zu vertices, %0.02f%% of the original (hasBlendShapes=%s)",
|
||||
graph.GetNodeName(nodeIndex).GetName(),
|
||||
mesh->GetUsedControlPointCount(),
|
||||
optimizedMesh->GetUsedControlPointCount(),
|
||||
((float)optimizedMesh->GetUsedControlPointCount() / (float)mesh->GetUsedControlPointCount()) * 100.0f
|
||||
((float)optimizedMesh->GetUsedControlPointCount() / (float)mesh->GetUsedControlPointCount()) * 100.0f,
|
||||
hasBlendShapes ? "Yes" : "No"
|
||||
);
|
||||
|
||||
const NodeIndex optimizedMeshNodeIndex = graph.AddChild(graph.GetNodeParent(nodeIndex), name.c_str(), AZStd::move(optimizedMesh));
|
||||
@@ -651,7 +653,7 @@ namespace AZ::SceneGenerationComponents
|
||||
const auto& faceInfo = optimizedMesh->GetFaceInfo(optimizedMesh->GetFaceCount() - 1);
|
||||
AZStd::copy(AZStd::begin(faceInfo.vertexIndex), AZStd::end(faceInfo.vertexIndex), AZStd::inserter(usedIndexes, usedIndexes.begin()));
|
||||
}
|
||||
indexOffset += usedIndexes.size();
|
||||
indexOffset += static_cast<unsigned int>(usedIndexes.size());
|
||||
}
|
||||
|
||||
AZStd::unique_ptr<SkinWeightData> optimizedSkinWeights;
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ namespace AZ::TangentGeneration::BlendShape::MikkT
|
||||
{
|
||||
MikktCustomData* customData = static_cast<MikktCustomData*>(context->m_pUserData);
|
||||
const AZ::u32 vertexIndex = customData->m_blendShapeData->GetFaceVertexIndex(face, vert);
|
||||
const AZ::Vector2& uv = customData->m_blendShapeData->GetUV(vertexIndex, customData->m_uvSetIndex);
|
||||
const AZ::Vector2& uv = customData->m_blendShapeData->GetUV(vertexIndex, static_cast<unsigned int>(customData->m_uvSetIndex));
|
||||
texOut[0] = uv.GetX();
|
||||
texOut[1] = uv.GetY();
|
||||
}
|
||||
@@ -105,7 +105,7 @@ namespace AZ::TangentGeneration::BlendShape::MikkT
|
||||
AZ::SceneAPI::DataTypes::MikkTSpaceMethod tSpaceMethod)
|
||||
{
|
||||
// Create tangent and bitangent data sets and relate them to the given UV set.
|
||||
const AZStd::vector<AZ::Vector2>& uvSet = blendShapeData->GetUVs(uvSetIndex);
|
||||
const AZStd::vector<AZ::Vector2>& uvSet = blendShapeData->GetUVs(static_cast<AZ::u8>(uvSetIndex));
|
||||
if (uvSet.empty())
|
||||
{
|
||||
AZ_Error(AZ::SceneAPI::Utilities::ErrorWindow, false,
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/Serialization/Utils.h>
|
||||
#include <SceneAPI/SceneCore/Containers/Views/PairIterator.h>
|
||||
#include <SceneAPI/SceneCore/DataTypes/IGraphObject.h>
|
||||
#include <SceneAPI/SceneCore/Containers/Views/SceneGraphDownwardsIterator.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/std/containers/set.h>
|
||||
#include <AzFramework/Application/Application.h>
|
||||
@@ -308,7 +306,10 @@ namespace SceneBuilder
|
||||
|
||||
if (itr != request.m_jobDescription.m_jobParameters.end() && itr->second == "true")
|
||||
{
|
||||
BuildDebugSceneGraph(outputFolder.c_str(), productList, scene);
|
||||
AZStd::string productName;
|
||||
AzFramework::StringFunc::Path::GetFullFileName(scene->GetSourceFilename().c_str(), productName);
|
||||
AzFramework::StringFunc::Path::ReplaceExtension(productName, "dbgsg");
|
||||
AZ::SceneAPI::Utilities::DebugOutput::BuildDebugSceneGraph(outputFolder.c_str(), productList, scene, productName);
|
||||
}
|
||||
|
||||
AZ_TracePrintf(Utilities::LogWindow, "Collecting and registering products.\n");
|
||||
@@ -373,66 +374,4 @@ namespace SceneBuilder
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
void WriteAndLog(AZ::IO::SystemFile& dbgFile, const char* strToWrite)
|
||||
{
|
||||
AZ_TracePrintf(AZ::SceneAPI::Utilities::LogWindow, "%s", strToWrite);
|
||||
dbgFile.Write(strToWrite, strlen(strToWrite));
|
||||
dbgFile.Write("\n", strlen("\n"));
|
||||
|
||||
}
|
||||
|
||||
void SceneBuilderWorker::BuildDebugSceneGraph(const char* outputFolder, AZ::SceneAPI::Events::ExportProductList& productList, const AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene>& scene) const
|
||||
{
|
||||
const int debugSceneGraphVersion = 1;
|
||||
AZStd::string productName, debugSceneFile;
|
||||
|
||||
AzFramework::StringFunc::Path::GetFullFileName(scene->GetSourceFilename().c_str(), productName);
|
||||
AzFramework::StringFunc::Path::ReplaceExtension(productName, "dbgsg");
|
||||
AzFramework::StringFunc::Path::ConstructFull(outputFolder, productName.c_str(), debugSceneFile);
|
||||
AZ_TracePrintf(AZ::SceneAPI::Utilities::LogWindow, "outputFolder %s, name %s.\n", outputFolder, productName.c_str());
|
||||
|
||||
AZ::IO::SystemFile dbgFile;
|
||||
if (dbgFile.Open(debugSceneFile.c_str(), AZ::IO::SystemFile::SF_OPEN_CREATE | AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY))
|
||||
{
|
||||
WriteAndLog(dbgFile, AZStd::string::format("ProductName: %s", productName.c_str()).c_str());
|
||||
WriteAndLog(dbgFile, AZStd::string::format("debugSceneGraphVersion: %d", debugSceneGraphVersion).c_str());
|
||||
WriteAndLog(dbgFile, scene->GetName().c_str());
|
||||
|
||||
const AZ::SceneAPI::Containers::SceneGraph& sceneGraph = scene->GetGraph();
|
||||
auto names = sceneGraph.GetNameStorage();
|
||||
auto content = sceneGraph.GetContentStorage();
|
||||
auto pairView = AZ::SceneAPI::Containers::Views::MakePairView(names, content);
|
||||
auto view = AZ::SceneAPI::Containers::Views::MakeSceneGraphDownwardsView<
|
||||
AZ::SceneAPI::Containers::Views::BreadthFirst>(
|
||||
sceneGraph, sceneGraph.GetRoot(), pairView.cbegin(), true);
|
||||
|
||||
for (auto&& viewIt : view)
|
||||
{
|
||||
if (viewIt.second == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
AZ::SceneAPI::DataTypes::IGraphObject* graphObject = const_cast<AZ::SceneAPI::DataTypes::IGraphObject*>(viewIt.second.get());
|
||||
|
||||
WriteAndLog(dbgFile, AZStd::string::format("Node Name: %s", viewIt.first.GetName()).c_str());
|
||||
WriteAndLog(dbgFile, AZStd::string::format("Node Path: %s", viewIt.first.GetPath()).c_str());
|
||||
WriteAndLog(dbgFile, AZStd::string::format("Node Type: %s", graphObject->RTTI_GetTypeName()).c_str());
|
||||
|
||||
AZ::SceneAPI::Utilities::DebugOutput debugOutput;
|
||||
viewIt.second->GetDebugOutput(debugOutput);
|
||||
|
||||
if (!debugOutput.GetOutput().empty())
|
||||
{
|
||||
WriteAndLog(dbgFile, debugOutput.GetOutput().c_str());
|
||||
}
|
||||
}
|
||||
dbgFile.Close();
|
||||
|
||||
static const AZ::Data::AssetType dbgSceneGraphAssetType("{07F289D1-4DC7-4C40-94B4-0A53BBCB9F0B}");
|
||||
productList.AddProduct(productName, AZ::Uuid::CreateName(productName.c_str()), dbgSceneGraphAssetType,
|
||||
AZStd::nullopt, AZStd::nullopt);
|
||||
}
|
||||
}
|
||||
} // namespace SceneBuilder
|
||||
|
||||
@@ -55,9 +55,6 @@ namespace SceneBuilder
|
||||
void PopulateProductDependencies(const AZ::SceneAPI::Events::ExportProduct& exportProduct, const char* watchFolder, AssetBuilderSDK::JobProduct& jobProduct) const;
|
||||
|
||||
protected:
|
||||
|
||||
void BuildDebugSceneGraph(const char* outputFolder, AZ::SceneAPI::Events::ExportProductList& productList, const AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene>& scene) const;
|
||||
|
||||
bool LoadScene(AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene>& result,
|
||||
const AssetBuilderSDK::ProcessJobRequest& request, AssetBuilderSDK::ProcessJobResponse& response);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <AzToolsFramework/Debug/TraceContext.h>
|
||||
#include <SceneAPI/SceneCore/Events/AssetImportRequest.h>
|
||||
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
|
||||
#include <SceneAPI/SceneCore/Components/LoadingComponent.h>
|
||||
|
||||
namespace SceneBuilder
|
||||
{
|
||||
@@ -79,8 +80,9 @@ namespace SceneBuilder
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene> scene =
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath(filePath, sceneSourceGuid, AssetImportRequest::RequestingApplication::AssetProcessor);
|
||||
AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene> scene = AssetImportRequest::LoadSceneFromVerifiedPath(
|
||||
filePath, sceneSourceGuid, AssetImportRequest::RequestingApplication::AssetProcessor,
|
||||
AZ::SceneAPI::SceneCore::LoadingComponent::TYPEINFO_Uuid());
|
||||
|
||||
if (!scene)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user