Browse Source

AnimationUtils: Update docs.

Don McCurdy 6 years ago
parent
commit
215c63154e

+ 5 - 0
docs/api/en/animation/AnimationClip.html

@@ -66,6 +66,11 @@
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 
 
+		<h3>[method:AnimationClip clone]()</h3>
+		<p>
+			Returns a copy of this clip.
+		</p>
+
 		<h3>[method:this optimize]()</h3>
 		<h3>[method:this optimize]()</h3>
 		<p>
 		<p>
 			Optimizes each track by removing equivalent sequential keys (which are common in morph target
 			Optimizes each track by removing equivalent sequential keys (which are common in morph target

+ 3 - 0
docs/api/zh/animation/AnimationClip.html

@@ -62,6 +62,9 @@
 		<h2>方法</h2>
 		<h2>方法</h2>
 
 
 
 
+		<h3>[method:AnimationClip clone]()</h3>
+		<p></p>
+
 		<h3>[method:this optimize]()</h3>
 		<h3>[method:this optimize]()</h3>
 		<p>
 		<p>
             通过移除等效的顺序键(在变形目标序列中很常见)来优化每一个轨道
             通过移除等效的顺序键(在变形目标序列中很常见)来优化每一个轨道

+ 6 - 0
docs/api/zh/animation/AnimationUtils.html

@@ -38,12 +38,18 @@
             返回一个数组,时间和值可以根据此数组排序。
             返回一个数组,时间和值可以根据此数组排序。
 		</p>
 		</p>
 
 
+		<h3>[method:Number insertKeyframe]( [param:KeyframeTrack track], [param:Number time] )</h3>
+		<p></p>
+
 		<h3>[method:Boolean isTypedArray]( object )</h3>
 		<h3>[method:Boolean isTypedArray]( object )</h3>
 		<p>
 		<p>
             如果该对象是类型化数组,返回*true*
             如果该对象是类型化数组,返回*true*
 
 
 		</p>
 		</p>
 
 
+		<h3>[method:AnimationClip mergeMorphTargetTracks]( [param:AnimationClip tracks], [param:Object3D root] )</h3>
+		<p></p>
+
 		<h3>[method:Array sortedArray]( values, stride, order )</h3>
 		<h3>[method:Array sortedArray]( values, stride, order )</h3>
 		<p>
 		<p>
             将[page:AnimationUtils.getKeyframeOrder getKeyframeOrder]方法返回的数组排序。
             将[page:AnimationUtils.getKeyframeOrder getKeyframeOrder]方法返回的数组排序。

+ 3 - 0
docs/api/zh/animation/KeyframeTrack.html

@@ -137,6 +137,9 @@
 		<h2>方法</h2>
 		<h2>方法</h2>
 
 
 
 
+		<h3>[method:KeyframeTrack clone]()</h3>
+		<p></p>
+
 		<h3>[method:null createInterpolant]()</h3>
 		<h3>[method:null createInterpolant]()</h3>
 		<p>
 		<p>
 			根据传入构造器中的插值类型参数,创建线性插值([page:LinearInterpolant LinearInterpolant]),立方插值([page:CubicInterpolant CubicInterpolant])或离散插值
 			根据传入构造器中的插值类型参数,创建线性插值([page:LinearInterpolant LinearInterpolant]),立方插值([page:CubicInterpolant CubicInterpolant])或离散插值

+ 1 - 1
examples/js/exporters/GLTFExporter.js

@@ -1408,7 +1408,7 @@ THREE.GLTFExporter.prototype = {
 
 
 			}
 			}
 
 
-			THREE.AnimationUtils.mergeMorphTargetTracks( clip, root );
+			clip = THREE.AnimationUtils.mergeMorphTargetTracks( clip.clone(), root );
 
 
 			var tracks = clip.tracks;
 			var tracks = clip.tracks;
 			var channels = [];
 			var channels = [];

+ 15 - 0
src/animation/AnimationClip.js

@@ -445,6 +445,21 @@ Object.assign( AnimationClip.prototype, {
 
 
 		return this;
 		return this;
 
 
+	},
+
+
+	clone: function () {
+
+		var tracks = [];
+
+		for ( var i = 0; i < this.tracks.length; i ++ ) {
+
+			tracks.push( this.tracks[ i ].clone() );
+
+		}
+
+		return new AnimationClip( this.name, this.duration, tracks );
+
 	}
 	}
 
 
 } );
 } );