Esempio n. 1
0
        //
        // GUI for BakedReverb
        //
        public void BakedReverbGUI()
        {
            PhononGUI.SectionHeader("Baked Reverb Settings");

            PhononListener bakedReverb = serializedObject.targetObject as PhononListener;

            GUI.enabled = !bakedReverb.phononBaker.IsBakeActive();
            EditorGUILayout.PropertyField(serializedObject.FindProperty("useAllProbeBoxes"));
            if (!serializedObject.FindProperty("useAllProbeBoxes").boolValue)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("probeBoxes"), true);
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(" ");
            if (GUILayout.Button("Bake Reverb"))
            {
                Debug.Log("START: Baking reverb effect.");
                bakedReverb.BeginBake();
            }
            EditorGUILayout.EndHorizontal();
            GUI.enabled = true;

            DisplayProgressBarAndCancel();

            if (bakedReverb.phononBaker.GetBakeStatus() == BakeStatus.Complete)
            {
                bakedReverb.EndBake();
                Repaint();
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
                Debug.Log("COMPLETED: Baking reverb effect.");
            }
        }
        public bool BakedReverbGUI(PhononManager phononManager)
        {
            PhononListener bakedReverb = GameObject.FindObjectOfType <PhononListener>();

            if (bakedReverb == null || !bakedReverb.enableReverb ||
                bakedReverb.reverbSimulationType != ReverbSimulationType.BakedReverb)
            {
                return(false);
            }

            PhononGUI.SectionHeader("Bake Reverb");

            GUI.enabled = !bakedReverb.phononBaker.IsBakeActive();
            EditorGUILayout.BeginHorizontal();
            bakedReverb.UpdateBakedDataStatistics();
            EditorGUILayout.LabelField("__reverb__", (bakedReverb.bakedDataSize / 1000.0f).ToString("0.0") + " KB");
            if (GUILayout.Button("Bake Reverb", GUILayout.Width(200.0f)))
            {
                Debug.Log("START: Baking reverb effect.");
                phononManager.currentlyBakingObject = bakedReverb;
                bakedReverb.BeginBake();
            }
            EditorGUILayout.EndHorizontal();
            GUI.enabled = true;

            DisplayProgressBarAndCancel(bakedReverb, phononManager);

            if (bakedReverb.phononBaker.GetBakeStatus() == BakeStatus.Complete)
            {
                bakedReverb.EndBake();
                phononManager.currentlyBakingObject = null;
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
                Debug.Log("COMPLETED: Baking reverb effect.");
            }

            return(true);
        }