Beispiel #1
0
        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 = !PhononBaker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
            EditorGUILayout.BeginHorizontal();
            bakedReverb.UpdateBakedDataStatistics();

            bool previousValues = bakedReverb.bakeToggle;
            bool newValue       = GUILayout.Toggle(bakedReverb.bakeToggle, " reverb");

            if (previousValues != newValue)
            {
                Undo.RecordObject(bakedReverb, "Toggled reverb in Phonon Manager");
                bakedReverb.bakeToggle = newValue;
            }

            EditorGUILayout.LabelField((bakedReverb.bakedDataSize / 1000.0f).ToString("0.0") + " KB");
            EditorGUILayout.EndHorizontal();
            GUI.enabled = true;

            return(true);
        }
Beispiel #2
0
        public bool ProbeGenerationGUI()
        {
            ProbeBox[] probeBoxes = GameObject.FindObjectsOfType <ProbeBox>();
            if (probeBoxes.Length > 0)
            {
                PhononGUI.SectionHeader("Probe Generation");
            }
            else
            {
                return(false);
            }

            GUI.enabled = !PhononBaker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
            foreach (ProbeBox probeBox in probeBoxes)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(probeBox.name);
                if (GUILayout.Button("Generate Probe", GUILayout.Width(200.0f)))
                {
                    probeBox.GenerateProbes();
                    EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
                }
                EditorGUILayout.EndHorizontal();
            }
            GUI.enabled = true;

            return(true);
        }
