Beispiel #1
0
        public static void DrawBus(InAudioNode node)
        {
            if (!node.IsRoot)
            {
                bool overrideParent = EditorGUILayout.Toggle("Override Parent Bus", node.OverrideParentBus);
                if (overrideParent != node.OverrideParentBus)
                {
                    UndoHelper.RecordObjectFull(new Object[] { node.NodeData, node }, "Override parent bus");
                    node.OverrideParentBus = overrideParent;
                }
                if (!node.OverrideParentBus)
                {
                    GUI.enabled = false;
                }
            }
            EditorGUILayout.BeginHorizontal();

            //

            if (node.GetBus() != null)
            {
                var usedBus = node.GetBus();
                if (usedBus != null)
                {
                    EditorGUILayout.TextField("Used Bus", usedBus.Name);
                }
                else
                {
                    EditorGUILayout.TextField("Used Bus", "Missing bus");
                }
            }
            else
            {
                GUILayout.Label("Missing node");
            }

            if (GUILayout.Button("Find"))
            {
                SearchHelper.SearchFor(node.Bus);
            }

            GUI.enabled = true;
            GUILayout.Button("Drag bus here to assign");

            var buttonArea = GUILayoutUtility.GetLastRect();
            var bus        = HandleBusDrag(buttonArea);

            if (bus != null)
            {
                UndoHelper.RecordObjectFull(node, "Assign bus");
                node.Bus = bus;
                node.OverrideParentBus = true;
                Event.current.Use();
            }


            EditorGUILayout.EndHorizontal();
        }
        public static void DrawMixer(InMusicNode node, SerializedProperty prop)
        {
            if (!node.IsRoot)
            {
                bool overrideParent = EditorGUILayout.Toggle("Override Parent Mixer", node._overrideParentMixerGroup);
                if (overrideParent != node._overrideParentMixerGroup)
                {
                    InUndoHelper.RecordObjectFull(node, "Override parent mixer group");
                    node._overrideParentMixerGroup = overrideParent;
                }
                if (!node._overrideParentMixerGroup)
                {
                    GUI.enabled = false;
                }
            }
            EditorGUILayout.BeginHorizontal();

            if (node._overrideParentMixerGroup)
            {
                EditorGUILayout.PropertyField(prop, new GUIContent("Mixer Group"));
            }
            else
            {
                if (node._parent != null)
                {
                    var parentProp = new SerializedObject(node.GetParentMixing());
                    parentProp.Update();
                    EditorGUILayout.PropertyField(parentProp.FindProperty("_mixerGroup"),
                                                  new GUIContent("Parent Mixer Group"));
                    parentProp.ApplyModifiedProperties();
                }
                else
                {
                    var parentProp = new SerializedObject(node);
                    parentProp.Update();
                    EditorGUILayout.PropertyField(parentProp.FindProperty("_mixerGroup"), new GUIContent("Mixer Group"));
                    parentProp.ApplyModifiedProperties();
                }
            }

            GUI.enabled = node.GetParentMixing() != null;
            if (GUILayout.Button("Find", GUILayout.Width(40)))
            {
                SearchHelper.SearchFor(node._mixerGroup);
            }
            EditorGUILayout.EndHorizontal();
            GUI.enabled = true;
        }
        public static void DrawMixer(InAudioNode node)
        {
            var serialized = new SerializedObject(node);

            serialized.Update();
            if (!node.IsRoot)
            {
                bool overrideParent = EditorGUILayout.Toggle("Override Parent Mixer Group", node.OverrideParentMixerGroup);
                if (overrideParent != node.OverrideParentMixerGroup)
                {
                    InUndoHelper.RecordObjectFull(new Object[] { node._nodeData, node }, "Override parent mixer group");
                    node.OverrideParentMixerGroup = overrideParent;
                }
                if (!node.OverrideParentMixerGroup)
                {
                    GUI.enabled = false;
                }
            }

            EditorGUILayout.BeginHorizontal();

            if (node.IsRoot)
            {
                EditorGUILayout.PropertyField(serialized.FindProperty("MixerGroup"), new GUIContent("Mixer Group"));
            }
            else if (node.OverrideParentMixerGroup)
            {
                EditorGUILayout.PropertyField(serialized.FindProperty("MixerGroup"), new GUIContent("Mixer Group"));
            }
            else
            {
                EditorGUILayout.PropertyField(new SerializedObject(node.GetParentMixerGroup()).FindProperty("MixerGroup"), new GUIContent("Parent Mixer Group"));
            }

            GUI.enabled = node.GetMixerGroup() != null;
            if (GUILayout.Button("Find", GUILayout.Width(40)))
            {
                SearchHelper.SearchFor(node.MixerGroup);
            }
            EditorGUILayout.EndHorizontal();
            serialized.ApplyModifiedProperties();
            GUI.enabled = true;
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);
            var propPos = position;

            propPos.width -= 65;
            var controlPos = position;

            controlPos.width = 60;
            controlPos.x     = position.width - controlPos.width + 30;

            property.FindPropertyRelative("PlaybackControl").enumValueIndex = (int)(MusicState)EditorGUI.EnumPopup(controlPos, (MusicState)property.FindPropertyRelative("PlaybackControl").intValue);
            propPos.width -= 20;
            propPos.height = EditorGUIUtility.singleLineHeight;
            EditorGUI.ObjectField(propPos, property.FindPropertyRelative("MusicGroup"), typeof(InMusicGroup), GUIContent.none);
            var musicGroup = property.FindPropertyRelative("MusicGroup").objectReferenceValue as InMusicGroup;

            if (musicGroup != null)
            {
                Rect labelArea = position;
                labelArea.y     += EditorGUIUtility.singleLineHeight;
                labelArea.height = EditorGUIUtility.singleLineHeight;
                EditorGUI.LabelField(labelArea, musicGroup.GetName);

                Rect findArea = labelArea;
                findArea.x     = position.width - 105;
                findArea.width = 40;
                if (GUI.Button(findArea, "Find"))
                {
                    SearchHelper.SearchFor(musicGroup);
                }
            }

            var buttonPos = controlPos;

            buttonPos.width = 10;
            controlPos.x   += 65;



            EditorGUI.EndProperty();
        }
        internal static void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
        {
            EditorGUI.BeginProperty(pos, label, prop);

            Rect  originalPos = pos;
            float width       = pos.width;

            pos.height = EditorGUIUtility.singleLineHeight;

            var node = prop.objectReferenceValue as InMusicNode;

            EditorGUI.PropertyField(pos, prop, label);
            pos.y     += 15;
            pos.x     += 125;
            pos.width -= 60;



            if (node != null)
            {
                Rect labelPos = originalPos;
                pos.height  = EditorGUIUtility.singleLineHeight;
                labelPos.y  = labelPos.y + EditorGUIUtility.singleLineHeight;
                labelPos.x += 14;
                EditorGUI.LabelField(labelPos, "Node name:");
                labelPos.x += 106;
                EditorGUI.LabelField(labelPos, node.GetName);

                pos.x     = width - 25;
                pos.width = 40;
                bool guiEnabled = GUI.enabled;
                GUI.enabled = true;
                if (GUI.Button(pos, "Find"))
                {
                    SearchHelper.SearchFor(node);
                }
                GUI.enabled = guiEnabled;
            }
            EditorGUI.EndProperty();
        }
Beispiel #6
0
        public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
        {
            EditorGUI.BeginProperty(pos, label, prop);

            Rect  originalPos = pos;
            float width       = pos.width;

            pos.height = EditorGUIUtility.singleLineHeight;
            var node = prop.objectReferenceValue as InAudioNode;


            EditorGUI.PropertyField(pos, prop, label);
            pos.y     += 15;
            pos.x     += 125;
            pos.width -= 60;



            if (node != null)
            {
                Rect labelPos = originalPos;
                pos.height  = EditorGUIUtility.singleLineHeight;
                labelPos.y  = labelPos.y + EditorGUIUtility.singleLineHeight;
                labelPos.x += 14;
                EditorGUI.LabelField(labelPos, "Node name:");
                labelPos.x += 106;
                EditorGUI.LabelField(labelPos, node.Name);


                pos.x     = width - 25;
                pos.width = 40;
                if (GUI.Button(pos, "Find"))
                {
                    SearchHelper.SearchFor(node);
                }
            }
            EditorGUI.EndProperty();
        }