Пример #1
0
        /// <summary>
        /// Adds a new user profile
        /// </summary>
        private void AddNewCustomProfile()
        {
            //GaiaLightingProfileValues selectdValues = m_savedSettings.LoadSettings(m_profile, true);
            GaiaLightingProfileValues selectdValues = m_profileValues;
            GaiaLightingProfileValues newProfile    = new GaiaLightingProfileValues();

            GaiaUtils.CopyFields(selectdValues, newProfile);
            int count = m_profile.m_lightingProfiles.Count + 1;

            newProfile.m_typeOfLighting    = "New User Profile " + count;
            newProfile.m_userCustomProfile = true;
            m_profile.m_lightingProfiles.Add(newProfile);
            m_profile.m_selectedLightingProfileValuesIndex = m_profile.m_lightingProfiles.Count - 1;

            if (m_profile.m_selectedLightingProfileValuesIndex != -99)
            {
                GaiaUtils.GetRuntimeSceneObject();

                if (GaiaGlobal.Instance != null)
                {
                    GaiaLighting.GetProfile(m_profile, m_gaiaSettings.m_pipelineProfile, m_gaiaSettings.m_pipelineProfile.m_activePipelineInstalled);
                }
            }

            EditorUtility.SetDirty(m_profile);
        }
Пример #2
0
        private void RealtimeUpdateEnabled(bool helpEnabled)
        {
            m_profile.m_updateInRealtime = m_editorUtils.ToggleLeft("UpdateChangesInRealtime", m_profile.m_updateInRealtime, helpEnabled);
            if (m_profile.m_updateInRealtime)
            {
                EditorGUILayout.HelpBox("Update In Realtime is enabled this will allow profiles to be endited inside the editor and automatically apply changes every frame. This feature can be expensive and should not be left enabled in testing and builds", MessageType.Warning);
            }
            else
            {
                if (m_editorUtils.Button("UpdateToScene"))
                {
                    if (m_profile.m_selectedLightingProfileValuesIndex != -99)
                    {
                        GaiaUtils.GetRuntimeSceneObject();

                        if (GaiaGlobal.Instance != null)
                        {
                            //GaiaLighting.GetProfile(m_profile, m_gaiaSettings.m_pipelineProfile, m_gaiaSettings.m_pipelineProfile.m_activePipelineInstalled);
                            EditorUtility.SetDirty(m_profile);
                        }
                    }
                }

                m_editorUtils.InlineHelp("UpdateToScene", helpEnabled);

                if (m_editorUtils.Button("UpdateDynamicGI"))
                {
                    GaiaLighting.UpdateAmbientEnvironment();
                }

                m_editorUtils.InlineHelp("UpdateDynamicGI", helpEnabled);
            }
        }
Пример #3
0
        private void UpdateLighting(bool process, bool applyProfile = false)
        {
            if (process)
            {
                if (GaiaGlobal.Instance != null)
                {
                    GaiaUtils.GetRuntimeSceneObject();
                    GaiaLighting.GetProfile(GaiaGlobal.Instance.SceneProfile, m_gaiaSettings.m_pipelineProfile, m_gaiaSettings.m_pipelineProfile.m_activePipelineInstalled, applyProfile);
                }

                EditorUtility.SetDirty(m_profile.SceneProfile);
            }
        }
Пример #4
0
        private static void LoadWaterAndLighting(GaiaSettings settings, bool showDebug = false)
        {
            if (settings == null)
            {
                Debug.LogError("Gaia settings was not found.");
                return;
            }
            if (settings.m_gaiaWaterProfile == null)
            {
                Debug.LogError("Water Profile was not found!");
                return;
            }
            else
            {
                Material waterMat = GaiaWater.GetGaiaOceanMaterial();
                if (waterMat != null)
                {
                    GameObject waterObject = GameObject.Find(GaiaConstants.waterSurfaceObject);
                    if (waterObject != null)
                    {
                        GaiaUtils.GetRuntimeSceneObject();
                        if (GaiaGlobal.Instance != null)
                        {
                            GaiaWater.GetProfile(GaiaGlobal.Instance.SceneProfile.m_selectedWaterProfileValuesIndex, waterMat, GaiaGlobal.Instance.SceneProfile, true, false);
                        }
                    }
                }
            }
            if (settings.m_gaiaLightingProfile == null)
            {
                Debug.LogError("Lighting Profile was not found!");
                return;
            }
            else
            {
                GameObject lightObject = GameObject.Find(GaiaConstants.gaiaLightingObject);
                if (lightObject != null)
                {
                    if (GaiaGlobal.Instance != null)
                    {
                        GaiaUtils.GetRuntimeSceneObject();
                        GaiaLighting.GetProfile(GaiaGlobal.Instance.SceneProfile, settings.m_pipelineProfile, settings.m_pipelineProfile.m_activePipelineInstalled);
                    }
                }
            }

            if (showDebug)
            {
                Debug.Log("Loading up profile settings successfully");
            }
        }
