Ejemplo n.º 1
0
 private void InitializeLightingFields()
 {
     this.m_Lighting = new LightingSettingsInspector(base.serializedObject);
     this.m_Lighting.showSettings         = EditorPrefs.GetBool("MeshRendererEditor.Lighting.ShowSettings", false);
     this.m_Lighting.showChartingSettings = SessionState.GetBool("MeshRendererEditor.Lighting.ShowChartingSettings", true);
     this.m_Lighting.showLightmapSettings = SessionState.GetBool("MeshRendererEditor.Lighting.ShowLightmapSettings", true);
 }
        public virtual void OnEnable()
        {
            m_SortingOrder         = serializedObject.FindProperty("m_SortingOrder");
            m_SortingLayerID       = serializedObject.FindProperty("m_SortingLayerID");
            m_DynamicOccludee      = serializedObject.FindProperty("m_DynamicOccludee");
            m_RenderingLayerMask   = serializedObject.FindProperty("m_RenderingLayerMask");
            m_RendererPriority     = serializedObject.FindProperty("m_RendererPriority");
            m_MotionVectors        = serializedObject.FindProperty("m_MotionVectors");
            m_SkinnedMotionVectors = serializedObject.FindProperty("m_SkinnedMotionVectors");
            m_Materials            = serializedObject.FindProperty("m_Materials");
            m_MaterialsSize        = serializedObject.FindProperty("m_Materials.Array.size");

            m_ShowMaterials     = new SavedBool($"{target.GetType()}.ShowMaterials", true);
            m_ShowProbeSettings = new SavedBool($"{target.GetType()}.ShowProbeSettings", true);
            m_ShowOtherSettings = new SavedBool($"{target.GetType()}.ShowOtherSettings", true);

            m_Lighting = new LightingSettingsInspector(serializedObject);
            m_Lighting.showLightingSettings = new SavedBool($"{target.GetType()}.ShowLightingSettings", true);
            m_Lighting.showLightmapSettings = new SavedBool($"{target.GetType()}.ShowLightmapSettings", true);
            m_Lighting.showBakedLightmap    = new SavedBool($"{target.GetType()}.ShowBakedLightmapSettings", false);
            m_Lighting.showRealtimeLightmap = new SavedBool($"{target.GetType()}.ShowRealtimeLightmapSettings", false);

            m_Probes = new Probes();
            m_Probes.Initialize(serializedObject);
        }
Ejemplo n.º 3
0
        private void InitializeLightingFields()
        {
            m_Lighting = new LightingSettingsInspector(serializedObject);

            m_Lighting.showChartingSettings = SessionState.GetBool(kDisplayChartingKey, true);
            m_Lighting.showLightmapSettings = SessionState.GetBool(kDisplayLightmapKey, true);
        }
Ejemplo n.º 4
0
        public static bool LightmapParametersGUI(SerializedProperty prop, GUIContent content)
        {
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUIInternal.AssetPopup <LightmapParameters>(prop, content, "giparams", "Scene Default Parameters");
            string text = "Edit...";

            if (LightingSettingsInspector.isBuiltIn(prop))
            {
                text = "View";
            }
            bool result = false;

            if (prop.objectReferenceValue == null)
            {
                SerializedObject   serializedObject   = new SerializedObject(LightmapEditorSettings.GetLightmapSettings());
                SerializedProperty serializedProperty = serializedObject.FindProperty("m_LightmapEditorSettings.m_LightmapParameters");
                using (new EditorGUI.DisabledScope(serializedProperty == null))
                {
                    if (LightingSettingsInspector.isBuiltIn(serializedProperty))
                    {
                        text = "View";
                    }
                    else
                    {
                        text = "Edit...";
                    }
                    if (GUILayout.Button(text, EditorStyles.miniButton, new GUILayoutOption[]
                    {
                        GUILayout.ExpandWidth(false)
                    }))
                    {
                        Selection.activeObject = serializedProperty.objectReferenceValue;
                        result = true;
                    }
                }
            }
            else if (GUILayout.Button(text, EditorStyles.miniButton, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false)
            }))
            {
                Selection.activeObject = prop.objectReferenceValue;
                result = true;
            }
            EditorGUILayout.EndHorizontal();
            return(result);
        }
Ejemplo n.º 5
0
 private void InitializeLightingFields()
 {
     this.m_Lighting = new LightingSettingsInspector(base.serializedObject);
     this.m_Lighting.showSettings = EditorPrefs.GetBool("SkinnedMeshRendererEditor.Lighting.ShowSettings", false);
 }
Ejemplo n.º 6
0
 public void RenderTerrainSettings()
 {
     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();
         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_ShowLightmapSettings = EditorGUILayout.Foldout(this.m_ShowLightmapSettings, LightingSettingsInspector.s_Styles.LightmapSettings);
                 if (this.m_ShowLightmapSettings)
                 {
                     EditorGUI.indentLevel++;
                     using (new EditorGUI.DisabledScope(!flag))
                     {
                         if (GUI.enabled)
                         {
                             this.ShowTerrainChunks(this.m_Terrains);
                         }
                         float       lightmapScale     = this.LightmapScaleGUI(1f);
                         TerrainData terrainData       = this.m_Terrains[0].terrainData;
                         float       cachedSurfaceArea = (!(terrainData != null)) ? 0f : (terrainData.size.x * terrainData.size.z);
                         this.ShowClampedSizeInLightmapGUI(lightmapScale, cachedSurfaceArea);
                         LightingSettingsInspector.LightmapParametersGUI(this.m_LightmapParameters, LightingSettingsInspector.s_Styles.LightmapParameters);
                         if (GUI.enabled && this.m_Terrains.Length == 1 && this.m_Terrains[0].terrainData != null)
                         {
                             this.ShowBakePerformanceWarning(this.m_Terrains[0]);
                         }
                         this.m_ShowBakedLM = EditorGUILayout.Foldout(this.m_ShowBakedLM, LightingSettingsInspector.s_Styles.Atlas);
                         if (this.m_ShowBakedLM)
                         {
                             this.ShowAtlasGUI(this.m_Terrains[0].GetInstanceID());
                         }
                         this.m_ShowRealtimeLM = EditorGUILayout.Foldout(this.m_ShowRealtimeLM, LightingSettingsInspector.s_Styles.RealtimeLM);
                         if (this.m_ShowRealtimeLM)
                         {
                             this.ShowRealtimeLMGUI(this.m_Terrains[0]);
                         }
                         this.m_SerializedObject.ApplyModifiedProperties();
                     }
                     EditorGUI.indentLevel--;
                 }
                 GUILayout.Space(10f);
             }
             else
             {
                 EditorGUILayout.HelpBox(LightingSettingsInspector.s_Styles.TerrainLightmapInfoBox.text, MessageType.Info);
             }
         }
     }
 }
Ejemplo n.º 7
0
 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);
                 }
             }
         }
     }
 }
 private void InitializeLightingFields()
 {
     m_Lighting = new LightingSettingsInspector(serializedObject);
 }
        private void InitializeLightingFields()
        {
            m_Lighting = new LightingSettingsInspector(serializedObject);

            m_Lighting.showSettings = EditorPrefs.GetBool(kDisplayLightingKey, false);
        }