Browse Source

Editor: Remove glTF1 alert. (#25284)

Michael Herzog 2 years ago
parent
commit
996f6c9f5f
1 changed files with 6 additions and 51 deletions
  1. 6 51
      editor/js/Loader.js

+ 6 - 51
editor/js/Loader.js

@@ -298,24 +298,14 @@ function Loader( editor ) {
 
 
 					const contents = event.target.result;
 					const contents = event.target.result;
 
 
-					let loader, dracoLoader;
-
-					if ( isGLTF1( contents ) ) {
-
-						alert( 'Import of glTF asset not possible. Only versions >= 2.0 are supported. Please try to upgrade the file to glTF 2.0 using glTF-Pipeline.' );
-
-					} else {
-
-						const { DRACOLoader } = await import( 'three/addons/loaders/DRACOLoader.js' );
-						const { GLTFLoader } = await import( 'three/addons/loaders/GLTFLoader.js' );
-
-						dracoLoader = new DRACOLoader();
-						dracoLoader.setDecoderPath( '../examples/jsm/libs/draco/gltf/' );
+					const { DRACOLoader } = await import( 'three/addons/loaders/DRACOLoader.js' );
+					const { GLTFLoader } = await import( 'three/addons/loaders/GLTFLoader.js' );
 
 
-						loader = new GLTFLoader( manager );
-						loader.setDRACOLoader( dracoLoader );
+					const dracoLoader = new DRACOLoader();
+					dracoLoader.setDecoderPath( '../examples/jsm/libs/draco/gltf/' );
 
 
-					}
+					const loader = new GLTFLoader( manager );
+					loader.setDRACOLoader( dracoLoader );
 
 
 					loader.parse( contents, '', function ( result ) {
 					loader.parse( contents, '', function ( result ) {
 
 
@@ -1013,41 +1003,6 @@ function Loader( editor ) {
 
 
 	}
 	}
 
 
-	function isGLTF1( contents ) {
-
-		let resultContent;
-
-		if ( typeof contents === 'string' ) {
-
-			// contents is a JSON string
-			resultContent = contents;
-
-		} else {
-
-			const magic = THREE.LoaderUtils.decodeText( new Uint8Array( contents, 0, 4 ) );
-
-			if ( magic === 'glTF' ) {
-
-				// contents is a .glb file; extract the version
-				const version = new DataView( contents ).getUint32( 4, true );
-
-				return version < 2;
-
-			} else {
-
-				// contents is a .gltf file
-				resultContent = THREE.LoaderUtils.decodeText( new Uint8Array( contents ) );
-
-			}
-
-		}
-
-		const json = JSON.parse( resultContent );
-
-		return ( json.asset != undefined && json.asset.version[ 0 ] < 2 );
-
-	}
-
 }
 }
 
 
 export { Loader };
 export { Loader };