public override void OnBodyGUI()
        {
            if (target == null)
            {
                Debug.LogWarning("Null target node for node editor!");
                return;
            }

            NodePort output = target.GetPort("output");

            GUILayout.BeginHorizontal();
            if (output != null)
            {
                NodeEditorGUILayout.PortField(GUIContent.none, output, GUILayout.MinWidth(0));
            }
            GUILayout.EndHorizontal();

            EditorGUIUtility.labelWidth = 60;

            base.OnBodyGUI();

            if (GUILayout.Button("Save"))
            {
                var node = target as DecisionTreeSaverNode;
                node.Save();
            }
        }
Esempio n. 2
0
        public static void DrawPortHandle(NodePort port, int overridePortHeight = -1)
        {
            var nodeEditorWindow = NodeEditorWindow.current;

            if (nodeEditorWindow == null)
            {
                return;
            }

            NodeEditor nodeEditor   = NodeEditor.GetEditor(port.node, nodeEditorWindow);
            var        portPosition = EditorGUILayout.GetControlRect(false, 0, GUILayout.Width(0), GUILayout.Height(overridePortHeight >= 0 ? overridePortHeight : EditorGUIUtility.singleLineHeight));

            // Inputs go on the left, outputs on the right
            if (port.IsInput)
            {
                NodeEditorGUILayout.PortField(
                    new Vector2(0, portPosition.y),
                    port
                    );
            }
            else
            {
                NodeEditorGUILayout.PortField(
                    new Vector2(nodeEditor.GetWidth() - 16, portPosition.y),
                    port
                    );
            }
        }
Esempio n. 3
0
 public override void OnBodyGUI()
 {
     if (_dataReaderNode == null)
     {
         _dataReaderNode = (DataReaderNode)target;
     }
     serializedObject.Update();
     EditorGUILayout.LabelField("Iterated Data", EditorStyles.boldLabel);
     foreach (KeyValuePair <string, SerializableInfo> valuePair in _dataReaderNode.InfoDictionary.OrderBy(pair => pair.Value.Order))
     {
         if (!valuePair.Value.IsIteratable)
         {
             continue;
         }
         NodeEditorGUILayout.PortField(_dataReaderNode.GetOutputPort(valuePair.Value.PortName));
     }
     EditorGUILayout.LabelField("Simple Data", EditorStyles.boldLabel);
     foreach (KeyValuePair <string, SerializableInfo> valuePair in _dataReaderNode.InfoDictionary.OrderBy(pair => pair.Value.Order))
     {
         if (valuePair.Value.IsIteratable)
         {
             continue;
         }
         NodeEditorGUILayout.PortField(_dataReaderNode.GetOutputPort(valuePair.Value.PortName));
     }
     serializedObject.ApplyModifiedProperties();
 }
