@@ -590,6 +590,8 @@ public bool ExportMesh (Mesh mesh, FbxNode fbxNode, Material[] materials = null)
590
590
return ExportMesh ( meshInfo , fbxNode ) ;
591
591
}
592
592
593
+ private Dictionary < Vector3 , int > ControlPointToIndex = new Dictionary < Vector3 , int > ( ) ;
594
+
593
595
/// <summary>
594
596
/// Exports a unity mesh and attaches it to the node as an FbxMesh.
595
597
/// </summary>
@@ -607,7 +609,7 @@ bool ExportMesh (MeshInfo meshInfo, FbxNode fbxNode)
607
609
FbxMesh fbxMesh = FbxMesh . Create ( fbxScene , "Scene" ) ;
608
610
609
611
// Create control points.
610
- Dictionary < Vector3 , int > ControlPointToIndex = new Dictionary < Vector3 , int > ( ) ;
612
+ ControlPointToIndex . Clear ( ) ;
611
613
{
612
614
var vertices = meshInfo . Vertices ;
613
615
for ( int v = 0 , n = meshInfo . VertexCount ; v < n ; v ++ ) {
@@ -898,16 +900,6 @@ private bool ExportSkin (SkinnedMeshRenderer skinnedMesh,
898
900
/// </summary>
899
901
private void SetVertexWeights ( MeshInfo meshInfo , Dictionary < int , FbxCluster > boneCluster )
900
902
{
901
- // Create control points.
902
- Dictionary < Vector3 , int > ControlPointToIndex = new Dictionary < Vector3 , int > ( ) ;
903
- var vertices = meshInfo . Vertices ;
904
- for ( int v = 0 , n = meshInfo . VertexCount ; v < n ; v ++ ) {
905
- if ( ControlPointToIndex . ContainsKey ( vertices [ v ] ) ) {
906
- continue ;
907
- }
908
- ControlPointToIndex [ vertices [ v ] ] = ControlPointToIndex . Count ( ) ;
909
- }
910
-
911
903
// set the vertex weights for each bone
912
904
for ( int i = 0 ; i < meshInfo . BoneWeights . Length ; i ++ ) {
913
905
var boneWeights = meshInfo . BoneWeights ;
@@ -931,7 +923,6 @@ boneWeights [i].weight3
931
923
if ( ! boneCluster . ContainsKey ( indices [ j ] ) ) {
932
924
continue ;
933
925
}
934
- //boneCluster [indices [j]].AddControlPointIndex (i, weights [j]);
935
926
boneCluster [ indices [ j ] ] . AddControlPointIndex ( ControlPointToIndex [ meshInfo . Vertices [ i ] ] , weights [ j ] ) ;
936
927
}
937
928
}
0 commit comments