diff --git a/src/extras/loaders/ColladaLoader.js b/src/extras/loaders/ColladaLoader.js index 1d96547f..07cc4258 100644 --- a/src/extras/loaders/ColladaLoader.js +++ b/src/extras/loaders/ColladaLoader.js @@ -164,15 +164,11 @@ THREE.ColladaLoader = function () { function parseAsset () { - var elements = COLLADA.evaluate("//dae:asset", - COLLADA, - _nsResolver, - XPathResult.ORDERED_NODE_ITERATOR_TYPE, - null) ; + var elements = COLLADA.evaluate( '//dae:asset', COLLADA, _nsResolver, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); var element = elements.iterateNext(); - if ( element ) { + if ( element && element.children ) { for ( var i = 0; i < element.children.length; i ++ ) { @@ -2742,6 +2738,8 @@ THREE.ColladaLoader = function () { ColorOrTexture.prototype.parseTexture = function ( element ) { + if ( ! element.children ) return this; + // This should be supported by Maya, 3dsMax, and MotionBuilder if ( element.children[0] && element.children[0].nodeName === 'extra' ) { diff --git a/src/extras/loaders/JSONLoader.js b/src/extras/loaders/JSONLoader.js index b3c242e7..919a5f3f 100644 --- a/src/extras/loaders/JSONLoader.js +++ b/src/extras/loaders/JSONLoader.js @@ -52,16 +52,15 @@ THREE.JSONLoader.prototype.loadAjaxJSON = function( context, url, callback, text var jsonObject = JSON.parse( xhr.responseText ); - context.createModel( jsonObject, callback, texturePath ); - context.onLoadComplete(); - } catch ( error ) { - console.error( error ); console.warn( "DEPRECATED: [" + url + "] seems to be using old model format" ); } + context.createModel( jsonObject, callback, texturePath ); + context.onLoadComplete(); + } else { console.error( "Couldn't load [" + url + "] [" + xhr.status + "]" ); @@ -396,6 +395,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path dstVertices = geometry.morphTargets[ i ].vertices; srcVertices = json.morphTargets [ i ].vertices; + for( v = 0, vl = srcVertices.length; v < vl; v += 3 ) { x = srcVertices[ v ] * scale;