Exemple #1
0
        public static void Draw(InAudioNode node)
        {
            var nodeData = node._nodeData;

            EditorGUILayout.BeginVertical();
            var data = node._nodeData as InFolderData;


            #region Mixer
            DataDrawerHelper.DrawMixer(node);
            #endregion
            EditorGUILayout.Separator();
            #region Volume
            if (Application.isPlaying)
            {
                InUndoHelper.GUIUndo(nodeData, "Folder volume", ref data.runtimeVolume, () => EditorGUILayout.Slider("Runtime Volume", data.runtimeVolume, 0, 1));
            }
            else
            {
                InUndoHelper.GUIUndo(nodeData, "Folder volume", ref data.VolumeMin, () => EditorGUILayout.Slider("Initial Volume", data.VolumeMin, 0, 1));
            }
            #endregion

            EditorGUILayout.EndVertical();
        }
Exemple #2
0
        public static void Draw(InMusicFolder node)
        {
            node.ScrollPosition = EditorGUILayout.BeginScrollView(node.ScrollPosition);
            var prop = new SerializedObject(node);

            prop.Update();
            EditorGUILayout.BeginVertical();
            #region Mixer

            DataDrawerHelper.DrawMixer(node, prop.FindProperty("_mixerGroup"));

            #endregion
            EditorGUILayout.Separator();
            #region Volume & Pitch
            if (!Application.isPlaying)
            {
                InUndoHelper.GUIUndo(node, "Volume", ref node._minVolume, () => EditorGUILayout.Slider("Initial Volume", node._minVolume, 0f, 1f));
            }
            else
            {
                InUndoHelper.GUIUndo(node, "Volume", ref node.runtimeVolume, () => EditorGUILayout.Slider("Current Volume", node.runtimeVolume, 0f, 1f));
            }

            if (!Application.isPlaying)
            {
                InUndoHelper.GUIUndo(node, "Pitch", ref node._minPitch, () => EditorGUILayout.Slider("Initial Pitch", node._minPitch, 0f, 3f));
            }
            else
            {
                InUndoHelper.GUIUndo(node, "Pitch", ref node.runtimePitch, () => EditorGUILayout.Slider("Current Pitch", node.runtimePitch, 0f, 3f));
            }
            #endregion

            EditorGUILayout.EndVertical();
            prop.ApplyModifiedProperties();

            EditorGUILayout.EndScrollView();
        }
        public static void Draw(InMusicGroup node)
        {
            node.ScrollPosition = EditorGUILayout.BeginScrollView(node.ScrollPosition);
            var prop = new SerializedObject(node);

            prop.Update();

            EditorGUILayout.PropertyField(prop.FindProperty("_name"));


            if (!Application.isPlaying)
            {
                InUndoHelper.GUIUndo(node, "Volume", ref node._minVolume, () => EditorGUILayout.Slider("Initial Volume", node._minVolume, 0f, 1f));
            }
            else
            {
                InUndoHelper.GUIUndo(node, "Volume", ref node.runtimeVolume, () => EditorGUILayout.Slider("Current Volume", node.runtimeVolume, 0f, 1f));
            }

            if (!Application.isPlaying)
            {
                InUndoHelper.GUIUndo(node, "Pitch", ref node._minPitch, () => EditorGUILayout.Slider("Initial Pitch", node._minPitch, 0f, 3f));
            }
            else
            {
                InUndoHelper.GUIUndo(node, "Pitch", ref node.runtimePitch, () => EditorGUILayout.Slider("Current Pitch", node.runtimePitch, 0f, 3f));
            }
            EditorGUILayout.BeginHorizontal();
            if (Application.isPlaying)
            {
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Save volume & pitch"))
                {
                    InUndoHelper.RecordObject(node, "Volume & Pitch for Music");
                    node._minVolume = node.runtimeVolume;
                    node._minPitch  = node.runtimePitch;
                    Debug.Log("InAudio: Saved volume: " + node._minVolume + ", pitch: " + node._minPitch);
                }
            }
            EditorGUILayout.EndHorizontal();

            var playingInfo = node.PlayingInfo;

            if (playingInfo.Fading && Application.isPlaying)
            {
                EditorGUILayout.Slider("Volume target", playingInfo.TargetVolume, 0f, 1f);
                GUI.enabled = false;
                var duration = playingInfo.EndTime - playingInfo.StartTime;
                var left     = playingInfo.EndTime - Time.time;
                EditorGUILayout.Slider("Time elapsed", duration - left, 0, duration);
                GUI.enabled = true;
            }

            EditorGUILayout.PropertyField(prop.FindProperty("_loop"));

            EditorGUILayout.Separator();

            DataDrawerHelper.DrawMixer(node, prop.FindProperty("_mixerGroup"));
            EditorGUILayout.Separator();

            prop.ApplyModifiedProperties();

            if (!Application.isPlaying)
            {
                InUndoHelper.GUIUndo(node, "Mute", ref node._mute, () => EditorGUILayout.Toggle("Initial Mute", node._mute));
            }
            else
            {
                InUndoHelper.GUIUndo(node, "Mute", ref node.runtimeMute, () => EditorGUILayout.Toggle("Currently Mute", node.runtimeMute));
            }

            if (!Application.isPlaying)
            {
                InUndoHelper.GUIUndo(node, "Solo", ref node._solo, () => EditorGUILayout.Toggle("Initial Solo", node._solo));
            }
            else
            {
                InUndoHelper.GUIUndo(node, "Solo", ref node.runtimeSolo, () => EditorGUILayout.Toggle("Currently Solo", node.runtimeSolo));
            }

            EditorGUILayout.Separator();
            prop.Update();

            EditorGUILayout.LabelField("Clips in node");
            if (Application.isPlaying)
            {
                ReorderableListGUI.ListField(prop.FindProperty("_clips"), ReorderableListFlags.DisableDuplicateCommand | ReorderableListFlags.DisableContextMenu | ReorderableListFlags.DisableReordering | ReorderableListFlags.HideRemoveButtons);
                var rect = GUILayoutUtility.GetLastRect();
                for (int i = 0; i < node._clips.Count; i++)
                {
                    var progress = rect;
                    progress.height = 3;
                    progress.x     += 5;
                    progress.width -= 30;
                    progress.y     += i * 20 + 20;
                    //GUI.DrawTexture(progress, EditorResources.Background);
                    var item   = node._clips[i];
                    var player = node.PlayingInfo.Players.Find(s => s.clip == item);
                    if (player != null)
                    {
                        EditorGUI.DrawRect(progress, Color.white);
                        float pos = (float)player.ExactPosition();
                        if (node.PlayingInfo.State == MusicState.Playing || node.PlayingInfo.State == MusicState.Paused)
                        {
                            progress.width = progress.width * Mathf.Clamp01(pos / item.length);
                            EditorGUI.DrawRect(progress, Color.green);
                        }
                    }
                }
            }
            else
            {
                ReorderableListGUI.ListField(prop.FindProperty("_clips"), ReorderableListFlags.DisableDuplicateCommand);
            }

            prop.ApplyModifiedProperties();


            EditorGUILayout.Separator();
            if (node._children.Count > 0)
            {
                EditorGUILayout.LabelField("Child nodes");
                ReorderableListGUI.ListField(node._children, (position, item) =>
                {
                    EditorGUI.LabelField(position, item._name);
                    return(item);
                },
                                             ReorderableListFlags.DisableContextMenu | ReorderableListFlags.DisableReordering |
                                             ReorderableListFlags.HideAddButton | ReorderableListFlags.HideRemoveButtons);
            }
            EditorGUILayout.EndScrollView();
        }
        //private static GameObject go;
        public static void Draw(InAudioNode node)
        {
            if (Application.isPlaying)
            {
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Play Node"))
                {
                    if (preview != null)
                    {
                        preview.Stop();
                    }
                    preview = InAudio.Play(InAudioInstanceFinder.Instance.gameObject, node);
                    preview.SpatialBlend = 0.0f;
                    preview.OnCompleted  = (go, audioNode) => preview = null;
                }
                if (GUILayout.Button("Stop Playing Node") && preview != null)
                {
                    InAudio.StopAll(InAudioInstanceFinder.Instance.gameObject);
                }
                if (GUILayout.Button("Stop All Instances"))
                {
                    InAudio.StopAllOfNode(node);
                }
                EditorGUILayout.EndHorizontal();
            }

            InAudioNodeData baseData = (InAudioNodeData)node._nodeData;

            EditorGUILayout.Separator();

            DrawSelectedArea(node, baseData);

            Seperators(2);

            if (baseData.SelectedArea == 0)
            {
                EditorGUIHelper.DrawID(node._guid);

                #region Volume

                DataDrawerHelper.DrawVolume(baseData, ref baseData.MinVolume, ref baseData.MaxVolume, ref baseData.RandomVolume);
                #endregion

                Seperators(2);

                #region Parent pitch

                SetPitch(baseData);

                #endregion
                Seperators(2);
                #region Spatial blend

                SetSpatialBlend(baseData);

                #endregion

                Seperators(2);

                #region Delay

                GUILayout.BeginHorizontal();

                GUILayout.BeginVertical();

                InUndoHelper.GUIUndo(baseData, "Randomize Delay", ref baseData.RandomizeDelay, () =>
                                     EditorGUILayout.Toggle("Randomize Delay", baseData.RandomizeDelay));
                if (baseData.RandomizeDelay)
                {
                    InUndoHelper.GUIUndo(baseData, "Delay Change", ref baseData.InitialDelayMin, ref baseData.InitialDelayMax,
                                         (out float v1, out float v2) =>
                    {
                        v1 = Mathf.Clamp(EditorGUILayout.FloatField("Min delay", baseData.InitialDelayMin), 0, baseData.InitialDelayMax);
                        v2 = Mathf.Clamp(EditorGUILayout.FloatField("Max delay", baseData.InitialDelayMax), baseData.InitialDelayMin, float.MaxValue);
                    });
                }
                else
                {
                    InUndoHelper.GUIUndo(baseData, "Delay", ref baseData.InitialDelayMin, () =>
                    {
                        float delay = Mathf.Max(EditorGUILayout.FloatField("Initial delay", baseData.InitialDelayMin), 0);
                        if (delay > baseData.InitialDelayMax)
                        {
                            baseData.InitialDelayMax = baseData.InitialDelayMin + 0.001f;
                        }
                        return(delay);
                    });
                }

                GUILayout.EndVertical();

                GUILayout.BeginVertical();

                GUILayout.EndVertical();

                GUILayout.EndHorizontal();
                #endregion

                Seperators(2);

                #region Audio bus

                DataDrawerHelper.DrawMixer(node);

                #endregion

                Seperators(2);

                #region Loops

                GUI.enabled = true;
                GUILayout.BeginVertical();

                InUndoHelper.GUIUndo(baseData, "Use looping", ref baseData.Loop, () => EditorGUILayout.Toggle("Loop", baseData.Loop));
                if (baseData.Loop)
                {
                    GUI.enabled = baseData.Loop;

                    InUndoHelper.GUIUndo(baseData, "Loop Infinite", ref baseData.LoopInfinite,
                                         () => EditorGUILayout.Toggle("Loop Infinite", baseData.LoopInfinite));
                    if (baseData.Loop)
                    {
                        GUI.enabled = !baseData.LoopInfinite;
                    }

                    InUndoHelper.GUIUndo(baseData, "Loop Randomize", ref baseData.RandomizeLoops,
                                         () => EditorGUILayout.Toggle("Randomize Loop Count", baseData.RandomizeLoops));

                    if (!baseData.RandomizeLoops)
                    {
                        InUndoHelper.GUIUndo(baseData, "Loop Count",
                                             ref baseData.MinIterations, () => (byte)Mathf.Clamp(EditorGUILayout.IntField("Loop Count", baseData.MinIterations), 0, 255));
                    }
                    else
                    {
                        GUILayout.BeginHorizontal();
                        InUndoHelper.GUIUndo(baseData, "Loop Count", ref baseData.MinIterations, ref baseData.MaxIterations,
                                             (out byte v1, out byte v2) =>
                        {
                            v1 = (byte)Mathf.Clamp(EditorGUILayout.IntField("Min Loop Count", baseData.MinIterations), 0, 255);
                            v2 = (byte)Mathf.Clamp(EditorGUILayout.IntField("Max Loop Count", baseData.MaxIterations), 0, 255);

                            //Clamp to 0-255 and so that min/max doesn't overlap
                            v2 = (byte)Mathf.Clamp(v2, v1, 255);
                            v1 = (byte)Mathf.Clamp(v1, 0, v2);
                        });

                        GUILayout.EndHorizontal();
                    }
                }

                GUI.enabled = true;

                GUILayout.EndVertical();

                #endregion

                Seperators(2);

                #region Instance limiting
                InUndoHelper.GUIUndo(baseData, "Limit Instances (Global)", ref baseData.LimitInstances, () => EditorGUILayout.Toggle("Limit Instances", baseData.LimitInstances));
                GUI.enabled = baseData.LimitInstances;
                if (baseData.LimitInstances)
                {
                    InUndoHelper.GUIUndo(baseData, "Max Instance Cont", ref baseData.MaxInstances, () => Math.Max(EditorGUILayout.IntField("Max Instance Count", baseData.MaxInstances), 0));
                    InUndoHelper.GUIUndo(baseData, "Stealing Type", ref baseData.InstanceStealingTypes, () => (InstanceStealingTypes)EditorGUILayout.EnumPopup("Stealing Type", baseData.InstanceStealingTypes));
                }
                GUI.enabled = true;

                #endregion

                Seperators(2);

                #region Priority
                InUndoHelper.GUIUndo(baseData, "Priority", ref baseData.Priority, () => EditorGUILayout.IntSlider("Priority", baseData.Priority, 0, 255));
                #endregion

                Seperators(2);

                #region Sample offset
                InUndoHelper.GUIUndo(baseData, "Random Second Offset", ref baseData.RandomSecondsOffset, () =>
                                     EditorGUILayout.Toggle("Random Second Offset", baseData.RandomSecondsOffset));

                if (baseData.RandomSecondsOffset)
                {
                    InUndoHelper.GUIUndo(baseData, "First item offset", ref baseData.MinSecondsOffset, ref baseData.MaxSecondsOffset,
                                         (out float v1, out float v2) =>
                    {
                        v1 = Mathf.Clamp(EditorGUILayout.FloatField("Min offset", baseData.MinSecondsOffset), 0, baseData.MaxSecondsOffset);
                        v2 = Mathf.Clamp(EditorGUILayout.FloatField("Max offset", baseData.MaxSecondsOffset), baseData.MinSecondsOffset, float.MaxValue);
                    });
                }
                else
                {
                    InUndoHelper.GUIUndo(baseData, "Delay", ref baseData.MinSecondsOffset, () =>
                    {
                        var delay = Mathf.Max(EditorGUILayout.FloatField("First clip offset", baseData.MinSecondsOffset), 0);
                        if (delay > baseData.MaxSecondsOffset)
                        {
                            baseData.MaxSecondsOffset = baseData.MinSecondsOffset + 1;
                        }
                        return(delay);
                    });
                }

                if (node._type == AudioNodeType.Audio)
                {
                    var nodeData = node._nodeData as InAudioData;
                    if (nodeData.AudioClip != null)
                    {
                        float length = nodeData.AudioClip.ExactLength();
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.PrefixLabel("Clip length");
                        EditorGUILayout.SelectableLabel(length.ToString(), GUILayout.Height(EditorGUIUtility.singleLineHeight));
                        EditorGUILayout.EndHorizontal();
                        if (baseData.RandomSecondsOffset && (baseData.MinSecondsOffset > length || baseData.MaxSecondsOffset > length))
                        {
                            EditorGUILayout.HelpBox("Offset exceeds sound clip length", MessageType.Warning);
                        }
                        else if (baseData.MinSecondsOffset > length)
                        {
                            EditorGUILayout.HelpBox("Offset exceeds sound clip length", MessageType.Warning);
                        }
                    }
                }
                #endregion
            }
            else
            {
                #region Attenuation

                if (!node._parent.IsRootOrFolder)
                {
                    InUndoHelper.GUIUndo(baseData, "Override Parent", ref baseData.OverrideAttenuation, () => GUILayout.Toggle(baseData.OverrideAttenuation, "Override Parent"));
                }
                GUI.enabled = baseData.OverrideAttenuation;
                if (node._parent.IsRootOrFolder)
                {
                    GUI.enabled = true;
                }

                InUndoHelper.GUIUndo(node, "Rolloff Mode", ref baseData.RolloffMode, () => (AudioRolloffMode)EditorGUILayout.EnumPopup("Volume Rolloff", baseData.RolloffMode));

                InUndoHelper.GUIUndo(baseData, "Set Rolloff Distance", ref baseData.MinDistance, ref baseData.MaxDistance,
                                     (out float v1, out float v2) =>
                {
                    if (baseData.RolloffMode != AudioRolloffMode.Custom)
                    {
                        v1 = EditorGUILayout.FloatField("Min Distance", baseData.MinDistance);
                    }
                    else
                    {
                        v1 = baseData.MinDistance;
                    }
                    v2 = EditorGUILayout.FloatField("Max Distance", baseData.MaxDistance);
                    v1 = Mathf.Max(v1, 0.00001f);
                    v2 = Mathf.Max(v2, v1 + 0.01f);
                });



                if (baseData.RolloffMode == AudioRolloffMode.Custom)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Rolloff");

                    InUndoHelper.GUIUndo(baseData, "Set Rolloff Curve", ref baseData.FalloffCurve, () => EditorGUILayout.CurveField(baseData.FalloffCurve, GUILayout.Height(200), GUILayout.Width(200)));
                    //baseData.FalloffCurve = EditorGUILayout.CurveField(baseData.FalloffCurve, GUILayout.Height(200), GUILayout.Width(200));
                    EditorGUILayout.EndHorizontal();

                    var keys     = baseData.FalloffCurve.keys;
                    int keyCount = keys.Length;
                    for (int i = 0; i < keyCount; i++)
                    {
                        Keyframe key = keys[i];

                        key.time  = Mathf.Clamp01(key.time);
                        key.value = Mathf.Clamp01(key.value);
                        try
                        {
                            baseData.FalloffCurve.MoveKey(i, key);
                        }
                        catch (Exception)
                        {
                        }
                    }
                    if (GUILayout.Button("Reset curve", GUILayout.Width(150)))
                    {
                        InUndoHelper.RecordObject(baseData, "Reset Curve");
                        baseData.FalloffCurve = new AnimationCurve(new Keyframe(0, 1), new Keyframe(0.1f, 1), new Keyframe(1, 0));
                    }

                    if (Selection.activeObject == null)
                    {
                        EditorGUILayout.HelpBox("Please select any game object in the scene.\nIt fixes a bug in Unity Editor API",
                                                MessageType.Info, true);
                    }

                    EditorGUILayout.HelpBox("Unity does not support setting custom rolloff via scripts. This will perform slower than a log/linear rolloff curve", MessageType.Warning, true);
                    GUI.enabled = false;
                }

                #endregion

                GUI.enabled = true;
            }
        }
        public static void Draw(InMusicFolder node)
        {
            node.ScrollPosition = EditorGUILayout.BeginScrollView(node.ScrollPosition);
            var prop = new SerializedObject(node);

            prop.Update();
            EditorGUILayout.BeginVertical();

            #region Bank

            InUndoHelper.GUIUndo(node, "Name Change", ref node._name, () =>
                                 EditorGUILayout.TextField("Name", node._name));


            if (!node.IsRoot)
            {
                bool overrideparent = EditorGUILayout.Toggle("Override Parent Bank", node._overrideParentBank);
                if (overrideparent != node._overrideParentBank)
                {
                    AudioBankWorker.ChangeBankOverride(node);
                }
            }
            else
            {
                EditorGUILayout.Separator();
            }

            if (node._overrideParentBank == false && !node.IsRoot)
            {
                GUI.enabled = false;
            }

            EditorGUILayout.BeginHorizontal();

            var parentLink = node.GetBank();
            if (node._overrideParentBank)
            {
                if (node._bankLink != null)
                {
                    EditorGUILayout.LabelField("Bank", node._bankLink.GetName);
                }
                else
                {
                    if (parentLink != null)
                    {
                        EditorGUILayout.LabelField("Bank", "Missing Bank, using parent bank" + parentLink.GetName);
                    }
                    else
                    {
                        EditorGUILayout.LabelField("Bank", "Missing Banks, no bank found");
                    }
                }
            }
            else
            {
                if (parentLink != null)
                {
                    EditorGUILayout.LabelField("Using Bank", parentLink.GetName);
                }
                else
                {
                    EditorGUILayout.LabelField("Using Bank", "Missing");
                }
            }

            bool wasEnabled = GUI.enabled;
            GUI.enabled = true;
            if (GUILayout.Button("Find", GUILayout.Width(50)))
            {
                EditorWindow.GetWindow <AuxWindow>().FindBank(parentLink);
            }

            Rect findArea = GUILayoutUtility.GetLastRect();
            findArea.y += 20;
            if (GUI.Button(findArea, "Find"))
            {
                EditorWindow.GetWindow <AuxWindow>().FindBank(node._bankLink);
            }

            GUI.enabled = wasEnabled;

            GUILayout.Button("Drag new bank here", GUILayout.Width(140));

            var newBank = OnDragging.BusDragging(GUILayoutUtility.GetLastRect());
            if (newBank != null)
            {
                AudioBankWorker.ChangeMusicNodeBank(node, newBank);
            }
            GUI.enabled = true;
            EditorGUILayout.EndHorizontal();
            GUI.enabled = false;
            if (node._bankLink != null)
            {
                EditorGUILayout.LabelField("Node Bank", node._bankLink.GetName);
            }
            else
            {
                EditorGUILayout.LabelField("Node Bank", "Missing Bank");
            }
            GUI.enabled = true;
            if (Application.isPlaying)
            {
                EditorGUILayout.Toggle("Is Loaded", BankLoader.IsLoaded(parentLink));
            }

            #endregion

            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            #region Mixer

            DataDrawerHelper.DrawMixer(node, prop.FindProperty("_mixerGroup"));

            #endregion
            EditorGUILayout.Separator();
            #region Volume & Pitch
            if (!Application.isPlaying)
            {
                InUndoHelper.GUIUndo(node, "Volume", ref node._minVolume, () => EditorGUILayout.Slider("Initial Volume", node._minVolume, 0f, 1f));
            }
            else
            {
                InUndoHelper.GUIUndo(node, "Volume", ref node.runtimeVolume, () => EditorGUILayout.Slider("Current Volume", node.runtimeVolume, 0f, 1f));
            }

            if (!Application.isPlaying)
            {
                InUndoHelper.GUIUndo(node, "Pitch", ref node._minPitch, () => EditorGUILayout.Slider("Initial Pitch", node._minPitch, 0f, 3f));
            }
            else
            {
                InUndoHelper.GUIUndo(node, "Pitch", ref node.runtimePitch, () => EditorGUILayout.Slider("Current Pitch", node.runtimePitch, 0f, 3f));
            }
            #endregion

            EditorGUILayout.EndVertical();
            prop.ApplyModifiedProperties();

            EditorGUILayout.EndScrollView();
        }
