@@ -688,10 +688,19 @@ static void ReadNodeHierarchy(
688
688
FbxScene* pScene,
689
689
FbxNode* pNode,
690
690
const long parentId,
691
- const std::string& path) {
691
+ const std::string& path,
692
+ int extraSkinIx) {
692
693
const FbxUInt64 nodeId = pNode->GetUniqueID ();
693
694
const char * nodeName = pNode->GetName ();
694
- const int nodeIndex = raw.AddNode (nodeId, nodeName, parentId);
695
+ FbxSkeleton *skel = pNode->GetSkeleton ();
696
+ if (skel == nullptr ) {
697
+ extraSkinIx = -1 ;
698
+ } else {
699
+ if (skel->IsSkeletonRoot ()) {
700
+ extraSkinIx = raw.CreateExtraSkinIndex ();
701
+ }
702
+ }
703
+ const int nodeIndex = raw.AddNode (nodeId, nodeName, parentId, extraSkinIx);
695
704
RawNode& node = raw.GetNode (nodeIndex);
696
705
697
706
FbxTransform::EInheritType lInheritType;
@@ -745,7 +754,7 @@ static void ReadNodeHierarchy(
745
754
raw.SetRootNode (nodeId);
746
755
}
747
756
for (int child = 0 ; child < pNode->GetChildCount (); child++) {
748
- ReadNodeHierarchy (raw, pScene, pNode->GetChild (child), nodeId, newPath);
757
+ ReadNodeHierarchy (raw, pScene, pNode->GetChild (child), nodeId, newPath, extraSkinIx );
749
758
}
750
759
}
751
760
@@ -1174,7 +1183,7 @@ bool LoadFBXFile(
1174
1183
// this is always 0.01, but let's opt for clarity.
1175
1184
scaleFactor = FbxSystemUnit::m.GetConversionFactorFrom (FbxSystemUnit::cm);
1176
1185
1177
- ReadNodeHierarchy (raw, pScene, pScene->GetRootNode (), 0 , " " );
1186
+ ReadNodeHierarchy (raw, pScene, pScene->GetRootNode (), 0 , " " , - 1 );
1178
1187
ReadNodeAttributes (raw, pScene, pScene->GetRootNode (), textureLocations);
1179
1188
ReadAnimations (raw, pScene, options);
1180
1189
0 commit comments