@@ -1020,14 +1020,17 @@ private GlobalVertex ExtractVertex(MFnMesh mFnMesh, int polygonId, int vertexInd
10201020 OrderByDescending ( ref weightByInfluenceIndex ) ;
10211021
10221022 int bonesCount = indexByNodeName . Count ; // number total of bones/influences for the mesh
1023+
10231024 float weight0 = 0 ;
10241025 float weight1 = 0 ;
10251026 float weight2 = 0 ;
10261027 float weight3 = 0 ;
1028+
10271029 ushort bone0 = 0 ;
10281030 ushort bone1 = 0 ;
10291031 ushort bone2 = 0 ;
10301032 ushort bone3 = 0 ;
1033+
10311034 int nbBones = weightByInfluenceIndex . Count ; // number of bones/influences for this vertex
10321035
10331036 if ( nbBones == 0 )
@@ -1067,36 +1070,43 @@ private GlobalVertex ExtractVertex(MFnMesh mFnMesh, int polygonId, int vertexInd
10671070
10681071 if ( nbBones > 4 )
10691072 {
1070- bone0 = ( ushort ) weightByInfluenceIndex . ElementAt ( 4 ) . Key ;
1071- weight0 = ( float ) weightByInfluenceIndex . ElementAt ( 4 ) . Value ;
1072- weight1 = 0 ;
1073- weight2 = 0 ;
1074- weight3 = 0 ;
1073+ ushort bone4 = ( ushort ) weightByInfluenceIndex . ElementAt ( 4 ) . Key ;
1074+ float weight4 = ( float ) weightByInfluenceIndex . ElementAt ( 4 ) . Value ;
1075+
1076+ ushort bone5 = 0 ;
1077+ float weight5 = 0 ;
1078+
1079+ ushort bone6 = 0 ;
1080+ float weight6 = 0 ;
1081+
1082+ ushort bone7 = 0 ;
1083+ float weight7 = 0 ;
10751084
10761085 if ( nbBones > 5 )
10771086 {
1078- bone1 = ( ushort ) weightByInfluenceIndex . ElementAt ( 5 ) . Key ;
1079- weight1 = ( float ) weightByInfluenceIndex . ElementAt ( 4 ) . Value ;
1087+ bone5 = ( ushort ) weightByInfluenceIndex . ElementAt ( 5 ) . Key ;
1088+ weight5 = ( float ) weightByInfluenceIndex . ElementAt ( 5 ) . Value ;
10801089
10811090 if ( nbBones > 6 )
10821091 {
1083- bone2 = ( ushort ) weightByInfluenceIndex . ElementAt ( 6 ) . Key ;
1084- weight2 = ( float ) weightByInfluenceIndex . ElementAt ( 4 ) . Value ;
1092+ bone6 = ( ushort ) weightByInfluenceIndex . ElementAt ( 6 ) . Key ;
1093+ weight6 = ( float ) weightByInfluenceIndex . ElementAt ( 6 ) . Value ;
10851094
10861095 if ( nbBones > 7 )
10871096 {
1088- bone3 = ( ushort ) weightByInfluenceIndex . ElementAt ( 7 ) . Key ;
1089- weight3 = ( float ) weightByInfluenceIndex . ElementAt ( 7 ) . Value ;
1097+ bone7 = ( ushort ) weightByInfluenceIndex . ElementAt ( 7 ) . Key ;
1098+ weight7 = ( float ) weightByInfluenceIndex . ElementAt ( 7 ) . Value ;
10901099 }
10911100 }
10921101 }
10931102
1094- float [ ] weightsExtra = { weight0 , weight1 , weight2 , weight3 } ;
1103+ float [ ] weightsExtra = { weight4 , weight5 , weight6 , weight7 } ;
10951104 vertex . WeightsExtra = weightsExtra ;
1096- ushort [ ] boneIndexesExtra = { bone0 , bone1 , bone2 , bone3 } ;
1105+ ushort [ ] boneIndexesExtra = { bone4 , bone5 , bone6 , bone7 } ;
10971106 vertex . BonesIndicesExtra = boneIndexesExtra ;
10981107 }
10991108 }
1109+
11001110 return vertex ;
11011111 }
11021112
0 commit comments