|
@@ -184,6 +184,25 @@ Menubar.File = function ( editor ) {
|
|
|
|
|
|
options.add( new UI.HorizontalRule() );
|
|
|
|
|
|
+ // Export GLB
|
|
|
+
|
|
|
+ var option = new UI.Row();
|
|
|
+ option.setClass( 'option' );
|
|
|
+ option.setTextContent( 'Export GLB' );
|
|
|
+ option.onClick( function () {
|
|
|
+
|
|
|
+ var exporter = new THREE.GLTFExporter();
|
|
|
+
|
|
|
+ exporter.parse( editor.scene, function ( result ) {
|
|
|
+
|
|
|
+ saveArrayBuffer( result, 'scene.glb' );
|
|
|
+
|
|
|
+ }, { binary: true } );
|
|
|
+
|
|
|
+
|
|
|
+ } );
|
|
|
+ options.add( option );
|
|
|
+
|
|
|
// Export GLTF
|
|
|
|
|
|
var option = new UI.Row();
|
|
@@ -352,6 +371,12 @@ Menubar.File = function ( editor ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ function saveArrayBuffer( buffer, filename ) {
|
|
|
+
|
|
|
+ save( new Blob( [ buffer ], { type: 'application/octet-stream' } ), filename );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
function saveString( text, filename ) {
|
|
|
|
|
|
save( new Blob( [ text ], { type: 'text/plain' } ), filename );
|