Skip to content

Commit

Permalink
Editor: Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Feb 7, 2021
1 parent 72b446c commit 4885b4c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 62 deletions.
3 changes: 1 addition & 2 deletions editor/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ textarea, input { outline: none; } /* osx */

.TabbedPanel .Tabs .Tab {
padding: 10px;
vertical-align: middle;
text-transform: uppercase;
}

Expand Down Expand Up @@ -240,7 +239,7 @@ textarea, input { outline: none; } /* osx */
/* */

#outliner .Script:after {
content: '{...}' /* ❮/❯ */
content: '◎'
}

/* */
Expand Down
2 changes: 1 addition & 1 deletion editor/examples/shaders.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"uuid": "EA781333-F3AE-470D-9110-A9724FCB42AA",
"type": "IcosahedronGeometry",
"radius": 1,
"detail": 4
"detail": 24
}],
"materials": [
{
Expand Down
2 changes: 2 additions & 0 deletions editor/js/Menubar.Help.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function MenubarHelp( editor ) {
} );
options.add( option );

/*
// Icon
var option = new UIRow();
Expand All @@ -39,6 +40,7 @@ function MenubarHelp( editor ) {
} );
options.add( option );
*/

// About

Expand Down
104 changes: 46 additions & 58 deletions editor/js/Sidebar.Project.Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,96 +20,89 @@ function SidebarProjectRenderer( editor ) {
// Antialias

var antialiasRow = new UIRow();
var antialiasBoolean = new UIBoolean( config.getKey( 'project/renderer/antialias' ) ).onChange( function () {

createRenderer();

} );
container.add( antialiasRow );

antialiasRow.add( new UIText( strings.getKey( 'sidebar/project/antialias' ) ).setWidth( '90px' ) );

var antialiasBoolean = new UIBoolean( config.getKey( 'project/renderer/antialias' ) ).onChange( createRenderer );
antialiasRow.add( antialiasBoolean );

container.add( antialiasRow );
// Physically Correct lights

// Shadows
var physicallyCorrectLightsRow = new UIRow();
container.add( physicallyCorrectLightsRow );

var shadowsRow = new UIRow();
var shadowsBoolean = new UIBoolean( config.getKey( 'project/renderer/shadows' ) ).onChange( function () {
physicallyCorrectLightsRow.add( new UIText( strings.getKey( 'sidebar/project/physicallyCorrectLights' ) ).setWidth( '90px' ) );

currentRenderer.shadowMap.enabled = this.getValue();
var physicallyCorrectLightsBoolean = new UIBoolean( config.getKey( 'project/renderer/physicallyCorrectLights' ) ).onChange( function () {

currentRenderer.physicallyCorrectLights = this.getValue();
signals.rendererUpdated.dispatch();

} );
physicallyCorrectLightsRow.add( physicallyCorrectLightsBoolean );

// Shadows

var shadowsRow = new UIRow();
container.add( shadowsRow );

shadowsRow.add( new UIText( strings.getKey( 'sidebar/project/shadows' ) ).setWidth( '90px' ) );

var shadowsBoolean = new UIBoolean( config.getKey( 'project/renderer/shadows' ) ).onChange( updateShadows );
shadowsRow.add( shadowsBoolean );

var shadowTypeSelect = new UISelect().setOptions( {
0: 'Basic',
1: 'PCF',
2: 'PCF (Soft)',
2: 'PCF Soft',
// 3: 'VSM'
} ).setWidth( '125px' ).onChange( function () {

currentRenderer.shadowMap.type = parseFloat( this.getValue() );
signals.rendererUpdated.dispatch();

} );
} ).setWidth( '125px' ).onChange( updateShadows );
shadowTypeSelect.setValue( config.getKey( 'project/renderer/shadowType' ) );

shadowsRow.add( shadowTypeSelect );

container.add( shadowsRow );

// Physically Correct lights
function updateShadows() {

var physicallyCorrectLightsRow = new UIRow();
var physicallyCorrectLightsBoolean = new UIBoolean( config.getKey( 'project/renderer/physicallyCorrectLights' ) ).onChange( function () {
currentRenderer.shadowMap.enabled = shadowsBoolean.getValue();
currentRenderer.shadowMap.type = parseFloat( shadowTypeSelect.getValue() );

currentRenderer.physicallyCorrectLights = this.getValue();
signals.rendererUpdated.dispatch();

} );

physicallyCorrectLightsRow.add( new UIText( strings.getKey( 'sidebar/project/physicallyCorrectLights' ) ).setWidth( '90px' ) );
physicallyCorrectLightsRow.add( physicallyCorrectLightsBoolean );

container.add( physicallyCorrectLightsRow );
}

// Tonemapping

var toneMappingRow = new UIRow();
container.add( toneMappingRow );

toneMappingRow.add( new UIText( strings.getKey( 'sidebar/project/toneMapping' ) ).setWidth( '90px' ) );

var toneMappingSelect = new UISelect().setOptions( {
0: 'None',
0: 'No',
1: 'Linear',
2: 'Reinhard',
3: 'Cineon',
4: 'ACESFilmic'
} ).setWidth( '120px' ).onChange( function () {

currentRenderer.toneMapping = parseFloat( this.getValue() );
toneMappingExposure.setDisplay( currentRenderer.toneMapping === 0 ? 'none' : '' );
signals.rendererUpdated.dispatch();

} );
} ).setWidth( '120px' ).onChange( updateToneMapping );
toneMappingSelect.setValue( config.getKey( 'project/renderer/toneMapping' ) );

