Browse Source

Editor: Added Edit / Clone.

Mr.doob 12 năm trước cách đây
mục cha
commit
42da32414c
3 tập tin đã thay đổi với 17 bổ sung0 xóa
  1. 1 0
      editor/index.html
  2. 8 0
      editor/js/ui/Menubar.Edit.js
  3. 8 0
      editor/js/ui/Viewport.js

+ 1 - 0
editor/index.html

@@ -108,6 +108,7 @@
 
 				// actions
 
+				cloneSelectedObject: new SIGNALS.Signal(),
 				removeSelectedObject: new SIGNALS.Signal(),
 				exportGeometry: new SIGNALS.Signal(),
 				exportScene: new SIGNALS.Signal(),

+ 8 - 0
editor/js/ui/Menubar.Edit.js

@@ -15,6 +15,14 @@ Menubar.Edit = function ( signals ) {
 	options.setClass( 'options' );
 	container.add( options );
 
+	// clone
+
+	var option = new UI.Panel();
+	option.setClass( 'option' );
+	option.setTextContent( 'Clone' );
+	option.onClick( function () { signals.cloneSelectedObject.dispatch(); } );
+	options.add( option );
+
 	// delete
 
 	var option = new UI.Panel();

+ 8 - 0
editor/js/ui/Viewport.js

@@ -388,6 +388,14 @@ var Viewport = function ( signals ) {
 
 	} );
 
+	signals.cloneSelectedObject.add( function () {
+
+		if ( selected === camera ) return;
+
+		signals.objectAdded.dispatch( selected.clone() );
+
+	} );
+
 	signals.removeSelectedObject.add( function () {
 
 		if ( selected === camera ) return;