|
@@ -67,6 +67,14 @@ class AnimationClip {
|
|
|
*/
|
|
*/
|
|
|
this.uuid = generateUUID();
|
|
this.uuid = generateUUID();
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * An object that can be used to store custom data about the animation clip.
|
|
|
|
|
+ * It should not hold references to functions as these will not be cloned.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @type {Object}
|
|
|
|
|
+ */
|
|
|
|
|
+ this.userData = {};
|
|
|
|
|
+
|
|
|
// this means it should figure out its duration by scanning the tracks
|
|
// this means it should figure out its duration by scanning the tracks
|
|
|
if ( this.duration < 0 ) {
|
|
if ( this.duration < 0 ) {
|
|
|
|
|
|
|
@@ -98,6 +106,8 @@ class AnimationClip {
|
|
|
const clip = new this( json.name, json.duration, tracks, json.blendMode );
|
|
const clip = new this( json.name, json.duration, tracks, json.blendMode );
|
|
|
clip.uuid = json.uuid;
|
|
clip.uuid = json.uuid;
|
|
|
|
|
|
|
|
|
|
+ clip.userData = JSON.parse( json.userData || '{}' );
|
|
|
|
|
+
|
|
|
return clip;
|
|
return clip;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -120,7 +130,8 @@ class AnimationClip {
|
|
|
'duration': clip.duration,
|
|
'duration': clip.duration,
|
|
|
'tracks': tracks,
|
|
'tracks': tracks,
|
|
|
'uuid': clip.uuid,
|
|
'uuid': clip.uuid,
|
|
|
- 'blendMode': clip.blendMode
|
|
|
|
|
|
|
+ 'blendMode': clip.blendMode,
|
|
|
|
|
+ 'userData': JSON.stringify( clip.userData ),
|
|
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -515,7 +526,11 @@ class AnimationClip {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return new this.constructor( this.name, this.duration, tracks, this.blendMode );
|
|
|
|
|
|
|
+ const clip = new this.constructor( this.name, this.duration, tracks, this.blendMode );
|
|
|
|
|
+
|
|
|
|
|
+ clip.userData = JSON.parse( JSON.stringify( this.userData ) );
|
|
|
|
|
+
|
|
|
|
|
+ return clip;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|