Просмотр исходного кода

Editor: Add default environment. (#32752)

mrdoob 1 месяц назад
Родитель
Сommit
a519dddc3c
4 измененных файлов с 21 добавлено и 14 удалено
  1. 4 0
      editor/index.html
  2. 6 4
      editor/js/Editor.js
  3. 10 9
      editor/js/Sidebar.Scene.js
  4. 1 1
      editor/js/Viewport.js

+ 4 - 0
editor/index.html

@@ -112,6 +112,10 @@
 
 						await editor.fromJSON( state );
 
+					} else {
+
+						editor.signals.sceneEnvironmentChanged.dispatch( 'Default' );
+
 					}
 
 					const selected = editor.config.getKey( 'selected' );

+ 6 - 4
editor/js/Editor.js

@@ -686,10 +686,12 @@ Editor.prototype = {
 
 		this.setScene( await loader.parseAsync( json.scene ) );
 
-		if ( json.environment === 'Room' ||
-			 json.environment === 'ModelViewer' /* DEPRECATED */ ) {
+		if ( json.environment == null ||
+			 json.environment === 'Default' ||
+			 json.environment === 'Room' /* COMPAT */ ||
+			 json.environment === 'ModelViewer' /* COMPAT */ ) {
 
-			this.signals.sceneEnvironmentChanged.dispatch( json.environment );
+			this.signals.sceneEnvironmentChanged.dispatch( 'Default' );
 			this.signals.refreshSidebarEnvironment.dispatch();
 
 		}
@@ -721,7 +723,7 @@ Editor.prototype = {
 
 		if ( this.scene.environment !== null && this.scene.environment.isRenderTargetTexture === true ) {
 
-			environment = 'Room';
+			environment = 'Default';
 
 		}
 

+ 10 - 9
editor/js/Sidebar.Scene.js

@@ -154,12 +154,13 @@ function SidebarScene( editor ) {
 
 	const backgroundType = new UISelect().setOptions( {
 
-		'None': '',
+		'Default': 'Default',
 		'Color': 'Color',
 		'Texture': 'Texture',
 		'Equirectangular': 'Equirect'
 
 	} ).setWidth( '150px' );
+	backgroundType.setValue( 'Default' );
 	backgroundType.onChange( function () {
 
 		onBackgroundChanged();
@@ -233,7 +234,7 @@ function SidebarScene( editor ) {
 
 		const type = backgroundType.getValue();
 
-		backgroundType.setWidth( type === 'None' ? '150px' : '110px' );
+		backgroundType.setWidth( type === 'Default' ? '150px' : '110px' );
 		backgroundColor.setDisplay( type === 'Color' ? '' : 'none' );
 		backgroundTexture.setDisplay( type === 'Texture' ? '' : 'none' );
 		backgroundEquirectangularTexture.setDisplay( type === 'Equirectangular' ? '' : 'none' );
@@ -257,13 +258,13 @@ function SidebarScene( editor ) {
 
 	const environmentType = new UISelect().setOptions( {
 
-		'None': '',
+		'Default': 'Default',
 		'Background': 'Background',
 		'Equirectangular': 'Equirect',
-		'Room': 'Room'
+		'None': 'None'
 
 	} ).setWidth( '150px' );
-	environmentType.setValue( 'None' );
+	environmentType.setValue( 'Default' );
 	environmentType.onChange( function () {
 
 		onEnvironmentChanged();
@@ -327,7 +328,7 @@ function SidebarScene( editor ) {
 	const fogTypeRow = new UIRow();
 	const fogType = new UISelect().setOptions( {
 
-		'None': '',
+		'None': 'None',
 		'Fog': 'Linear',
 		'FogExp2': 'Exponential'
 
@@ -445,7 +446,7 @@ function SidebarScene( editor ) {
 
 		} else {
 
-			backgroundType.setValue( 'None' );
+			backgroundType.setValue( 'Default' );
 			backgroundTexture.setValue( null );
 			backgroundEquirectangularTexture.setValue( null );
 			backgroundColorSpace.setValue( THREE.NoColorSpace );
@@ -465,13 +466,13 @@ function SidebarScene( editor ) {
 
 			} else if ( scene.environment.isRenderTargetTexture === true ) {
 
-				environmentType.setValue( 'Room' );
+				environmentType.setValue( 'Default' );
 
 			}
 
 		} else {
 
-			environmentType.setValue( 'None' );
+			environmentType.setValue( 'Default' );
 			environmentEquirectangularTexture.setValue( null );
 
 		}

+ 1 - 1
editor/js/Viewport.js

@@ -592,7 +592,7 @@ function Viewport( editor ) {
 
 				break;
 
-			case 'Room':
+			case 'Default':
 
 				scene.environment = pmremGenerator.fromScene( new RoomEnvironment(), 0.04 ).texture;
 

粤ICP备19079148号