提交 647fd93d 编写于 作者: M Mr.doob

Editor: Added Edit/Flatten.

上级 1fd0a3fb
......@@ -144,6 +144,7 @@
// actions
flattenSelectedObject: new SIGNALS.Signal(),
cloneSelectedObject: new SIGNALS.Signal(),
removeSelectedObject: new SIGNALS.Signal(),
playAnimations: new SIGNALS.Signal(),
......
......@@ -19,6 +19,14 @@ Menubar.Edit = function ( signals ) {
options.setDisplay( 'none' );
container.add( options );
// flatten
var option = new UI.Panel();
option.setClass( 'option' );
option.setTextContent( 'Flatten' );
option.onClick( function () { signals.flattenSelectedObject.dispatch(); } );
options.add( option );
// clone
var option = new UI.Panel();
......
......@@ -82,7 +82,7 @@ Sidebar.Geometry = function ( signals ) {
}
signals.objectSelected.add( function ( object ) {
function build( object ) {
if ( object && object.geometry ) {
......@@ -148,17 +148,10 @@ Sidebar.Geometry = function ( signals ) {
}
} );
signals.objectChanged.add( function ( object ) {
if ( object && object.geometry ) {
updateFields( object.geometry );
}
}
} );
signals.objectSelected.add( build );
signals.objectChanged.add( build );
//
......
......@@ -346,6 +346,27 @@ var Viewport = function ( signals ) {
} );
signals.flattenSelectedObject.add( function () {
var name = selected.name ? '"' + selected.name + '"': "selected object";
if ( confirm( 'Flatten ' + name + '?' ) === false ) return;
delete selected.__webglInit; // TODO: Remove hack (WebGLRenderer refactoring)
var geometry = selected.geometry.clone();
geometry.applyMatrix( selected.matrix );
selected.setGeometry( geometry );
selected.position.set( 0, 0, 0 );
selected.rotation.set( 0, 0, 0 );
selected.scale.set( 1, 1, 1 );
signals.objectChanged.dispatch( selected );
} );
signals.cloneSelectedObject.add( function () {
if ( selected === camera ) return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册