src/etc/SceneUtils.js
/**
	* Clones a skinned mesh. This method is necessary since three.js
	* does not yet support cloning of skinned meshes in the core.
	*
	* @param {SkinnedMesh} source - The skinned mesh to clone.
	* @return {SkinnedMesh} The cloned skinned mesh.
	*/
Clones a skinned mesh. This method is necessary since three.js
does not yet support cloning of skinned meshes in the core.

@param {SkinnedMesh} source - The skinned mesh to clone.
@return {SkinnedMesh} The cloned skinned mesh.
Clones a skinned mesh . This method is necessary since three . js does not yet support cloning of skinned meshes in the core . @param { SkinnedMesh } source - The skinned mesh to clone . @return { SkinnedMesh } The cloned skinned mesh .
static cloneWithSkinning( source ) {
		const cloneLookup = new Map();
		const clone = source.clone();
		parallelTraverse( source, clone, ( sourceNode, clonedNode ) => {
			cloneLookup.set( sourceNode, clonedNode );
		} );
		source.traverse( function ( sourceMesh ) {
			if ( ! sourceMesh.isSkinnedMesh ) return;
			const sourceBones = sourceMesh.skeleton.bones;
			const clonedMesh = cloneLookup.get( sourceMesh );
			clonedMesh.skeleton = sourceMesh.skeleton.clone();
			clonedMesh.skeleton.bones = sourceBones.map( ( sourceBone ) => {
				if ( ! cloneLookup.has( sourceBone ) ) {
					throw new Error( 'SceneUtils: Required bones are not descendants of the given object.' );
				}
				return cloneLookup.get( sourceBone );
			} );
			clonedMesh.bind( clonedMesh.skeleton, sourceMesh.bindMatrix );
		} );
		return clone;
	}
static cloneWithSkinning ( source ) { const cloneLookup = new Map ( ) ; const clone = source . clone ( ) ; parallelTraverse ( source , clone , ( sourceNode , clonedNode ) => { cloneLookup . set ( sourceNode , clonedNode ) ; } ) ; source . traverse ( function ( sourceMesh ) { if ( ! sourceMesh . isSkinnedMesh ) return ; const sourceBones = sourceMesh . skeleton . bones ; const clonedMesh = cloneLookup . get ( sourceMesh ) ; clonedMesh . skeleton = sourceMesh . skeleton . clone ( ) ; clonedMesh . skeleton . bones = sourceBones . map ( ( sourceBone ) => { if ( ! cloneLookup . has ( sourceBone ) ) { throw new Error ( 'SceneUtils: Required bones are not descendants of the given object.' ) ; } return cloneLookup . get ( sourceBone ) ; } ) ; clonedMesh . bind ( clonedMesh . skeleton , sourceMesh . bindMatrix ) ; } ) ; return clone ; }
Clones a skinned mesh.
Clones a skinned mesh .
// see https://github.com/mrdoob/three.js/pull/14494