Viewport.Camera.js 767 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. Viewport.Camera = function ( editor ) {
  5. var signals = editor.signals;
  6. //
  7. var cameraSelect = new UI.Select();
  8. cameraSelect.setPosition( 'absolute' );
  9. cameraSelect.setRight( '10px' );
  10. cameraSelect.setTop( '10px' );
  11. cameraSelect.onChange( function () {
  12. editor.setViewportCamera( this.getValue() );
  13. } );
  14. signals.cameraAdded.add( update );
  15. signals.cameraRemoved.add( update );
  16. update();
  17. //
  18. function update() {
  19. var options = {};
  20. var cameras = editor.cameras;
  21. for ( var key in cameras ) {
  22. var camera = cameras[ key ];
  23. options[ camera.uuid ] = camera.name;
  24. }
  25. cameraSelect.setOptions( options );
  26. cameraSelect.setValue( editor.viewportCamera.uuid );
  27. }
  28. return cameraSelect;
  29. };