public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(m_Fog, Styles.FogEnable); if (m_Fog.boolValue) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_FogColor, Styles.FogColor); EditorGUILayout.PropertyField(m_FogMode, Styles.FogMode); if ((FogMode)m_FogMode.intValue != FogMode.Linear) { EditorGUILayout.PropertyField(m_FogDensity, Styles.FogDensity); } else { EditorGUILayout.PropertyField(m_LinearFogStart, Styles.FogLinearStart); EditorGUILayout.PropertyField(m_LinearFogEnd, Styles.FogLinearEnd); } if (SceneView.IsUsingDeferredRenderingPath()) { EditorGUILayout.HelpBox(Styles.FogWarning.text, MessageType.Info); } EditorGUI.indentLevel--; EditorGUILayout.Space(); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { base.serializedObject.Update(); EditorGUILayout.PropertyField(this.m_Fog, FogEditor.Styles.FogEnable, new GUILayoutOption[0]); if (this.m_Fog.boolValue) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(this.m_FogColor, FogEditor.Styles.FogColor, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_FogMode, FogEditor.Styles.FogMode, new GUILayoutOption[0]); if (this.m_FogMode.intValue != 1) { EditorGUILayout.PropertyField(this.m_FogDensity, FogEditor.Styles.FogDensity, new GUILayoutOption[0]); } else { EditorGUILayout.PropertyField(this.m_LinearFogStart, FogEditor.Styles.FogLinearStart, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_LinearFogEnd, FogEditor.Styles.FogLinearEnd, new GUILayoutOption[0]); } if (SceneView.IsUsingDeferredRenderingPath()) { EditorGUILayout.HelpBox(FogEditor.Styles.FogWarning.text, MessageType.Info); } EditorGUI.indentLevel--; EditorGUILayout.Space(); } base.serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { base.serializedObject.Update(); bool flag = false; SerializedProperty serializedProperty = base.serializedObject.FindProperty("m_Materials"); if (!serializedProperty.hasMultipleDifferentValues) { MeshFilter component = ((MeshRenderer)base.serializedObject.targetObject).GetComponent <MeshFilter>(); flag = (component != null && component.sharedMesh != null && serializedProperty.arraySize > component.sharedMesh.subMeshCount); } EditorGUILayout.PropertyField(this.m_CastShadows, true, new GUILayoutOption[0]); bool disabled = SceneView.IsUsingDeferredRenderingPath(); using (new EditorGUI.DisabledScope(disabled)) { EditorGUILayout.PropertyField(this.m_ReceiveShadows, true, new GUILayoutOption[0]); } EditorGUILayout.PropertyField(this.m_MotionVectors, true, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_Materials, true, new GUILayoutOption[0]); if (!this.m_Materials.hasMultipleDifferentValues && flag) { EditorGUILayout.HelpBox("This renderer has more materials than the Mesh has submeshes. Multiple materials will be applied to the same submesh, which costs performance. Consider using multiple shader passes.", MessageType.Warning, true); } base.RenderProbeFields(); base.serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { base.serializedObject.Update(); this.m_ShowEditor = EditorGUILayout.ToggleTitlebar(this.m_ShowEditor, FogEditor.Styles.fogHeader, this.m_Fog); if (this.m_ShowEditor) { EditorGUI.indentLevel++; EditorGUI.BeginDisabledGroup(!this.m_Fog.boolValue); EditorGUILayout.PropertyField(this.m_FogColor, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_FogMode, new GUILayoutOption[0]); EditorGUI.indentLevel++; FogMode intValue = (FogMode)this.m_FogMode.intValue; if (intValue != FogMode.Linear) { EditorGUILayout.PropertyField(this.m_FogDensity, FogEditor.Styles.fogDensity, new GUILayoutOption[0]); } else { EditorGUILayout.PropertyField(this.m_LinearFogStart, FogEditor.Styles.fogLinearStart, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_LinearFogEnd, FogEditor.Styles.fogLinearEnd, new GUILayoutOption[0]); } EditorGUI.indentLevel--; if (SceneView.IsUsingDeferredRenderingPath()) { EditorGUILayout.HelpBox(FogEditor.Styles.fogWarning.text, MessageType.Info); } EditorGUILayout.EndFadeGroup(); EditorGUI.EndDisabledGroup(); EditorGUI.indentLevel--; } base.serializedObject.ApplyModifiedProperties(); }
protected void RenderCommonProbeFields(bool useMiniStyle) { bool isDeferredRenderingPath = SceneView.IsUsingDeferredRenderingPath(); bool isDeferredReflections = isDeferredRenderingPath && (GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != BuiltinShaderMode.Disabled); m_Probes.RenderReflectionProbeUsage(useMiniStyle, isDeferredRenderingPath, isDeferredReflections); m_Probes.RenderProbeAnchor(useMiniStyle); }
protected void RenderCommonProbeFields(bool useMiniStyle) { bool flag = SceneView.IsUsingDeferredRenderingPath(); bool isDeferredReflections = flag && UnityEngine.Rendering.GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != BuiltinShaderMode.Disabled; this.m_Probes.RenderReflectionProbeUsage(useMiniStyle, flag, isDeferredReflections); this.m_Probes.RenderProbeAnchor(useMiniStyle); }
public override void OnInspectorGUI(ParticleSystem s) { if (RendererModuleUI.s_Texts == null) { RendererModuleUI.s_Texts = new RendererModuleUI.Texts(); } RendererModuleUI.RenderMode intValue = (RendererModuleUI.RenderMode) this.m_RenderMode.intValue; RendererModuleUI.RenderMode renderMode = (RendererModuleUI.RenderMode)ModuleUI.GUIPopup(RendererModuleUI.s_Texts.renderMode, this.m_RenderMode, RendererModuleUI.s_Texts.particleTypes); if (renderMode == RendererModuleUI.RenderMode.Mesh) { EditorGUI.indentLevel++; this.DoListOfMeshesGUI(); EditorGUI.indentLevel--; if (intValue != RendererModuleUI.RenderMode.Mesh && this.m_Meshes[0].objectReferenceInstanceIDValue == 0) { this.m_Meshes[0].objectReferenceValue = Resources.GetBuiltinResource(typeof(Mesh), "Cube.fbx"); } } else if (renderMode == RendererModuleUI.RenderMode.Stretch3D) { EditorGUI.indentLevel++; ModuleUI.GUIFloat(RendererModuleUI.s_Texts.cameraSpeedScale, this.m_CameraVelocityScale); ModuleUI.GUIFloat(RendererModuleUI.s_Texts.speedScale, this.m_VelocityScale); ModuleUI.GUIFloat(RendererModuleUI.s_Texts.lengthScale, this.m_LengthScale); EditorGUI.indentLevel--; } if (renderMode != RendererModuleUI.RenderMode.Mesh) { ModuleUI.GUIFloat(RendererModuleUI.s_Texts.normalDirection, this.m_NormalDirection); } if (this.m_Material != null) { ModuleUI.GUIObject(RendererModuleUI.s_Texts.material, this.m_Material); } ModuleUI.GUIPopup(RendererModuleUI.s_Texts.sortMode, this.m_SortMode, RendererModuleUI.s_Texts.sortTypes); ModuleUI.GUIFloat(RendererModuleUI.s_Texts.sortingFudge, this.m_SortingFudge); ModuleUI.GUIPopup(RendererModuleUI.s_Texts.castShadows, this.m_CastShadows, this.m_CastShadows.enumDisplayNames); using (new EditorGUI.DisabledScope(SceneView.IsUsingDeferredRenderingPath())) { ModuleUI.GUIToggle(RendererModuleUI.s_Texts.receiveShadows, this.m_ReceiveShadows); } if (renderMode != RendererModuleUI.RenderMode.Mesh) { ModuleUI.GUIFloat(RendererModuleUI.s_Texts.minParticleSize, this.m_MinParticleSize); ModuleUI.GUIFloat(RendererModuleUI.s_Texts.maxParticleSize, this.m_MaxParticleSize); } EditorGUILayout.Space(); EditorGUILayout.SortingLayerField(RendererModuleUI.s_Texts.sortingLayer, this.m_SortingLayerID, ParticleSystemStyles.Get().popup, ParticleSystemStyles.Get().label); ModuleUI.GUIInt(RendererModuleUI.s_Texts.sortingOrder, this.m_SortingOrder); if (renderMode == RendererModuleUI.RenderMode.Billboard) { ModuleUI.GUIPopup(RendererModuleUI.s_Texts.space, this.m_RenderAlignment, RendererModuleUI.s_Texts.spaces); } ModuleUI.GUIVector3Field(RendererModuleUI.s_Texts.pivot, this.m_Pivot); this.m_Probes.OnGUI(null, s.GetComponent <Renderer>(), true); }
public override void OnInspectorGUI(ParticleSystem s) { if (s_Texts == null) { s_Texts = new Texts(); } RenderMode intValue = (RenderMode)this.m_RenderMode.intValue; RenderMode mode2 = (RenderMode)ModuleUI.GUIPopup(s_Texts.renderMode, this.m_RenderMode, s_Texts.particleTypes); switch (mode2) { case RenderMode.Mesh: EditorGUI.indentLevel++; this.DoListOfMeshesGUI(); EditorGUI.indentLevel--; if ((intValue != RenderMode.Mesh) && (this.m_Meshes[0].objectReferenceInstanceIDValue == 0)) { this.m_Meshes[0].objectReferenceValue = Resources.GetBuiltinResource(typeof(Mesh), "Cube.fbx"); } break; case RenderMode.Stretch3D: EditorGUI.indentLevel++; ModuleUI.GUIFloat(s_Texts.cameraSpeedScale, this.m_CameraVelocityScale); ModuleUI.GUIFloat(s_Texts.speedScale, this.m_VelocityScale); ModuleUI.GUIFloat(s_Texts.lengthScale, this.m_LengthScale); EditorGUI.indentLevel--; break; } if (mode2 != RenderMode.Mesh) { ModuleUI.GUIFloat(s_Texts.normalDirection, this.m_NormalDirection); } if (this.m_Material != null) { ModuleUI.GUIObject(s_Texts.material, this.m_Material); } ModuleUI.GUIPopup(s_Texts.sortMode, this.m_SortMode, s_Texts.sortTypes); ModuleUI.GUIFloat(s_Texts.sortingFudge, this.m_SortingFudge); ModuleUI.GUIPopup(s_Texts.castShadows, this.m_CastShadows, this.m_CastShadows.enumDisplayNames); EditorGUI.BeginDisabledGroup(SceneView.IsUsingDeferredRenderingPath()); ModuleUI.GUIToggle(s_Texts.receiveShadows, this.m_ReceiveShadows); EditorGUI.EndDisabledGroup(); ModuleUI.GUIFloat(s_Texts.minParticleSize, this.m_MinParticleSize); ModuleUI.GUIFloat(s_Texts.maxParticleSize, this.m_MaxParticleSize); EditorGUILayout.Space(); EditorGUILayout.SortingLayerField(s_Texts.sortingLayer, this.m_SortingLayerID, ParticleSystemStyles.Get().popup, ParticleSystemStyles.Get().label); ModuleUI.GUIInt(s_Texts.sortingOrder, this.m_SortingOrder); if (mode2 == RenderMode.Billboard) { ModuleUI.GUIPopup(s_Texts.space, this.m_RenderAlignment, s_Texts.spaces); } EditorGUILayout.PropertyField(this.m_Pivot, s_Texts.pivot, new GUILayoutOption[0]); this.m_Probes.OnGUI(null, s.GetComponent <Renderer>(), true); }
// Set useMiniStyle to true to use smaller UI styles, // like in particle system modules UI. // // The code does branches right now on that instead of just // picking one or another style, since there are no UI // functions, like EditorGUILayout.ObjectField that would take // a style parameter :( internal void OnGUI(UnityEngine.Object[] selection, Renderer renderer, bool useMiniStyle) { int selectionCount = 1; bool isDeferredRenderingPath = SceneView.IsUsingDeferredRenderingPath(); bool isDeferredReflections = isDeferredRenderingPath && (UnityEngine.Rendering.GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != BuiltinShaderMode.Disabled); bool areLightProbesAllowed = true; if (selection != null) { foreach (UnityEngine.Object obj in selection) { if (LightProbes.AreLightProbesAllowed((Renderer)obj) == false) { areLightProbesAllowed = false; break; } } selectionCount = selection.Length; } RenderLightProbeUsage(selectionCount, renderer, useMiniStyle, areLightProbesAllowed); RenderLightProbeProxyVolumeWarningNote(renderer, selectionCount); RenderReflectionProbeUsage(useMiniStyle, isDeferredRenderingPath, isDeferredReflections); // anchor field - light probes and reflection probes share the same anchor bool needsProbeAnchorField = RenderProbeAnchor(useMiniStyle); if (needsProbeAnchorField) { bool useReflectionProbes = !m_ReflectionProbeUsage.hasMultipleDifferentValues && (ReflectionProbeUsage)m_ReflectionProbeUsage.intValue != ReflectionProbeUsage.Off; if (useReflectionProbes) { if (!isDeferredReflections) { renderer.GetClosestReflectionProbes(m_BlendInfo); ShowClosestReflectionProbes(m_BlendInfo); } } } bool receivesShadow = !m_ReceiveShadows.hasMultipleDifferentValues && m_ReceiveShadows.boolValue; if ((isDeferredRenderingPath && receivesShadow) || (isDeferredReflections && needsProbeAnchorField)) { EditorGUILayout.HelpBox(m_DeferredNote.text, MessageType.Info); } }
internal void OnGUI(UnityEngine.Object[] selection, Renderer renderer, bool useMiniStyle) { int selectionCount = 1; bool flag = SceneView.IsUsingDeferredRenderingPath(); bool flag2 = flag && UnityEngine.Rendering.GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != BuiltinShaderMode.Disabled; bool usesLightMaps = false; if (selection != null) { for (int i = 0; i < selection.Length; i++) { UnityEngine.Object @object = selection[i]; if (LightmapEditorSettings.IsLightmappedOrDynamicLightmappedForRendering((Renderer)@object)) { usesLightMaps = true; break; } } selectionCount = selection.Length; } this.RenderLightProbeUsage(selectionCount, renderer, useMiniStyle, usesLightMaps); this.RenderReflectionProbeUsage(useMiniStyle, flag, flag2); bool flag3 = this.RenderProbeAnchor(useMiniStyle); if (flag3) { bool flag4 = !this.m_ReflectionProbeUsage.hasMultipleDifferentValues && this.m_ReflectionProbeUsage.intValue != 0; if (flag4) { if (!flag2) { renderer.GetClosestReflectionProbes(this.m_BlendInfo); RendererEditorBase.Probes.ShowClosestReflectionProbes(this.m_BlendInfo); } } } bool flag5 = !this.m_ReceiveShadows.hasMultipleDifferentValues && this.m_ReceiveShadows.boolValue; if ((flag && flag5) || (flag2 && flag3)) { EditorGUILayout.HelpBox(this.m_DeferredNote.text, MessageType.Info); } this.RenderLightProbeProxyVolumeWarningNote(renderer, selectionCount); }
public override void OnInspectorGUI(InitialModuleUI initial) { if (RendererModuleUI.s_Texts == null) { RendererModuleUI.s_Texts = new RendererModuleUI.Texts(); } EditorGUI.BeginChangeCheck(); RendererModuleUI.RenderMode renderMode = (RendererModuleUI.RenderMode)ModuleUI.GUIPopup(RendererModuleUI.s_Texts.renderMode, this.m_RenderMode, RendererModuleUI.s_Texts.particleTypes, new GUILayoutOption[0]); bool flag = EditorGUI.EndChangeCheck(); if (!this.m_RenderMode.hasMultipleDifferentValues) { if (renderMode == RendererModuleUI.RenderMode.Mesh) { EditorGUI.indentLevel++; this.DoListOfMeshesGUI(); EditorGUI.indentLevel--; if (flag && this.m_Meshes[0].objectReferenceInstanceIDValue == 0 && !this.m_Meshes[0].hasMultipleDifferentValues) { this.m_Meshes[0].objectReferenceValue = Resources.GetBuiltinResource(typeof(Mesh), "Cube.fbx"); } } else if (renderMode == RendererModuleUI.RenderMode.Stretch3D) { EditorGUI.indentLevel++; ModuleUI.GUIFloat(RendererModuleUI.s_Texts.cameraSpeedScale, this.m_CameraVelocityScale, new GUILayoutOption[0]); ModuleUI.GUIFloat(RendererModuleUI.s_Texts.speedScale, this.m_VelocityScale, new GUILayoutOption[0]); ModuleUI.GUIFloat(RendererModuleUI.s_Texts.lengthScale, this.m_LengthScale, new GUILayoutOption[0]); EditorGUI.indentLevel--; } if (renderMode != RendererModuleUI.RenderMode.None) { if (renderMode != RendererModuleUI.RenderMode.Mesh) { ModuleUI.GUIFloat(RendererModuleUI.s_Texts.normalDirection, this.m_NormalDirection, new GUILayoutOption[0]); } if (this.m_Material != null) { ModuleUI.GUIObject(RendererModuleUI.s_Texts.material, this.m_Material, new GUILayoutOption[0]); } } } bool flag2 = this.m_ParticleSystemUI.m_ParticleSystems.FirstOrDefault((ParticleSystem o) => o.trails.enabled) != null; if (flag2 && this.m_TrailMaterial != null) { ModuleUI.GUIObject(RendererModuleUI.s_Texts.trailMaterial, this.m_TrailMaterial, new GUILayoutOption[0]); } if (!this.m_RenderMode.hasMultipleDifferentValues) { if (renderMode != RendererModuleUI.RenderMode.None) { ModuleUI.GUIPopup(RendererModuleUI.s_Texts.sortMode, this.m_SortMode, RendererModuleUI.s_Texts.sortTypes, new GUILayoutOption[0]); ModuleUI.GUIFloat(RendererModuleUI.s_Texts.sortingFudge, this.m_SortingFudge, new GUILayoutOption[0]); if (renderMode != RendererModuleUI.RenderMode.Mesh) { ModuleUI.GUIFloat(RendererModuleUI.s_Texts.minParticleSize, this.m_MinParticleSize, new GUILayoutOption[0]); ModuleUI.GUIFloat(RendererModuleUI.s_Texts.maxParticleSize, this.m_MaxParticleSize, new GUILayoutOption[0]); } if (renderMode == RendererModuleUI.RenderMode.Billboard) { bool flag3 = this.m_ParticleSystemUI.m_ParticleSystems.FirstOrDefault((ParticleSystem o) => o.shape.alignToDirection) != null; if (flag3) { using (new EditorGUI.DisabledScope(true)) { ModuleUI.GUIPopup(RendererModuleUI.s_Texts.space, 0, new string[] { RendererModuleUI.s_Texts.spaces[2] }, new GUILayoutOption[0]); } GUIContent gUIContent = EditorGUIUtility.TextContent("Using Align to Direction in the Shape Module forces the system to be rendered using Local Billboard Alignment."); EditorGUILayout.HelpBox(gUIContent.text, MessageType.Info, true); } else { ModuleUI.GUIPopup(RendererModuleUI.s_Texts.space, this.m_RenderAlignment, RendererModuleUI.s_Texts.spaces, new GUILayoutOption[0]); } } ModuleUI.GUIVector3Field(RendererModuleUI.s_Texts.pivot, this.m_Pivot, new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); RendererModuleUI.s_VisualizePivot = ModuleUI.GUIToggle(RendererModuleUI.s_Texts.visualizePivot, RendererModuleUI.s_VisualizePivot, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool("VisualizePivot", RendererModuleUI.s_VisualizePivot); } if (ModuleUI.GUIToggle(RendererModuleUI.s_Texts.useCustomVertexStreams, this.m_UseCustomVertexStreams, new GUILayoutOption[0])) { this.DoVertexStreamsGUI(renderMode); } EditorGUILayout.Space(); ModuleUI.GUIPopup(RendererModuleUI.s_Texts.castShadows, this.m_CastShadows, this.m_CastShadows.enumDisplayNames, new GUILayoutOption[0]); using (new EditorGUI.DisabledScope(SceneView.IsUsingDeferredRenderingPath())) { ModuleUI.GUIToggle(RendererModuleUI.s_Texts.receiveShadows, this.m_ReceiveShadows, new GUILayoutOption[0]); } ModuleUI.GUIPopup(RendererModuleUI.s_Texts.motionVectors, this.m_MotionVectors, RendererModuleUI.s_Texts.motionVectorOptions, new GUILayoutOption[0]); EditorGUILayout.SortingLayerField(RendererModuleUI.s_Texts.sortingLayer, this.m_SortingLayerID, ParticleSystemStyles.Get().popup, ParticleSystemStyles.Get().label); ModuleUI.GUIInt(RendererModuleUI.s_Texts.sortingOrder, this.m_SortingOrder, new GUILayoutOption[0]); } } List <ParticleSystemRenderer> list = new List <ParticleSystemRenderer>(); ParticleSystem[] particleSystems = this.m_ParticleSystemUI.m_ParticleSystems; for (int i = 0; i < particleSystems.Length; i++) { ParticleSystem particleSystem = particleSystems[i]; list.Add(particleSystem.GetComponent <ParticleSystemRenderer>()); } this.m_Probes.OnGUI(list.ToArray(), list.FirstOrDefault <ParticleSystemRenderer>(), true); }
override public void OnInspectorGUI(InitialModuleUI initial) { var renderer = serializedObject.targetObject as Renderer; EditorGUI.BeginChangeCheck(); RenderMode renderMode = (RenderMode)GUIPopup(s_Texts.renderMode, m_RenderMode, s_Texts.particleTypes); bool renderModeChanged = EditorGUI.EndChangeCheck(); if (!m_RenderMode.hasMultipleDifferentValues) { if (renderMode == RenderMode.Mesh) { GUIPopup(s_Texts.meshDistribution, m_MeshDistribution, s_Texts.meshDistributionOptions); DoListOfMeshesGUI(); if (renderModeChanged && m_Meshes[0].objectReferenceInstanceIDValue == 0 && !m_Meshes[0].hasMultipleDifferentValues) { m_Meshes[0].objectReferenceValue = Resources.GetBuiltinResource(typeof(Mesh), "Cube.fbx"); } } else if (renderMode == RenderMode.Stretch3D) { EditorGUI.indentLevel++; GUIFloat(s_Texts.cameraSpeedScale, m_CameraVelocityScale); GUIFloat(s_Texts.speedScale, m_VelocityScale); GUIFloat(s_Texts.lengthScale, m_LengthScale); GUIToggle(s_Texts.freeformStretching, m_FreeformStretching); if (m_FreeformStretching.boolValue && !m_FreeformStretching.hasMultipleDifferentValues) { GUIToggle(s_Texts.rotateWithStretchDirection, m_RotateWithStretchDirection); } else { using (new EditorGUI.DisabledScope(true)) { GUIToggle(s_Texts.rotateWithStretchDirection, true); } } EditorGUI.indentLevel--; } if (renderMode != RenderMode.None) { if (renderMode != RenderMode.Mesh) { GUIFloat(s_Texts.normalDirection, m_NormalDirection); } } } if (renderMode != RenderMode.None) { if (m_Material != null) // The renderer's material list could be empty { GUIObject(s_Texts.material, m_Material); } } var trailMaterial = serializedObject.FindProperty("m_Materials.Array.data[1]"); // Optional - may fail if (trailMaterial != null) // Only show if the system has a second material slot { GUIObject(s_Texts.trailMaterial, trailMaterial); } if (renderMode != RenderMode.None) { if (!m_RenderMode.hasMultipleDifferentValues) { GUIPopup(s_Texts.sortMode, m_SortMode, s_Texts.sortTypes); if (renderer != null && SortingGroup.invalidSortingGroupID != renderer.sortingGroupID) { using (new EditorGUI.DisabledScope(true)) GUIFloat(s_Texts.sortingFudgeDisabledDueToSortingGroup, m_SortingFudge); } else { GUIFloat(s_Texts.sortingFudge, m_SortingFudge); } if (renderMode != RenderMode.Mesh) { GUIFloat(s_Texts.minParticleSize, m_MinParticleSize); GUIFloat(s_Texts.maxParticleSize, m_MaxParticleSize); } if (renderMode == RenderMode.Billboard || renderMode == RenderMode.Mesh) { bool anyAlignToDirection = m_ParticleSystemUI.m_ParticleSystems.FirstOrDefault(o => o.shape.enabled && o.shape.alignToDirection) != null; if (anyAlignToDirection) { using (new EditorGUI.DisabledScope(true)) { GUIPopup(s_Texts.space, 0, s_Texts.localSpace); // force to "Local" } GUIContent info = EditorGUIUtility.TrTextContent("Using Align to Direction in the Shape Module forces the system to be rendered using Local Render Alignment."); EditorGUILayout.HelpBox(info.text, MessageType.Info, true); } else { GUIPopup(s_Texts.space, m_RenderAlignment, s_Texts.spaces); } } if (renderMode == RenderMode.Mesh) { GUIVector3Field(s_Texts.flipMeshes, m_Flip); } else { GUIVector3Field(s_Texts.flip, m_Flip); } if (renderMode == RenderMode.Billboard) { GUIToggle(s_Texts.allowRoll, m_AllowRoll); } if (renderMode == RenderMode.Mesh && SupportedRenderingFeatures.active.particleSystemInstancing) { GUIToggle(s_Texts.enableGPUInstancing, m_EnableGPUInstancing); if (!m_ParticleSystemUI.multiEdit && m_EnableGPUInstancing.boolValue) { Material materialAsset = m_Material?.objectReferenceValue as Material; Material trailMaterialAsset = trailMaterial?.objectReferenceValue as Material; if (materialAsset != null && trailMaterialAsset != null) { if (trailMaterialAsset.shader == materialAsset.shader) { if (ShaderUtil.HasProceduralInstancing(materialAsset.shader)) { EditorGUILayout.HelpBox(s_Texts.meshGPUInstancingTrailsWarning.text, MessageType.Error, true); } } } } } } GUIVector3Field(s_Texts.pivot, m_Pivot); if (EditorGUIUtility.comparisonViewMode == EditorGUIUtility.ComparisonViewMode.None) { EditorGUI.BeginChangeCheck(); s_VisualizePivot = GUIToggle(s_Texts.visualizePivot, s_VisualizePivot); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool("VisualizePivot", s_VisualizePivot); } } GUIPopup(s_Texts.maskingMode, m_MaskInteraction, s_Texts.maskInteractions); GUIToggle(s_Texts.applyActiveColorSpace, m_ApplyActiveColorSpace); if (GUIToggle(s_Texts.useCustomVertexStreams, m_UseCustomVertexStreams)) { DoVertexStreamsGUI(renderMode); } } EditorGUILayout.Space(); GUIPopup(s_Texts.castShadows, m_CastShadows, EditorGUIUtility.TempContent(m_CastShadows.enumDisplayNames)); if (m_CastShadows.hasMultipleDifferentValues || m_CastShadows.intValue != 0) { RenderPipelineAsset srpAsset = GraphicsSettings.currentRenderPipeline; if (srpAsset != null) { GUIToggle(s_Texts.staticShadowCaster, m_StaticShadowCaster); } } if (SupportedRenderingFeatures.active.receiveShadows) { // Disable ReceiveShadows options for Deferred rendering path if (SceneView.IsUsingDeferredRenderingPath()) { using (new EditorGUI.DisabledScope(true)) { GUIToggle(s_Texts.receiveShadows, true); } } else { GUIToggle(s_Texts.receiveShadows, m_ReceiveShadows); } } if (renderMode != RenderMode.Mesh) { GUIFloat(s_Texts.shadowBias, m_ShadowBias); } if (SupportedRenderingFeatures.active.motionVectors) { GUIPopup(s_Texts.motionVectors, m_MotionVectors, s_Texts.motionVectorOptions); } GUISortingLayerField(s_Texts.sortingLayer, m_SortingLayerID); GUIInt(s_Texts.sortingOrder, m_SortingOrder); List <ParticleSystemRenderer> renderers = new List <ParticleSystemRenderer>(); foreach (ParticleSystem ps in m_ParticleSystemUI.m_ParticleSystems) { renderers.Add(ps.GetComponent <ParticleSystemRenderer>()); } var renderersArray = renderers.ToArray(); m_Probes.OnGUI(renderersArray, renderers.FirstOrDefault(), true); RendererEditorBase.DrawRenderingLayer(m_RenderingLayerMask, renderer, renderersArray, true); RendererEditorBase.DrawRendererPriority(m_RendererPriority, true); }
override public void OnInspectorGUI(InitialModuleUI initial) { EditorGUI.BeginChangeCheck(); RenderMode renderMode = (RenderMode)GUIPopup(s_Texts.renderMode, m_RenderMode, s_Texts.particleTypes); bool renderModeChanged = EditorGUI.EndChangeCheck(); if (!m_RenderMode.hasMultipleDifferentValues) { if (renderMode == RenderMode.Mesh) { EditorGUI.indentLevel++; DoListOfMeshesGUI(); EditorGUI.indentLevel--; if (renderModeChanged && m_Meshes[0].objectReferenceInstanceIDValue == 0 && !m_Meshes[0].hasMultipleDifferentValues) { m_Meshes[0].objectReferenceValue = Resources.GetBuiltinResource(typeof(Mesh), "Cube.fbx"); } } else if (renderMode == RenderMode.Stretch3D) { EditorGUI.indentLevel++; GUIFloat(s_Texts.cameraSpeedScale, m_CameraVelocityScale); GUIFloat(s_Texts.speedScale, m_VelocityScale); GUIFloat(s_Texts.lengthScale, m_LengthScale); EditorGUI.indentLevel--; } if (renderMode != RenderMode.None) { if (renderMode != RenderMode.Mesh) { GUIFloat(s_Texts.normalDirection, m_NormalDirection); } if (m_Material != null) // The renderer's material list could be empty { GUIObject(s_Texts.material, m_Material); } } } if (m_TrailMaterial != null) // The renderer's material list could be empty { GUIObject(s_Texts.trailMaterial, m_TrailMaterial); } if (renderMode != RenderMode.None) { if (!m_RenderMode.hasMultipleDifferentValues) { GUIPopup(s_Texts.sortMode, m_SortMode, s_Texts.sortTypes); GUIFloat(s_Texts.sortingFudge, m_SortingFudge); if (renderMode != RenderMode.Mesh) { GUIFloat(s_Texts.minParticleSize, m_MinParticleSize); GUIFloat(s_Texts.maxParticleSize, m_MaxParticleSize); } if (renderMode == RenderMode.Billboard || renderMode == RenderMode.Mesh) { bool anyAligntoDirection = m_ParticleSystemUI.m_ParticleSystems.FirstOrDefault(o => o.shape.alignToDirection) != null; if (anyAligntoDirection) { using (new EditorGUI.DisabledScope(true)) { GUIPopup(s_Texts.space, 0, s_Texts.localSpace); // force to "Local" } GUIContent info = EditorGUIUtility.TrTextContent("Using Align to Direction in the Shape Module forces the system to be rendered using Local Render Alignment."); EditorGUILayout.HelpBox(info.text, MessageType.Info, true); } else { GUIPopup(s_Texts.space, m_RenderAlignment, s_Texts.spaces); } } if (renderMode == RenderMode.Mesh) { GUIToggle(s_Texts.enableGPUInstancing, m_EnableGPUInstancing); } } GUIVector3Field(s_Texts.pivot, m_Pivot); EditorGUI.BeginChangeCheck(); s_VisualizePivot = GUIToggle(s_Texts.visualizePivot, s_VisualizePivot); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool("VisualizePivot", s_VisualizePivot); } GUIPopup(s_Texts.maskingMode, m_MaskInteraction, s_Texts.maskInteractions); if (GUIToggle(s_Texts.useCustomVertexStreams, m_UseCustomVertexStreams)) { DoVertexStreamsGUI(renderMode); } } EditorGUILayout.Space(); GUIPopup(s_Texts.castShadows, m_CastShadows, EditorGUIUtility.TempContent(m_CastShadows.enumDisplayNames)); if (SupportedRenderingFeatures.active.rendererSupportsReceiveShadows) { // Disable ReceiveShadows options for Deferred rendering path if (SceneView.IsUsingDeferredRenderingPath()) { using (new EditorGUI.DisabledScope(true)) { GUIToggle(s_Texts.receiveShadows, true); } } else { GUIToggle(s_Texts.receiveShadows, m_ReceiveShadows); } } if (SupportedRenderingFeatures.active.rendererSupportsMotionVectors) { GUIPopup(s_Texts.motionVectors, m_MotionVectors, s_Texts.motionVectorOptions); } GUISortingLayerField(s_Texts.sortingLayer, m_SortingLayerID); GUIInt(s_Texts.sortingOrder, m_SortingOrder); List <ParticleSystemRenderer> renderers = new List <ParticleSystemRenderer>(); foreach (ParticleSystem ps in m_ParticleSystemUI.m_ParticleSystems) { renderers.Add(ps.GetComponent <ParticleSystemRenderer>()); } var renderersArray = renderers.ToArray(); m_Probes.OnGUI(renderersArray, renderers.FirstOrDefault(), true); RendererEditorBase.RenderRenderingLayer(m_RenderingLayerMask, serializedObject.targetObject as Renderer, renderersArray, true); }
public void RenderMeshSettings(bool showLightmapSettings) { if (s_Styles == null) { s_Styles = new Styles(); } if (m_SerializedObject == null || m_GameObjectsSerializedObject == null || m_GameObjectsSerializedObject.targetObjects.Length == 0) { return; } m_GameObjectsSerializedObject.Update(); m_LightmapSettings.Update(); EditorGUILayout.PropertyField(m_CastShadows, s_Styles.CastShadows, true); bool isDeferredRenderingPath = SceneView.IsUsingDeferredRenderingPath(); if (SupportedRenderingFeatures.active.rendererSupportsReceiveShadows) { using (new EditorGUI.DisabledScope(isDeferredRenderingPath)) EditorGUILayout.PropertyField(m_ReceiveShadows, s_Styles.ReceiveShadows, true); } if (SupportedRenderingFeatures.active.rendererSupportsMotionVectors) { EditorGUILayout.PropertyField(m_MotionVectors, s_Styles.MotionVectors, true); } if (!showLightmapSettings) { return; } LightmapStaticSettings(); if (!(m_EnabledBakedGI.boolValue || m_EnabledRealtimeGI.boolValue) && !isPrefabAsset) { EditorGUILayout.HelpBox(s_Styles.GINotEnabledInfo.text, MessageType.Info); return; } bool enableSettings = (m_StaticEditorFlags.intValue & (int)StaticEditorFlags.LightmapStatic) != 0; // We want to show the lightmap settings if the lightmap static flag is set. // Most of the settings apply to both, realtime and baked GI. if (enableSettings) { bool showEnlightenSettings = isPrefabAsset || m_EnabledRealtimeGI.boolValue || (m_EnabledBakedGI.boolValue && LightmapEditorSettings.lightmapper == LightmapEditorSettings.Lightmapper.Enlighten); bool showProgressiveSettings = isPrefabAsset || (m_EnabledBakedGI.boolValue && LightmapEditorSettings.lightmapper != LightmapEditorSettings.Lightmapper.Enlighten); if (showEnlightenSettings) { m_ShowChartingSettings = EditorGUILayout.Foldout(m_ShowChartingSettings, s_Styles.UVCharting, true); if (m_ShowChartingSettings) { RendererUVSettings(); } } m_ShowLightmapSettings = EditorGUILayout.Foldout(m_ShowLightmapSettings, s_Styles.LightmapSettings, true); if (m_ShowLightmapSettings) { EditorGUI.indentLevel += 1; float lodScale = LightmapVisualization.GetLightmapLODLevelScale(m_Renderers[0]); for (int i = 1; i < m_Renderers.Length; i++) { if (!Mathf.Approximately(lodScale, LightmapVisualization.GetLightmapLODLevelScale(m_Renderers[i]))) { lodScale = 1.0F; } } float lightmapScale = LightmapScaleGUI(lodScale) * LightmapVisualization.GetLightmapLODLevelScale(m_Renderers[0]); // tell the user if the object's size in lightmap has reached the max atlas size float cachedSurfaceArea = InternalMeshUtil.GetCachedMeshSurfaceArea((MeshRenderer)m_Renderers[0]); ShowClampedSizeInLightmapGUI(lightmapScale, cachedSurfaceArea); // Enlighten specific if (showEnlightenSettings) { EditorGUILayout.PropertyField(m_ImportantGI, s_Styles.ImportantGI); } if (showProgressiveSettings) { EditorGUILayout.PropertyField(m_StitchLightmapSeams, s_Styles.StitchLightmapSeams); } LightmapParametersGUI(m_LightmapParameters, s_Styles.LightmapParameters); m_ShowBakedLM = EditorGUILayout.Foldout(m_ShowBakedLM, s_Styles.Atlas, true); if (m_ShowBakedLM) { ShowAtlasGUI(m_Renderers[0].GetInstanceID()); } m_ShowRealtimeLM = EditorGUILayout.Foldout(m_ShowRealtimeLM, s_Styles.RealtimeLM, true); if (m_ShowRealtimeLM) { ShowRealtimeLMGUI(m_Renderers[0]); } EditorGUI.indentLevel -= 1; } if (LightmapEditorSettings.HasZeroAreaMesh(m_Renderers[0])) { EditorGUILayout.HelpBox(s_Styles.ZeroAreaPackingMesh.text, MessageType.Warning); } if (LightmapEditorSettings.HasClampedResolution(m_Renderers[0])) { EditorGUILayout.HelpBox(s_Styles.ClampedPackingResolution.text, MessageType.Warning); } if (!HasNormals(m_Renderers[0])) { EditorGUILayout.HelpBox(s_Styles.NoNormalsNoLightmapping.text, MessageType.Warning); } if (LightmapEditorSettings.HasUVOverlaps(m_Renderers[0])) { EditorGUILayout.HelpBox(s_Styles.UVOverlap.text, MessageType.Warning); } m_SerializedObject.ApplyModifiedProperties(); } else { EditorGUILayout.HelpBox(s_Styles.LightmapInfoBox.text, MessageType.Info); } }
internal void OnGUI(UnityEngine.Object[] targets, Renderer renderer, bool useMiniStyle) { bool disabled1 = SceneView.IsUsingDeferredRenderingPath(); bool flag1 = disabled1 && UnityEngine.Rendering.GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != UnityEngine.Rendering.BuiltinShaderMode.Disabled; bool disabled2 = false; if (targets != null) { foreach (Renderer target in targets) { if (LightmapEditorSettings.IsLightmappedOrDynamicLightmappedForRendering(target)) { disabled2 = true; break; } } } if (this.m_UseLightProbes != null) { EditorGUI.BeginDisabledGroup(disabled2); if (!useMiniStyle) { if (disabled2) EditorGUILayout.Toggle(this.m_UseLightProbesStyle, false, new GUILayoutOption[0]); else EditorGUILayout.PropertyField(this.m_UseLightProbes, this.m_UseLightProbesStyle, new GUILayoutOption[0]); } else if (disabled2) ModuleUI.GUIToggle(this.m_UseLightProbesStyle, false); else ModuleUI.GUIToggle(this.m_UseLightProbesStyle, this.m_UseLightProbes); EditorGUI.EndDisabledGroup(); } EditorGUI.BeginDisabledGroup(disabled1); if (!useMiniStyle) { if (flag1) EditorGUILayout.EnumPopup(this.m_ReflectionProbeUsageStyle, (Enum) (ReflectionProbeUsage) (this.m_ReflectionProbeUsage.intValue == 0 ? 0 : 3), new GUILayoutOption[0]); else EditorGUILayout.Popup(this.m_ReflectionProbeUsage, this.m_ReflectionProbeUsageOptions, this.m_ReflectionProbeUsageStyle, new GUILayoutOption[0]); } else if (flag1) ModuleUI.GUIPopup(this.m_ReflectionProbeUsageStyle, 3, this.m_ReflectionProbeUsageNames); else ModuleUI.GUIPopup(this.m_ReflectionProbeUsageStyle, this.m_ReflectionProbeUsage, this.m_ReflectionProbeUsageNames); EditorGUI.EndDisabledGroup(); bool flag2 = !this.m_ReflectionProbeUsage.hasMultipleDifferentValues && this.m_ReflectionProbeUsage.intValue != 0 || this.m_UseLightProbes != null && !this.m_UseLightProbes.hasMultipleDifferentValues && this.m_UseLightProbes.boolValue; if (flag2) { if (!useMiniStyle) EditorGUILayout.PropertyField(this.m_ProbeAnchor, this.m_ProbeAnchorStyle, new GUILayoutOption[0]); else ModuleUI.GUIObject(this.m_ProbeAnchorStyle, this.m_ProbeAnchor); if (!flag1) { renderer.GetClosestReflectionProbes(this.m_BlendInfo); RendererEditorBase.Probes.ShowClosestReflectionProbes(this.m_BlendInfo); } } bool flag3 = !this.m_ReceiveShadows.hasMultipleDifferentValues && this.m_ReceiveShadows.boolValue; if ((!disabled1 || !flag3) && (!flag1 || !flag2)) return; EditorGUILayout.HelpBox(this.m_DeferredNote.text, MessageType.Info); }
public void RenderSettings(bool showLightmapSettings) { if (m_SerializedObject == null || m_GameObjectsSerializedObject == null || m_GameObjectsSerializedObject.targetObjectsCount == 0) { return; } var settings = Lightmapping.GetLightingSettingsOrDefaultsFallback(); var lightmapper = settings.lightmapper; bool bakedGI = settings.bakedGI; bool realtimeGI = settings.realtimeGI; m_GameObjectsSerializedObject.Update(); ReceiveGI receiveGI = (ReceiveGI)m_ReceiveGI.intValue; bool contributeGI = (m_StaticEditorFlags.intValue & (int)StaticEditorFlags.ContributeGI) != 0; bool showEnlightenSettings = isPrefabAsset || realtimeGI || (bakedGI && lightmapper == LightingSettings.Lightmapper.Enlighten); // m_ReceiveGI might still be set to Lightmaps, but LightProbes is shown in the inspector since the contributeGI if off. // In this case we still have to mark it as "multiple values" even though both have "Lightmaps" as the value, but one is showing a grayed out "Light Probes" in the UI bool showMixedGIValue = m_ReceiveGI.hasMultipleDifferentValues || ((m_StaticEditorFlags.hasMultipleDifferentValuesBitwise & (int)StaticEditorFlags.ContributeGI) != 0); m_ShowLightingSettings.value = EditorGUILayout.BeginFoldoutHeaderGroup(m_ShowLightingSettings.value, Styles.lightingSettings); if (m_ShowLightingSettings.value) { EditorGUI.indentLevel += 1; EditorGUILayout.PropertyField(m_CastShadows, Styles.castShadows, true); bool isDeferredRenderingPath = SceneView.IsUsingDeferredRenderingPath(); if (SupportedRenderingFeatures.active.receiveShadows) { using (new EditorGUI.DisabledScope(isDeferredRenderingPath)) EditorGUILayout.PropertyField(m_ReceiveShadows, Styles.receiveShadows, true); } if (!showLightmapSettings) { EditorGUI.indentLevel -= 1; EditorGUILayout.EndFoldoutHeaderGroup(); return; } contributeGI = ContributeGISettings(); if (!(bakedGI || realtimeGI) && !isPrefabAsset && contributeGI) { EditorGUILayout.HelpBox(Styles.giNotEnabledInfo.text, MessageType.Info); EditorGUI.indentLevel -= 1; EditorGUILayout.EndFoldoutHeaderGroup(); return; } if (contributeGI) { var rect = EditorGUILayout.GetControlRect(); EditorGUI.BeginProperty(rect, Styles.receiveGITitle, m_ReceiveGI); EditorGUI.BeginChangeCheck(); receiveGI = (ReceiveGI)EditorGUI.IntPopup(rect, Styles.receiveGITitle, (int)receiveGI, Styles.receiveGILightmapStrings, Styles.receiveGILightmapValues); if (EditorGUI.EndChangeCheck()) { m_ReceiveGI.intValue = (int)receiveGI; } EditorGUI.EndProperty(); if (showEnlightenSettings) { EditorGUILayout.PropertyField(m_ImportantGI, Styles.importantGI); } if (receiveGI == ReceiveGI.LightProbes && !showMixedGIValue) { LightmapScaleGUI(true, Styles.albedoScale, true); } } else { using (new EditorGUI.DisabledScope(true)) { EditorGUI.showMixedValue = showMixedGIValue; receiveGI = (ReceiveGI)EditorGUILayout.IntPopup(Styles.receiveGITitle, (int)ReceiveGI.LightProbes, Styles.receiveGILightmapStrings, Styles.receiveGILightmapValues); EditorGUI.showMixedValue = false; } } EditorGUI.indentLevel -= 1; } EditorGUILayout.EndFoldoutHeaderGroup(); if (showLightmapSettings && contributeGI && receiveGI == ReceiveGI.Lightmaps && !showMixedGIValue) { m_ShowLightmapSettings.value = EditorGUILayout.BeginFoldoutHeaderGroup(m_ShowLightmapSettings.value, Styles.lightmapSettings); if (m_ShowLightmapSettings.value) { EditorGUI.indentLevel += 1; bool showProgressiveSettings = isPrefabAsset || (bakedGI && lightmapper != LightingSettings.Lightmapper.Enlighten); LightmapScaleGUI(true, Styles.scaleInLightmap, false); if (showProgressiveSettings) { EditorGUILayout.PropertyField(m_StitchLightmapSeams, Styles.stitchLightmapSeams); } LightmapParametersGUI(m_LightmapParameters, Styles.lightmapParameters); if (showEnlightenSettings) { RendererUVSettings(); } if ((m_Renderers != null) && (m_Renderers.Length > 0)) { ShowAtlasGUI(m_Renderers[0].GetInstanceID(), true); ShowRealtimeLMGUI(m_Renderers[0]); if (Lightmapping.HasZeroAreaMesh(m_Renderers[0])) { EditorGUILayout.HelpBox(Styles.zeroAreaPackingMesh.text, MessageType.Warning); } DisplayMeshWarning(); if (showEnlightenSettings) { if (Lightmapping.HasClampedResolution(m_Renderers[0])) { EditorGUILayout.HelpBox(Styles.clampedPackingResolution.text, MessageType.Warning); } } if (showProgressiveSettings) { if (Lightmapping.HasUVOverlaps(m_Renderers[0])) { EditorGUILayout.HelpBox(Styles.uvOverlap.text, MessageType.Warning); } } } EditorGUI.indentLevel -= 1; } EditorGUILayout.EndFoldoutHeaderGroup(); } }
public override void OnInspectorGUI() { serializedObject.Update(); if (targets.Length == 1) { DoToolbar(); } m_ShowProbeModeRealtimeOptions.target = reflectionProbeMode == ReflectionProbeMode.Realtime; m_ShowProbeModeCustomOptions.target = reflectionProbeMode == ReflectionProbeMode.Custom; // Bake/custom/realtime type EditorGUILayout.IntPopup(m_Mode, Styles.reflectionProbeMode, Styles.reflectionProbeModeValues, Styles.typeText); // We cannot show multiple different type controls if (!m_Mode.hasMultipleDifferentValues) { EditorGUI.indentLevel++; { // Custom cubemap UI (Bake button and manual cubemap assignment) if (EditorGUILayout.BeginFadeGroup(m_ShowProbeModeCustomOptions.faded)) { EditorGUILayout.PropertyField(m_RenderDynamicObjects, Styles.renderDynamicObjects); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = m_CustomBakedTexture.hasMultipleDifferentValues; var newCubemap = EditorGUILayout.ObjectField(Styles.customCubemapText, m_CustomBakedTexture.objectReferenceValue, typeof(Texture), false); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { m_CustomBakedTexture.objectReferenceValue = newCubemap; } } EditorGUILayout.EndFadeGroup(); // Realtime UI if (EditorGUILayout.BeginFadeGroup(m_ShowProbeModeRealtimeOptions.faded)) { EditorGUILayout.PropertyField(m_RefreshMode, Styles.refreshMode); EditorGUILayout.PropertyField(m_TimeSlicingMode, Styles.timeSlicing); EditorGUILayout.Space(); } EditorGUILayout.EndFadeGroup(); } EditorGUI.indentLevel--; } EditorGUILayout.Space(); m_ShowRuntimeSettings.value = EditorGUILayout.BeginFoldoutHeaderGroup(m_ShowRuntimeSettings.value, Styles.runtimeSettingsHeader); if (m_ShowRuntimeSettings.value) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_Importance, Styles.importanceText); EditorGUILayout.PropertyField(m_IntensityMultiplier, Styles.intensityText); // Only take graphic Tier settings into account when built-in render pipeline is active. if (GraphicsSettings.currentRenderPipeline == null && Rendering.EditorGraphicsSettings.GetCurrentTierSettings().reflectionProbeBoxProjection == false) { using (new EditorGUI.DisabledScope(true)) { EditorGUILayout.Toggle(Styles.boxProjectionText, false); } } else { EditorGUILayout.PropertyField(m_BoxProjection, Styles.boxProjectionText); } bool isDeferredRenderingPath = SceneView.IsUsingDeferredRenderingPath(); bool isDeferredReflections = isDeferredRenderingPath && (UnityEngine.Rendering.GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != BuiltinShaderMode.Disabled); using (new EditorGUI.DisabledScope(!isDeferredReflections && !SupportedRenderingFeatures.active.reflectionProbesBlendDistance)) { EditorGUILayout.PropertyField(m_BlendDistance, Styles.blendDistanceText); } // Bounds editing (box projection bounds + the bounds that objects use to check if they should be affected by this reflection probe) if (EditorGUILayout.BeginFadeGroup(m_ShowBoxOptions.faded)) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_BoxSize, Styles.sizeText); EditorGUILayout.PropertyField(m_BoxOffset, Styles.centerText); if (EditorGUI.EndChangeCheck()) { Vector3 center = m_BoxOffset.vector3Value; Vector3 size = m_BoxSize.vector3Value; if (ValidateAABB(ref center, ref size)) { m_BoxOffset.vector3Value = center; m_BoxSize.vector3Value = size; } } } EditorGUILayout.EndFadeGroup(); EditorGUI.indentLevel--; } EditorGUILayout.EndFoldoutHeaderGroup(); m_ShowCubemapCaptureSettings.value = EditorGUILayout.BeginFoldoutHeaderGroup(m_ShowCubemapCaptureSettings.value, Styles.captureCubemapHeader); if (m_ShowCubemapCaptureSettings.value) { EditorGUI.indentLevel++; int[] reflectionResolutionValuesArray = null; GUIContent[] reflectionResolutionTextArray = null; GetResolutionArray(ref reflectionResolutionValuesArray, ref reflectionResolutionTextArray); EditorGUILayout.IntPopup(m_Resolution, reflectionResolutionTextArray, reflectionResolutionValuesArray, Styles.resolutionText, GUILayout.MinWidth(40)); EditorGUILayout.PropertyField(m_HDR, Styles.hdrText); EditorGUILayout.PropertyField(m_ShadowDistance, Styles.shadowDistanceText); EditorGUILayout.IntPopup(m_ClearFlags, Styles.clearFlags, Styles.clearFlagsValues, Styles.clearFlagsText); EditorGUILayout.PropertyField(m_BackgroundColor, Styles.backgroundColorText); EditorGUILayout.PropertyField(m_CullingMask, Styles.cullingMaskText); EditorGUILayout.PropertyField(m_UseOcclusionCulling, Styles.useOcclusionCulling); EditorGUILayout.PropertiesField(EditorGUI.s_ClipingPlanesLabel, m_NearAndFarProperties, EditorGUI.s_NearAndFarLabels, EditorGUI.kNearFarLabelsWidth); EditorGUI.indentLevel--; } EditorGUILayout.EndFoldoutHeaderGroup(); EditorGUILayout.Space(); if (targets.Length == 1) { ReflectionProbe probe = (ReflectionProbe)target; if (probe.mode == ReflectionProbeMode.Custom && probe.customBakedTexture != null) { Cubemap cubemap = probe.customBakedTexture as Cubemap; if (cubemap && cubemap.mipmapCount == 1) { EditorGUILayout.HelpBox("No mipmaps in the cubemap, Smoothness value in Standard shader will be ignored.", MessageType.Warning); } } } DoBakeButton(); EditorGUILayout.Space(); serializedObject.ApplyModifiedProperties(); }
public void RenderMeshSettings(bool showLightmapSettings) { if (LightingSettingsInspector.s_Styles == null) { LightingSettingsInspector.s_Styles = new LightingSettingsInspector.Styles(); } if (this.m_SerializedObject != null && this.m_GameObjectsSerializedObject != null && this.m_GameObjectsSerializedObject.targetObjects.Length != 0) { this.m_GameObjectsSerializedObject.Update(); EditorGUILayout.PropertyField(this.m_CastShadows, LightingSettingsInspector.s_Styles.CastShadows, true, new GUILayoutOption[0]); bool disabled = SceneView.IsUsingDeferredRenderingPath(); using (new EditorGUI.DisabledScope(disabled)) { EditorGUILayout.PropertyField(this.m_ReceiveShadows, LightingSettingsInspector.s_Styles.ReceiveShadows, true, new GUILayoutOption[0]); } EditorGUILayout.PropertyField(this.m_MotionVectors, LightingSettingsInspector.s_Styles.MotionVectors, true, new GUILayoutOption[0]); if (showLightmapSettings) { this.LightmapStaticSettings(); if (!LightModeUtil.Get().IsAnyGIEnabled() && !this.isPrefabAsset) { EditorGUILayout.HelpBox(LightingSettingsInspector.s_Styles.GINotEnabledInfo.text, MessageType.Info); } else { bool flag = (this.m_StaticEditorFlags.intValue & 1) != 0; if (flag) { this.m_ShowChartingSettings = EditorGUILayout.Foldout(this.m_ShowChartingSettings, LightingSettingsInspector.s_Styles.UVCharting); if (this.m_ShowChartingSettings) { this.RendererUVSettings(); } this.m_ShowLightmapSettings = EditorGUILayout.Foldout(this.m_ShowLightmapSettings, LightingSettingsInspector.s_Styles.LightmapSettings); if (this.m_ShowLightmapSettings) { EditorGUI.indentLevel++; float num = LightmapVisualization.GetLightmapLODLevelScale(this.m_Renderers[0]); for (int i = 1; i < this.m_Renderers.Length; i++) { if (!Mathf.Approximately(num, LightmapVisualization.GetLightmapLODLevelScale(this.m_Renderers[i]))) { num = 1f; } } float lightmapScale = this.LightmapScaleGUI(num) * LightmapVisualization.GetLightmapLODLevelScale(this.m_Renderers[0]); float cachedMeshSurfaceArea = InternalMeshUtil.GetCachedMeshSurfaceArea((MeshRenderer)this.m_Renderers[0]); this.ShowClampedSizeInLightmapGUI(lightmapScale, cachedMeshSurfaceArea); EditorGUILayout.PropertyField(this.m_ImportantGI, LightingSettingsInspector.s_Styles.ImportantGI, new GUILayoutOption[0]); LightingSettingsInspector.LightmapParametersGUI(this.m_LightmapParameters, LightingSettingsInspector.s_Styles.LightmapParameters); this.m_ShowBakedLM = EditorGUILayout.Foldout(this.m_ShowBakedLM, LightingSettingsInspector.s_Styles.Atlas); if (this.m_ShowBakedLM) { this.ShowAtlasGUI(this.m_Renderers[0].GetInstanceID()); } this.m_ShowRealtimeLM = EditorGUILayout.Foldout(this.m_ShowRealtimeLM, LightingSettingsInspector.s_Styles.RealtimeLM); if (this.m_ShowRealtimeLM) { this.ShowRealtimeLMGUI(this.m_Renderers[0]); } EditorGUI.indentLevel--; } if (LightmapEditorSettings.HasZeroAreaMesh(this.m_Renderers[0])) { EditorGUILayout.HelpBox(LightingSettingsInspector.s_Styles.ZeroAreaPackingMesh.text, MessageType.Warning); } if (LightmapEditorSettings.HasClampedResolution(this.m_Renderers[0])) { EditorGUILayout.HelpBox(LightingSettingsInspector.s_Styles.ClampedPackingResolution.text, MessageType.Warning); } if (!LightingSettingsInspector.HasNormals(this.m_Renderers[0])) { EditorGUILayout.HelpBox(LightingSettingsInspector.s_Styles.NoNormalsNoLightmapping.text, MessageType.Warning); } this.m_SerializedObject.ApplyModifiedProperties(); } else { EditorGUILayout.HelpBox(LightingSettingsInspector.s_Styles.LightmapInfoBox.text, MessageType.Info); } } } } }
public override void OnInspectorGUI() { base.serializedObject.Update(); if (base.targets.Length == 1) { this.DoToolbar(); } this.m_ShowProbeModeRealtimeOptions.target = (this.reflectionProbeMode == ReflectionProbeMode.Realtime); this.m_ShowProbeModeCustomOptions.target = (this.reflectionProbeMode == ReflectionProbeMode.Custom); EditorGUILayout.IntPopup(this.m_Mode, ReflectionProbeEditor.Styles.reflectionProbeMode, ReflectionProbeEditor.Styles.reflectionProbeModeValues, ReflectionProbeEditor.Styles.typeText, new GUILayoutOption[0]); if (!this.m_Mode.hasMultipleDifferentValues) { EditorGUI.indentLevel++; if (EditorGUILayout.BeginFadeGroup(this.m_ShowProbeModeCustomOptions.faded)) { EditorGUILayout.PropertyField(this.m_RenderDynamicObjects, ReflectionProbeEditor.Styles.renderDynamicObjects, new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = this.m_CustomBakedTexture.hasMultipleDifferentValues; UnityEngine.Object objectReferenceValue = EditorGUILayout.ObjectField(ReflectionProbeEditor.Styles.customCubemapText, this.m_CustomBakedTexture.objectReferenceValue, typeof(Cubemap), false, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { this.m_CustomBakedTexture.objectReferenceValue = objectReferenceValue; } } EditorGUILayout.EndFadeGroup(); if (EditorGUILayout.BeginFadeGroup(this.m_ShowProbeModeRealtimeOptions.faded)) { EditorGUILayout.PropertyField(this.m_RefreshMode, ReflectionProbeEditor.Styles.refreshMode, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_TimeSlicingMode, ReflectionProbeEditor.Styles.timeSlicing, new GUILayoutOption[0]); EditorGUILayout.Space(); } EditorGUILayout.EndFadeGroup(); EditorGUI.indentLevel--; } EditorGUILayout.Space(); GUILayout.Label(ReflectionProbeEditor.Styles.runtimeSettingsHeader, new GUILayoutOption[0]); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(this.m_Importance, ReflectionProbeEditor.Styles.importanceText, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_IntensityMultiplier, ReflectionProbeEditor.Styles.intensityText, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_BoxProjection, ReflectionProbeEditor.Styles.boxProjectionText, new GUILayoutOption[0]); bool flag = SceneView.IsUsingDeferredRenderingPath(); bool flag2 = flag && GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != BuiltinShaderMode.Disabled; using (new EditorGUI.DisabledScope(!flag2)) { EditorGUILayout.PropertyField(this.m_BlendDistance, ReflectionProbeEditor.Styles.blendDistanceText, new GUILayoutOption[0]); } if (EditorGUILayout.BeginFadeGroup(this.m_ShowBoxOptions.faded)) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(this.m_BoxSize, ReflectionProbeEditor.Styles.sizeText, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_BoxOffset, ReflectionProbeEditor.Styles.centerText, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { Vector3 vector3Value = this.m_BoxOffset.vector3Value; Vector3 vector3Value2 = this.m_BoxSize.vector3Value; if (this.ValidateAABB(ref vector3Value, ref vector3Value2)) { this.m_BoxOffset.vector3Value = vector3Value; this.m_BoxSize.vector3Value = vector3Value2; } } } EditorGUILayout.EndFadeGroup(); EditorGUI.indentLevel--; EditorGUILayout.Space(); GUILayout.Label(ReflectionProbeEditor.Styles.captureCubemapHeaderText, new GUILayoutOption[0]); EditorGUI.indentLevel++; EditorGUILayout.IntPopup(this.m_Resolution, ReflectionProbeEditor.Styles.renderTextureSizes.ToArray(), ReflectionProbeEditor.Styles.renderTextureSizesValues.ToArray(), ReflectionProbeEditor.Styles.resolutionText, new GUILayoutOption[] { GUILayout.MinWidth(40f) }); EditorGUILayout.PropertyField(this.m_HDR, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_ShadowDistance, new GUILayoutOption[0]); EditorGUILayout.IntPopup(this.m_ClearFlags, ReflectionProbeEditor.Styles.clearFlags, ReflectionProbeEditor.Styles.clearFlagsValues, ReflectionProbeEditor.Styles.clearFlagsText, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_BackgroundColor, ReflectionProbeEditor.Styles.backgroundColorText, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_CullingMask, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_UseOcclusionCulling, new GUILayoutOption[0]); EditorGUILayout.PropertiesField(EditorGUI.s_ClipingPlanesLabel, this.m_NearAndFarProperties, EditorGUI.s_NearAndFarLabels, 35f, new GUILayoutOption[0]); EditorGUI.indentLevel--; EditorGUILayout.Space(); if (base.targets.Length == 1) { ReflectionProbe reflectionProbe = (ReflectionProbe)base.target; if (reflectionProbe.mode == ReflectionProbeMode.Custom && reflectionProbe.customBakedTexture != null) { Cubemap cubemap = reflectionProbe.customBakedTexture as Cubemap; if (cubemap && cubemap.mipmapCount == 1) { EditorGUILayout.HelpBox("No mipmaps in the cubemap, Smoothness value in Standard shader will be ignored.", MessageType.Warning); } } } this.DoBakeButton(); EditorGUILayout.Space(); base.serializedObject.ApplyModifiedProperties(); }
internal void OnGUI(UnityEngine.Object[] targets, Renderer renderer, bool useMiniStyle) { bool flag = SceneView.IsUsingDeferredRenderingPath(); bool flag2 = flag && UnityEngine.Rendering.GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != BuiltinShaderMode.Disabled; bool disabled = false; if (targets != null) { for (int i = 0; i < targets.Length; i++) { UnityEngine.Object @object = targets[i]; if (LightmapEditorSettings.IsLightmappedOrDynamicLightmappedForRendering((Renderer)@object)) { disabled = true; break; } } } if (this.m_UseLightProbes != null) { EditorGUI.BeginDisabledGroup(disabled); if (!useMiniStyle) { EditorGUILayout.PropertyField(this.m_UseLightProbes, this.m_UseLightProbesStyle, new GUILayoutOption[0]); } else { ModuleUI.GUIToggle(this.m_UseLightProbesStyle, this.m_UseLightProbes); } EditorGUI.EndDisabledGroup(); } EditorGUI.BeginDisabledGroup(flag); if (!useMiniStyle) { if (flag2) { EditorGUILayout.EnumPopup(this.m_ReflectionProbeUsageStyle, (this.m_ReflectionProbeUsage.intValue == 0) ? ReflectionProbeUsage.Off : ReflectionProbeUsage.Simple, new GUILayoutOption[0]); } else { EditorGUILayout.Popup(this.m_ReflectionProbeUsage, this.m_ReflectionProbeUsageOptions, this.m_ReflectionProbeUsageStyle, new GUILayoutOption[0]); } } else if (flag2) { ModuleUI.GUIPopup(this.m_ReflectionProbeUsageStyle, 3, this.m_ReflectionProbeUsageNames); } else { ModuleUI.GUIPopup(this.m_ReflectionProbeUsageStyle, this.m_ReflectionProbeUsage, this.m_ReflectionProbeUsageNames); } EditorGUI.EndDisabledGroup(); bool flag3 = !this.m_ReflectionProbeUsage.hasMultipleDifferentValues && this.m_ReflectionProbeUsage.intValue != 0; bool flag4 = this.m_UseLightProbes != null && !this.m_UseLightProbes.hasMultipleDifferentValues && this.m_UseLightProbes.boolValue; bool flag5 = flag3 || flag4; if (flag5) { if (!useMiniStyle) { EditorGUILayout.PropertyField(this.m_ProbeAnchor, this.m_ProbeAnchorStyle, new GUILayoutOption[0]); } else { ModuleUI.GUIObject(this.m_ProbeAnchorStyle, this.m_ProbeAnchor); } if (!flag2) { renderer.GetClosestReflectionProbes(this.m_BlendInfo); RendererEditorBase.Probes.ShowClosestReflectionProbes(this.m_BlendInfo); } } bool flag6 = !this.m_ReceiveShadows.hasMultipleDifferentValues && this.m_ReceiveShadows.boolValue; if ((flag && flag6) || (flag2 && flag5)) { EditorGUILayout.HelpBox(this.m_DeferredNote.text, MessageType.Info); } }