toneMappingRow.add( new UIText( strings.getKey( 'sidebar/project/toneMapping' ) ).setWidth( '90px' ) );
toneMappingRow.add( toneMappingSelect );

var toneMappingExposure = new UINumber( config.getKey( 'project/renderer/toneMappingExposure' ) );
toneMappingExposure.setDisplay( toneMappingSelect.getValue() === '0' ? 'none' : '' );
toneMappingExposure.setWidth( '30px' ).setMarginLeft( '10px' );
toneMappingExposure.setRange( 0, 10 );
toneMappingExposure.onChange( function () {
toneMappingExposure.onChange( updateToneMapping );
toneMappingRow.add( toneMappingExposure );

currentRenderer.toneMappingExposure = this.getValue();
signals.rendererUpdated.dispatch();
function updateToneMapping() {

} );
toneMappingRow.add( toneMappingExposure );
toneMappingExposure.setDisplay( toneMappingSelect.getValue() === '0' ? 'none' : '' );

container.add( toneMappingRow );
currentRenderer.toneMapping = parseFloat( toneMappingSelect.getValue() );
currentRenderer.toneMappingExposure = toneMappingExposure.getValue();
signals.rendererUpdated.dispatch();

}

//

Expand All @@ -129,32 +122,27 @@ function SidebarProjectRenderer( editor ) {

createRenderer();

// signals

// Signals

signals.editorCleared.add( function () {

currentRenderer.physicallyCorrectLights = false;
currentRenderer.shadowMap.enabled = true;
currentRenderer.shadowMap.type = 1;
currentRenderer.toneMapping = 0;
currentRenderer.shadowMap.type = THREE.PCFShadowMap;
currentRenderer.toneMapping = THREE.NoToneMapping;
currentRenderer.toneMappingExposure = 1;

refreshRendererUI();

signals.rendererUpdated.dispatch();

} );

function refreshRendererUI() {

physicallyCorrectLightsBoolean.setValue( currentRenderer.physicallyCorrectLights );
shadowsBoolean.setValue( currentRenderer.shadowMap.enabled );
shadowTypeSelect.setValue( currentRenderer.shadowMap.type );
toneMappingSelect.setValue( currentRenderer.toneMapping );
toneMappingExposure.setValue( currentRenderer.toneMappingExposure );
toneMappingExposure.setDisplay( currentRenderer.toneMapping === 0 ? 'none' : '' );

}
signals.rendererUpdated.dispatch();

} );

signals.rendererUpdated.add( function () {

Expand Down
2 changes: 1 addition & 1 deletion editor/js/Sidebar.Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ function SidebarScene( editor ) {

if ( ignoreObjectSelectedSignal === true ) return;

if ( object !== null ) {
if ( object !== null && object.parent !== null ) {

let needsRefresh = false;
let parent = object.parent;
Expand Down

0 comments on commit 4885b4c

Please sign in to comment.