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

Editor: Added option to export GLB

上级 5ab5e550
......@@ -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();
......@@ -373,6 +392,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 );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册