Exemplo n.º 1
0
        public void OnEnable()
        {
            //Get Gaia Lighting Profile object
            m_profile = (GaiaLightingProfile)target;

            if (m_editorUtils == null)
            {
                // Get editor utils for this
                m_editorUtils = PWApp.GetEditorUtils(this);
            }

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

            m_renderPipeline = m_gaiaSettings.m_pipelineProfile.m_activePipelineInstalled;
            m_version        = PWApp.CONF.Version;

            if (m_profile != null)
            {
                m_profileValues = m_profile.m_lightingProfiles[m_profile.m_selectedLightingProfileValuesIndex];
            }

            enableEditMode = System.IO.Directory.Exists(GaiaUtils.GetAssetPath("Dev Utilities"));
        }
Exemplo n.º 2
0
        public static void CreateSkyProfiles()
        {
            GaiaLightingProfile asset = ScriptableObject.CreateInstance <GaiaLightingProfile>();

            AssetDatabase.CreateAsset(asset, "Assets/Gaia Lighting System Profile.asset");
            AssetDatabase.SaveAssets();
            EditorUtility.FocusProjectWindow();
            Selection.activeObject = asset;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Show Select Profile Manager editor window
        /// </summary>
        public static void ShowProfileManager(GaiaLightingProfile lightingProfile, GaiaWaterProfile waterProfile, GaiaSettings gaiaSettings)
        {
            var manager = EditorWindow.GetWindow <SelectProfileWindowEditor>(false, "Lighting And Water Profile Selection");

            if (manager != null)
            {
                manager.m_lightingProfile = lightingProfile;
                manager.m_waterProfile    = waterProfile;
                manager.m_gaiaSettings    = gaiaSettings;

                Vector2 initialSize = new Vector2(350f, 120f);
                manager.position = new Rect(new Vector2(Screen.currentResolution.width / 2f - initialSize.x / 2f, Screen.currentResolution.height / 2f - initialSize.y / 2f), initialSize);
                manager.Show();
            }
        }
Exemplo n.º 4
0
        public void SaveToGaiaDefault(GaiaLightingProfileValues profileValues, ProceduralWorldsGlobalWeather globalWeather)
        {
            if (profileValues == null)
            {
                return;
            }

            GaiaLightingProfileValues newProfileValues = new GaiaLightingProfileValues();

            GaiaUtils.CopyFields(profileValues, newProfileValues);
            newProfileValues.m_userCustomProfile = false;
#if UNITY_POST_PROCESSING_STACK_V2
            newProfileValues.PostProcessProfileBuiltIn          = profileValues.PostProcessProfileBuiltIn;
            newProfileValues.m_postProcessingProfileGUIDBuiltIn = profileValues.m_postProcessingProfileGUIDBuiltIn;
#endif
#if UPPipeline
            newProfileValues.PostProcessProfileURP          = profileValues.PostProcessProfileURP;
            newProfileValues.m_postProcessingProfileGUIDURP = profileValues.m_postProcessingProfileGUIDURP;
#endif
#if HDPipeline
            newProfileValues.PostProcessProfileHDRP          = profileValues.PostProcessProfileHDRP;
            newProfileValues.m_postProcessingProfileGUIDHDRP = profileValues.m_postProcessingProfileGUIDHDRP;
            newProfileValues.EnvironmentProfileHDRP          = profileValues.EnvironmentProfileHDRP;
            newProfileValues.m_environmentProfileGUIDHDRP    = profileValues.m_environmentProfileGUIDHDRP;
#endif

            GaiaSettings gaiaSettings = GaiaUtils.GetGaiaSettings();
            if (gaiaSettings != null)
            {
                GaiaLightingProfile lightingProfile = gaiaSettings.m_gaiaLightingProfile;
                if (lightingProfile != null)
                {
                    bool addProfile          = true;
                    int  indexForReplacement = 0;
                    for (int i = 0; i < lightingProfile.m_lightingProfiles.Count; i++)
                    {
                        if (lightingProfile.m_lightingProfiles[i].m_typeOfLighting == newProfileValues.m_typeOfLighting)
                        {
                            addProfile          = false;
                            indexForReplacement = i;
                        }
                    }

                    if (addProfile)
                    {
                        SavePWSkyAtmosphere(newProfileValues, globalWeather);
                        SavePWSeason(newProfileValues, globalWeather);
                        SavePWSkyCloud(newProfileValues, globalWeather);
                        SavePWSkyWeather(newProfileValues, globalWeather);
                        SavePWSkyWind(newProfileValues, globalWeather);
                        SaveColorAndCubemapFields(newProfileValues, profileValues);
                        lightingProfile.m_lightingProfiles.Add(newProfileValues);
                    }
                    else
                    {
                        #if UNITY_EDITOR
                        if (EditorUtility.DisplayDialog("Profile Already Exists", "This profile " + newProfileValues.m_typeOfLighting + " already exists the the default Gaia lighting profile. Do you want to replace this profile?", "Yes", "No"))
                        {
                            GaiaUtils.CopyFields(newProfileValues, lightingProfile.m_lightingProfiles[indexForReplacement]);
                            SavePWSkyAtmosphere(lightingProfile.m_lightingProfiles[indexForReplacement], globalWeather);
                            SavePWSeason(lightingProfile.m_lightingProfiles[indexForReplacement], globalWeather);
                            SavePWSkyCloud(lightingProfile.m_lightingProfiles[indexForReplacement], globalWeather);
                            SavePWSkyWeather(lightingProfile.m_lightingProfiles[indexForReplacement], globalWeather);
                            SavePWSkyWind(lightingProfile.m_lightingProfiles[indexForReplacement], globalWeather);
                            SaveColorAndCubemapFields(lightingProfile.m_lightingProfiles[indexForReplacement], profileValues);
#if UNITY_POST_PROCESSING_STACK_V2
                            lightingProfile.m_lightingProfiles[indexForReplacement].PostProcessProfileBuiltIn          = profileValues.PostProcessProfileBuiltIn;
                            lightingProfile.m_lightingProfiles[indexForReplacement].m_postProcessingProfileGUIDBuiltIn = profileValues.m_postProcessingProfileGUIDBuiltIn;
#endif
#if UPPipeline
                            lightingProfile.m_lightingProfiles[indexForReplacement].PostProcessProfileURP          = profileValues.PostProcessProfileURP;
                            lightingProfile.m_lightingProfiles[indexForReplacement].m_postProcessingProfileGUIDURP = profileValues.m_postProcessingProfileGUIDURP;
#endif
#if HDPipeline
                            lightingProfile.m_lightingProfiles[indexForReplacement].PostProcessProfileHDRP          = profileValues.PostProcessProfileHDRP;
                            lightingProfile.m_lightingProfiles[indexForReplacement].m_postProcessingProfileGUIDHDRP = profileValues.m_postProcessingProfileGUIDHDRP;
#endif
                        }
                        #endif
                    }

                    #if UNITY_EDITOR
                    EditorUtility.SetDirty(lightingProfile);
                    #endif

                    Debug.Log("Profile successfully added to the Gaia Lighting Profile. Remember to save your project to save the changes");
                }
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Loads the profile type only
 /// </summary>
 /// <param name="mainProfile"></param>
 public void LoadProfileType(GaiaLightingProfile mainProfile)
 {
     mainProfile.m_selectedLightingProfileValuesIndex = m_lightingProfileIndex;
 }