|
@@ -19,6 +19,9 @@ function AnimationClip( name, duration, tracks ) {
|
|
this.tracks = tracks;
|
|
this.tracks = tracks;
|
|
this.duration = ( duration !== undefined ) ? duration : - 1;
|
|
this.duration = ( duration !== undefined ) ? duration : - 1;
|
|
|
|
|
|
|
|
+ this.isValidated = false;
|
|
|
|
+ this.isOptimized = false;
|
|
|
|
+
|
|
this.uuid = _Math.generateUUID();
|
|
this.uuid = _Math.generateUUID();
|
|
|
|
|
|
// this means it should figure out its duration by scanning the tracks
|
|
// this means it should figure out its duration by scanning the tracks
|
|
@@ -28,8 +31,6 @@ function AnimationClip( name, duration, tracks ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- this.optimize();
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
Object.assign( AnimationClip, {
|
|
Object.assign( AnimationClip, {
|
|
@@ -341,8 +342,24 @@ Object.assign( AnimationClip.prototype, {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ validate: function () {
|
|
|
|
+
|
|
|
|
+ if (this.isValidated) return this;
|
|
|
|
+
|
|
|
|
+ for ( var i = 0; i < this.tracks.length; i ++ ) {
|
|
|
|
+
|
|
|
|
+ this.tracks[ i ].validate();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return this;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
optimize: function () {
|
|
optimize: function () {
|
|
|
|
|
|
|
|
+ if (this.isOptimized) return this;
|
|
|
|
+
|
|
for ( var i = 0; i < this.tracks.length; i ++ ) {
|
|
for ( var i = 0; i < this.tracks.length; i ++ ) {
|
|
|
|
|
|
this.tracks[ i ].optimize();
|
|
this.tracks[ i ].optimize();
|