private void OnGUI() { EditorGUIUtility.labelWidth = (float)((double)this.position.width - 64.0 - 20.0); bool flag1 = true; this.m_ScrollPosition = EditorGUILayout.BeginVerticalScrollView(this.m_ScrollPosition, false, GUI.skin.verticalScrollbar, GUI.skin.scrollView); bool flag2 = flag1 & this.ValidateTerrain(); EditorGUI.BeginChangeCheck(); GUILayout.BeginHorizontal(); string label = string.Empty; float alignmentOffset = 0.0f; switch (this.m_Terrain.materialType) { case Terrain.MaterialType.BuiltInStandard: label = " Albedo (RGB)\nSmoothness (A)"; alignmentOffset = 15f; break; case Terrain.MaterialType.BuiltInLegacyDiffuse: label = "\n Diffuse (RGB)"; alignmentOffset = 15f; break; case Terrain.MaterialType.BuiltInLegacySpecular: label = "Diffuse (RGB)\n Gloss (A)"; alignmentOffset = 12f; break; case Terrain.MaterialType.Custom: label = " \n Splat"; alignmentOffset = 0.0f; break; } TerrainSplatEditor.TextureFieldGUI(label, ref this.m_Texture, alignmentOffset); TerrainSplatEditor.TextureFieldGUI("\nNormal", ref this.m_NormalMap, -4f); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); bool flag3 = flag2 & this.ValidateMainTexture(this.m_Texture); if (flag3) { if (TerrainSplatEditor.IsUsingMetallic(this.m_Terrain.materialType, this.m_Terrain.materialTemplate)) { EditorGUILayout.Space(); float labelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 75f; this.m_Metallic = EditorGUILayout.Slider("Metallic", this.m_Metallic, 0.0f, 1f, new GUILayoutOption[0]); EditorGUIUtility.labelWidth = labelWidth; } else if (TerrainSplatEditor.IsUsingSpecular(this.m_Terrain.materialType, this.m_Terrain.materialTemplate)) { this.m_Specular = EditorGUILayout.ColorField("Specular", this.m_Specular, new GUILayoutOption[0]); } if (TerrainSplatEditor.IsUsingSmoothness(this.m_Terrain.materialType, this.m_Terrain.materialTemplate) && !TextureUtil.HasAlphaTextureFormat(this.m_Texture.format)) { EditorGUILayout.Space(); float labelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 75f; this.m_Smoothness = EditorGUILayout.Slider("Smoothness", this.m_Smoothness, 0.0f, 1f, new GUILayoutOption[0]); EditorGUIUtility.labelWidth = labelWidth; } } TerrainSplatEditor.SplatSizeGUI(ref this.m_TileSize, ref this.m_TileOffset); bool flag4 = EditorGUI.EndChangeCheck(); EditorGUILayout.EndScrollView(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUI.enabled = flag3; if (GUILayout.Button(this.m_ButtonTitle, new GUILayoutOption[1] { GUILayout.MinWidth(100f) })) { this.ApplyTerrainSplat(); this.Close(); GUIUtility.ExitGUI(); } GUI.enabled = true; GUILayout.EndHorizontal(); if (!flag4 || !flag3 || this.m_Index == -1) { return; } this.ApplyTerrainSplat(); }
private void OnGUI() { EditorGUIUtility.labelWidth = (float)Screen.width - 64f - 20f; bool flag = true; this.m_ScrollPosition = EditorGUILayout.BeginVerticalScrollView(this.m_ScrollPosition, false, GUI.skin.verticalScrollbar, GUI.skin.scrollView, new GUILayoutOption[0]); flag &= this.ValidateTerrain(); EditorGUI.BeginChangeCheck(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); string label = string.Empty; float alignmentOffset = 0f; switch (this.m_Terrain.materialType) { case Terrain.MaterialType.BuiltInStandard: if (this.m_Terrain.useDefaultSmoothness) { label = "\n Albedo (RGB)"; } else { label = " Albedo (RGB)\nSmoothness (A)"; } alignmentOffset = 15f; break; case Terrain.MaterialType.BuiltInLegacyDiffuse: label = "\n Diffuse (RGB)"; alignmentOffset = 15f; break; case Terrain.MaterialType.BuiltInLegacySpecular: label = "Diffuse (RGB)\n Gloss (A)"; alignmentOffset = 12f; break; case Terrain.MaterialType.Custom: label = " \n Splat"; alignmentOffset = 0f; break; } TerrainSplatEditor.TextureFieldGUI(label, ref this.m_Texture, alignmentOffset); TerrainSplatEditor.TextureFieldGUI("\nNormal", ref this.m_NormalMap, -4f); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); flag &= this.ValidateMainTexture(this.m_Texture); if (flag) { if (TerrainSplatEditor.IsUsingMetallic(this.m_Terrain.materialType, this.m_Terrain.materialTemplate)) { EditorGUILayout.Space(); float labelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 60f; this.m_Metallic = EditorGUILayout.Slider("Metallic", this.m_Metallic, 0f, 1f, new GUILayoutOption[0]); EditorGUIUtility.labelWidth = labelWidth; } else { if (TerrainSplatEditor.IsUsingSpecular(this.m_Terrain.materialType, this.m_Terrain.materialTemplate)) { this.m_Specular = EditorGUILayout.ColorField("Specular", this.m_Specular, new GUILayoutOption[0]); } } } TerrainSplatEditor.SplatSizeGUI(ref this.m_TileSize, ref this.m_TileOffset); bool flag2 = EditorGUI.EndChangeCheck(); EditorGUILayout.EndScrollView(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUI.enabled = flag; if (GUILayout.Button(this.m_ButtonTitle, new GUILayoutOption[] { GUILayout.MinWidth(100f) })) { this.ApplyTerrainSplat(); base.Close(); GUIUtility.ExitGUI(); } GUI.enabled = true; GUILayout.EndHorizontal(); if (flag2 && flag && this.m_Index != -1) { this.ApplyTerrainSplat(); } }