Esempio n. 4
0
    public override void OnBodyGUI()
    {
        ChannelInNode target = ((ChannelInNode)this.target);

        foreach (NodePort port in target.Inputs)
        {
            NodeEditorGUILayout.PortField(port);
        }
        foreach (NodePort port in target.Outputs)
        {
            NodeEditorGUILayout.PortField(port);
        }
        if (target.initialized)
        {
            target.Link();
            if (target.Receiver != null)
            {
                target.address = EditorGUILayout.TextField("Address:", target.address);

                target.Bind(target.Receiver, target.address);
                if (target.channel != null)
                {
                    EditorGUILayout.LabelField("Value:", target.channel.value.ToString());
                }
            }
            //Selection.activeGameObject = target.Receiver.gameObject;
        }
    }
        public override void OnBodyGUI()
        {
            if (target == null)
            {
                Debug.LogWarning("Null target node for node editor!");
                return;
            }

            NodePort input = target.GetPort("input");

            GUILayout.BeginHorizontal();
            if (input != null)
            {
                NodeEditorGUILayout.PortField(GUIContent.none, input, GUILayout.MinWidth(0));
            }

            var node  = target as ActionNode;
            var graph = node.graph as DecisionTreeGraph;

            node.Selected = EditorGUILayout.Popup(node.Selected, graph.ActionTypes, GUILayout.Width(150));
            GUILayout.EndHorizontal();

            EditorGUIUtility.labelWidth = 60;

            base.OnBodyGUI();
        }
 public override void OnBodyGUI()
 {
     if (_actionLauncherNode == null)
     {
         _actionLauncherNode = (ActionLauncherNode)target;
     }
     serializedObject.Update();
     if (_actionLauncherNode.SerializableInfos.Count > 0)
     {
         foreach (NodePort dynamicInput in _actionLauncherNode.DynamicInputs)
         {
             NodeEditorGUILayout.PortField(dynamicInput);
         }
         string[] choices = _actionLauncherNode.SerializableInfos.Select(info => info.Name).ToArray();
         //BUG-fred ArgumentException: Getting control 2's position in a group with only 2 controls when doing mouseUp
         int choiceIndex = EditorGUILayout.Popup(_actionLauncherNode.ChoiceIndex, choices);
         if (choiceIndex != _actionLauncherNode.ChoiceIndex)
         {
             UpdateChoice(choiceIndex);
         }
         _actionLauncherNode.SelectedSerializableInfo = _actionLauncherNode.SerializableInfos
                                                        .ElementAt(_actionLauncherNode.ChoiceIndex);
         NodePort dataPort = _actionLauncherNode.GetPort(nameof(_actionLauncherNode.Data));
         NodeEditorGUILayout.AddPortField(dataPort);
         NodePort linkedOptionPort = _actionLauncherNode.GetPort(nameof(_actionLauncherNode.LinkedOption));
         NodeEditorGUILayout.AddPortField(linkedOptionPort);
     }
     else
     {
         NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_actionLauncherNode.Data)));
     }
     serializedObject.ApplyModifiedProperties();
 }
        public override void OnBodyGUI()
        {
            serializedObject.Update();

            GUILayout.BeginHorizontal();
            {
                NodeEditorGUILayout.PortField(new GUIContent("Prev"), target.GetInputPort("prev"), GUILayout.Width(30));

                DrawTextSupplements();

                GUILayout.BeginVertical(GUILayout.Width(55));
                {
                    NodeEditorGUILayout.PortField(new GUIContent("Success"), target.GetOutputPort("success"), GUILayout.Width(55));
                    NodeEditorGUILayout.PortField(new GUIContent("Fail"), target.GetOutputPort("fail"), GUILayout.Width(55));
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();

            NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("text"), new GUIContent("Text"), false);
            NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("synonims"));

            GUILayout.BeginHorizontal();
            {
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("blacklist"), true, GUILayout.Width(100));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("whitelist"), true, GUILayout.Width(10));
            }
            GUILayout.EndHorizontal();

            // Apply property modifications
            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 8
0
 public override void OnBodyGUI()
 {
     if (_actionSetterNode == null)
     {
         _actionSetterNode = (ActionSetterNode)target;
     }
     if (_actionSetterNode.SelectedSerializableInfo != null && _actionSetterNode.SerializableInfos.Count > 0)
     {
         NodePort valuePort = _actionSetterNode.GetPort(nameof(_actionSetterNode.Value));
         valuePort.ValueType = _actionSetterNode.SelectedSerializableInfo.Type;
         NodeEditorGUILayout.PortField(valuePort);
         string[] choices = _actionSetterNode.SerializableInfos.Select(info => info.Name).ToArray();
         //BUG-fred ArgumentException: Getting control 2's position in a group with only 2 controls when doing mouseUp
         int choiceIndex = EditorGUILayout.Popup(_actionSetterNode.ChoiceIndex, choices);
         if (choiceIndex != _actionSetterNode.ChoiceIndex)
         {
             UpdateChoice(choiceIndex);
         }
         NodePort dataPort = _actionSetterNode.GetPort(nameof(_actionSetterNode.Data));
         NodeEditorGUILayout.AddPortField(dataPort);
         NodePort linkedOptionPort = _actionSetterNode.GetPort(nameof(_actionSetterNode.LinkedOption));
         NodeEditorGUILayout.AddPortField(linkedOptionPort);
     }
     else
     {
         NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_actionSetterNode.Data)));
     }
 }
