コード例 #1
0
        internal void SetProfiles()
        {
            Debug.Log("Copying init profile settings");
            initialProfile = ScriptableObject.CreateInstance <LightingProfile>();
            initialProfile.CopyFromCurrentScene();

            currentProfile  = ScriptableObject.CreateInstance <LightingProfile>();
            temporalProfile = ScriptableObject.CreateInstance <LightingProfile>();
            currentProfile.CopyFromCurrentScene();
            temporalProfile.CopyFromCurrentScene();
        }
コード例 #2
0
 private void ResetTemporalProfile()
 {
     counter = blend = 0;
     if (volA != null)
     {
         volA.blend = 0;
     }
     hasToFade = false;
     currentProfile.CopyFromCurrentScene();
     currentProfileName = desireProfile.name;
     desireProfile      = null;
     desiredProfileName = "---";
 }
コード例 #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);
            }
        }