Menubar.File.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. /*
  41. // export scene
  42. var option = new UI.Panel();
  43. option.setClass( 'option' );
  44. option.setTextContent( 'Export Scene' );
  45. option.onClick( function () { signals.exportScene.dispatch( { exporter: THREE.SceneExporter } ); } );
  46. options.add( option );
  47. */
  48. // export scene 2
  49. var option = new UI.Panel();
  50. option.setClass( 'option' );
  51. option.setTextContent( 'Export Scene 2' );
  52. option.onClick( function () { signals.exportScene.dispatch( { exporter: THREE.SceneExporter2 } ); } );
  53. options.add( option );
  54. // export OBJ
  55. var option = new UI.Panel();
  56. option.setClass( 'option' );
  57. option.setTextContent( 'Export OBJ' );
  58. option.onClick( function () { signals.exportGeometry.dispatch( { exporter: THREE.OBJExporter } ); } );
  59. options.add( option );
  60. //
  61. return container;
  62. }