Skip to content

Commit

Permalink
AnimationClip: Revert .trim() changes, remove temp changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Jul 17, 2018
1 parent dd1d025 commit 9d9b1bc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 36 deletions.
5 changes: 5 additions & 0 deletions docs/api/animation/AnimationClip.html
Expand Up @@ -66,6 +66,11 @@ <h3>[property:String uuid]</h3>
<h2>Methods</h2>


<h3>[method:AnimationClip clone]()</h3>
<p>
Returns a copy of this clip.
</p>

<h3>[method:AnimationClip optimize]()</h3>
<p>
Optimizes each track by removing equivalent sequential keys (which are common in morph target
Expand Down
4 changes: 2 additions & 2 deletions docs/api/animation/AnimationUtils.html
Expand Up @@ -49,9 +49,9 @@ <h3>[method:Array sortedArray]( values, stride, order )</h3>
</p>

<h3>[method:AnimationClip subclip]( [param:AnimationClip clip], [param:String name], [param:Number startFrame], [param:Number endFrame], [param:Number fps] )</h3>
<div>
<p>
Creates a new clip, containing only the segment of the original clip between the given frames.
</div>
</p>

<h2>Source</h2>

Expand Down
5 changes: 5 additions & 0 deletions docs/api/animation/KeyframeTrack.html
Expand Up @@ -160,6 +160,11 @@ <h3>[property:Constant ValueBufferType ]</h3>
<h2>Methods</h2>


<h3>[method:KeyframeTrack clone]()</h3>
<p>
Returns a copy of this track.
</p>

<h3>[method:null createInterpolant]()</h3>
<p>
Creates a [page:LinearInterpolant LinearInterpolant], [page:CubicInterpolant CubicInterpolant]
Expand Down
34 changes: 3 additions & 31 deletions src/animation/AnimationClip.js
Expand Up @@ -409,42 +409,14 @@ Object.assign( AnimationClip.prototype, {

},

trim: function ( startTime, endTime ) {
trim: function () {

if ( startTime === undefined ) startTime = 0;
if ( endTime === undefined ) endTime = this.duration;

var tracks = [];

for ( var i = 0; i < this.tracks.length; ++ i ) {

var track = this.tracks[ i ];

var hasKeyframe = false;

// omit tracks without frames between new start/end times
for ( var j = 0; j < track.times.length; ++ j ) {

if ( startTime <= track.times[ j ] && endTime > track.times [ j ] ) {

hasKeyframe = true;

break;

}

}

if ( ! hasKeyframe ) continue;

this.tracks[ i ].trim( startTime, endTime );
for ( var i = 0; i < this.tracks.length; i ++ ) {

tracks.push( this.tracks[ i ] );
this.tracks[ i ].trim( 0, this.duration );

}

this.tracks = tracks;

return this;

},
Expand Down
3 changes: 0 additions & 3 deletions src/animation/KeyframeTrack.js
Expand Up @@ -348,9 +348,6 @@ Object.assign( KeyframeTrack.prototype, {
// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)
optimize: function () {

// TODO: Opt-out of optimization?
return this;

var times = this.times,
values = this.values,
stride = this.getValueSize(),
Expand Down

0 comments on commit 9d9b1bc

Please sign in to comment.