Esempio n. 9
0
        public override void OnBodyGUI()
        {
            serializedObject.Update();

            NodeEditorGUILayout.PortField(value);
            NodeEditorGUILayout.PropertyField(type);
            switch (type.enumValueIndex)
            {
            case 0:     // Euler
                EditorGUILayout.PrefixLabel("Euler Angles");
                NodeEditorGUILayout.PropertyField(vector0, quaternion.GetInputPort(nameof(vector0)));
                break;

            case 1:     // LookRotation
                EditorGUILayout.PrefixLabel("Forward Direction");
                NodeEditorGUILayout.PropertyField(vector0, quaternion.GetInputPort(nameof(vector0)));
                NodeEditorGUILayout.PropertyField(setUpward);
                if (setUpward.boolValue)
                {
                    EditorGUILayout.PrefixLabel("Upward Direction");
                    NodeEditorGUILayout.PropertyField(vector1, quaternion.GetInputPort(nameof(vector1)));
                }
                break;

            case 2:     // FromToRotation
                EditorGUILayout.PrefixLabel("From Direction");
                NodeEditorGUILayout.PropertyField(vector0, quaternion.GetInputPort(nameof(vector0)));
                EditorGUILayout.PrefixLabel("To Direction");
                NodeEditorGUILayout.PropertyField(vector1, quaternion.GetInputPort(nameof(vector1)));
                break;
            }

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 10
0
        public override void OnBodyGUI()
        {
            GUI.color = Color.white;
            NodeEditorGUILayout.PortField(target.GetInputPort("enter"));
            Rect rect = GUILayoutUtility.GetLastRect();

            rect.x    += 47;
            rect.width = 65;
            EditorGUI.PropertyField(rect, serializedObject.FindProperty("splitType"), GUIContent.none);

            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Outlets:", GUILayout.Width(43));
            node.outlets = Mathf.Clamp(EditorGUILayout.IntField(node.outlets, GUILayout.Width(22)), 2, 50);

            node.changeCheck();

            EditorGUILayout.LabelField("Next:", GUILayout.Width(35));
            node.nextOutletNum = EditorGUILayout.IntField(node.nextOutletNum, GUILayout.Width(22));
            GUILayout.EndHorizontal();

            // draw the outlets
            for (int i = 0; i < node.outlets; i++)
            {
                NodeEditorGUILayout.PortField(target.GetOutputPort("out" + i));
            }
            serializedObject.ApplyModifiedProperties();
            serializedObject.Update();
            DrawFooterGUI();
        }
Esempio n. 11
0
        void DrawOutputPorts()
        {
            // Sine wave outputs
            NodeEditorGUILayout.PortField(new Vector2(27, 200), Target.MasterSinePort);
            EditorGUI.LabelField(new Rect(20, 220, 30, 15), "Sin", ValueStyle);
            NodeEditorGUILayout.PortField(new Vector2(68, 200), Target.MultiplierASinePort);
            EditorGUI.LabelField(new Rect(61, 220, 30, 15), "Sin", ValueStyle);
            NodeEditorGUILayout.PortField(new Vector2(109, 200), Target.MultiplierBSinePort);
            EditorGUI.LabelField(new Rect(102, 220, 30, 15), "Sin", ValueStyle);
            NodeEditorGUILayout.PortField(new Vector2(150, 200), Target.MultiplierCSinePort);
            EditorGUI.LabelField(new Rect(143, 220, 30, 15), "Sin", ValueStyle);

            // Triangle wave outputs
            NodeEditorGUILayout.PortField(new Vector2(27, 245), Target.MasterTrianglePort);
            EditorGUI.LabelField(new Rect(20, 265, 30, 15), "Tri", ValueStyle);
            NodeEditorGUILayout.PortField(new Vector2(68, 245), Target.MultiplierATrianglePort);
            EditorGUI.LabelField(new Rect(61, 265, 30, 15), "Tri", ValueStyle);
            NodeEditorGUILayout.PortField(new Vector2(109, 245), Target.MultiplierBTrianglePort);
            EditorGUI.LabelField(new Rect(102, 265, 30, 15), "Tri", ValueStyle);
            NodeEditorGUILayout.PortField(new Vector2(150, 245), Target.MultiplierCTrianglePort);
            EditorGUI.LabelField(new Rect(143, 265, 30, 15), "Tri", ValueStyle);

            // Saw wave outputs
            NodeEditorGUILayout.PortField(new Vector2(27, 290), Target.MasterSawtoothPort);
            EditorGUI.LabelField(new Rect(20, 310, 30, 15), "Saw", ValueStyle);
            NodeEditorGUILayout.PortField(new Vector2(68, 290), Target.MultiplierASawtoothPort);
            EditorGUI.LabelField(new Rect(61, 310, 30, 15), "Saw", ValueStyle);
            NodeEditorGUILayout.PortField(new Vector2(109, 290), Target.MultiplierBSawtoothPort);
            EditorGUI.LabelField(new Rect(102, 310, 30, 15), "Saw", ValueStyle);
            NodeEditorGUILayout.PortField(new Vector2(150, 290), Target.MultiplierCSawtoothPort);
            EditorGUI.LabelField(new Rect(143, 310, 30, 15), "Saw", ValueStyle);
        }
Esempio n. 12
0
        public override void OnBodyGUI()
        {
            serializedObject.Update();

            Chat node = target as Chat;

            EditorGUILayout.LabelField("讲话的那位");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("character"), GUIContent.none);
            if (node.answers.Count > 1)
            {
                EditorGUILayout.LabelField("回复的那位");
                EditorGUILayout.PropertyField(serializedObject.FindProperty("answerCharacter"), GUIContent.none);
            }
            EditorGUILayout.LabelField("左侧立绘(可为空)");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("leftCharacter"), GUIContent.none);
            EditorGUILayout.LabelField("右侧立绘(可为空)");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("rightCharacter"), GUIContent.none);
            if (node.answers.Count == 0)
            {
                GUILayout.BeginHorizontal();
                NodeEditorGUILayout.PortField(GUIContent.none, target.GetInputPort("input"), GUILayout.MinWidth(0));
                NodeEditorGUILayout.PortField(GUIContent.none, target.GetOutputPort("output"), GUILayout.MinWidth(0));
                GUILayout.EndHorizontal();
            }
            else
            {
                NodeEditorGUILayout.PortField(GUIContent.none, target.GetInputPort("input"));
            }
            GUILayout.Space(-30);

            NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("text"), GUIContent.none);
            NodeEditorGUILayout.InstancePortList("answers", typeof(DialogueBaseNode), serializedObject, NodePort.IO.Output, Node.ConnectionType.Override);

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 13
0
 public static void DrawPorts(XNode.Node target)
 {
     EditorGUILayout.BeginHorizontal();
     NodeEditorGUILayout.PortField(new GUIContent("Input"), target.GetInputPort("input"), GUILayout.MinWidth(0));
     NodeEditorGUILayout.PortField(new GUIContent("Output"), target.GetOutputPort("output"), GUILayout.MinWidth(0));
     EditorGUILayout.EndHorizontal();
 }
 public override void OnBodyGUI()
 {
     Target.InletPorts.ForEach(inlet =>
                               NodeEditorGUILayout.PortField(new GUIContent("Inlet"), inlet));
     Target.OutletPorts.ForEach(outlet =>
                                NodeEditorGUILayout.PortField(new GUIContent("Outlet"), outlet));
 }