Пример #5
0
        /// <summary>
        /// Creates the buffer manager in the scene
        /// </summary>
        public static void CreateBufferManager()
        {
            //Create Manager
            CommandBufferManager manager = FindObjectOfType <CommandBufferManager>();

            if (manager == null)
            {
                GameObject managerGameObject = new GameObject(m_bufferManagerObjectName);
                manager = managerGameObject.AddComponent <CommandBufferManager>();
                manager.RebuildBuffers();

                //Parent
                manager.transform.SetParent(GaiaUtils.GetRuntimeSceneObject().transform);
            }
        }
Пример #6
0
        private void UpdateWater(bool process)
        {
            if (process)
            {
                if (m_profile.WaterMaterial == null)
                {
                    m_profile.WaterMaterial = GaiaWater.GetGaiaOceanMaterial();
                }

                GaiaUtils.GetRuntimeSceneObject();
                if (GaiaGlobal.Instance != null)
                {
                    GaiaWater.GetProfile(m_profile.SceneProfile.m_selectedWaterProfileValuesIndex, m_profile.WaterMaterial, GaiaGlobal.Instance.SceneProfile, true, false);
                }
                EditorUtility.SetDirty(m_profile.SceneProfile);
            }
        }
Пример #7
0
 private void Lighting()
 {
     EditorGUI.BeginChangeCheck();
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.LabelField("Lighting Preset", EditorStyles.boldLabel, GUILayout.Width(105f));
     m_lightingProfile.m_selectedLightingProfileValuesIndex = EditorGUILayout.Popup(m_lightingProfile.m_selectedLightingProfileValuesIndex, LightingList.ToArray());
     if (GUILayout.Button("Edit"))
     {
         GaiaLighting.FocusGaiaLightingProfile();
     }
     EditorGUILayout.EndHorizontal();
     if (EditorGUI.EndChangeCheck())
     {
         if (GaiaGlobal.Instance != null)
         {
             GaiaUtils.GetRuntimeSceneObject();
             GaiaLighting.GetProfile(GaiaGlobal.Instance.SceneProfile, m_gaiaSettings.m_pipelineProfile, m_gaiaSettings.m_pipelineProfile.m_activePipelineInstalled);
         }
     }
 }
Пример #8
0
        private void Water()
        {
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Water Preset", EditorStyles.boldLabel, GUILayout.Width(105f));
            m_gaiaSettings.m_gaiaWaterProfile.m_selectedWaterProfileValuesIndex = EditorGUILayout.Popup(m_gaiaSettings.m_gaiaWaterProfile.m_selectedWaterProfileValuesIndex, WaterList.ToArray());
            if (GUILayout.Button("Edit"))
            {
                GaiaUtils.FocusWaterProfile();
            }
            EditorGUILayout.EndHorizontal();
            if (EditorGUI.EndChangeCheck())
            {
                Material waterMat = GaiaWater.GetGaiaOceanMaterial();

                GaiaUtils.GetRuntimeSceneObject();
                if (GaiaGlobal.Instance != null)
                {
                    GaiaWater.GetProfile(m_gaiaSettings.m_gaiaWaterProfile.m_selectedWaterProfileValuesIndex, waterMat, GaiaGlobal.Instance.SceneProfile, true, false);
                }
            }
        }
Пример #9
0
        public override void OnInspectorGUI()
        {
            //Initialization
            m_editorUtils.Initialize(); // Do not remove this!

            //Monitor for changes
            EditorGUI.BeginChangeCheck();

            defaultBackground = GUI.backgroundColor;

            if (m_gaiaSettings == null)
            {
                m_gaiaSettings = GaiaUtils.GetGaiaSettings();
            }

            if (m_renderPipeline != m_gaiaSettings.m_pipelineProfile.m_activePipelineInstalled)
            {
                m_renderPipeline = m_gaiaSettings.m_pipelineProfile.m_activePipelineInstalled;
            }

            if (m_profile.m_selectedLightingProfileValuesIndex > m_profile.m_lightingProfiles.Count - 1)
            {
                m_profile.m_selectedLightingProfileValuesIndex = 0;
            }

            EditorGUILayout.LabelField("Profile Version: " + m_version);
            if (enableEditMode)
            {
                m_profile.m_editSettings = EditorGUILayout.ToggleLeft("Use Procedural Worlds Editor Settings", m_profile.m_editSettings);
            }
            else
            {
                m_profile.m_editSettings = false;
            }

            if (m_profile.m_editSettings)
            {
                m_editorUtils.Panel("UpdateSettings", RealtimeUpdateEnabled);
                m_editorUtils.Panel("GlobalSettings", GlobalSettingsEnabled);
                m_editorUtils.Panel("LightingProfileSettings", LightingProfileSettingsEnabled);

                DrawDefaultInspector();
            }

            //Check for changes, make undo record, make changes and let editor know we are dirty
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(m_profile, "Made changes");
                EditorUtility.SetDirty(m_profile);

                if (m_profile.m_updateInRealtime)
                {
                    if (m_profile.m_selectedLightingProfileValuesIndex != -99)
                    {
                        GaiaUtils.GetRuntimeSceneObject();

                        if (GaiaGlobal.Instance != null)
                        {
                            //GaiaLighting.GetProfile(m_profile, m_gaiaSettings.m_pipelineProfile, m_gaiaSettings.m_pipelineProfile.m_activePipelineInstalled);
                        }
                    }
                    EditorUtility.SetDirty(m_profile);
                }
            }
        }