File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Assets/FbxExporters/Editor Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1025,8 +1025,17 @@ private bool ExportSkin (SkinnedMeshRenderer skinnedMesh,
1025
1025
/// </summary>
1026
1026
private void SetVertexWeights ( MeshInfo meshInfo , Dictionary < int , FbxCluster > boneCluster )
1027
1027
{
1028
+ HashSet < int > visitedVertices = new HashSet < int > ( ) ;
1029
+
1028
1030
// set the vertex weights for each bone
1029
1031
for ( int i = 0 ; i < meshInfo . BoneWeights . Length ; i ++ ) {
1032
+ var actualIndex = ControlPointToIndex [ meshInfo . Vertices [ i ] ] ;
1033
+
1034
+ if ( visitedVertices . Contains ( actualIndex ) ) {
1035
+ continue ;
1036
+ }
1037
+ visitedVertices . Add ( actualIndex ) ;
1038
+
1030
1039
var boneWeights = meshInfo . BoneWeights ;
1031
1040
int [ ] indices = {
1032
1041
boneWeights [ i ] . boneIndex0 ,
@@ -1048,7 +1057,8 @@ boneWeights [i].weight3
1048
1057
if ( ! boneCluster . ContainsKey ( indices [ j ] ) ) {
1049
1058
continue ;
1050
1059
}
1051
- boneCluster [ indices [ j ] ] . AddControlPointIndex ( ControlPointToIndex [ meshInfo . Vertices [ i ] ] , weights [ j ] ) ;
1060
+ // add vertex and weighting on vertex to this bone's cluster
1061
+ boneCluster [ indices [ j ] ] . AddControlPointIndex ( actualIndex , weights [ j ] ) ;
1052
1062
}
1053
1063
}
1054
1064
}
You can’t perform that action at this time.
0 commit comments