Beispiel #3
0
        public bool BakedSourcesGUI(PhononManager phononManager)
        {
            PhononSource[] bakedSources = GameObject.FindObjectsOfType <PhononSource>();

            bool showBakedSources = false;

            foreach (PhononSource bakedSource in bakedSources)
            {
                if (bakedSource.enableReflections && bakedSource.uniqueIdentifier.Length != 0 &&
                    bakedSource.sourceSimulationType == SourceSimulationType.BakedStaticSource)
                {
                    showBakedSources = true;
                    break;
                }
            }

            if (showBakedSources)
            {
                PhononGUI.SectionHeader("Baked Sources");
            }
            else
            {
                return(false);
            }

            foreach (PhononSource bakedSource in bakedSources)
            {
                if (!bakedSource.enableReflections || bakedSource.uniqueIdentifier.Length == 0 ||
                    bakedSource.sourceSimulationType != SourceSimulationType.BakedStaticSource)
                {
                    continue;
                }

                GUI.enabled = !PhononBaker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
                EditorGUILayout.BeginHorizontal();

                bakedSource.UpdateBakedDataStatistics();
                bool previousValue = bakedSource.bakeToggle;
                bool newValue      = GUILayout.Toggle(bakedSource.bakeToggle, " " + bakedSource.uniqueIdentifier);
                if (previousValue != newValue)
                {
                    Undo.RecordObject(bakedSource, "Toggled " + bakedSource.uniqueIdentifier +
                                      " in Phonon Manager");
                    bakedSource.bakeToggle = newValue;
                }

                EditorGUILayout.LabelField((bakedSource.bakedDataSize / 1000.0f).ToString("0.0") + " KB");
                EditorGUILayout.EndHorizontal();
                GUI.enabled = true;
            }

            return(true);
        }
        //
        // Draws the inspector GUI.
        //
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            PhononGUI.SectionHeader("Baked Static Listener Settings");

            BakedStaticListenerNode bakedStaticListener =
                serializedObject.targetObject as BakedStaticListenerNode;

            GUI.enabled = !PhononBaker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
            EditorGUILayout.PropertyField(serializedObject.FindProperty("uniqueIdentifier"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("bakingRadius"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("useAllProbeBoxes"));

            bakedStaticListener.uniqueIdentifier = bakedStaticListener.uniqueIdentifier.Trim();
            if (bakedStaticListener.uniqueIdentifier.Length == 0)
            {
                EditorGUILayout.HelpBox("You must specify a unique identifier name.", MessageType.Warning);
            }

            if (!serializedObject.FindProperty("useAllProbeBoxes").boolValue)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("probeBoxes"), true);
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(" ");
            if (GUILayout.Button("Bake Effect"))
            {
                if (bakedStaticListener.uniqueIdentifier.Length == 0)
                {
                    Debug.LogError("You must specify a unique identifier name.");
                }
                else
                {
                    bakedStaticListener.BeginBake();
                }
            }
            EditorGUILayout.EndHorizontal();
            GUI.enabled = true;

            DisplayProgressBarAndCancel();

            serializedObject.FindProperty("bakedStatsFoldout").boolValue =
                EditorGUILayout.Foldout(serializedObject.FindProperty("bakedStatsFoldout").boolValue,
                                        "Baked Static Listener Node Statistics");
            if (bakedStaticListener.bakedStatsFoldout)
            {
                BakedStaticListenerNodeStatsGUI();
            }
            serializedObject.ApplyModifiedProperties();
        }
        public void BakedSourceStatsGUI()
        {
            PhononSource bakedSource = serializedObject.targetObject as PhononSource;

            GUI.enabled = !PhononBaker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
            bakedSource.UpdateBakedDataStatistics();
            for (int i = 0; i < bakedSource.bakedProbeNames.Count; ++i)
            {
                EditorGUILayout.LabelField(bakedSource.bakedProbeNames[i], (bakedSource.bakedProbeDataSizes[i] / 1000.0f).ToString("0.0") + " KB");
            }
            EditorGUILayout.LabelField("Total Size", (bakedSource.bakedDataSize / 1000.0f).ToString("0.0") + " KB");
            GUI.enabled = true;
        }
        public void BakedSourceGUI()
        {
            PhononGUI.SectionHeader("Baked Static Source Settings");

            PhononSource bakedSource = serializedObject.targetObject as PhononSource;

            GUI.enabled = !PhononBaker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
            EditorGUILayout.PropertyField(serializedObject.FindProperty("uniqueIdentifier"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("bakingRadius"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("useAllProbeBoxes"));

            if (!serializedObject.FindProperty("useAllProbeBoxes").boolValue)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("probeBoxes"), true);
            }

            bakedSource.uniqueIdentifier = bakedSource.uniqueIdentifier.Trim();
            if (bakedSource.uniqueIdentifier.Length == 0)
            {
                EditorGUILayout.HelpBox("You must specify a unique identifier name.", MessageType.Warning);
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(" ");
            if (GUILayout.Button("Bake Effect"))
            {
                if (bakedSource.uniqueIdentifier.Length == 0)
                {
                    Debug.LogError("You must specify a unique identifier name.");
                }
                else
                {
                    bakedSource.BeginBake();
                }
            }
            EditorGUILayout.EndHorizontal();
            GUI.enabled = true;

            DisplayProgressBarAndCancel();
        }
Beispiel #7
0
        public bool BakeAllGUI()
        {
            bool hasBakeComponents = GameObject.FindObjectsOfType <ProbeBox>().Length > 0;

            if (hasBakeComponents)
            {
                PhononGUI.SectionHeader("Bake All");
            }
            else
            {
                return(false);
            }

            GUI.enabled = !PhononBaker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Select All"))
            {
                SelectForBakeEffect(true);
            }

            if (GUILayout.Button("Select None"))
            {
                SelectForBakeEffect(false);
            }

            if (GUILayout.Button("Bake", GUILayout.Width(200.0f)))
            {
                BakeSelected();
            }

            EditorGUILayout.EndHorizontal();
            GUI.enabled = true;

            DisplayProgressBarAndCancel();

            return(true);
        }
        //
        // GUI for BakedReverb
        //
        public void BakedReverbGUI()
        {
            PhononGUI.SectionHeader("Baked Reverb Settings");

            PhononListener bakedReverb = serializedObject.targetObject as PhononListener;

            GUI.enabled = !PhononBaker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
            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"))
            {
                bakedReverb.BeginBake();
            }
            EditorGUILayout.EndHorizontal();
            GUI.enabled = true;

            DisplayProgressBarAndCancel();
        }