Menubar.File.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. Menubar.File = function ( signals ) {
  2. var container = new UI.Panel();
  3. container.setClass( 'menu' );
  4. var title = new UI.Panel();
  5. title.setTextContent( 'File' ).setColor( '#666' );
  6. title.setMargin( '0px' );
  7. title.setPadding( '8px' );
  8. container.add( title );
  9. //
  10. var options = new UI.Panel();
  11. options.setClass( 'options' );
  12. container.add( options );
  13. /*
  14. // open
  15. var option = new UI.Panel();
  16. option.setClass( 'option' );
  17. option.setTextContent( 'Open' );
  18. option.onClick( function () { alert( 'Open' ) } );
  19. options.add( option );
  20. */
  21. // reset
  22. var option = new UI.Panel();
  23. option.setClass( 'option' );
  24. option.setTextContent( 'Reset' );
  25. option.onClick( function () {
  26. if ( confirm( 'Are you sure?' ) ) {
  27. if ( localStorage.threejsEditor !== undefined ) {
  28. delete localStorage.threejsEditor;
  29. }
  30. location.reload();
  31. }
  32. } );
  33. options.add( option );
  34. // export geometry
  35. var option = new UI.Panel();
  36. option.setClass( 'option' );
  37. option.setTextContent( 'Export Geometry' );
  38. option.onClick( function () { signals.exportGeometry.dispatch( { exporter: THREE.GeometryExporter } ); } );
  39. options.add( option );
  40. // export scene
  41. var option = new UI.Panel();
  42. option.setClass( 'option' );
  43. option.setTextContent( 'Export Scene' );
  44. option.onClick( function () { signals.exportScene.dispatch( { exporter: THREE.SceneExporter } ); } );
  45. options.add( option );
  46. // export scene 2
  47. var option = new UI.Panel();
  48. option.setClass( 'option' );
  49. option.setTextContent( 'Export Scene 2' );
  50. option.onClick( function () { signals.exportScene.dispatch( { exporter: THREE.SceneExporter2 } ); } );
  51. options.add( option );
  52. // export OBJ
  53. var option = new UI.Panel();
  54. option.setClass( 'option' );
  55. option.setTextContent( 'Export OBJ' );
  56. option.onClick( function () { signals.exportGeometry.dispatch( { exporter: THREE.OBJExporter } ); } );
  57. options.add( option );
  58. //
  59. return container;
  60. }
粤ICP备19079148号