feat: compatible multi rootNode in scene

This commit is contained in:
luzhuang 2023-08-17 08:05:20 +00:00
parent 826543d876
commit f40e11f957
2 changed files with 8 additions and 5 deletions

Binary file not shown.

View File

@ -1164,10 +1164,13 @@ bool LoadFBXFile(
// this is always 0.01, but let's opt for clarity. // this is always 0.01, but let's opt for clarity.
scaleFactor = FbxSystemUnit::m.GetConversionFactorFrom(FbxSystemUnit::cm); scaleFactor = FbxSystemUnit::m.GetConversionFactorFrom(FbxSystemUnit::cm);
FbxNode* rootNode = pScene->GetRootNode(); FbxNode* rootNode = pScene->GetRootNode();
if (rootNode->GetChildCount() > 1) {
ReadNodeHierarchy(raw, pScene, rootNode, 0, "");
ReadNodeAttributes(raw, pScene, rootNode, textureLocations);
} else {
ReadNodeHierarchy(raw, pScene, rootNode->GetChild(0), 0, ""); ReadNodeHierarchy(raw, pScene, rootNode->GetChild(0), 0, "");
ReadNodeAttributes(raw, pScene, rootNode->GetChild(0), textureLocations); ReadNodeAttributes(raw, pScene, rootNode->GetChild(0), textureLocations);
// ReadNodeHierarchy(raw, pScene, pScene->GetRootNode(), 0, ""); }
// ReadNodeAttributes(raw, pScene, pScene->GetRootNode(), textureLocations);
ReadAnimations(raw, pScene, options); ReadAnimations(raw, pScene, options);
pScene->Destroy(); pScene->Destroy();