Esempio n. 15
0
 private void DrawPorts(Group node)
 {
     EditorGUILayout.BeginHorizontal();
     NodeEditorGUILayout.PortField(new GUIContent("Input"), target.GetInputPort("input"), GUILayout.MinWidth(0));
     NodeEditorGUILayout.PortField(new GUIContent("Output"), target.GetOutputPort("output"), GUILayout.MinWidth(0));
     EditorGUILayout.EndHorizontal();
 }
Esempio n. 16
0
        /// <inheritdoc />
        public override void OnBodyGUI()
        {
            SOFlowEditorUtilities.AdjustTextContrast(GetTint());

            serializedObject.Update();

            EventNode eventNode = (EventNode)target;

            NodePort entryPort = GetDynamicPort("Entry", true, Node.ConnectionType.Multiple);
            NodePort exitPort  = GetDynamicPort("Exit", false);

            SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.TertiaryLayerColour,
                                                            () =>
            {
                NodeEditorGUILayout.PortField(entryPort,
                                              GUILayout.MinWidth(0f));

                NodeEditorGUILayout.PortField(exitPort,
                                              GUILayout.MinWidth(0f));
            });

            SOFlowEditorUtilities.RestoreTextContrast();

            NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(eventNode.Event)));

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 17
0
        public override void OnBodyGUI()
        {
            serializedObject.Update();

            DialogueChatNode node = target as DialogueChatNode;

            EditorGUILayout.PropertyField(serializedObject.FindProperty("character"), GUIContent.none);
            if (node.answers == null || node.answers.Count == 0)
            {
                GUILayout.BeginHorizontal();
                NodeEditorGUILayout.PortField(GUIContent.none, target.GetInputPort("input"), GUILayout.MinWidth(0));
                NodeEditorGUILayout.PortField(GUIContent.none, target.GetOutputPort("output"), GUILayout.MinWidth(0));
                GUILayout.EndHorizontal();
            }
            else
            {
                NodeEditorGUILayout.PortField(GUIContent.none, target.GetInputPort("input"));
            }
            GUILayout.Space(-30);

            NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("content"), GUIContent.none);
            NodeEditorGUILayout.DynamicPortList("answers", typeof(DialogueBaseNode), serializedObject, NodePort.IO.Output, Node.ConnectionType.Override);

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 18
0
        public override void OnBodyGUI()
        {
            TimerNode timeNode = (TimerNode)target;

            //NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("inputNode"));

            NodeEditorGUILayout.PortField(target.GetInputPort("inputNode"));

            EditorGUILayout.Space();
            // NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("timeEvents"));

            if (timeNode.timeEvents != null)
            {
                //target.ClearInstancePorts();
                for (int i = 0; i < timeNode.timeEvents.Length; i++)
                {
                    var _timeEvent = timeNode.timeEvents[i];

                    NodePort port = target.GetPort("eventnode_" + i);
                    if (port == null)
                    {
                        port = target.AddInstanceOutput(typeof(TimerNode.TimeEvent), Node.ConnectionType.Multiple, "eventnode_" + i);
                    }

                    NodeEditorGUILayout.PortField(new GUIContent("eventnode_" + i), port);


                    EditorGUILayout.Space();
                }
            }
        }
