public bool BakedReverbGUI(SteamAudioManager phononManager)
        {
            SteamAudioListener bakedReverb = GameObject.FindObjectOfType <SteamAudioListener>();

            if (bakedReverb == null)
            {
                return(false);
            }

            EditorGUILayout.LabelField("Baked Reverb", EditorStyles.boldLabel);

            GUI.enabled = !Baker.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);
        }
        public bool ProbeGenerationGUI()
        {
            SteamAudioProbeBox[] probeBoxes = GameObject.FindObjectsOfType <SteamAudioProbeBox>();
            if (probeBoxes.Length > 0)
            {
                EditorGUILayout.LabelField("Probe Generation", EditorStyles.boldLabel);
            }
            else
            {
                return(false);
            }

            GUI.enabled = !Baker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
            foreach (SteamAudioProbeBox 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);
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(mCurrentBakedListener);

            EditorGUILayout.PropertyField(mApplyReverb);
            if (mApplyReverb.boolValue)
            {
                EditorGUILayout.PropertyField(mReverbType);
            }

            var oldGUIEnabled = GUI.enabled;

            GUI.enabled = !Baker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;

            var tgt = target as SteamAudioListener;

            EditorGUILayout.PropertyField(mUseAllProbeBatches);
            if (!mUseAllProbeBatches.boolValue)
            {
                EditorGUILayout.PropertyField(mProbeBatches);
            }

            EditorGUILayout.Space();
            if (GUILayout.Button("Bake"))
            {
                tgt.BeginBake();
                mShouldShowProgressBar = true;
            }

            GUI.enabled = oldGUIEnabled;

            if (mShouldShowProgressBar && !Baker.IsBakeActive())
            {
                mShouldShowProgressBar = false;
            }

            if (mShouldShowProgressBar)
            {
                Baker.DrawProgressBar();
            }

            Repaint();

            EditorGUILayout.Space();
            mStatsFoldout = EditorGUILayout.Foldout(mStatsFoldout, "Baked Data Statistics");
            if (mStatsFoldout && !Baker.IsBakeActive())
            {
                for (var i = 0; i < tgt.GetProbeBatchesUsed().Length; ++i)
                {
                    EditorGUILayout.LabelField(tgt.GetProbeBatchesUsed()[i].gameObject.name, Common.HumanReadableDataSize(tgt.GetProbeDataSizes()[i]));
                }
                EditorGUILayout.LabelField("Total Size", Common.HumanReadableDataSize(tgt.GetTotalDataSize()));
            }

            serializedObject.ApplyModifiedProperties();
        }
        public bool BakedSourcesGUI(SteamAudioManager phononManager)
        {
            SteamAudioSource[] bakedSources = GameObject.FindObjectsOfType <SteamAudioSource>();

            bool showBakedSources = false;

            foreach (SteamAudioSource bakedSource in bakedSources)
            {
                if (bakedSource.reflections && bakedSource.uniqueIdentifier.Length != 0 &&
                    bakedSource.simulationType == SourceSimulationType.BakedStaticSource)
                {
                    showBakedSources = true;
                    break;
                }
            }

            if (showBakedSources)
            {
                EditorGUILayout.LabelField("Baked Sources", EditorStyles.boldLabel);
            }
            else
            {
                return(false);
            }

            foreach (SteamAudioSource bakedSource in bakedSources)
            {
                if (!bakedSource.reflections || bakedSource.uniqueIdentifier.Length == 0 ||
                    bakedSource.simulationType != SourceSimulationType.BakedStaticSource)
                {
                    continue;
                }

                GUI.enabled = !Baker.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();

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Baked Static Listener Settings", EditorStyles.boldLabel);

            SteamAudioBakedStaticListenerNode bakedStaticListener =
                serializedObject.targetObject as SteamAudioBakedStaticListenerNode;

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

            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();
        }
Exemple #6
0
        public void BakedSourceStatsGUI()
        {
            SteamAudioSource bakedSource = serializedObject.targetObject as SteamAudioSource;

            GUI.enabled = !Baker.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;
        }
Exemple #7
0
        public void BakedSourceGUI()
        {
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Baked Static Source Settings", EditorStyles.boldLabel);

            SteamAudioSource bakedSource = serializedObject.targetObject as SteamAudioSource;

            GUI.enabled = !Baker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;

            EditorGUILayout.PropertyField(serializedObject.FindProperty("uniqueIdentifier"));
            bakedSource.uniqueIdentifier = bakedSource.uniqueIdentifier.Trim();
            EditorGUILayout.PropertyField(serializedObject.FindProperty("bakingRadius"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("useAllProbeBoxes"));

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

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

            if (bakedSource.dipoleWeight > 0.0f)
            {
                EditorGUILayout.HelpBox("A baked static source should not rotate at run-time, " +
                                        "otherwise indirect sound rendered using baked data may not be accurate.", 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();
        }
        public bool BakeAllGUI()
        {
            bool hasBakeComponents = GameObject.FindObjectsOfType <SteamAudioProbeBox>().Length > 0;

            if (hasBakeComponents)
            {
                EditorGUILayout.LabelField("Bake All", EditorStyles.boldLabel);
            }
            else
            {
                return(false);
            }

            GUI.enabled = !Baker.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);
        }
Exemple #9
0
        //
        // GUI for BakedReverb
        //
        public void BakedReverbGUI()
        {
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Baked Reverb Settings", EditorStyles.boldLabel);
            SteamAudioListener bakedReverb = serializedObject.targetObject as SteamAudioListener;

            GUI.enabled = !Baker.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();
        }
Exemple #10
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            var oldGUIEnabled = GUI.enabled;

            GUI.enabled = !Baker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;

            var tgt = target as SteamAudioProbeBatch;

            EditorGUILayout.PropertyField(mAsset);

            EditorGUILayout.PropertyField(mPlacementStrategy);
            if ((ProbeGenerationType)mPlacementStrategy.enumValueIndex == ProbeGenerationType.UniformFloor)
            {
                EditorGUILayout.PropertyField(mHorizontalSpacing);
                EditorGUILayout.PropertyField(mHeightAboveFloor);
            }

            EditorGUILayout.Space();
            if (GUILayout.Button("Generate Probes"))
            {
                tgt.GenerateProbes();
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
            }

            if (tgt.GetNumProbes() > 0)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Baked Pathing Settings", EditorStyles.boldLabel);
                if (GUILayout.Button("Bake"))
                {
                    tgt.BeginBake();
                    mShouldShowProgressBar = true;
                }
            }

            GUI.enabled = oldGUIEnabled;

            if (mShouldShowProgressBar && !Baker.IsBakeActive())
            {
                mShouldShowProgressBar = false;
            }

            if (mShouldShowProgressBar)
            {
                Baker.DrawProgressBar();
            }

            Repaint();

            if (tgt.GetNumProbes() > 0)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Probe Statistics", EditorStyles.boldLabel);
                EditorGUILayout.LabelField("Probes", tgt.GetNumProbes().ToString());
                EditorGUILayout.LabelField("Data Size", Common.HumanReadableDataSize(tgt.probeDataSize));

                if (tgt.GetNumLayers() > 0)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("Detailed Statistics", EditorStyles.boldLabel);
                    for (var i = 0; i < tgt.GetNumLayers(); ++i)
                    {
                        var layerInfo = tgt.GetInfoForLayer(i);

                        var name = "";
                        if (layerInfo.identifier.type == BakedDataType.Pathing)
                        {
                            name = "Pathing";
                        }
                        else if (layerInfo.identifier.variation == BakedDataVariation.Reverb)
                        {
                            name = "Reverb";
                        }
                        else
                        {
                            name = layerInfo.gameObject.name;
                        }

                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField(name, Common.HumanReadableDataSize(layerInfo.dataSize));
                        if (GUILayout.Button("Clear"))
                        {
                            tgt.DeleteBakedDataForIdentifier(layerInfo.identifier);
                            EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                }
            }

            serializedObject.ApplyModifiedProperties();
        }