提交 682b889c 编写于 作者: M Mr.doob

JSONLoader: Helpful error when file is using new format. Fixes #5936.

上级 d22bb22d
......@@ -12,7 +12,7 @@ THREE.JSONLoader = function ( showStatus ) {
};
THREE.JSONLoader.prototype = Object.create( THREE.Loader.prototype );
THREE.JSONLoader.prototype.constructor = THREE.JSONLoader;
THREE.JSONLoader.prototype.constructor = THREE.JSONLoader;
THREE.JSONLoader.prototype.load = function ( url, callback, texturePath ) {
......@@ -43,6 +43,13 @@ THREE.JSONLoader.prototype.loadAjaxJSON = function ( context, url, callback, tex
var json = JSON.parse( xhr.responseText );
if ( json.metadata !== undefined && json.metadata.version >= 4 ) {
console.error( 'THREE.JSONLoader: "' + url + '" should be loaded with THREE.ObjectLoader instead.' );
return;
}
if ( json.metadata !== undefined && json.metadata.type === 'scene' ) {
console.error( 'THREE.JSONLoader: "' + url + '" seems to be a Scene. Use THREE.SceneLoader instead.' );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册