Exemple #6
0
        public static void Draw(InAudioNode node)
        {
            EditorGUILayout.BeginVertical();

            #region Bank

            UndoHelper.GUIUndo(node, "Name Change", ref node.Name, () =>
                               EditorGUILayout.TextField("Name", node.Name));
            var data = node.NodeData as InFolderData;
            if (node.Type == AudioNodeType.Folder)
            {
                bool overrideparent = EditorGUILayout.Toggle("Override Parent Bank", data.OverrideParentBank);
                if (overrideparent != data.OverrideParentBank)
                {
                    AudioBankWorker.ChangeBankOverride(node, InAudioInstanceFinder.DataManager.BankLinkTree, InAudioInstanceFinder.DataManager.AudioTree);
                }
            }
            else
            {
                EditorGUILayout.LabelField(""); //To fill out the area from the toggle
            }
            if (data.OverrideParentBank == false && node.Type != AudioNodeType.Root)
            {
                GUI.enabled = false;
            }

            EditorGUILayout.BeginHorizontal();

            var parentLink = FindParentBank(node);
            if (data.OverrideParentBank)
            {
                if (data.BankLink != null)
                {
                    EditorGUILayout.LabelField("Bank", data.BankLink.GetName);
                }
                else
                {
                    if (parentLink != null)
                    {
                        EditorGUILayout.LabelField("Bank", "Missing Bank, using parent bank" + parentLink.GetName);
                    }
                    else
                    {
                        EditorGUILayout.LabelField("Bank", "Missing Banks, no bank found");
                    }
                }
            }
            else
            {
                if (parentLink != null)
                {
                    EditorGUILayout.LabelField("Using Bank", parentLink.GetName);
                }
                else
                {
                    EditorGUILayout.LabelField("Using Bank", "Missing");
                }
            }

            bool wasEnabled = GUI.enabled;
            GUI.enabled = true;
            if (GUILayout.Button("Find", GUILayout.Width(50)))
            {
                EditorWindow.GetWindow <AuxWindow>().FindBank(parentLink);
            }

            Rect findArea = GUILayoutUtility.GetLastRect();
            findArea.y += 20;
            if (GUI.Button(findArea, "Find"))
            {
                EditorWindow.GetWindow <AuxWindow>().FindBank(data.BankLink);
            }

            GUI.enabled = wasEnabled;

            GUILayout.Button("Drag new bank here", GUILayout.Width(140));

            var newBank = HandleDragging(GUILayoutUtility.GetLastRect());
            if (newBank != null)
            {
                AudioBankWorker.ChangeBank(node, newBank, InAudioInstanceFinder.DataManager.BankLinkTree, InAudioInstanceFinder.DataManager.AudioTree);
            }
            GUI.enabled = true;
            EditorGUILayout.EndHorizontal();
            GUI.enabled = false;
            if (data.BankLink != null)
            {
                EditorGUILayout.LabelField("Node Bank", data.BankLink.GetName);
            }
            else
            {
                EditorGUILayout.LabelField("Node Bank", "Missing Bank");
            }
            GUI.enabled = true;
            #endregion

            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            #region Bus
            DataDrawerHelper.DrawBus(node);
            #endregion

            EditorGUILayout.EndVertical();
        }
        public static void Draw(InAudioNode node)
        {
            var nodeData = node._nodeData;

            EditorGUILayout.BeginVertical();
            var data = node._nodeData as InFolderData;

            #region Bank

            InUndoHelper.GUIUndo(node, "Name Change", ref node.Name, () =>
                                 EditorGUILayout.TextField("Name", node.Name));

            if (node._type == AudioNodeType.Folder)
            {
                bool overrideparent = EditorGUILayout.Toggle("Override Parent Bank", data.OverrideParentBank);
                if (overrideparent != data.OverrideParentBank)
                {
                    AudioBankWorker.ChangeBankOverride(node);
                }
            }
            else
            {
                EditorGUILayout.LabelField(""); //To fill out the area from the toggle
            }
            if (data.OverrideParentBank == false && node._type != AudioNodeType.Root)
            {
                GUI.enabled = false;
            }

            EditorGUILayout.BeginHorizontal();

            var parentLink = FindParentBank(node);
            if (data.OverrideParentBank)
            {
                if (data.BankLink != null)
                {
                    EditorGUILayout.LabelField("Bank", data.BankLink.GetName);
                }
                else
                {
                    if (parentLink != null)
                    {
                        EditorGUILayout.LabelField("Bank", "Missing Bank, using parent bank" + parentLink.GetName);
                    }
                    else
                    {
                        EditorGUILayout.LabelField("Bank", "Missing Banks, no bank found");
                    }
                }
            }
            else
            {
                if (parentLink != null)
                {
                    EditorGUILayout.LabelField("Using Bank", parentLink.GetName);
                }
                else
                {
                    EditorGUILayout.LabelField("Using Bank", "Missing");
                }
            }

            bool wasEnabled = GUI.enabled;
            GUI.enabled = true;
            if (GUILayout.Button("Find", GUILayout.Width(50)))
            {
                EditorWindow.GetWindow <AuxWindow>().FindBank(parentLink);
            }

            Rect findArea = GUILayoutUtility.GetLastRect();
            findArea.y += 20;
            if (GUI.Button(findArea, "Find"))
            {
                EditorWindow.GetWindow <AuxWindow>().FindBank(data.BankLink);
            }

            GUI.enabled = wasEnabled;

            GUILayout.Button("Drag new bank here", GUILayout.Width(140));

            var newBank = OnDragging.BusDragging(GUILayoutUtility.GetLastRect());
            if (newBank != null)
            {
                AudioBankWorker.ChangeAudioNodeBank(node, newBank);
            }
            GUI.enabled = true;
            EditorGUILayout.EndHorizontal();
            GUI.enabled = false;
            if (data.BankLink != null)
            {
                EditorGUILayout.LabelField("Node Bank", data.BankLink.GetName);
            }
            else
            {
                EditorGUILayout.LabelField("Node Bank", "Missing Bank");
            }

            GUI.enabled = true;
            if (Application.isPlaying)
            {
                EditorGUILayout.Toggle("Is Loaded", BankLoader.IsLoaded(parentLink));
            }
            #endregion

            if (data.ExternalPlacement)
            {
                EditorGUILayout.Separator();

                GUI.enabled = false;
                EditorGUILayout.ObjectField("Placed on", node.gameObject, typeof(GameObject), false);
                GUI.enabled = true;

                EditorGUILayout.Separator();
            }

            #region Mixer
            DataDrawerHelper.DrawMixer(node);
            #endregion
            EditorGUILayout.Separator();
            #region Volume
            if (Application.isPlaying)
            {
                InUndoHelper.GUIUndo(nodeData, "Folder volume", ref data.runtimeVolume, () => EditorGUILayout.Slider("Runtime Volume", data.runtimeVolume, 0, 1));
            }
            else
            {
                InUndoHelper.GUIUndo(nodeData, "Folder volume", ref data.VolumeMin, () => EditorGUILayout.Slider("Initial Volume", data.VolumeMin, 0, 1));
            }
            #endregion

            EditorGUILayout.EndVertical();
        }