Skip to content

Commit 9b3d564

Browse files
authored
Merge pull request #14885 from looeee/fbxloader_morph_name_fix
FBXLoader: return all morph targets and fix undefined name
2 parents 30e06b7 + 09e837b commit 9b3d564

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

examples/js/loaders/FBXLoader.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ THREE.FBXLoader = ( function () {
9999

100100
}
101101

102-
//console.log( FBXTree );
102+
// console.log( fbxTree );
103103

104104
var textureLoader = new THREE.TextureLoader( this.manager ).setPath( resourceDirectory ).setCrossOrigin( this.crossOrigin );
105105

@@ -743,14 +743,6 @@ THREE.FBXLoader = ( function () {
743743

744744
for ( var i = 0; i < relationships.children.length; i ++ ) {
745745

746-
if ( i === 8 ) {
747-
748-
console.warn( 'FBXLoader: maximum of 8 morph targets supported. Ignoring additional targets.' );
749-
750-
break;
751-
752-
}
753-
754746
var child = relationships.children[ i ];
755747

756748
var morphTargetNode = deformerNodes[ child.ID ];
@@ -2001,7 +1993,7 @@ THREE.FBXLoader = ( function () {
20011993
if ( morphTarget === null ) return;
20021994

20031995
parentGeo.morphAttributes.position = [];
2004-
parentGeo.morphAttributes.normal = [];
1996+
// parentGeo.morphAttributes.normal = []; // not implemented
20051997

20061998
var self = this;
20071999
morphTarget.rawTargets.forEach( function ( rawTarget ) {
@@ -2010,7 +2002,7 @@ THREE.FBXLoader = ( function () {
20102002

20112003
if ( morphGeoNode !== undefined ) {
20122004

2013-
self.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform );
2005+
self.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name );
20142006

20152007
}
20162008

@@ -2022,7 +2014,7 @@ THREE.FBXLoader = ( function () {
20222014
// in FBXTree.Objects.Geometry, however it can only have attributes for position, normal
20232015
// and a special attribute Index defining which vertices of the original geometry are affected
20242016
// Normal and position attributes only have data for the vertices that are affected by the morph
2025-
genMorphGeometry: function ( parentGeo, parentGeoNode, morphGeoNode, preTransform ) {
2017+
genMorphGeometry: function ( parentGeo, parentGeoNode, morphGeoNode, preTransform, name ) {
20262018

20272019
var morphGeo = new THREE.BufferGeometry();
20282020
if ( morphGeoNode.attrName ) morphGeo.name = morphGeoNode.attrName;
@@ -2056,7 +2048,7 @@ THREE.FBXLoader = ( function () {
20562048
var morphBuffers = this.genBuffers( morphGeoInfo );
20572049

20582050
var positionAttribute = new THREE.Float32BufferAttribute( morphBuffers.vertex, 3 );
2059-
positionAttribute.name = morphGeoNode.attrName;
2051+
positionAttribute.name = name || morphGeoNode.attrName;
20602052

20612053
preTransform.applyToBufferAttribute( positionAttribute );
20622054

@@ -2890,7 +2882,7 @@ THREE.FBXLoader = ( function () {
28902882
parse: function ( text ) {
28912883

28922884
this.currentIndent = 0;
2893-
console.log("FBXTree: ", FBXTree);
2885+
28942886
this.allNodes = new FBXTree();
28952887
this.nodeStack = [];
28962888
this.currentProp = [];

0 commit comments

Comments
 (0)