Browse Source

Editor: Added File/Export USDZ

Mr.doob 4 years ago
parent
commit
b47c97dde7
3 changed files with 21 additions and 0 deletions
  1. 16 0
      editor/js/Menubar.File.js
  2. 3 0
      editor/js/Strings.js
  3. 2 0
      editor/sw.js

+ 16 - 0
editor/js/Menubar.File.js

@@ -379,6 +379,22 @@ function MenubarFile( editor ) {
 	} );
 	options.add( option );
 
+	// Export USDZ
+
+	var option = new UIRow();
+	option.setClass( 'option' );
+	option.setTextContent( strings.getKey( 'menubar/file/export/usdz' ) );
+	option.onClick( async function () {
+
+		var { USDZExporter } = await import( '../../examples/jsm/exporters/USDZExporter.js' );
+
+		var exporter = new USDZExporter();
+
+		saveArrayBuffer( exporter.parse( editor.scene, { binary: true } ), 'model.usdz' );
+
+	} );
+	options.add( option );
+
 	//
 
 	options.add( new UIHorizontalRule() );

+ 3 - 0
editor/js/Strings.js

@@ -21,6 +21,7 @@ function Strings( config ) {
 			'menubar/file/export/ply_binary': 'Export PLY (Binary)',
 			'menubar/file/export/stl': 'Export STL',
 			'menubar/file/export/stl_binary': 'Export STL (Binary)',
+			'menubar/file/export/usdz': 'Export USDZ',
 			'menubar/file/publish': 'Publish',
 
 			'menubar/edit': 'Edit',
@@ -344,6 +345,7 @@ function Strings( config ) {
 			'menubar/file/export/ply_binary': 'Exporter PLY (Binaire)',
 			'menubar/file/export/stl': 'Exporter STL',
 			'menubar/file/export/stl_binary': 'Exporter STL (Binaire)',
+			'menubar/file/export/usdz': 'Exporter USDZ',
 			'menubar/file/publish': 'Publier',
 
 			'menubar/edit': 'Edition',
@@ -667,6 +669,7 @@ function Strings( config ) {
 			'menubar/file/export/ply_binary': '导出PLY(二进制)',
 			'menubar/file/export/stl': '导出STL',
 			'menubar/file/export/stl_binary': '导出STL(二进制)',
+			'menubar/file/export/usdz': '导出USDZ',
 			'menubar/file/publish': '发布',
 
 			'menubar/edit': '编辑',

+ 2 - 0
editor/sw.js

@@ -14,6 +14,7 @@ const assets = [
 
 	'../examples/jsm/libs/chevrotain.module.min.js',
 	'../examples/jsm/libs/fflate.module.min.js',
+	'../examples/jsm/libs/fflate.module.js', // TODO: Optimize 
 
 	'../examples/js/libs/draco/draco_decoder.js',
 	'../examples/js/libs/draco/draco_decoder.wasm',
@@ -58,6 +59,7 @@ const assets = [
 	'../examples/jsm/exporters/OBJExporter.js',
 	'../examples/jsm/exporters/PLYExporter.js',
 	'../examples/jsm/exporters/STLExporter.js',
+	'../examples/jsm/exporters/USDZExporter.js',
 
 	'../examples/jsm/helpers/VertexNormalsHelper.js',