提交 fd21a826 编写于 作者: M Mr.doob

Merge pull request #7404 from bhouston/fix_animationHierarchyParser

Add support for loading SkinnedMeshes from SceneLoader + bug fix.
......@@ -177,7 +177,7 @@ THREE.AnimationClip.parse = function( json ) {
// parse the animation.hierarchy format
THREE.AnimationClip.parseAnimation = function( animation, bones, nodeName ) {
THREE.AnimationClip.parseAnimation = function( animation, bones ) {
if ( ! animation ) {
console.error( " no animation in JSONLoader data" );
......@@ -211,7 +211,7 @@ THREE.AnimationClip.parseAnimation = function( animation, bones, nodeName ) {
};
var tracks = [];
var clipName = animation.name || 'default';
var duration = animation.length || -1; // automatic length determination in AnimationClip.
var fps = animation.fps || 30;
......@@ -259,7 +259,7 @@ THREE.AnimationClip.parseAnimation = function( animation, bones, nodeName ) {
}
tracks.push( new THREE.NumberKeyframeTrack( nodeName + '.morphTargetInfluence[' + morphTargetName + ']', keys ) );
tracks.push( new THREE.NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', keys ) );
}
......@@ -267,7 +267,7 @@ THREE.AnimationClip.parseAnimation = function( animation, bones, nodeName ) {
} else {
var boneName = nodeName + '.bones[' + bones[ h ].name + ']';
var boneName = '.bones[' + bones[ h ].name + ']';
// track contains positions...
var positionTrack = convertTrack( boneName + '.position', animationKeys, 'pos', THREE.VectorKeyframeTrack, function( animationKey ) {
......
......@@ -514,9 +514,22 @@ THREE.ObjectLoader.prototype = {
break;
case 'Mesh':
case 'Mesh': {
object = new THREE.Mesh( getGeometry( data.geometry ), getMaterial( data.material ) );
var geometry = getGeometry( data.geometry );
if( geometry.bones && geometry.bones.length > 0 ) {
object = new THREE.SkinnedMesh( geometry, getMaterial( data.material ) );
}
else {
object = new THREE.Mesh( geometry, getMaterial( data.material ) );
}
}
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册