diff --git a/src/r3-d3-mesh-0.js b/src/r3-d3-mesh-0.js index bbd2708..e6eba13 100644 --- a/src/r3-d3-mesh-0.js +++ b/src/r3-d3-mesh-0.js @@ -60,11 +60,12 @@ R3.D3.Mesh = function ( }.bind(this) ); - if (this.skeleton) { - this.skeleton = new R3.D3.Skeleton( - this.graphics, - this.skeleton - ); + if ( + R3.Utils.Defined(this.skeleton) && + R3.Utils.Defined(this.skeleton.componentType) && + !(this.skeleton instanceof R3.D3.Skeleton) + ) { + this.skeleton = R3.Component.ConstructFromObject(this.skeleton); } this.cloneDirection = new R3.Vector3( diff --git a/src/r3-d3-skeleton.js b/src/r3-d3-skeleton.js index 0a7769c..223f186 100644 --- a/src/r3-d3-skeleton.js +++ b/src/r3-d3-skeleton.js @@ -29,17 +29,15 @@ R3.D3.Skeleton = function Skeleton( apiSkeleton.parentEntity ); + this.bones = this.bones.map( function(apiBone) { - if (apiBone instanceof R3.D3.API.Bone) { - return new R3.D3.Bone( - this.graphics, - apiBone - ) - } else { - console.warn('apiBone not an instance of API.Bone'); - throw new Error('apiBone not an instance of API.Bone'); + if ( + R3.Utils.Defined(apiBone.componentType) && + !(apiBone instanceof R3.D3.Bone) + ) { + return R3.Component.ConstructFromObject(apiBone); } }.bind(this) diff --git a/src/r3-d3-vertex.js b/src/r3-d3-vertex.js index 18912ac..a709b10 100644 --- a/src/r3-d3-vertex.js +++ b/src/r3-d3-vertex.js @@ -30,10 +30,10 @@ R3.D3.Vertex = function Vertex( this.boneWeights = this.boneWeights.map( function(boneWeight) { return new R3.Vector4( - this.graphics, + this.implementation, boneWeight ) - } + }.bind(this) ); };