Esempio n. 19
0
    public override void OnBodyGUI()
    {
        serializedObject.Update();

        var node = target as HumanItemConditionNode;

        EditorGUIUtility.labelWidth = 60;
        NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("itemId"));
        if (node.itemId != null && node.itemId.Length > 0)
        {
            var style = new GUIStyle(GUI.skin.label)
            {
                alignment = TextAnchor.MiddleRight
            };
            if (MMX.ItemStorage.shared.items.ContainsKey(node.itemId))
            {
                var item = MMX.ItemStorage.shared.items[node.itemId];
                EditorGUILayout.LabelField(item.name, style, GUILayout.ExpandWidth(true));
            }
            else
            {
                EditorGUILayout.LabelField("Invalid Item Id", style, GUILayout.ExpandWidth(true));
            }
        }
        NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("comparisonOperator"));
        NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("count"));
        NodeEditorGUILayout.PortField(target.GetOutputPort("output"));

        serializedObject.ApplyModifiedProperties();
    }
Esempio n. 20
0
    public override void OnBodyGUI()
    {
        AnimatorParameterNode target = ((AnimatorParameterNode)this.target);

        target.parameter = (AnimatorParameterSetter)EditorGUILayout.ObjectField("Parameter", target.parameter, typeof(AnimatorParameterSetter), true);
        foreach (NodePort port in target.Inputs)
        {
            NodeEditorGUILayout.PortField(port);
        }
        foreach (NodePort port in target.Outputs)
        {
            NodeEditorGUILayout.PortField(port);
        }
        if (target.initialized)
        {
            target.Link();
            if (target.animator != null)
            {
                string[] options = new string[target.animator.parameterCount];
                for (int p = 0; p < target.animator.parameterCount; ++p)
                {
                    options[p] = target.animator.parameters[p].name;
                }

                target.selected = EditorGUILayout.Popup("Label", target.selected, options);
                //target.parameterName = EditorGUILayout.TextField("Parameter name:", options[target.selected]);
                target.Bind(target.animator, target.parameterName);
                if (target.parameter != null)
                {
                    EditorGUILayout.LabelField("Value:", target.parameter.value.ToString());
                }
            }
        }
    }
