MCPcopy Create free account
hub / github.com/mrdoob/three.js / fromJSON

Method fromJSON

src/objects/Skeleton.js:317–342  ·  view source on GitHub ↗

* Setups the skeleton by the given JSON and bones. * * @param {Object} json - The skeleton as serialized JSON. * @param {Object } bones - An array of bones. * @return {Skeleton} A reference of this instance.

( json, bones )

Source from the content-addressed store, hash-verified

315 * @return {Skeleton} A reference of this instance.
316 */
317 fromJSON( json, bones ) {
318
319 this.uuid = json.uuid;
320
321 for ( let i = 0, l = json.bones.length; i < l; i ++ ) {
322
323 const uuid = json.bones[ i ];
324 let bone = bones[ uuid ];
325
326 if ( bone === undefined ) {
327
328 warn( 'Skeleton: No bone found with UUID:', uuid );
329 bone = new Bone();
330
331 }
332
333 this.bones.push( bone );
334 this.boneInverses.push( new Matrix4().fromArray( json.boneInverses[ i ] ) );
335
336 }
337
338 this.init();
339
340 return this;
341
342 }
343
344 /**
345 * Serializes the skeleton into JSON.

Callers

nothing calls this directly

Calls 4

initMethod · 0.95
warnFunction · 0.90
pushMethod · 0.45
fromArrayMethod · 0.45

Tested by

no test coverage detected