From 7d91a4c08ef816e845303f85918f1914c603fc64 Mon Sep 17 00:00:00 2001 From: jackalbe <23512001+jackalbe@users.noreply.github.com> Date: Thu, 13 May 2021 17:50:02 -0500 Subject: [PATCH] {LYN-3787} Fix for infinite loop in the scene builder's import phase (#747) * This simple fix pops any node that can not be registered using it name and unique ID * Any scene file (i.e FBX) with the three or more nodes with the same name and parent will sort of work * After the 2nd child node with the same name and parent will be dropped on export Tests: added the new AutomatedTesting/Assets/BadAssets/three_same_named_nodes.fbx to regress test this --- AutomatedTesting/Assets/BadAssets/three_same_named_nodes.fbx | 3 +++ Code/Tools/SceneAPI/FbxSceneBuilder/FbxImporter.cpp | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 AutomatedTesting/Assets/BadAssets/three_same_named_nodes.fbx diff --git a/AutomatedTesting/Assets/BadAssets/three_same_named_nodes.fbx b/AutomatedTesting/Assets/BadAssets/three_same_named_nodes.fbx new file mode 100644 index 0000000000..8eadb16d86 --- /dev/null +++ b/AutomatedTesting/Assets/BadAssets/three_same_named_nodes.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45b58009dc2f9340e08cafd5e68f142d15d77e19e7cef142933f2dff3cfb9293 +size 38352 diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImporter.cpp index c7f7b4ad79..4242033f8b 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImporter.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImporter.cpp @@ -139,6 +139,8 @@ namespace AZ if (!nodeNameMap.RegisterNode(node.m_node, scene.GetGraph(), node.m_parent)) { AZ_TracePrintf(Utilities::ErrorWindow, "Failed to register asset importer node in name table."); + // Skip this node since it could not be registered + nodes.pop(); continue; } AZStd::string nodeName = nodeNameMap.GetNodeName(node.m_node);