Esempio n. 21
0
        /// <inheritdoc />
        public override void OnBodyGUI()
        {
            SOFlowEditorUtilities.AdjustTextContrast(GetTint());

            serializedObject.Update();

            BranchNode branch = (BranchNode)target;

            NodePort entryPort   = GetDynamicPort("Entry", true, Node.ConnectionType.Multiple);
            NodePort defaultPort = GetDynamicPort("Default", false);

            SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.TertiaryLayerColour,
                                                            () =>
            {
                NodeEditorGUILayout.PortField(entryPort);
            });

            SOFlowEditorUtilities.RestoreTextContrast();

            NodeEditorGUILayout.DynamicPortList(nameof(branch.Conditions), typeof(Node), serializedObject,
                                                NodePort.IO.Output, Node.ConnectionType.Override);

            SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.TertiaryLayerColour,
                                                            () =>
            {
                NodeEditorGUILayout.PortField(defaultPort);
            });

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 22
0
 public override void OnBodyGUI()
 {
     GUI.color = Color.white;
     NodeEditorGUILayout.PortField(target.GetInputPort("enter"));
     NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("message"), GUIContent.none);
     DrawFooterGUI();
 }
Esempio n. 23
0
        public override void OnBodyGUI()
        {
            _subgraph = serializedObject.FindProperty("subgraph");

            serializedObject.Update();
            EditorGUIUtility.labelWidth = 60;
            foreach (var stateIn in _node.inputStates)
            {
                NodeEditorGUILayout.PortField(stateIn);
            }
            foreach (var stateOut in _node.outputStates)
            {
                NodeEditorGUILayout.PortField(stateOut);
            }
            EditorGUILayout.Space();
            NodeEditorGUILayout.PropertyField(_subgraph);
            serializedObject.ApplyModifiedProperties();

            if (!(_node.graph is IBrainGraph graph))
            {
                return;
            }
            if (!ReferenceEquals(graph.StartingNode, _node) && GUILayout.Button(C.LABEL_SET_AS_STARTING_STATE))
            {
                graph.StartingNode = _node;
            }
        }
Esempio n. 24
0
        /// <summary>Draw node's body GUI.</summary>
        public override void OnBodyGUI()
        {
            base.OnBodyGUI();

            _decorator = target as BTDecoratorNode;

            // Check if we need to create new exit.
            _child = target.GetOutputPort("_child");
            if (_child == null)
            {
                _child = target.AddInstanceOutput(typeof(BTConnection), Node.ConnectionType.Override, "_child");
            }

            // Output port field.
            GUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            NodeEditorGUILayout.PortField(_child, GUILayout.Width(60));
            GUILayout.EndHorizontal();

            // Update connection values.
            if (_child.Connection == null)
            {
                _connection      = null;
                _decorator.Child = null;
            }
            else if (_child.Connection.node != _connection)
            {
                _connection      = _child.Connection.node;
                _decorator.Child = new BTConnection(_decorator, _child.fieldName);
            }
        }
