Browse Source

Set UUID (if exists) in ObjectLoader for AnimationClip

Erik Ritter 7 years ago
parent
commit
232586ee65
2 changed files with 9 additions and 3 deletions
  1. 3 3
      src/animation/AnimationClip.js
  2. 6 0
      src/loaders/ObjectLoader.js

+ 3 - 3
src/animation/AnimationClip.js

@@ -13,13 +13,13 @@ import { _Math } from '../math/Math.js';
  * @author David Sarno / http://lighthaus.us/
  */
 
-function AnimationClip( name, duration, tracks, uuid = _Math.generateUUID() ) {
+function AnimationClip( name, duration, tracks ) {
 
 	this.name = name;
 	this.tracks = tracks;
 	this.duration = ( duration !== undefined ) ? duration : - 1;
 
-	this.uuid = uuid;
+	this.uuid = _Math.generateUUID();
 
 	// this means it should figure out its duration by scanning the tracks
 	if ( this.duration < 0 ) {
@@ -46,7 +46,7 @@ Object.assign( AnimationClip, {
 
 		}
 
-		return new AnimationClip( json.name, json.duration, tracks, json.uuid );
+		return new AnimationClip( json.name, json.duration, tracks );
 
 	},
 

+ 6 - 0
src/loaders/ObjectLoader.js

@@ -458,6 +458,12 @@ Object.assign( ObjectLoader.prototype, {
 
 			var clip = AnimationClip.parse( json[ i ] );
 
+			if ( json[ i ].uuid !== undefined ) {
+
+				clip.uuid = json[ i ].uuid;
+
+			}
+
 			animations.push( clip );
 
 		}