void LateUpdate()
        {
            if (GetBlendFrame())
            {
                if (isInBlend && currentProfile != null && desireProfile != null)
                {
                    temporalProfile.Lerp(currentProfile, desireProfile, GetBlendValue(), switchSkybox, useEnvLighting, useEnvReflection, useMixedLighting, useFog, useHalo);
                    temporalProfile.ApplyRenderSettings();
                }

                BlendLightingSettings();
            }

            if (GetCheckVolumesFrame())
            {
                GetCurrentVolumes();
                DebugPosition();
            }
        }
Example #2
0
        internal LightingProfile GetGlobalLighting()
        {
            tempLightingProfile = GetDefaultGlobalProfileLighting();

            if (tempLightingProfile == null)
            {
                Debug.Log("No Global profile found. TEMP profile is now the initial profile");
                tempLightingProfile = initProfile;
            }

            Debug.Log("Applying TEMP profile");
            tempLightingProfile.ApplyRenderSettings();
            return(tempLightingProfile);
        }
Example #3
0
        private void SectionApplySettings()
        {
            GUILayout.Space(4);
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Copy FROM current scene", GUILayout.Height(40), GUILayout.MinWidth(180)))
            {
                Undo.RecordObject(lp, "Copy lighting from scene to profile");
                lp.CopyFromCurrentScene();
                EditorUtility.SetDirty(lp);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
                // QGM: I think is not necessary.
                //serializedObject.Update();
            }

            if (GUILayout.Button("Apply TO current scene", GUILayout.Height(40), GUILayout.MinWidth(180)))
            {
                // Unity leaves us no other way than to do this dirty trick.
                Object renderSettings = Object.FindObjectOfType(typeof(RenderSettings));
                Undo.RecordObject(renderSettings, "Apply lighting from profile to scene");
                lp.ApplyRenderSettings();
                // QGM: I think is not necessary.
                //serializedObject.Update();
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            // TODO: automatize the process of preserving the Unity-generated bake assets.
            EditorGUILayout.HelpBox("IMPORTANT: Unity removes the baked assets when re-baking. Make sure you keep copies of those assets or they could get deleted unintentionally!", MessageType.Warning);

            if (RenderSettings.sun != null)
            {
                EditorGUILayout.HelpBox("The Profile will not preserve the reference to the Sun object, because the object may not exist when the profile is applied in a different scene. Consider not setting that reference or implement a workaround for it", MessageType.Warning);
            }
        }
 private void OnDestroy()
 {
     Debug.Log("Settings initial lighting profile");
     initialProfile.ApplyRenderSettings();
 }