|
@@ -29,11 +29,14 @@ Object.assign( THREE.AnimationMixer.prototype, THREE.EventDispatcher.prototype,
|
|
|
|
|
|
var root = optionalRoot || this._root,
|
|
|
rootUuid = root.uuid,
|
|
|
- clipName = ( typeof clip === 'string' ) ? clip : clip.name,
|
|
|
- clipObject = ( clip !== clipName ) ? clip : null,
|
|
|
|
|
|
- actionsForClip = this._actionsByClip[ clipName ],
|
|
|
- prototypeAction;
|
|
|
+ clipObject = typeof clip === 'string' ?
|
|
|
+ THREE.AnimationClip.findByName( root, clip ) : clip,
|
|
|
+
|
|
|
+ clipUuid = clipObject !== null ? clipObject.uuid : clip,
|
|
|
+
|
|
|
+ actionsForClip = this._actionsByClip[ clipUuid ],
|
|
|
+ prototypeAction = null;
|
|
|
|
|
|
if ( actionsForClip !== undefined ) {
|
|
|
|
|
@@ -51,14 +54,8 @@ Object.assign( THREE.AnimationMixer.prototype, THREE.EventDispatcher.prototype,
|
|
|
prototypeAction = actionsForClip.knownActions[ 0 ];
|
|
|
|
|
|
// also, take the clip from the prototype action
|
|
|
- clipObject = prototypeAction._clip;
|
|
|
-
|
|
|
- if ( clip !== clipName && clip !== clipObject ) {
|
|
|
-
|
|
|
- throw new Error(
|
|
|
- "Different clips with the same name detected!" );
|
|
|
-
|
|
|
- }
|
|
|
+ if ( clipObject === null )
|
|
|
+ clipObject = prototypeAction._clip;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -72,7 +69,7 @@ Object.assign( THREE.AnimationMixer.prototype, THREE.EventDispatcher.prototype,
|
|
|
this._bindAction( newAction, prototypeAction );
|
|
|
|
|
|
// and make the action known to the memory manager
|
|
|
- this._addInactiveAction( newAction, clipName, rootUuid );
|
|
|
+ this._addInactiveAction( newAction, clipUuid, rootUuid );
|
|
|
|
|
|
return newAction;
|
|
|
|
|
@@ -83,8 +80,13 @@ Object.assign( THREE.AnimationMixer.prototype, THREE.EventDispatcher.prototype,
|
|
|
|
|
|
var root = optionalRoot || this._root,
|
|
|
rootUuid = root.uuid,
|
|
|
- clipName = ( typeof clip === 'string' ) ? clip : clip.name,
|
|
|
- actionsForClip = this._actionsByClip[ clipName ];
|
|
|
+
|
|
|
+ clipObject = typeof clip === 'string' ?
|
|
|
+ THREE.AnimationClip.findByName( root, clip ) : clip,
|
|
|
+
|
|
|
+ clipUuid = clipObject ? clipObject.uuid : clip,
|
|
|
+
|
|
|
+ actionsForClip = this._actionsByClip[ clipUuid ];
|
|
|
|
|
|
if ( actionsForClip !== undefined ) {
|
|
|
|
|
@@ -176,9 +178,9 @@ Object.assign( THREE.AnimationMixer.prototype, THREE.EventDispatcher.prototype,
|
|
|
uncacheClip: function( clip ) {
|
|
|
|
|
|
var actions = this._actions,
|
|
|
- clipName = clip.name,
|
|
|
+ clipUuid = clip.uuid,
|
|
|
actionsByClip = this._actionsByClip,
|
|
|
- actionsForClip = actionsByClip[ clipName ];
|
|
|
+ actionsForClip = actionsByClip[ clipUuid ];
|
|
|
|
|
|
if ( actionsForClip !== undefined ) {
|
|
|
|
|
@@ -208,7 +210,7 @@ Object.assign( THREE.AnimationMixer.prototype, THREE.EventDispatcher.prototype,
|
|
|
|
|
|
}
|
|
|
|
|
|
- delete actionsByClip[ clipName ];
|
|
|
+ delete actionsByClip[ clipUuid ];
|
|
|
|
|
|
}
|
|
|
|
|
@@ -220,9 +222,9 @@ Object.assign( THREE.AnimationMixer.prototype, THREE.EventDispatcher.prototype,
|
|
|
var rootUuid = root.uuid,
|
|
|
actionsByClip = this._actionsByClip;
|
|
|
|
|
|
- for ( var clipName in actionsByClip ) {
|
|
|
+ for ( var clipUuid in actionsByClip ) {
|
|
|
|
|
|
- var actionByRoot = actionsByClip[ clipName ].actionByRoot,
|
|
|
+ var actionByRoot = actionsByClip[ clipUuid ].actionByRoot,
|
|
|
action = actionByRoot[ rootUuid ];
|
|
|
|
|
|
if ( action !== undefined ) {
|
|
@@ -350,13 +352,13 @@ Object.assign( THREE.AnimationMixer.prototype, {
|
|
|
// appears to be still using it -> rebind
|
|
|
|
|
|
var rootUuid = ( action._localRoot || this._root ).uuid,
|
|
|
- clipName = action._clip.name,
|
|
|
- actionsForClip = this._actionsByClip[ clipName ];
|
|
|
+ clipUuid = action._clip.uuid,
|
|
|
+ actionsForClip = this._actionsByClip[ clipUuid ];
|
|
|
|
|
|
this._bindAction( action,
|
|
|
actionsForClip && actionsForClip.knownActions[ 0 ] );
|
|
|
|
|
|
- this._addInactiveAction( action, clipName, rootUuid );
|
|
|
+ this._addInactiveAction( action, clipUuid, rootUuid );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -462,11 +464,11 @@ Object.assign( THREE.AnimationMixer.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- _addInactiveAction: function( action, clipName, rootUuid ) {
|
|
|
+ _addInactiveAction: function( action, clipUuid, rootUuid ) {
|
|
|
|
|
|
var actions = this._actions,
|
|
|
actionsByClip = this._actionsByClip,
|
|
|
- actionsForClip = actionsByClip[ clipName ];
|
|
|
+ actionsForClip = actionsByClip[ clipUuid ];
|
|
|
|
|
|
if ( actionsForClip === undefined ) {
|
|
|
|
|
@@ -479,7 +481,7 @@ Object.assign( THREE.AnimationMixer.prototype, {
|
|
|
|
|
|
action._byClipCacheIndex = 0;
|
|
|
|
|
|
- actionsByClip[ clipName ] = actionsForClip;
|
|
|
+ actionsByClip[ clipUuid ] = actionsForClip;
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -510,9 +512,9 @@ Object.assign( THREE.AnimationMixer.prototype, {
|
|
|
action._cacheIndex = null;
|
|
|
|
|
|
|
|
|
- var clipName = action._clip.name,
|
|
|
+ var clipUuid = action._clip.uuid,
|
|
|
actionsByClip = this._actionsByClip,
|
|
|
- actionsForClip = actionsByClip[ clipName ],
|
|
|
+ actionsForClip = actionsByClip[ clipUuid ],
|
|
|
knownActionsForClip = actionsForClip.knownActions,
|
|
|
|
|
|
lastKnownAction =
|
|
@@ -534,7 +536,7 @@ Object.assign( THREE.AnimationMixer.prototype, {
|
|
|
|
|
|
if ( knownActionsForClip.length === 0 ) {
|
|
|
|
|
|
- delete actionsByClip[ clipName ];
|
|
|
+ delete actionsByClip[ clipUuid ];
|
|
|
|
|
|
}
|
|
|
|