Skip to content

Commit a519ddd

Browse files
authored
Editor: Add default environment. (#32752)
1 parent e90650f commit a519ddd

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

editor/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@
112112

113113
await editor.fromJSON( state );
114114

115+
} else {
116+
117+
editor.signals.sceneEnvironmentChanged.dispatch( 'Default' );
118+
115119
}
116120

117121
const selected = editor.config.getKey( 'selected' );

editor/js/Editor.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -686,10 +686,12 @@ Editor.prototype = {
686686

687687
this.setScene( await loader.parseAsync( json.scene ) );
688688

689-
if ( json.environment === 'Room' ||
690-
json.environment === 'ModelViewer' /* DEPRECATED */ ) {
689+
if ( json.environment == null ||
690+
json.environment === 'Default' ||
691+
json.environment === 'Room' /* COMPAT */ ||
692+
json.environment === 'ModelViewer' /* COMPAT */ ) {
691693

692-
this.signals.sceneEnvironmentChanged.dispatch( json.environment );
694+
this.signals.sceneEnvironmentChanged.dispatch( 'Default' );
693695
this.signals.refreshSidebarEnvironment.dispatch();
694696

695697
}
@@ -721,7 +723,7 @@ Editor.prototype = {
721723

722724
if ( this.scene.environment !== null && this.scene.environment.isRenderTargetTexture === true ) {
723725

724-
environment = 'Room';
726+
environment = 'Default';
725727

726728
}
727729

editor/js/Sidebar.Scene.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,13 @@ function SidebarScene( editor ) {
154154

155155
const backgroundType = new UISelect().setOptions( {
156156

157-
'None': '',
157+
'Default': 'Default',
158158
'Color': 'Color',
159159
'Texture': 'Texture',
160160
'Equirectangular': 'Equirect'
161161

162162
} ).setWidth( '150px' );
163+
backgroundType.setValue( 'Default' );
163164
backgroundType.onChange( function () {
164165

165166
onBackgroundChanged();
@@ -233,7 +234,7 @@ function SidebarScene( editor ) {
233234

234235
const type = backgroundType.getValue();
235236

236-
backgroundType.setWidth( type === 'None' ? '150px' : '110px' );
237+
backgroundType.setWidth( type === 'Default' ? '150px' : '110px' );
237238
backgroundColor.setDisplay( type === 'Color' ? '' : 'none' );
238239
backgroundTexture.setDisplay( type === 'Texture' ? '' : 'none' );
239240
backgroundEquirectangularTexture.setDisplay( type === 'Equirectangular' ? '' : 'none' );
@@ -257,13 +258,13 @@ function SidebarScene( editor ) {
257258

258259
const environmentType = new UISelect().setOptions( {
259260

260-
'None': '',
261+
'Default': 'Default',
261262
'Background': 'Background',
262263
'Equirectangular': 'Equirect',
263-
'Room': 'Room'
264+
'None': 'None'
264265

265266
} ).setWidth( '150px' );
266-
environmentType.setValue( 'None' );
267+
environmentType.setValue( 'Default' );
267268
environmentType.onChange( function () {
268269

269270
onEnvironmentChanged();
@@ -327,7 +328,7 @@ function SidebarScene( editor ) {
327328
const fogTypeRow = new UIRow();
328329
const fogType = new UISelect().setOptions( {
329330

330-
'None': '',
331+
'None': 'None',
331332
'Fog': 'Linear',
332333
'FogExp2': 'Exponential'
333334

@@ -445,7 +446,7 @@ function SidebarScene( editor ) {
445446

446447
} else {
447448

448-
backgroundType.setValue( 'None' );
449+
backgroundType.setValue( 'Default' );
449450
backgroundTexture.setValue( null );
450451
backgroundEquirectangularTexture.setValue( null );
451452
backgroundColorSpace.setValue( THREE.NoColorSpace );
@@ -465,13 +466,13 @@ function SidebarScene( editor ) {
465466

466467
} else if ( scene.environment.isRenderTargetTexture === true ) {
467468

468-
environmentType.setValue( 'Room' );
469+
environmentType.setValue( 'Default' );
469470

470471
}
471472

472473
} else {
473474

474-
environmentType.setValue( 'None' );
475+
environmentType.setValue( 'Default' );
475476
environmentEquirectangularTexture.setValue( null );
476477

477478
}

editor/js/Viewport.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ function Viewport( editor ) {
592592

593593
break;
594594

595-
case 'Room':
595+
case 'Default':
596596

597597
scene.environment = pmremGenerator.fromScene( new RoomEnvironment(), 0.04 ).texture;
598598

0 commit comments

Comments
 (0)