Fix cloth with MeshOptimization ON

- Reexport cloth assets with AssImp ON. These was necessary because AssImp collects a different name for the color streams than FbxSDK and therefore they needed to be reassigned in the cloth rule.
- Adding '_optimized' string to a global variable and using StringFunc RChop to remove it for a string.
This commit is contained in:
Aaron Ruiz Mora
2021-04-23 21:42:17 +01:00
committed by GitHub
parent 2d02839c9d
commit 45fbc86d2d
11 changed files with 281 additions and 378 deletions
@@ -205,7 +205,7 @@ namespace AZ
const auto isNonOptimizedMesh = [](const SceneAPI::Containers::SceneGraph& graph, SceneAPI::Containers::SceneGraph::NodeIndex& index)
{
return SceneAPI::Utilities::SceneGraphSelector::IsMesh(graph, index) &&
!AZStd::string_view{graph.GetNodeName(index).GetName(), graph.GetNodeName(index).GetNameLength()}.ends_with("_optimized");
!AZStd::string_view{graph.GetNodeName(index).GetName(), graph.GetNodeName(index).GetNameLength()}.ends_with(SceneAPI::Utilities::OptimizedMeshSuffix);
};
if (lodRule)
@@ -310,7 +310,16 @@ namespace AZ
// Gather mesh content
SourceMeshContent sourceMesh;
sourceMesh.m_name = meshName;
// Although the nodes used to gather mesh content are the optimized ones (when found), to make
// this process transparent for the end-asset generated, the name assigned to the source mesh
// content will not include the "_optimized" prefix.
AZStd::string_view sourceMeshName = meshName;
if (sourceMeshName.ends_with(SceneAPI::Utilities::OptimizedMeshSuffix))
{
sourceMeshName.remove_suffix(SceneAPI::Utilities::OptimizedMeshSuffix.size());
}
sourceMesh.m_name = sourceMeshName;
const auto node = sceneGraph.Find(meshPath);
sourceMesh.m_worldTransform = AZ::SceneAPI::Utilities::DetermineWorldTransform(scene, node, context.m_group.GetRuleContainerConst());