Browse Source

JSONLoader: Added check for Scene files. Fixes #4420.

Mr.doob 11 years ago
parent
commit
5bb9e2d47d
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/loaders/JSONLoader.js

+ 8 - 0
src/loaders/JSONLoader.js

@@ -41,6 +41,14 @@ THREE.JSONLoader.prototype.loadAjaxJSON = function ( context, url, callback, tex
 				if ( xhr.responseText ) {
 				if ( xhr.responseText ) {
 
 
 					var json = JSON.parse( xhr.responseText );
 					var json = JSON.parse( xhr.responseText );
+
+					if ( json.metadata.type === 'scene' ) {
+
+						console.error( 'THREE.JSONLoader: "' + url + '" seems to be a Scene. Use THREE.SceneLoader instead.' );
+						return;
+
+					}
+
 					var result = context.parse( json, texturePath );
 					var result = context.parse( json, texturePath );
 					callback( result.geometry, result.materials );
 					callback( result.geometry, result.materials );