Sidebar.Script.js 993 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. Sidebar.Script = function ( editor ) {
  5. var signals = editor.signals;
  6. var container = new UI.CollapsiblePanel();
  7. container.setCollapsed( editor.config.getKey( 'ui/sidebar/script/collapsed' ) );
  8. container.onCollapsedChange( function ( boolean ) {
  9. editor.config.setKey( 'ui/sidebar/script/collapsed', boolean );
  10. } );
  11. container.setDisplay( 'none' );
  12. container.addStatic( new UI.Text( 'Script' ).setTextTransform( 'uppercase' ) );
  13. container.add( new UI.Break() );
  14. var source = new Sidebar.Script.Editor( editor );
  15. container.add( source );
  16. signals.objectSelected.add( function ( object ) {
  17. if ( object !== null ) {
  18. container.setDisplay( 'block' );
  19. /*
  20. var scripts = editor.scripts[ object.uuid ];
  21. if ( scripts !== undefined ) {
  22. scriptSource.setValue( scripts[ 0 ] );
  23. } else {
  24. scriptSource.setValue( '' );
  25. }
  26. */
  27. } else {
  28. container.setDisplay( 'none' );
  29. }
  30. } );
  31. return container;
  32. }