Esempio n. 25
0
 public override void OnBodyGUI()
 {
     if (_actionSetterNode == null)
     {
         _actionSetterNode = (ActionSetterNode)target;
     }
     serializedObject.Update();
     if (_actionSetterNode.SelectedSerializableInfo != null && _actionSetterNode.SerializableInfos.Count > 0)
     {
         NodePort valuePort = _actionSetterNode.GetPort(nameof(_actionSetterNode.Value));
         valuePort.ValueType = _actionSetterNode.SelectedSerializableInfo.Type;
         NodeEditorGUILayout.PortField(valuePort);
         string[] choices     = _actionSetterNode.SerializableInfos.Select(info => info.Name).ToArray();
         int      choiceIndex = EditorGUILayout.Popup(_actionSetterNode.ChoiceIndex, choices);
         if (choiceIndex != _actionSetterNode.ChoiceIndex)
         {
             UpdateChoice(choiceIndex);
         }
         _actionSetterNode.SelectedSerializableInfo = _actionSetterNode.SerializableInfos.ElementAt(_actionSetterNode.ChoiceIndex);
         NodePort dataPort = _actionSetterNode.GetPort(nameof(_actionSetterNode.Data));
         NodeEditorGUILayout.AddPortField(dataPort);
         NodePort linkedOptionPort = _actionSetterNode.GetPort(nameof(_actionSetterNode.LinkedOption));
         NodeEditorGUILayout.AddPortField(linkedOptionPort);
     }
     else
     {
         NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_actionSetterNode.Data)));
     }
     serializedObject.ApplyModifiedProperties();
 }
Esempio n. 26
0
    public override void OnBodyGUI()
    {
        OSCReceiverNode target = ((OSCReceiverNode)this.target);

        foreach (NodePort port in target.Inputs)
        {
            NodeEditorGUILayout.PortField(port);
        }
        foreach (NodePort port in target.Outputs)
        {
            NodeEditorGUILayout.PortField(port);
        }
        if (target.initialized)
        {
            target.Link();

            if (target.Receiver != null)
            {
                foreach (string channel in target.Receiver.values.Keys)
                {
                    EditorGUILayout.TextField(channel, target.Receiver.values[channel].ToString());
                }
            }
        }
    }
        private static void Show(DetailNode obj, Action beforeProperties = null)
        {
            //General
            NodeEditorGUILayout.PortField(obj.GetInputPort("Constraint"));
            NodeEditorGUILayout.PortField(obj.GetInputPort("Modifier"));

            obj.DistributionType = (DetailNode.Distribution)EditorGUILayout.EnumPopup("Distribution", obj.DistributionType);
            if (obj.DistributionType == DetailNode.Distribution.PoissonDisc)
            {
                obj.Spread = EditorGUIExtension.MinMaxFloatField("Spread", obj.Spread, 1f, 50f);
            }
            else
            {
                obj.UniformResolution = EditorGUIExtension.MinMaxIntField("Resolution", obj.UniformResolution, 2, 1024);
            }

            obj.MaxObjects = EditorGUILayout.IntField("Max Objects", obj.MaxObjects);

            if (beforeProperties != null)
            {
                beforeProperties();
            }

            EditorGUIExtension.DrawMinMax("Width Scale", ref obj.WidthScale.x, ref obj.WidthScale.y);
            EditorGUIExtension.DrawMinMax("Height Scale", ref obj.HeightScale.x, ref obj.HeightScale.y);

            if (obj.MaxObjects < 1)
            {
                obj.MaxObjects = 1;
            }
        }
