mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-09 04:56:01 +10:00
ColladaLoader tried to access children-less object childrens. Changend JSONLoader try/catch code (better error logs this way).
This commit is contained in:
@@ -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' ) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user