提交 14ecfab5 编写于 作者: L Lewy Blue

use array.filter

上级 63560a12
...@@ -777,13 +777,11 @@ THREE.FBXLoader = ( function () { ...@@ -777,13 +777,11 @@ THREE.FBXLoader = ( function () {
if ( morphTargetNode.attrType !== 'BlendShapeChannel' ) return; if ( morphTargetNode.attrType !== 'BlendShapeChannel' ) return;
var targetRelationships = connections.get( parseInt( child.ID ) ); rawMorphTarget.geoID = connections.get( parseInt( child.ID ) ).children.filter( function ( child ) {
targetRelationships.children.forEach( function ( child ) { return child.relationship === undefined;
if ( child.relationship === undefined ) rawMorphTarget.geoID = child.ID; } )[ 0 ].ID;
} );
rawMorphTargets.push( rawMorphTarget ); rawMorphTargets.push( rawMorphTarget );
...@@ -2488,62 +2486,62 @@ THREE.FBXLoader = ( function () { ...@@ -2488,62 +2486,62 @@ THREE.FBXLoader = ( function () {
if ( layerCurveNodes[ i ] === undefined ) { if ( layerCurveNodes[ i ] === undefined ) {
var modelID; var modelID = connections.get( child.ID ).parents.filter( function ( parent ) {
connections.get( child.ID ).parents.forEach( function ( parent ) { return parent.relationship !== undefined;
if ( parent.relationship !== undefined ) modelID = parent.ID; } )[ 0 ].ID;
} ); if ( modelID !== undefined ) {
var rawModel = fbxTree.Objects.Model[ modelID.toString() ]; var rawModel = fbxTree.Objects.Model[ modelID.toString() ];
var node = { var node = {
modelName: THREE.PropertyBinding.sanitizeNodeName( rawModel.attrName ), modelName: THREE.PropertyBinding.sanitizeNodeName( rawModel.attrName ),
ID: rawModel.id, ID: rawModel.id,
initialPosition: [ 0, 0, 0 ], initialPosition: [ 0, 0, 0 ],
initialRotation: [ 0, 0, 0 ], initialRotation: [ 0, 0, 0 ],
initialScale: [ 1, 1, 1 ], initialScale: [ 1, 1, 1 ],
}; };
sceneGraph.traverse( function ( child ) { sceneGraph.traverse( function ( child ) {
if ( child.ID = rawModel.id ) { if ( child.ID = rawModel.id ) {
node.transform = child.matrix; node.transform = child.matrix;
if ( child.userData.transformData ) node.eulerOrder = child.userData.transformData.eulerOrder; if ( child.userData.transformData ) node.eulerOrder = child.userData.transformData.eulerOrder;
} }
} ); } );
if ( ! node.transform ) node.transform = new THREE.Matrix4(); if ( ! node.transform ) node.transform = new THREE.Matrix4();
// if the animated model is pre rotated, we'll have to apply the pre rotations to every // if the animated model is pre rotated, we'll have to apply the pre rotations to every
// animation value as well // animation value as well
if ( 'PreRotation' in rawModel ) node.preRotation = rawModel.PreRotation.value; if ( 'PreRotation' in rawModel ) node.preRotation = rawModel.PreRotation.value;
if ( 'PostRotation' in rawModel ) node.postRotation = rawModel.PostRotation.value; if ( 'PostRotation' in rawModel ) node.postRotation = rawModel.PostRotation.value;
layerCurveNodes[ i ] = node; layerCurveNodes[ i ] = node;
}
} }
layerCurveNodes[ i ][ curveNode.attr ] = curveNode; if ( layerCurveNodes[ i ] ) layerCurveNodes[ i ][ curveNode.attr ] = curveNode;
} else if ( curveNode.curves.morph !== undefined ) { } else if ( curveNode.curves.morph !== undefined ) {
if ( layerCurveNodes[ i ] === undefined ) { if ( layerCurveNodes[ i ] === undefined ) {
var deformerID; var deformerID = connections.get( child.ID ).parents.filter( function ( parent ) {
connections.get( child.ID ).parents.forEach( function ( parent ) { return parent.relationship !== undefined;
if ( parent.relationship !== undefined ) deformerID = parent.ID; } )[ 0 ].ID;
} );
var morpherID = connections.get( deformerID ).parents[ 0 ].ID; var morpherID = connections.get( deformerID ).parents[ 0 ].ID;
var geoID = connections.get( morpherID ).parents[ 0 ].ID; var geoID = connections.get( morpherID ).parents[ 0 ].ID;
...@@ -4003,7 +4001,7 @@ THREE.FBXLoader = ( function () { ...@@ -4003,7 +4001,7 @@ THREE.FBXLoader = ( function () {
lParentGRSM = lParentTM.getInverse( lParentTM ).multiply( lParentGX ); lParentGRSM = lParentTM.getInverse( lParentTM ).multiply( lParentGX );
lParentGSM = lParentGRM.getInverse( lParentGRM ).multiply( lParentGRSM ); lParentGSM = lParentGRM.getInverse( lParentGRM ).multiply( lParentGRSM );
lLSM = lScalingM; lLSM = lScalingM;
var lGlobalRS; var lGlobalRS;
if ( inheritType === 0 ) { if ( inheritType === 0 ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册