Esempio n. 28
0
    public override void OnBodyGUI()
    {
        NodeEditorGUILayout.PortField(target.GetPort("input"));

        OutNode noiseNode  = target as OutNode;
        Rect    lastRect   = GUILayoutUtility.GetLastRect();
        Rect    toggleRect = new Rect(lastRect)
        {
            width  = 18,
            height = 18,
            y      = lastRect.y + EditorGUIUtility.singleLineHeight,
            x      = (GetWidth() - 18f) / 2
        };

        noiseNode.ShowTextureInEditor = EditorGUI.Toggle(toggleRect, noiseNode.ShowTextureInEditor, NodeEditorResources.styles.preview);
        GUILayoutUtility.GetRect(toggleRect.width, toggleRect.height);

        if (noiseNode.ShowTextureInEditor)
        {
            if (noiseNode.HasTexture)
            {
                Rect textureRect = new Rect(toggleRect)
                {
                    width  = GetWidth() * 0.95f,
                    height = GetWidth() * 0.8f / noiseNode.GetGraph.Ratio,
                    y      = toggleRect.y + EditorGUIUtility.singleLineHeight * 2
                };
                textureRect.x = (GetWidth() - textureRect.width) / 2;
                GUILayoutUtility.GetRect(textureRect.width, textureRect.height + EditorGUIUtility.singleLineHeight);
                EditorGUI.DrawPreviewTexture(textureRect, noiseNode.GetInputTexture);
            }
        }
    }
Esempio n. 29
0
        public override void OnBodyGUI()
        {
            serializedObject.Update();

            AISetVariable node = target as AISetVariable;

            GUILayout.BeginHorizontal();
            NodeEditorGUILayout.PortField(GUIContent.none, target.GetInputPort("input"), GUILayout.MinWidth(0));
            NodeEditorGUILayout.PortField(GUIContent.none, target.GetOutputPort("output"), GUILayout.MinWidth(0));
            GUILayout.EndHorizontal();

            EditorGUILayout.PropertyField(serializedObject.FindProperty("variableType"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("variableName"), new GUIContent("Name:"));
            switch (node.variableType)
            {
            case AISetVariable.VariableType.Float:
                serializedObject.FindProperty("fVariable").floatValue = EditorGUILayout.FloatField("Value:", serializedObject.FindProperty("fVariable").floatValue);
                break;

            case AISetVariable.VariableType.String:
                serializedObject.FindProperty("sVariable").stringValue = EditorGUILayout.TextField("Value:", serializedObject.FindProperty("sVariable").stringValue);
                break;

            case AISetVariable.VariableType.Int:
                serializedObject.FindProperty("iVariable").intValue = EditorGUILayout.IntField("Value:", serializedObject.FindProperty("iVariable").intValue);
                break;

            case AISetVariable.VariableType.UnityObject:
                serializedObject.FindProperty("uVariable").objectReferenceValue = EditorGUILayout.ObjectField("Value:", serializedObject.FindProperty("uVariable").objectReferenceValue, typeof(UnityEngine.Object), false);
                break;
            }
            serializedObject.ApplyModifiedProperties();
        }
        public override void OnBodyGUI()
        {
            serializedObject.Update();

            NodeEditorGUILayout.DynamicPortList("out", typeof(object), serializedObject, NodePort.IO.Input,
                                                Node.ConnectionType.Override, onCreation: _inListSetting, onAdd: x =>
            {
                _updateGetChildNodeGroup((group, node) =>
                {
                    node.AddDynamicOutput(typeof(object), Node.ConnectionType.Multiple, fieldName: x);
                });
            });

            NodeEditorGUILayout.DynamicPortList("in", typeof(object), serializedObject, NodePort.IO.Output,
                                                Node.ConnectionType.Multiple, onCreation: _outListSetting, onAdd: x =>
            {
                _updateGetChildNodeGroup((group, node) =>
                {
                    node.AddDynamicInput(typeof(object), Node.ConnectionType.Override, Node.TypeConstraint.Inherited, fieldName: x);
                });
            });

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField(string.Empty, GUILayout.Width(GetWidth() / 2));
                NodeEditorGUILayout.PortField(new GUIContent("Main Node"), target.GetPort(ChildGroupNode.MainNodeFieldName));
            }
            EditorGUILayout.EndHorizontal();

            // Apply property modifications
            serializedObject.ApplyModifiedProperties();
        }