static private FoldoutTitlebar ( bool foldout, |
||
foldout | bool | |
label | ||
return | bool |
private void DebugSettingsGUI() { this.m_ShowDebugSettings = EditorGUILayout.FoldoutTitlebar(this.m_ShowDebugSettings, LightingWindowLightingTab.Styles.DebugSettings, true); if (this.m_ShowDebugSettings) { EditorGUI.indentLevel++; this.m_ShowProbeDebugSettings = EditorGUILayout.Foldout(this.m_ShowProbeDebugSettings, LightingWindowLightingTab.Styles.LightProbeVisualization); if (this.m_ShowProbeDebugSettings) { EditorGUI.BeginChangeCheck(); EditorGUI.indentLevel++; LightProbeVisualization.lightProbeVisualizationMode = (LightProbeVisualization.LightProbeVisualizationMode)EditorGUILayout.EnumPopup(LightProbeVisualization.lightProbeVisualizationMode, new GUILayoutOption[0]); LightProbeVisualization.showInterpolationWeights = EditorGUILayout.Toggle("Display Weights", LightProbeVisualization.showInterpolationWeights, new GUILayoutOption[0]); LightProbeVisualization.showOcclusions = EditorGUILayout.Toggle("Display Occlusion", LightProbeVisualization.showOcclusions, new GUILayoutOption[0]); EditorGUI.indentLevel--; if (EditorGUI.EndChangeCheck()) { EditorApplication.SetSceneRepaintDirty(); } } EditorGUILayout.Space(); this.m_BakeSettings.DeveloperBuildSettingsGUI(); EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
void LightingSettingsGUI() { m_ShowLightingSettings.value = EditorGUILayout.FoldoutTitlebar(m_ShowLightingSettings.value, Styles.lightingSettings, true); if (m_ShowLightingSettings.value) { ++EditorGUI.indentLevel; EditorGUILayout.PropertyField(m_LightingSettingsAsset, GUIContent.Temp("Lighting Settings Asset")); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(Styles.newLightingSettings, GUILayout.Width(170))) { var ls = new LightingSettings(); ls.name = "New Lighting Settings"; Undo.RecordObject(m_LightmapSettings.targetObject, "New Lighting Settings"); Lightmapping.lightingSettingsInternal = ls; ProjectWindowUtil.CreateAsset(ls, (ls.name + ".lighting")); } GUILayout.EndHorizontal(); EditorGUILayout.Space(); --EditorGUI.indentLevel; } }
void DebugSettingsGUI() { m_ShowDebugSettings.value = EditorGUILayout.FoldoutTitlebar(m_ShowDebugSettings.value, Styles.DebugSettings, true); if (m_ShowDebugSettings.value) { EditorGUI.indentLevel++; m_ShowProbeDebugSettings.value = EditorGUILayout.Foldout(m_ShowProbeDebugSettings.value, Styles.LightProbeVisualization, true); if (m_ShowProbeDebugSettings.value) { EditorGUI.BeginChangeCheck(); EditorGUI.indentLevel++; LightProbeVisualization.lightProbeVisualizationMode = (LightProbeVisualization.LightProbeVisualizationMode)EditorGUILayout.EnumPopup(LightProbeVisualization.lightProbeVisualizationMode); LightProbeVisualization.showInterpolationWeights = EditorGUILayout.Toggle(Styles.DisplayWeights, LightProbeVisualization.showInterpolationWeights); LightProbeVisualization.showOcclusions = EditorGUILayout.Toggle(Styles.DisplayOcclusion, LightProbeVisualization.showOcclusions); LightProbeVisualization.highlightInvalidCells = EditorGUILayout.Toggle(Styles.HighlightInvalidCells, LightProbeVisualization.highlightInvalidCells); EditorGUI.indentLevel--; if (EditorGUI.EndChangeCheck()) { EditorApplication.SetSceneRepaintDirty(); } } m_BakeSettings.DeveloperBuildSettingsGUI(); EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
void OtherSettingsGUI() { if (SupportedRenderingFeatures.active.overridesFog && SupportedRenderingFeatures.active.overridesOtherLightingSettings) { return; } m_ShowOtherSettings.value = EditorGUILayout.FoldoutTitlebar(m_ShowOtherSettings.value, Styles.OtherSettings, true); if (m_ShowOtherSettings.value) { EditorGUI.indentLevel++; if (!SupportedRenderingFeatures.active.overridesFog) { fogEditor.OnInspectorGUI(); } if (!SupportedRenderingFeatures.active.overridesOtherLightingSettings) { otherRenderingEditor.OnInspectorGUI(); } EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
private void GeneralSettingsGUI(SerializedObject so, SerializedProperty enableRealtimeGI, SerializedProperty enableBakedGI) { this.m_ShowGeneralSettings = EditorGUILayout.FoldoutTitlebar(this.m_ShowGeneralSettings, LightingWindow.styles.GeneralGILabel); if (!this.m_ShowGeneralSettings) { return; } SerializedProperty property = so.FindProperty("m_GISettings.m_AlbedoBoost"); SerializedProperty property2 = so.FindProperty("m_GISettings.m_IndirectOutputScale"); SerializedProperty property3 = so.FindProperty("m_LightmapEditorSettings.m_TextureWidth"); SerializedProperty prop = so.FindProperty("m_LightmapEditorSettings.m_LightmapParameters"); SerializedProperty serializedProperty = so.FindProperty("m_LightmapsMode"); bool flag = enableBakedGI.boolValue || enableRealtimeGI.boolValue; EditorGUI.BeginDisabledGroup(!flag); EditorGUI.indentLevel++; EditorGUILayout.IntPopup(serializedProperty, this.kModeStrings, this.kModeValues, LightingWindow.s_Styles.DirectionalMode, new GUILayoutOption[0]); if (serializedProperty.intValue == 2) { EditorGUILayout.HelpBox(LightingWindow.s_Styles.NoDirectionalSpecularInSM2AndGLES2.text, MessageType.Warning); } EditorGUILayout.Slider(property2, 0f, 5f, LightingWindow.styles.IndirectOutputScale, new GUILayoutOption[0]); EditorGUILayout.Slider(property, 1f, 10f, LightingWindow.styles.AlbedoBoost, new GUILayoutOption[0]); if (LightingWindowObjectTab.LightmapParametersGUI(prop, LightingWindow.styles.DefaultLightmapParameters)) { this.m_Mode = LightingWindow.Mode.ObjectSettings; } EditorGUILayout.IntPopup(property3, this.kMaxAtlasSizeStrings, this.kMaxAtlasSizeValues, LightingWindow.styles.MaxAtlasSize, new GUILayoutOption[0]); this.DeveloperBuildEnlightenSettings(so); EditorGUI.EndDisabledGroup(); EditorGUI.indentLevel--; }
private void OtherSettingsGUI() { this.m_ShowOtherSettings = EditorGUILayout.FoldoutTitlebar(this.m_ShowOtherSettings, LightingWindowLightingTab.Styles.OtherSettings, true); if (this.m_ShowOtherSettings) { EditorGUI.indentLevel++; this.fogEditor.OnInspectorGUI(); this.otherRenderingEditor.OnInspectorGUI(); EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
void MixedLightingGUI() { if (!SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked)) { return; } m_ShowMixedLightsSettings = EditorGUILayout.FoldoutTitlebar(m_ShowMixedLightsSettings, Styles.MixedLightsLabel, true); if (m_ShowMixedLightsSettings) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_EnabledBakedGI, Styles.EnableBaked); if (!m_EnabledBakedGI.boolValue) { EditorGUILayout.HelpBox(Styles.BakedGIDisabledInfo.text, MessageType.Info); } using (new EditorGUI.DisabledScope(!m_EnabledBakedGI.boolValue)) { bool mixedGISupported = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Mixed); if (mixedGISupported) { EditorGUILayout.IntPopup(m_MixedBakeMode, Styles.MixedModeStrings, Styles.MixedModeValues, Styles.MixedLightMode); if (!SupportedRenderingFeatures.IsMixedLightingModeSupported((MixedLightingMode)m_MixedBakeMode.intValue)) { string fallbackMode = Styles.MixedModeStrings[(int)SupportedRenderingFeatures.FallbackMixedLightingMode()].text; EditorGUILayout.HelpBox("The Mixed Mode is not supported by the current render pipline. Fallback mode is " + fallbackMode, MessageType.Warning); } else if (m_EnabledBakedGI.boolValue) { EditorGUILayout.HelpBox(Styles.HelpStringsMixed[m_MixedBakeMode.intValue].text, MessageType.Info); } if (m_MixedBakeMode.intValue == (int)MixedLightingMode.Subtractive) { EditorGUILayout.PropertyField(m_SubtractiveShadowColor, Styles.SubtractiveShadowColor); m_RenderSettingsSO.ApplyModifiedProperties(); EditorGUILayout.Space(); } } } EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
void OtherSettingsGUI() { m_ShowOtherSettings = EditorGUILayout.FoldoutTitlebar(m_ShowOtherSettings, Styles.OtherSettings, true); if (m_ShowOtherSettings) { EditorGUI.indentLevel++; fogEditor.OnInspectorGUI(); otherRenderingEditor.OnInspectorGUI(); EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
private void RealtimeLightingGUI() { if (SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Realtime)) { this.m_ShowRealtimeLightsSettings = EditorGUILayout.FoldoutTitlebar(this.m_ShowRealtimeLightsSettings, LightingWindowBakeSettings.Styles.RealtimeLightsLabel, true); if (this.m_ShowRealtimeLightsSettings) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(this.m_EnableRealtimeGI, LightingWindowBakeSettings.Styles.UseRealtimeGI, new GUILayoutOption[0]); if (this.m_EnableRealtimeGI.boolValue && LightingWindowBakeSettings.PlayerHasSM20Support()) { EditorGUILayout.HelpBox(LightingWindowBakeSettings.Styles.NoRealtimeGIInSM2AndGLES2.text, MessageType.Warning); } EditorGUI.indentLevel--; EditorGUILayout.Space(); } } }
static bool DoTitlebar(bool isOpen, GUIContent title, GenericMenu.MenuFunction reset) { EditorGUILayout.BeginHorizontal(); isOpen = EditorGUILayout.FoldoutTitlebar(isOpen, title, true); GUILayout.FlexibleSpace(); if (reset != null && GUILayout.Button(EditorGUI.GUIContents.titleSettingsIcon, EditorStyles.iconButton)) { var menu = new GenericMenu(); menu.AddItem(Contents.reset, false, () => { reset(); SceneView.RepaintAll(); }); menu.ShowAsContext(); } EditorGUILayout.EndHorizontal(); return(isOpen); }
private void RealtimeLightingGUI() { this.m_ShowRealtimeLightsSettings = EditorGUILayout.FoldoutTitlebar(this.m_ShowRealtimeLightsSettings, LightingWindowBakeSettings.Styles.RealtimeLightsLabel, true); if (this.m_ShowRealtimeLightsSettings) { EditorGUI.indentLevel++; int num; int mixedMode; this.m_LightModeUtil.GetModes(out num, out mixedMode); bool flag = num == 0; flag = EditorGUILayout.Toggle(LightingWindowBakeSettings.Styles.UseRealtimeGI, flag, new GUILayoutOption[0]); if (flag != (num == 0)) { this.m_LightModeUtil.Store((!flag) ? 1 : 0, mixedMode); } EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
public override void OnInspectorGUI() { base.serializedObject.Update(); EditorGUILayout.Space(); this.m_ShowEditor = EditorGUILayout.FoldoutTitlebar(this.m_ShowEditor, Styles.otherHeader); if (this.m_ShowEditor) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(this.m_HaloTexture, new GUILayoutOption[0]); EditorGUILayout.Slider(this.m_HaloStrength, 0f, 1f, new GUILayoutOption[0]); EditorGUILayout.Space(); EditorGUILayout.PropertyField(this.m_FlareFadeSpeed, new GUILayoutOption[0]); EditorGUILayout.Slider(this.m_FlareStrength, 0f, 1f, new GUILayoutOption[0]); EditorGUILayout.Space(); EditorGUILayout.PropertyField(this.m_SpotCookie, new GUILayoutOption[0]); EditorGUI.indentLevel--; base.serializedObject.ApplyModifiedProperties(); } }
public override void OnInspectorGUI() { this.serializedObject.Update(); EditorGUILayout.Space(); this.m_ShowEditor = EditorGUILayout.FoldoutTitlebar(this.m_ShowEditor, OtherRenderingEditor.Styles.otherHeader); if (!this.m_ShowEditor) { return; } ++EditorGUI.indentLevel; EditorGUILayout.PropertyField(this.m_HaloTexture); EditorGUILayout.Slider(this.m_HaloStrength, 0.0f, 1f); EditorGUILayout.Space(); EditorGUILayout.PropertyField(this.m_FlareFadeSpeed); EditorGUILayout.Slider(this.m_FlareStrength, 0.0f, 1f); EditorGUILayout.Space(); EditorGUILayout.PropertyField(this.m_SpotCookie); --EditorGUI.indentLevel; this.serializedObject.ApplyModifiedProperties(); }
private void MixedLightingGUI() { if (SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked)) { this.m_ShowMixedLightsSettings = EditorGUILayout.FoldoutTitlebar(this.m_ShowMixedLightsSettings, LightingWindowBakeSettings.Styles.MixedLightsLabel, true); if (this.m_ShowMixedLightsSettings) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(this.m_EnabledBakedGI, LightingWindowBakeSettings.Styles.EnableBaked, new GUILayoutOption[0]); if (!this.m_EnabledBakedGI.boolValue) { EditorGUILayout.HelpBox(LightingWindowBakeSettings.Styles.BakedGIDisabledInfo.text, MessageType.Info); } using (new EditorGUI.DisabledScope(!this.m_EnabledBakedGI.boolValue)) { bool flag = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Mixed); if (flag) { EditorGUILayout.IntPopup(this.m_MixedBakeMode, LightingWindowBakeSettings.Styles.MixedModeStrings, LightingWindowBakeSettings.Styles.MixedModeValues, LightingWindowBakeSettings.Styles.MixedLightMode, new GUILayoutOption[0]); if (!SupportedRenderingFeatures.IsMixedLightingModeSupported((MixedLightingMode)this.m_MixedBakeMode.intValue)) { string text = LightingWindowBakeSettings.Styles.MixedModeStrings[(int)SupportedRenderingFeatures.FallbackMixedLightingMode()].text; EditorGUILayout.HelpBox("The Mixed Mode is not supported by the current render pipline. Fallback mode is " + text, MessageType.Warning); } else if (this.m_EnabledBakedGI.boolValue) { EditorGUILayout.HelpBox(LightingWindowBakeSettings.Styles.HelpStringsMixed[this.m_MixedBakeMode.intValue].text, MessageType.Info); } if (this.m_MixedBakeMode.intValue == 1) { EditorGUILayout.PropertyField(this.m_SubtractiveShadowColor, LightingWindowBakeSettings.Styles.SubtractiveShadowColor, new GUILayoutOption[0]); this.m_RenderSettingsSO.ApplyModifiedProperties(); EditorGUILayout.Space(); } } } EditorGUI.indentLevel--; EditorGUILayout.Space(); } } }
private void MixedLightingGUI() { this.m_ShowMixedLightsSettings = EditorGUILayout.FoldoutTitlebar(this.m_ShowMixedLightsSettings, LightingWindowBakeSettings.Styles.MixedLightsLabel, true); if (this.m_ShowMixedLightsSettings) { EditorGUI.indentLevel++; LightModeUtil.Get().DrawBakedGIElement(); if (!LightModeUtil.Get().AreBakedLightmapsEnabled()) { EditorGUILayout.HelpBox(LightingWindowBakeSettings.Styles.BakedGIDisabledInfo.text, MessageType.Info); } using (new EditorGUI.DisabledScope(!LightModeUtil.Get().AreBakedLightmapsEnabled())) { int realtimeMode; int num; this.m_LightModeUtil.GetModes(out realtimeMode, out num); int num2 = EditorGUILayout.IntPopup(LightingWindowBakeSettings.Styles.MixedLightMode, num, LightingWindowBakeSettings.Styles.MixedModeStrings, LightingWindowBakeSettings.Styles.MixedModeValues, new GUILayoutOption[0]); if (LightmapEditorSettings.giBakeBackend == LightmapEditorSettings.GIBakeBackend.PathTracer && num2 != 0) { EditorGUILayout.HelpBox(LightingWindowBakeSettings.Styles.NoShadowMaskInProgressive.text, MessageType.Warning); } if (LightModeUtil.Get().AreBakedLightmapsEnabled()) { EditorGUILayout.HelpBox(LightingWindowBakeSettings.Styles.HelpStringsMixed[num].text, MessageType.Info); } if (num2 != num) { this.m_LightModeUtil.Store(realtimeMode, num2); } if (this.m_LightModeUtil.IsSubtractiveModeEnabled()) { EditorGUILayout.PropertyField(this.m_SubtractiveShadowColor, LightingWindowBakeSettings.Styles.SubtractiveShadowColor, new GUILayoutOption[0]); this.m_RenderSettingsSO.ApplyModifiedProperties(); EditorGUILayout.Space(); } } EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
private void GeneralSettingsGUI(SerializedObject so, bool enableRealtimeGI, bool enableBakedGI) { this.m_ShowGeneralSettings = EditorGUILayout.FoldoutTitlebar(this.m_ShowGeneralSettings, LightingWindow.styles.GeneralGILabel); if (this.m_ShowGeneralSettings) { SerializedProperty serializedProperty = so.FindProperty("m_GISettings.m_AlbedoBoost"); SerializedProperty property = so.FindProperty("m_GISettings.m_IndirectOutputScale"); SerializedProperty prop = so.FindProperty("m_LightmapEditorSettings.m_LightmapParameters"); SerializedProperty serializedProperty2 = so.FindProperty("m_LightmapEditorSettings.m_LightmapsBakeMode"); bool flag = enableBakedGI || enableRealtimeGI; EditorGUI.indentLevel++; using (new EditorGUI.DisabledScope(!flag)) { EditorGUILayout.IntPopup(serializedProperty2, this.kModeStrings, this.kModeValues, LightingWindow.s_Styles.DirectionalMode, new GUILayoutOption[0]); if (serializedProperty2.intValue == 1) { EditorGUILayout.HelpBox(LightingWindow.s_Styles.NoDirectionalInSM2AndGLES2.text, MessageType.Warning); } if (serializedProperty2.intValue == 2) { EditorGUILayout.HelpBox(LightingWindow.s_Styles.NoDirectionalSpecularInSM2AndGLES2.text, MessageType.Warning); } EditorGUILayout.Slider(property, 0f, 5f, LightingWindow.styles.IndirectOutputScale, new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); EditorGUILayout.Slider(serializedProperty, 1f, 10f, LightingWindow.styles.AlbedoBoost, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { Lightmapping.bounceBoost = serializedProperty.floatValue; } if (LightingWindowObjectTab.LightmapParametersGUI(prop, LightingWindow.styles.DefaultLightmapParameters, false)) { this.m_Mode = LightingWindow.Mode.ObjectSettings; } this.DeveloperBuildEnlightenSettings(so); } EditorGUI.indentLevel--; } }
bool DoTitlebar(bool isOpen, GUIContent title, GenericMenu.MenuFunction reset) { // title bars don't need to clip the prefix label since there's nothing to the right float labelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = position.width; EditorGUILayout.BeginHorizontal(); isOpen = EditorGUILayout.FoldoutTitlebar(isOpen, title, true); GUILayout.FlexibleSpace(); if (reset != null && GUILayout.Button(EditorGUI.GUIContents.titleSettingsIcon, EditorStyles.iconButton)) { var menu = new GenericMenu(); menu.AddItem(Contents.reset, false, () => { reset(); SceneView.RepaintAll(); }); menu.ShowAsContext(); } EditorGUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = labelWidth; return(isOpen); }
void RealtimeLightingGUI() { if (!SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Realtime)) { return; } m_ShowRealtimeLightsSettings = EditorGUILayout.FoldoutTitlebar(m_ShowRealtimeLightsSettings, Styles.RealtimeLightsLabel, true); if (m_ShowRealtimeLightsSettings) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_EnableRealtimeGI, Styles.UseRealtimeGI); if (m_EnableRealtimeGI.boolValue && PlayerHasSM20Support()) { EditorGUILayout.HelpBox(Styles.NoRealtimeGIInSM2AndGLES2.text, MessageType.Warning); } EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
public override void OnInspectorGUI() { this.serializedObject.Update(); this.m_lightmapSettings.Update(); EditorGUILayout.Space(); this.m_ShowEditor = EditorGUILayout.FoldoutTitlebar(this.m_ShowEditor, LightingEditor.Styles.environmentHeader); if (!this.m_ShowEditor) { return; } ++EditorGUI.indentLevel; EditorGUILayout.PropertyField(this.m_SkyboxMaterial, LightingEditor.Styles.skyboxLabel, new GUILayoutOption[0]); Material objectReferenceValue = this.m_SkyboxMaterial.objectReferenceValue as Material; if ((bool)((UnityEngine.Object)objectReferenceValue) && !EditorMaterialUtility.IsBackgroundMaterial(objectReferenceValue)) { EditorGUILayout.HelpBox(LightingEditor.Styles.skyboxWarning.text, MessageType.Warning); } EditorGUILayout.PropertyField(this.m_Sun, LightingEditor.Styles.sunLabel, new GUILayoutOption[0]); EditorGUILayout.Space(); EditorGUILayout.IntPopup(this.m_AmbientMode, LightingEditor.kFullAmbientModes, LightingEditor.kFullAmbientModeValues, LightingEditor.Styles.ambientModeLabel, new GUILayoutOption[0]); ++EditorGUI.indentLevel; switch (this.m_AmbientMode.intValue) { case 0: if ((UnityEngine.Object)objectReferenceValue == (UnityEngine.Object)null) { EditorGUILayout.PropertyField(this.m_AmbientSkyColor, LightingEditor.Styles.ambient, new GUILayoutOption[0]); break; } break; case 1: EditorGUILayout.PropertyField(this.m_AmbientSkyColor, LightingEditor.Styles.ambientUp, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_AmbientEquatorColor, LightingEditor.Styles.ambientMid, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_AmbientGroundColor, LightingEditor.Styles.ambientDown, new GUILayoutOption[0]); break; case 3: EditorGUILayout.PropertyField(this.m_AmbientSkyColor, LightingEditor.Styles.ambient, new GUILayoutOption[0]); break; } --EditorGUI.indentLevel; EditorGUILayout.Slider(this.m_AmbientIntensity, 0.0f, 8f, LightingEditor.Styles.ambientIntensity, new GUILayoutOption[0]); this.m_ShowAmbientBakeMode.target = LightingEditor.ShowAmbientField(); if (EditorGUILayout.BeginFadeGroup(this.m_ShowAmbientBakeMode.faded)) { bool flag = Lightmapping.realtimeLightmapsEnabled && Lightmapping.bakedLightmapsEnabled; EditorGUI.BeginDisabledGroup(!flag); if (flag) { EditorGUILayout.PropertyField(this.m_EnvironmentLightingMode, LightingEditor.Styles.SkyLightBaked, new GUILayoutOption[0]); } else { int index = !Lightmapping.bakedLightmapsEnabled ? 0 : 1; EditorGUILayout.LabelField(LightingEditor.Styles.SkyLightBaked, GUIContent.Temp(this.m_EnvironmentLightingMode.enumNames[index]), EditorStyles.popup, new GUILayoutOption[0]); } EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndFadeGroup(); EditorGUILayout.Space(); EditorGUILayout.PropertyField(this.m_DefaultReflectionMode, LightingEditor.Styles.reflectionModeLabel, new GUILayoutOption[0]); ++EditorGUI.indentLevel; switch ((DefaultReflectionMode)this.m_DefaultReflectionMode.intValue) { case DefaultReflectionMode.FromSkybox: EditorGUILayout.IntPopup(this.m_DefaultReflectionResolution, LightingEditor.Styles.defaultReflectionSizes, LightingEditor.Styles.defaultReflectionSizesValues, LightingEditor.Styles.defaultReflectionResolution, new GUILayoutOption[1] { GUILayout.MinWidth(40f) }); break; case DefaultReflectionMode.Custom: EditorGUILayout.PropertyField(this.m_CustomReflection, LightingEditor.Styles.customReflection, new GUILayoutOption[0]); break; } EditorGUILayout.PropertyField(this.m_ReflectionCompression, LightingEditor.Styles.ReflectionCompression, new GUILayoutOption[0]); --EditorGUI.indentLevel; EditorGUILayout.Slider(this.m_ReflectionIntensity, 0.0f, 1f, LightingEditor.Styles.reflectionIntensity, new GUILayoutOption[0]); EditorGUILayout.IntSlider(this.m_ReflectionBounces, 1, 5, LightingEditor.Styles.reflectionBounces, new GUILayoutOption[0]); --EditorGUI.indentLevel; this.serializedObject.ApplyModifiedProperties(); this.m_lightmapSettings.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { base.serializedObject.Update(); this.m_lightmapSettings.Update(); EditorGUILayout.Space(); this.m_ShowEditor = EditorGUILayout.FoldoutTitlebar(this.m_ShowEditor, Styles.environmentHeader); if (this.m_ShowEditor) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(this.m_SkyboxMaterial, Styles.skyboxLabel, new GUILayoutOption[0]); Material objectReferenceValue = this.m_SkyboxMaterial.objectReferenceValue as Material; if ((objectReferenceValue != null) && !EditorMaterialUtility.IsBackgroundMaterial(objectReferenceValue)) { EditorGUILayout.HelpBox(Styles.skyboxWarning.text, MessageType.Warning); } EditorGUILayout.PropertyField(this.m_Sun, Styles.sunLabel, new GUILayoutOption[0]); EditorGUILayout.Space(); EditorGUILayout.IntPopup(this.m_AmbientMode, kFullAmbientModes, kFullAmbientModeValues, Styles.ambientModeLabel, new GUILayoutOption[0]); EditorGUI.indentLevel++; switch (this.m_AmbientMode.intValue) { case 0: if (objectReferenceValue == null) { EditorGUILayout.PropertyField(this.m_AmbientSkyColor, Styles.ambient, new GUILayoutOption[0]); } break; case 1: EditorGUILayout.PropertyField(this.m_AmbientSkyColor, Styles.ambientUp, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_AmbientEquatorColor, Styles.ambientMid, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_AmbientGroundColor, Styles.ambientDown, new GUILayoutOption[0]); break; case 3: EditorGUILayout.PropertyField(this.m_AmbientSkyColor, Styles.ambient, new GUILayoutOption[0]); break; } EditorGUI.indentLevel--; EditorGUILayout.Slider(this.m_AmbientIntensity, 0f, 8f, Styles.ambientIntensity, new GUILayoutOption[0]); if (Lightmapping.realtimeLightmapsEnabled && Lightmapping.bakedLightmapsEnabled) { EditorGUILayout.PropertyField(this.m_EnvironmentLightingMode, Styles.SkyLightBaked, new GUILayoutOption[0]); } EditorGUILayout.Space(); EditorGUILayout.PropertyField(this.m_DefaultReflectionMode, Styles.reflectionModeLabel, new GUILayoutOption[0]); EditorGUI.indentLevel++; switch (((DefaultReflectionMode) this.m_DefaultReflectionMode.intValue)) { case DefaultReflectionMode.FromSkybox: { GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(40f) }; EditorGUILayout.IntPopup(this.m_DefaultReflectionResolution, Styles.defaultReflectionSizes, Styles.defaultReflectionSizesValues, Styles.defaultReflectionResolution, options); break; } case DefaultReflectionMode.Custom: EditorGUILayout.PropertyField(this.m_CustomReflection, Styles.customReflection, new GUILayoutOption[0]); break; } EditorGUILayout.PropertyField(this.m_ReflectionCompression, Styles.ReflectionCompression, new GUILayoutOption[0]); EditorGUI.indentLevel--; EditorGUILayout.Slider(this.m_ReflectionIntensity, 0f, 1f, Styles.reflectionIntensity, new GUILayoutOption[0]); EditorGUILayout.IntSlider(this.m_ReflectionBounces, 1, 5, Styles.reflectionBounces, new GUILayoutOption[0]); EditorGUI.indentLevel--; base.serializedObject.ApplyModifiedProperties(); this.m_lightmapSettings.ApplyModifiedProperties(); } }
private void DrawGUI() { Material skyboxMaterial = m_SkyboxMaterial.objectReferenceValue as Material; m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(m_bShowEnvironment, Styles.env_top, true); if (m_bShowEnvironment) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_SkyboxMaterial, Styles.env_skybox_mat); if (skyboxMaterial && !EditorMaterialUtility.IsBackgroundMaterial(skyboxMaterial)) { EditorGUILayout.HelpBox(Styles.skyboxWarning.text, MessageType.Warning); } EditorGUILayout.PropertyField(m_Sun, Styles.env_skybox_sun); EditorGUILayout.Space(); EditorGUILayout.PropertyField(m_SubtractiveShadowColor, Styles.SubtractiveColor); EditorGUILayout.Space(); EditorGUILayout.LabelField(Styles.env_amb_top); EditorGUI.indentLevel++; EditorGUILayout.IntPopup(m_AmbientSource, Styles.kFullAmbientSource, Styles.kFullAmbientSourceValues, Styles.env_amb_src); switch ((AmbientMode)m_AmbientSource.intValue) { case AmbientMode.Trilight: { EditorGUI.BeginChangeCheck(); Color newValueUp = EditorGUILayout.ColorField(Styles.ambientUp, m_AmbientSkyColor.colorValue, true, false, true); Color newValueMid = EditorGUILayout.ColorField(Styles.ambientMid, m_AmbientEquatorColor.colorValue, true, false, true); Color newValueDown = EditorGUILayout.ColorField(Styles.ambientDown, m_AmbientGroundColor.colorValue, true, false, true); if (EditorGUI.EndChangeCheck()) { m_AmbientSkyColor.colorValue = newValueUp; m_AmbientEquatorColor.colorValue = newValueMid; m_AmbientGroundColor.colorValue = newValueDown; } } break; case AmbientMode.Flat: { EditorGUI.BeginChangeCheck(); Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true); if (EditorGUI.EndChangeCheck()) { m_AmbientSkyColor.colorValue = newValue; } } break; case AmbientMode.Skybox: if (skyboxMaterial == null) { EditorGUI.BeginChangeCheck(); Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true); if (EditorGUI.EndChangeCheck()) { m_AmbientSkyColor.colorValue = newValue; } } else { // Ambient intensity - maximum is kEmissiveRGBMMax EditorGUILayout.Slider(m_AmbientIntensity, 0.0F, 8.0F, Styles.env_amb_int); } break; } EditorGUI.indentLevel--; EditorGUILayout.Space(); EditorGUILayout.LabelField(Styles.env_refl_top); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_DefaultReflectionMode, Styles.env_refl_src); DefaultReflectionMode defReflectionMode = (DefaultReflectionMode)m_DefaultReflectionMode.intValue; switch (defReflectionMode) { case DefaultReflectionMode.FromSkybox: { int[] reflectionResolutionValuesArray = null; GUIContent[] reflectionResolutionTextArray = null; ReflectionProbeEditor.GetResolutionArray(ref reflectionResolutionValuesArray, ref reflectionResolutionTextArray); EditorGUILayout.IntPopup(m_DefaultReflectionResolution, reflectionResolutionTextArray, reflectionResolutionValuesArray, Styles.env_refl_res, GUILayout.MinWidth(40)); } break; case DefaultReflectionMode.Custom: EditorGUILayout.PropertyField(m_CustomReflection, Styles.customReflection); break; } EditorGUILayout.PropertyField(m_ReflectionCompression, Styles.env_refl_cmp); EditorGUILayout.Slider(m_ReflectionIntensity, 0.0F, 1.0F, Styles.env_refl_int); EditorGUILayout.IntSlider(m_ReflectionBounces, 1, 5, Styles.env_refl_bnc); EditorGUI.indentLevel--; EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
private void DebugInfoSection(LightmapData[] lightmaps) { if (!showDebugInfo) { return; } Lightmapping.ResetExplicitlyShownMemLabels(); float oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 400.0f; { float gpuMemory = Lightmapping.ComputeTotalGPUMemoryUsageInBytes(); if (gpuMemory > 0.0f) { string foldoutNameGPU = String.Format("Total GPU memory ({0})", SizeString(gpuMemory)); EditorGUILayout.FoldoutTitlebar(false, new GUIContent(foldoutNameGPU), true); } } { Dictionary <Hash128, SortedList <int, int> > gbufferHashToLightmapIndices = new Dictionary <Hash128, SortedList <int, int> >(); for (int i = 0; i < lightmaps.Length; i++) { Hash128 gbufferHash; if (Lightmapping.GetGBufferHash(i, out gbufferHash)) { if (!gbufferHashToLightmapIndices.ContainsKey(gbufferHash)) { gbufferHashToLightmapIndices.Add(gbufferHash, new SortedList <int, int>()); } gbufferHashToLightmapIndices[gbufferHash].Add(i, i); } } float totalGBuffersSize = 0.0f; float totalLightmapsSize = 0.0f; foreach (var entry in gbufferHashToLightmapIndices) { Hash128 gbufferHash = entry.Key; float gbufferDataSize = Lightmapping.GetGBufferMemory(ref gbufferHash); totalGBuffersSize += gbufferDataSize; SortedList <int, int> lightmapIndices = entry.Value; foreach (var i in lightmapIndices) { LightmapMemory lightmapMemory = Lightmapping.GetLightmapMemory(i.Value); totalLightmapsSize += lightmapMemory.lightmapDataSizeCPU; totalLightmapsSize += lightmapMemory.lightmapTexturesSize; } } string foldoutNameFull = String.Format( "G-buffers ({0}) | Lightmaps ({1})", SizeString(totalGBuffersSize), SizeString(totalLightmapsSize)); if (lightmaps.Length > 0) { EditorGUILayout.FoldoutTitlebar(false, new GUIContent(foldoutNameFull), true); } } System.UInt64[] dummyCounts = new System.UInt64[0]; { MemLabels labels = Lightmapping.GetTransmissionTexturesMemLabels(); ShowObjectNamesSizesAndCounts("Transmission textures", kEditorPrefsTransmissionTextures, labels.labels, labels.sizes, dummyCounts); } { MemLabels labels = Lightmapping.GetMaterialTexturesMemLabels(); ShowObjectNamesSizesAndCounts("Albedo/emissive textures", kEditorPrefsMaterialTextures, labels.labels, labels.sizes, dummyCounts); } { GeoMemLabels labels = Lightmapping.GetGeometryMemory(); ShowObjectNamesSizesAndCounts("Geometry data", kEditorPrefsGeometryData, labels.labels, labels.sizes, labels.triCounts); } { // Note: this needs to go last. // It simply shows all the memory labels that were not explicitly queried after the Lightmapping.ResetExplicitlyShownMemLabels() call. MemLabels labels = Lightmapping.GetNotShownMemLabels(); string remainingEntriesFoldoutName = Lightmapping.isProgressiveLightmapperDone ? "Leaks" : "In-flight"; ShowObjectNamesSizesAndCounts(remainingEntriesFoldoutName, kEditorPrefsInFlight, labels.labels, labels.sizes, dummyCounts); } EditorGUILayout.Space(); EditorGUIUtility.labelWidth = oldWidth; }
void WorkflowSettingsGUI() { m_ShowWorkflowSettings.value = EditorGUILayout.FoldoutTitlebar(m_ShowWorkflowSettings.value, Styles.workflowSettings, true); if (m_ShowWorkflowSettings.value) { EditorGUI.indentLevel++; // GPU lightmapper device selection. if (Lightmapping.GetLightingSettingsOrDefaultsFallback().lightmapper == LightingSettings.Lightmapper.ProgressiveGPU) { DeviceAndPlatform[] devicesAndPlatforms = Lightmapping.GetLightmappingGpuDevices(); if (devicesAndPlatforms.Length > 0) { int[] lightmappingDeviceIndices = Enumerable.Range(0, devicesAndPlatforms.Length).ToArray(); GUIContent[] lightmappingDeviceStrings = devicesAndPlatforms.Select(x => new GUIContent(x.name)).ToArray(); int bakingDeviceAndPlatform = -1; string configDeviceAndPlatform = EditorUserSettings.GetConfigValue(m_LightmappingDeviceIndex); if (configDeviceAndPlatform != null) { bakingDeviceAndPlatform = Int32.Parse(configDeviceAndPlatform); bakingDeviceAndPlatform = Mathf.Clamp(bakingDeviceAndPlatform, 0, devicesAndPlatforms.Length - 1); // Removing a GPU and rebooting invalidates the saved value. } else { bakingDeviceAndPlatform = Lightmapping.GetLightmapBakeGPUDeviceIndex(); } Debug.Assert(bakingDeviceAndPlatform != -1); EditorGUI.BeginChangeCheck(); using (new EditorGUI.DisabledScope(devicesAndPlatforms.Length < 2)) { bakingDeviceAndPlatform = EditorGUILayout.IntPopup(Styles.progressiveGPUBakingDevice, bakingDeviceAndPlatform, lightmappingDeviceStrings, lightmappingDeviceIndices); } if (EditorGUI.EndChangeCheck()) { if (EditorUtility.DisplayDialog("Warning", Styles.progressiveGPUChangeWarning.text, "OK", "Cancel")) { EditorUserSettings.SetConfigValue(m_LightmappingDeviceIndex, bakingDeviceAndPlatform.ToString()); DeviceAndPlatform selectedDeviceAndPlatform = devicesAndPlatforms[bakingDeviceAndPlatform]; EditorApplication.CloseAndRelaunch(new string[] { "-OpenCL-PlatformAndDeviceIndices", selectedDeviceAndPlatform.platformId.ToString(), selectedDeviceAndPlatform.deviceId.ToString() }); } } } else { // To show when we are still fetching info, so that the UI doesn't pop around too much for no reason using (new EditorGUI.DisabledScope(true)) { EditorGUILayout.IntPopup(Styles.progressiveGPUBakingDevice, 0, Styles.progressiveGPUUnknownDeviceStrings, Styles.progressiveGPUUnknownDeviceValues); } EditorGUILayout.HelpBox(Styles.progressiveGPUUnknownDeviceInfo.text, MessageType.Info); } } m_ShowProbeDebugSettings.value = EditorGUILayout.Foldout(m_ShowProbeDebugSettings.value, Styles.lightProbeVisualization, true); if (m_ShowProbeDebugSettings.value) { EditorGUI.BeginChangeCheck(); EditorGUI.indentLevel++; LightProbeVisualization.lightProbeVisualizationMode = (LightProbeVisualization.LightProbeVisualizationMode)EditorGUILayout.EnumPopup(LightProbeVisualization.lightProbeVisualizationMode); LightProbeVisualization.showInterpolationWeights = EditorGUILayout.Toggle(Styles.displayWeights, LightProbeVisualization.showInterpolationWeights); LightProbeVisualization.showOcclusions = EditorGUILayout.Toggle(Styles.displayOcclusion, LightProbeVisualization.showOcclusions); LightProbeVisualization.highlightInvalidCells = EditorGUILayout.Toggle(Styles.highlightInvalidCells, LightProbeVisualization.highlightInvalidCells); EditorGUI.indentLevel--; if (EditorGUI.EndChangeCheck()) { EditorApplication.SetSceneRepaintDirty(); } } if (Unsupported.IsDeveloperMode()) { Lightmapping.concurrentJobsType = (Lightmapping.ConcurrentJobsType)EditorGUILayout.IntPopup(Styles.concurrentJobs, (int)Lightmapping.concurrentJobsType, Styles.concurrentJobsTypeStrings, Styles.concurrentJobsTypeValues); if (GUILayout.Button("Clear disk cache", GUILayout.Width(Styles.buttonWidth))) { Lightmapping.Clear(); Lightmapping.ClearDiskCache(); } if (GUILayout.Button("Print state to console", GUILayout.Width(Styles.buttonWidth))) { Lightmapping.PrintStateToConsole(); } if (GUILayout.Button("Reset albedo/emissive", GUILayout.Width(Styles.buttonWidth))) { GIDebugVisualisation.ResetRuntimeInputTextures(); } if (GUILayout.Button("Reset environment", GUILayout.Width(Styles.buttonWidth))) { DynamicGI.UpdateEnvironment(); } } EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
void GeneralLightmapSettingsGUI() { bool bakedGISupported = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked); if (!bakedGISupported && !SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Realtime)) { return; } m_ShowGeneralLightmapSettings = EditorGUILayout.FoldoutTitlebar(m_ShowGeneralLightmapSettings, Styles.GeneralLightmapLabel, true); if (m_ShowGeneralLightmapSettings) { EditorGUI.indentLevel++; using (new EditorGUI.DisabledScope(!m_EnabledBakedGI.boolValue && !m_EnableRealtimeGI.boolValue)) { if (bakedGISupported) { using (new EditorGUI.DisabledScope(!m_EnabledBakedGI.boolValue)) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_BakeBackend, Styles.BakeBackend); if (EditorGUI.EndChangeCheck()) { InspectorWindow.RepaintAllInspectors(); // We need to repaint other inspectors that might need to update based on the selected backend. } if (LightmapEditorSettings.lightmapper == LightmapEditorSettings.Lightmapper.ProgressiveCPU) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_PVRCulling, Styles.PVRCulling); // Sampling type //EditorGUILayout.PropertyField(m_PvrSampling, Styles.m_PVRSampling); // TODO(PVR): make non-fixed sampling modes work. if (LightmapEditorSettings.sampling != LightmapEditorSettings.Sampling.Auto) { // Update those constants also in LightmapBake.cpp UpdateSamples(). const int kMinSamples = 10; const int kMaxSamples = 100000; // Sample count // TODO(PVR): make non-fixed sampling modes work. //EditorGUI.indentLevel++; //if (LightmapEditorSettings.giPathTracerSampling == LightmapEditorSettings.PathTracerSampling.PathTracerSamplingAdaptive) // EditorGUILayout.PropertyField(m_PVRSampleCount, Styles.PVRSampleCountAdaptive); //else EditorGUILayout.PropertyField(m_PVRDirectSampleCount, Styles.PVRDirectSampleCount); EditorGUILayout.PropertyField(m_PVRSampleCount, Styles.PVRIndirectSampleCount); if (m_PVRSampleCount.intValue < kMinSamples || m_PVRSampleCount.intValue > kMaxSamples) { m_PVRSampleCount.intValue = Math.Max(Math.Min(m_PVRSampleCount.intValue, kMaxSamples), kMinSamples); } // TODO(PVR): make non-fixed sampling modes work. //EditorGUI.indentLevel--; } EditorGUILayout.IntPopup(m_PVRBounces, Styles.BouncesStrings, Styles.BouncesValues, Styles.PVRBounces); // Filtering EditorGUILayout.PropertyField(m_PVRFilteringMode, Styles.PVRFilteringMode); if (m_PVRFilteringMode.enumValueIndex == (int)LightmapEditorSettings.FilterMode.Advanced) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_PVRFilterTypeDirect, Styles.PVRFilterTypeDirect); DrawFilterSettingField(m_PVRFilteringGaussRadiusDirect, m_PVRFilteringAtrousPositionSigmaDirect, Styles.PVRFilteringGaussRadiusDirect, Styles.PVRFilteringAtrousPositionSigmaDirect, LightmapEditorSettings.filterTypeDirect); EditorGUILayout.Space(); EditorGUILayout.PropertyField(m_PVRFilterTypeIndirect, Styles.PVRFilterTypeIndirect); DrawFilterSettingField(m_PVRFilteringGaussRadiusIndirect, m_PVRFilteringAtrousPositionSigmaIndirect, Styles.PVRFilteringGaussRadiusIndirect, Styles.PVRFilteringAtrousPositionSigmaIndirect, LightmapEditorSettings.filterTypeIndirect); using (new EditorGUI.DisabledScope(!m_AmbientOcclusion.boolValue)) { EditorGUILayout.Space(); EditorGUILayout.PropertyField(m_PVRFilterTypeAO, Styles.PVRFilterTypeAO); DrawFilterSettingField(m_PVRFilteringGaussRadiusAO, m_PVRFilteringAtrousPositionSigmaAO, Styles.PVRFilteringGaussRadiusAO, Styles.PVRFilteringAtrousPositionSigmaAO, LightmapEditorSettings.filterTypeAO); } EditorGUI.indentLevel--; } EditorGUI.indentLevel--; EditorGUILayout.Space(); } } } using (new EditorGUI.DisabledScope((LightmapEditorSettings.lightmapper == LightmapEditorSettings.Lightmapper.ProgressiveCPU) && !m_EnableRealtimeGI.boolValue)) { DrawResolutionField(m_Resolution, Styles.IndirectResolution); } if (bakedGISupported) { using (new EditorGUI.DisabledScope(!m_EnabledBakedGI.boolValue)) { DrawResolutionField(m_BakeResolution, Styles.LightmapResolution); GUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(m_Padding, Styles.Padding); GUILayout.Label(" texels", Styles.LabelStyle); GUILayout.EndHorizontal(); EditorGUILayout.IntPopup(m_LightmapSize, Styles.LightmapSizeStrings, Styles.LightmapSizeValues, Styles.LightmapSize); EditorGUILayout.PropertyField(m_TextureCompression, Styles.TextureCompression); EditorGUILayout.PropertyField(m_AmbientOcclusion, Styles.AmbientOcclusion); if (m_AmbientOcclusion.boolValue) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_AOMaxDistance, Styles.AOMaxDistance); if (m_AOMaxDistance.floatValue < 0.0f) { m_AOMaxDistance.floatValue = 0.0f; } EditorGUILayout.Slider(m_CompAOExponent, 0.0f, 10.0f, Styles.AmbientOcclusionContribution); EditorGUILayout.Slider(m_CompAOExponentDirect, 0.0f, 10.0f, Styles.AmbientOcclusionContributionDirect); EditorGUI.indentLevel--; } if (LightmapEditorSettings.lightmapper == LightmapEditorSettings.Lightmapper.Enlighten) { EditorGUILayout.PropertyField(m_FinalGather, Styles.FinalGather); if (m_FinalGather.boolValue) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_FinalGatherRayCount, Styles.FinalGatherRayCount); EditorGUILayout.PropertyField(m_FinalGatherFiltering, Styles.FinalGatherFiltering); EditorGUI.indentLevel--; } } } } bool directionalSupported = SupportedRenderingFeatures.IsLightmapsModeSupported(LightmapsMode.CombinedDirectional); if (directionalSupported || (m_LightmapDirectionalMode.intValue == (int)LightmapsMode.CombinedDirectional)) { EditorGUILayout.IntPopup(m_LightmapDirectionalMode, Styles.LightmapDirectionalModeStrings, Styles.LightmapDirectionalModeValues, Styles.LightmapDirectionalMode); if (!directionalSupported) { EditorGUILayout.HelpBox("Directional Mode is not supported. Fallback will be Non-Directional.", MessageType.Warning); } } else { using (new EditorGUI.DisabledScope(true)) { EditorGUILayout.IntPopup(Styles.LightmapDirectionalMode, 0, Styles.LightmapDirectionalModeStrings, Styles.LightmapDirectionalModeValues); } } EditorGUILayout.Slider(m_IndirectOutputScale, 0.0f, 5.0f, Styles.IndirectOutputScale); // albedo boost, push the albedo value towards one in order to get more bounce EditorGUILayout.Slider(m_AlbedoBoost, 1.0f, 10.0f, Styles.AlbedoBoost); if (LightmapParametersGUI(m_LightmapParameters, Styles.DefaultLightmapParameters)) { EditorWindow.FocusWindowIfItsOpen <InspectorWindow>(); } EditorGUI.indentLevel--; EditorGUILayout.Space(); } } }
private void GeneralLightmapSettingsGUI() { this.m_ShowGeneralLightmapSettings = EditorGUILayout.FoldoutTitlebar(this.m_ShowGeneralLightmapSettings, LightingWindowBakeSettings.Styles.GeneralLightmapLabel, true); if (this.m_ShowGeneralLightmapSettings) { EditorGUI.indentLevel++; using (new EditorGUI.DisabledScope(!LightModeUtil.Get().IsAnyGIEnabled())) { using (new EditorGUI.DisabledScope(!LightModeUtil.Get().AreBakedLightmapsEnabled())) { EditorGUILayout.PropertyField(this.m_BakeBackend, LightingWindowBakeSettings.Styles.BakeBackend, new GUILayoutOption[0]); if (LightmapEditorSettings.giBakeBackend == LightmapEditorSettings.GIBakeBackend.PathTracer) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(this.m_PVRCulling, LightingWindowBakeSettings.Styles.PVRCulling, new GUILayoutOption[0]); if (LightmapEditorSettings.giPathTracerSampling != LightmapEditorSettings.PathTracerSampling.Auto) { EditorGUILayout.PropertyField(this.m_PVRDirectSampleCount, LightingWindowBakeSettings.Styles.PVRDirectSampleCount, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_PVRSampleCount, LightingWindowBakeSettings.Styles.PVRIndirectSampleCount, new GUILayoutOption[0]); if (this.m_PVRSampleCount.intValue < 10 || this.m_PVRSampleCount.intValue > 100000) { this.m_PVRSampleCount.intValue = Math.Max(Math.Min(this.m_PVRSampleCount.intValue, 100000), 10); } } EditorGUILayout.IntPopup(this.m_PVRBounces, LightingWindowBakeSettings.Styles.BouncesStrings, LightingWindowBakeSettings.Styles.BouncesValues, LightingWindowBakeSettings.Styles.PVRBounces, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_PVRFilteringMode, LightingWindowBakeSettings.Styles.PVRFilteringMode, new GUILayoutOption[0]); if (this.m_PVRFilteringMode.enumValueIndex == 2) { EditorGUI.indentLevel++; GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.IntSlider(this.m_PVRFilteringGaussRadiusDirect, 0, 5, LightingWindowBakeSettings.Styles.PVRFilteringGaussRadiusDirect, new GUILayoutOption[0]); GUILayout.Label(" texels", LightingWindowBakeSettings.Styles.LabelStyle, new GUILayoutOption[0]); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.IntSlider(this.m_PVRFilteringGaussRadiusIndirect, 0, 5, LightingWindowBakeSettings.Styles.PVRFilteringGaussRadiusIndirect, new GUILayoutOption[0]); GUILayout.Label(" texels", LightingWindowBakeSettings.Styles.LabelStyle, new GUILayoutOption[0]); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.IntSlider(this.m_PVRFilteringGaussRadiusAO, 0, 5, LightingWindowBakeSettings.Styles.PVRFilteringGaussRadiusAO, new GUILayoutOption[0]); GUILayout.Label(" texels", LightingWindowBakeSettings.Styles.LabelStyle, new GUILayoutOption[0]); GUILayout.EndHorizontal(); EditorGUI.indentLevel--; } EditorGUILayout.HelpBox(LightingWindowBakeSettings.Styles.NoTransparencyAndLODInProgressive.text, MessageType.Warning); EditorGUI.indentLevel--; EditorGUILayout.Space(); } } using (new EditorGUI.DisabledScope(LightmapEditorSettings.giBakeBackend == LightmapEditorSettings.GIBakeBackend.PathTracer && !LightModeUtil.Get().IsRealtimeGIEnabled())) { LightingWindowBakeSettings.DrawResolutionField(this.m_Resolution, LightingWindowBakeSettings.Styles.IndirectResolution); } using (new EditorGUI.DisabledScope(!LightModeUtil.Get().AreBakedLightmapsEnabled())) { LightingWindowBakeSettings.DrawResolutionField(this.m_BakeResolution, LightingWindowBakeSettings.Styles.LightmapResolution); GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_Padding, LightingWindowBakeSettings.Styles.Padding, new GUILayoutOption[0]); GUILayout.Label(" texels", LightingWindowBakeSettings.Styles.LabelStyle, new GUILayoutOption[0]); GUILayout.EndHorizontal(); EditorGUILayout.IntPopup(this.m_LightmapSize, LightingWindowBakeSettings.Styles.LightmapSizeStrings, LightingWindowBakeSettings.Styles.LightmapSizeValues, LightingWindowBakeSettings.Styles.LightmapSize, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_TextureCompression, LightingWindowBakeSettings.Styles.TextureCompression, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_AmbientOcclusion, LightingWindowBakeSettings.Styles.AmbientOcclusion, new GUILayoutOption[0]); if (this.m_AmbientOcclusion.boolValue) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(this.m_AOMaxDistance, LightingWindowBakeSettings.Styles.AOMaxDistance, new GUILayoutOption[0]); if (this.m_AOMaxDistance.floatValue < 0f) { this.m_AOMaxDistance.floatValue = 0f; } EditorGUILayout.Slider(this.m_CompAOExponent, 0f, 10f, LightingWindowBakeSettings.Styles.AmbientOcclusionContribution, new GUILayoutOption[0]); EditorGUILayout.Slider(this.m_CompAOExponentDirect, 0f, 10f, LightingWindowBakeSettings.Styles.AmbientOcclusionContributionDirect, new GUILayoutOption[0]); EditorGUI.indentLevel--; } if (LightmapEditorSettings.giBakeBackend == LightmapEditorSettings.GIBakeBackend.Radiosity) { EditorGUILayout.PropertyField(this.m_FinalGather, LightingWindowBakeSettings.Styles.FinalGather, new GUILayoutOption[0]); if (this.m_FinalGather.boolValue) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(this.m_FinalGatherRayCount, LightingWindowBakeSettings.Styles.FinalGatherRayCount, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_FinalGatherFiltering, LightingWindowBakeSettings.Styles.FinalGatherFiltering, new GUILayoutOption[0]); EditorGUI.indentLevel--; } } } EditorGUILayout.IntPopup(this.m_LightmapDirectionalMode, LightingWindowBakeSettings.Styles.LightmapDirectionalModeStrings, LightingWindowBakeSettings.Styles.LightmapDirectionalModeValues, LightingWindowBakeSettings.Styles.LightmapDirectionalMode, new GUILayoutOption[0]); if (this.m_LightmapDirectionalMode.intValue == 1) { EditorGUILayout.HelpBox(LightingWindowBakeSettings.Styles.NoDirectionalInSM2AndGLES2.text, MessageType.Warning); } EditorGUILayout.Slider(this.m_IndirectOutputScale, 0f, 5f, LightingWindowBakeSettings.Styles.IndirectOutputScale, new GUILayoutOption[0]); EditorGUILayout.Slider(this.m_AlbedoBoost, 1f, 10f, LightingWindowBakeSettings.Styles.AlbedoBoost, new GUILayoutOption[0]); if (LightingWindowBakeSettings.LightmapParametersGUI(this.m_LightmapParameters, LightingWindowBakeSettings.Styles.DefaultLightmapParameters)) { EditorWindow.FocusWindowIfItsOpen <InspectorWindow>(); } EditorGUI.indentLevel--; EditorGUILayout.Space(); } } }
private void DrawGUI() { Material skyboxMaterial = m_SkyboxMaterial.objectReferenceValue as Material; m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(m_bShowEnvironment, Styles.env_top, true); if (m_bShowEnvironment) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_SkyboxMaterial, Styles.env_skybox_mat); if (skyboxMaterial && !EditorMaterialUtility.IsBackgroundMaterial(skyboxMaterial)) { EditorGUILayout.HelpBox(Styles.skyboxWarning.text, MessageType.Warning); } EditorGUILayout.PropertyField(m_Sun, Styles.env_skybox_sun); EditorGUILayout.Space(); EditorGUILayout.LabelField(Styles.env_amb_top); EditorGUI.indentLevel++; EditorGUILayout.IntPopup(m_AmbientSource, Styles.kFullAmbientSource, Styles.kFullAmbientSourceValues, Styles.env_amb_src); switch ((AmbientMode)m_AmbientSource.intValue) { case AmbientMode.Trilight: { EditorGUI.BeginChangeCheck(); Color newValueUp = EditorGUILayout.ColorField(Styles.ambientUp, m_AmbientSkyColor.colorValue, true, false, true); Color newValueMid = EditorGUILayout.ColorField(Styles.ambientMid, m_AmbientEquatorColor.colorValue, true, false, true); Color newValueDown = EditorGUILayout.ColorField(Styles.ambientDown, m_AmbientGroundColor.colorValue, true, false, true); if (EditorGUI.EndChangeCheck()) { m_AmbientSkyColor.colorValue = newValueUp; m_AmbientEquatorColor.colorValue = newValueMid; m_AmbientGroundColor.colorValue = newValueDown; } } break; case AmbientMode.Flat: { EditorGUI.BeginChangeCheck(); Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true); if (EditorGUI.EndChangeCheck()) { m_AmbientSkyColor.colorValue = newValue; } } break; case AmbientMode.Skybox: if (skyboxMaterial == null) { EditorGUI.BeginChangeCheck(); Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true); if (EditorGUI.EndChangeCheck()) { m_AmbientSkyColor.colorValue = newValue; } } else { // Ambient intensity - maximum is kEmissiveRGBMMax EditorGUILayout.Slider(m_AmbientIntensity, 0.0F, 8.0F, Styles.env_amb_int); } break; } // ambient GI - realtime / baked bool realtimeGISupported = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Realtime); bool bakedGISupported = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked); if ((m_EnabledBakedGI.boolValue || m_EnabledRealtimeGI.boolValue) && (bakedGISupported || realtimeGISupported)) { int[] modeVals = { 0, 1 }; if (m_EnabledBakedGI.boolValue && m_EnabledRealtimeGI.boolValue) { // if the user has selected the only state that is supported, then gray it out using (new EditorGUI.DisabledScope(((m_AmbientLightingMode.intValue == 0) && realtimeGISupported && !bakedGISupported) || ((m_AmbientLightingMode.intValue == 1) && bakedGISupported && !realtimeGISupported))) { EditorGUILayout.IntPopup(m_AmbientLightingMode, Styles.AmbientLightingModes, modeVals, Styles.AmbientLightingMode); } // if they have selected a state that isnt supported, show dialog, and still make the box editable if (((m_AmbientLightingMode.intValue == 0) && !realtimeGISupported) || ((m_AmbientLightingMode.intValue == 1) && !bakedGISupported)) { EditorGUILayout.HelpBox("The following mode is not supported and will fallback on " + (((m_AmbientLightingMode.intValue == 0) && !realtimeGISupported) ? "Baked" : "Realtime"), MessageType.Warning); } } // Show "Baked" if precomputed GI is disabled and "Realtime" if baked GI is disabled (but we don't wanna show the box if the whole mode is not supported.) else if ((m_EnabledBakedGI.boolValue && bakedGISupported) || (m_EnabledRealtimeGI.boolValue && realtimeGISupported)) { using (new EditorGUI.DisabledScope(true)) { EditorGUILayout.IntPopup(Styles.AmbientLightingMode, m_EnabledBakedGI.boolValue ? 1 : 0, Styles.AmbientLightingModes, modeVals); } } } EditorGUI.indentLevel--; EditorGUILayout.Space(); EditorGUILayout.LabelField(Styles.env_refl_top); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_DefaultReflectionMode, Styles.env_refl_src); DefaultReflectionMode defReflectionMode = (DefaultReflectionMode)m_DefaultReflectionMode.intValue; switch (defReflectionMode) { case DefaultReflectionMode.FromSkybox: { int[] reflectionResolutionValuesArray = null; GUIContent[] reflectionResolutionTextArray = null; ReflectionProbeEditor.GetResolutionArray(ref reflectionResolutionValuesArray, ref reflectionResolutionTextArray); EditorGUILayout.IntPopup(m_DefaultReflectionResolution, reflectionResolutionTextArray, reflectionResolutionValuesArray, Styles.env_refl_res, GUILayout.MinWidth(40)); } break; case DefaultReflectionMode.Custom: EditorGUILayout.PropertyField(m_CustomReflection, Styles.customReflection); break; } EditorGUILayout.PropertyField(m_ReflectionCompression, Styles.env_refl_cmp); EditorGUILayout.Slider(m_ReflectionIntensity, 0.0F, 1.0F, Styles.env_refl_int); EditorGUILayout.IntSlider(m_ReflectionBounces, 1, 5, Styles.env_refl_bnc); EditorGUI.indentLevel--; EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
void MixedLightingGUI() { if (!SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked)) { return; } m_ShowMixedLightsSettings = EditorGUILayout.FoldoutTitlebar(m_ShowMixedLightsSettings, Styles.MixedLightsLabel, true); if (m_ShowMixedLightsSettings) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_EnabledBakedGI, Styles.EnableBaked); if (!m_EnabledBakedGI.boolValue) { EditorGUILayout.HelpBox(Styles.BakedGIDisabledInfo.text, MessageType.Info); } using (new EditorGUI.DisabledScope(!m_EnabledBakedGI.boolValue)) { bool mixedGISupported = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Mixed); using (new EditorGUI.DisabledScope(!mixedGISupported)) { var rect = EditorGUILayout.GetControlRect(); EditorGUI.BeginProperty(rect, Styles.MixedLightMode, m_MixedBakeMode); rect = EditorGUI.PrefixLabel(rect, Styles.MixedLightMode); int index = Math.Max(0, Array.IndexOf(Styles.MixedModeValues, m_MixedBakeMode.intValue)); if (EditorGUI.DropdownButton(rect, Styles.MixedModeStrings[index], FocusType.Passive)) { var menu = new GenericMenu(); for (int i = 0; i < Styles.MixedModeValues.Length; i++) { int value = Styles.MixedModeValues[i]; bool selected = (value == m_MixedBakeMode.intValue); if (!SupportedRenderingFeatures.IsMixedLightingModeSupported((MixedLightingMode)value)) { menu.AddDisabledItem(Styles.MixedModeStrings[i], selected); } else { menu.AddItem(Styles.MixedModeStrings[i], selected, OnMixedModeSelected, value); } } menu.DropDown(rect); } EditorGUI.EndProperty(); if (mixedGISupported) { if (!SupportedRenderingFeatures.IsMixedLightingModeSupported((MixedLightingMode)m_MixedBakeMode.intValue)) { string fallbackMode = Styles.MixedModeStrings[(int)SupportedRenderingFeatures.FallbackMixedLightingMode()].text; EditorGUILayout.HelpBox(Styles.MixedModeNotSupportedWarning.text + fallbackMode, MessageType.Warning); } else if (m_EnabledBakedGI.boolValue) { EditorGUILayout.HelpBox(Styles.HelpStringsMixed[m_MixedBakeMode.intValue].text, MessageType.Info); } } if (m_MixedBakeMode.intValue == (int)MixedLightingMode.Subtractive) { EditorGUILayout.PropertyField(m_SubtractiveShadowColor, Styles.SubtractiveShadowColor); m_RenderSettingsSO.ApplyModifiedProperties(); EditorGUILayout.Space(); } } } EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
private void DrawGUI() { Material material = this.m_SkyboxMaterial.objectReferenceValue as Material; this.m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(this.m_bShowEnvironment, LightingEditor.Styles.env_top, true); if (this.m_bShowEnvironment) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(this.m_SkyboxMaterial, LightingEditor.Styles.env_skybox_mat, new GUILayoutOption[0]); if (material && !EditorMaterialUtility.IsBackgroundMaterial(material)) { EditorGUILayout.HelpBox(LightingEditor.Styles.skyboxWarning.text, MessageType.Warning); } EditorGUILayout.PropertyField(this.m_Sun, LightingEditor.Styles.env_skybox_sun, new GUILayoutOption[0]); EditorGUILayout.Space(); EditorGUILayout.LabelField(LightingEditor.Styles.env_amb_top, new GUILayoutOption[0]); EditorGUI.indentLevel++; EditorGUILayout.IntPopup(this.m_AmbientSource, LightingEditor.Styles.kFullAmbientSource, LightingEditor.Styles.kFullAmbientSourceValues, LightingEditor.Styles.env_amb_src, new GUILayoutOption[0]); AmbientMode intValue = (AmbientMode)this.m_AmbientSource.intValue; if (intValue != AmbientMode.Trilight) { if (intValue != AmbientMode.Flat) { if (intValue == AmbientMode.Skybox) { if (material == null) { EditorGUI.BeginChangeCheck(); Color colorValue = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { this.m_AmbientSkyColor.colorValue = colorValue; } } else { EditorGUILayout.Slider(this.m_AmbientIntensity, 0f, 8f, LightingEditor.Styles.env_amb_int, new GUILayoutOption[0]); } } } else { EditorGUI.BeginChangeCheck(); Color colorValue2 = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { this.m_AmbientSkyColor.colorValue = colorValue2; } } } else { EditorGUI.BeginChangeCheck(); Color colorValue3 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientUp, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]); Color colorValue4 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientMid, this.m_AmbientEquatorColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]); Color colorValue5 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientDown, this.m_AmbientGroundColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { this.m_AmbientSkyColor.colorValue = colorValue3; this.m_AmbientEquatorColor.colorValue = colorValue4; this.m_AmbientGroundColor.colorValue = colorValue5; } } if (LightModeUtil.Get().IsAnyGIEnabled()) { int selectedValue; bool ambientLightingMode = LightModeUtil.Get().GetAmbientLightingMode(out selectedValue); using (new EditorGUI.DisabledScope(!ambientLightingMode)) { int[] optionValues = new int[] { 0, 1 }; if (ambientLightingMode) { this.m_AmbientLightingMode.intValue = EditorGUILayout.IntPopup(LightingEditor.Styles.AmbientLightingMode, this.m_AmbientLightingMode.intValue, LightingEditor.Styles.AmbientLightingModes, optionValues, new GUILayoutOption[0]); } else { EditorGUILayout.IntPopup(LightingEditor.Styles.AmbientLightingMode, selectedValue, LightingEditor.Styles.AmbientLightingModes, optionValues, new GUILayoutOption[0]); } } } EditorGUI.indentLevel--; EditorGUILayout.Space(); EditorGUILayout.LabelField(LightingEditor.Styles.env_refl_top, new GUILayoutOption[0]); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(this.m_DefaultReflectionMode, LightingEditor.Styles.env_refl_src, new GUILayoutOption[0]); DefaultReflectionMode intValue2 = (DefaultReflectionMode)this.m_DefaultReflectionMode.intValue; if (intValue2 != DefaultReflectionMode.FromSkybox) { if (intValue2 == DefaultReflectionMode.Custom) { EditorGUILayout.PropertyField(this.m_CustomReflection, LightingEditor.Styles.customReflection, new GUILayoutOption[0]); } } else { EditorGUILayout.IntPopup(this.m_DefaultReflectionResolution, LightingEditor.Styles.defaultReflectionSizes, LightingEditor.Styles.defaultReflectionSizesValues, LightingEditor.Styles.env_refl_res, new GUILayoutOption[] { GUILayout.MinWidth(40f) }); } EditorGUILayout.PropertyField(this.m_ReflectionCompression, LightingEditor.Styles.env_refl_cmp, new GUILayoutOption[0]); EditorGUILayout.Slider(this.m_ReflectionIntensity, 0f, 1f, LightingEditor.Styles.env_refl_int, new GUILayoutOption[0]); EditorGUILayout.IntSlider(this.m_ReflectionBounces, 1, 5, LightingEditor.Styles.env_refl_bnc, new GUILayoutOption[0]); EditorGUI.indentLevel--; EditorGUI.indentLevel--; EditorGUILayout.Space(); } }
private void ShowObjectNamesSizesAndCounts(string foldoutName, string editorPrefsName, string[] objectNames, float[] sizes, System.UInt64[] counts) { Debug.Assert(objectNames.Length == sizes.Length); if (objectNames.Length == 0) { return; } string countString = counts.Length > 0 ? (SumCounts(counts).ToString() + " tris, ") : ""; string sizeString = SizeString(SumSizes(sizes)); string foldoutNameFull = foldoutName + " (" + countString + sizeString + ")"; bool showDetailsOld = EditorPrefs.GetBool(editorPrefsName, false); bool showDetails = EditorGUILayout.FoldoutTitlebar(showDetailsOld, new GUIContent(foldoutNameFull), true); if (showDetails != showDetailsOld) { EditorPrefs.SetBool(editorPrefsName, showDetails); } if (!showDetails) { return; } GUILayout.BeginHorizontal(); { string[] stringSeparators = new string[] { " | " }; GUILayout.Space(20); GUILayout.BeginVertical(); for (int i = 0; i < objectNames.Length; ++i) { string fullName = objectNames[i]; string[] result = fullName.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries); Debug.Assert(result.Length > 0); string objectName = result[0]; string tooltip = ""; if (result.Length > 1) { tooltip = result[1]; } GUILayout.Label(new GUIContent(objectName, tooltip), EditorStyles.miniLabel); } GUILayout.EndVertical(); GUILayout.BeginVertical(); for (int i = 0; i < counts.Length; ++i) { GUILayout.Label(counts[i].ToString(), EditorStyles.miniLabel); } GUILayout.EndVertical(); GUILayout.BeginVertical(); for (int i = 0; i < sizes.Length; ++i) { GUILayout.Label(SizeString(sizes[i]), EditorStyles.miniLabel); } GUILayout.EndVertical(); GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); GUILayout.Space(10); }
public override void OnInspectorGUI() { base.serializedObject.Update(); this.m_lightmapSettings.Update(); EditorGUILayout.Space(); this.m_ShowEditor = EditorGUILayout.FoldoutTitlebar(this.m_ShowEditor, LightingEditor.Styles.environmentHeader); if (this.m_ShowEditor) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(this.m_SkyboxMaterial, LightingEditor.Styles.skyboxLabel, new GUILayoutOption[0]); Material material = this.m_SkyboxMaterial.objectReferenceValue as Material; if (material && !EditorMaterialUtility.IsBackgroundMaterial(material)) { EditorGUILayout.HelpBox(LightingEditor.Styles.skyboxWarning.text, MessageType.Warning); } EditorGUILayout.PropertyField(this.m_Sun, LightingEditor.Styles.sunLabel, new GUILayoutOption[0]); EditorGUILayout.Space(); EditorGUILayout.IntPopup(this.m_AmbientMode, LightingEditor.Styles.kFullAmbientModes, LightingEditor.Styles.kFullAmbientModeValues, LightingEditor.Styles.ambientModeLabel, new GUILayoutOption[0]); EditorGUI.indentLevel++; AmbientMode intValue = (AmbientMode)this.m_AmbientMode.intValue; if (intValue != AmbientMode.Trilight) { if (intValue != AmbientMode.Flat) { if (intValue == AmbientMode.Skybox) { if (material == null) { EditorGUI.BeginChangeCheck(); Color colorValue = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { this.m_AmbientSkyColor.colorValue = colorValue; } } else { EditorGUILayout.Slider(this.m_AmbientIntensity, 0f, 8f, LightingEditor.Styles.ambientIntensity, new GUILayoutOption[0]); } } } else { EditorGUI.BeginChangeCheck(); Color colorValue2 = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { this.m_AmbientSkyColor.colorValue = colorValue2; } } } else { EditorGUI.BeginChangeCheck(); Color colorValue3 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientUp, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]); Color colorValue4 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientMid, this.m_AmbientEquatorColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]); Color colorValue5 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientDown, this.m_AmbientGroundColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { this.m_AmbientSkyColor.colorValue = colorValue3; this.m_AmbientEquatorColor.colorValue = colorValue4; this.m_AmbientGroundColor.colorValue = colorValue5; } } EditorGUI.indentLevel--; this.m_ShowAmbientBakeMode.target = LightingEditor.ShowAmbientField(); if (EditorGUILayout.BeginFadeGroup(this.m_ShowAmbientBakeMode.faded)) { bool flag = Lightmapping.realtimeGI && Lightmapping.bakedGI; using (new EditorGUI.DisabledScope(!flag)) { if (flag) { EditorGUILayout.PropertyField(this.m_EnvironmentLightingMode, LightingEditor.Styles.SkyLightBaked, new GUILayoutOption[0]); } else { int num = (!Lightmapping.bakedGI) ? 0 : 1; EditorGUILayout.LabelField(LightingEditor.Styles.SkyLightBaked, GUIContent.Temp(this.m_EnvironmentLightingMode.enumNames[num]), EditorStyles.popup, new GUILayoutOption[0]); } } } EditorGUILayout.EndFadeGroup(); EditorGUILayout.Space(); EditorGUILayout.PropertyField(this.m_DefaultReflectionMode, LightingEditor.Styles.reflectionModeLabel, new GUILayoutOption[0]); EditorGUI.indentLevel++; Cubemap exists = this.m_CustomReflection.objectReferenceValue as Cubemap; DefaultReflectionMode intValue2 = (DefaultReflectionMode)this.m_DefaultReflectionMode.intValue; if ((!material && intValue2 == DefaultReflectionMode.FromSkybox) || (!exists && intValue2 == DefaultReflectionMode.Custom)) { EditorGUILayout.HelpBox(LightingEditor.Styles.defReflectionWarning.text, MessageType.Warning); } if (intValue2 != DefaultReflectionMode.FromSkybox) { if (intValue2 == DefaultReflectionMode.Custom) { EditorGUILayout.PropertyField(this.m_CustomReflection, LightingEditor.Styles.customReflection, new GUILayoutOption[0]); } } else { EditorGUILayout.IntPopup(this.m_DefaultReflectionResolution, LightingEditor.Styles.defaultReflectionSizes, LightingEditor.Styles.defaultReflectionSizesValues, LightingEditor.Styles.defaultReflectionResolution, new GUILayoutOption[] { GUILayout.MinWidth(40f) }); } EditorGUILayout.PropertyField(this.m_ReflectionCompression, LightingEditor.Styles.ReflectionCompression, new GUILayoutOption[0]); EditorGUI.indentLevel--; EditorGUILayout.Slider(this.m_ReflectionIntensity, 0f, 1f, LightingEditor.Styles.reflectionIntensity, new GUILayoutOption[0]); EditorGUILayout.IntSlider(this.m_ReflectionBounces, 1, 5, LightingEditor.Styles.reflectionBounces, new GUILayoutOption[0]); EditorGUI.indentLevel--; base.serializedObject.ApplyModifiedProperties(); this.m_lightmapSettings.ApplyModifiedProperties(); } }