浏览代码

Editor: Added Camera to Inspector. See #5550.

Mr.doob 10 年之前
父节点
当前提交
aaf29da882
共有 2 个文件被更改,包括 11 次插入0 次删除
  1. 9 0
      editor/js/Editor.js
  2. 2 0
      editor/js/Sidebar.Scene.js

+ 9 - 0
editor/js/Editor.js

@@ -63,6 +63,8 @@ var Editor = function () {
 	this.loader = new Loader( this );
 
 	this.camera = new THREE.PerspectiveCamera( 50, 1, 0.1, 100000 );
+	this.camera.name = 'Camera';
+
 	this.scene = new THREE.Scene();
 	this.scene.name = 'Scene';
 
@@ -310,6 +312,13 @@ Editor.prototype = {
 
 	selectById: function ( id ) {
 
+		if ( id === this.camera.id ) {
+
+			this.select( this.camera );
+			return;
+
+		}
+
 		this.select( this.scene.getObjectById( id, true ) );
 
 	},

+ 2 - 0
editor/js/Sidebar.Scene.js

@@ -128,10 +128,12 @@ Sidebar.Scene = function ( editor ) {
 
 	var refreshUI = function () {
 
+		var camera = editor.camera;
 		var scene = editor.scene;
 
 		var options = [];
 
+		options.push( { value: camera.id, html: '<span class="type ' + camera.type + '"></span> ' + camera.name } );
 		options.push( { value: scene.id, html: '<span class="type ' + scene.type + '"></span> ' + scene.name } );
 
 		( function addObjects( objects, pad ) {