Exemple #1
0
 public override void NodeGUI(UnityEditor.Graphs.Node n)
 {
     GUILayoutUtility.GetRect(160f, 0f);
     base.SelectNode(n);
     n.NodeUI(this);
     base.DragNodes();
 }
Exemple #2
0
 private static string GenerateConnectionKey(UnityEditor.Graphs.Node srcNode, UnityEditor.Graphs.Node dstNode)
 {
     return(srcNode.GetInstanceID() + "->" + dstNode.GetInstanceID());
 }
Exemple #3
0
        public override void NodeGUI(UnityEditor.Graphs.Node n)
        {
            Node node = n as Node;

            UnityEditor.Animations.BlendTree blendTree = node.motion as UnityEditor.Animations.BlendTree;
            GUILayout.BeginVertical(new GUILayoutOption[]
            {
                GUILayout.Width(200f)
            });
            foreach (Slot current in n.inputSlots)
            {
                base.LayoutSlot(current, this.LimitStringWidth(current.title, 180f, Styles.varPinIn), false, false, false, Styles.varPinIn);
            }
            foreach (Slot current2 in n.outputSlots)
            {
                base.LayoutSlot(current2, this.LimitStringWidth(current2.title, 180f, Styles.varPinOut), false, false, false, Styles.varPinOut);
            }
            n.NodeUI(this);
            EditorGUIUtility.labelWidth = 50f;
            if (blendTree)
            {
                int recursiveBlendParameterCount = blendTree.recursiveBlendParameterCount;
                if (recursiveBlendParameterCount > 0)
                {
                    for (int i = 0; i < blendTree.recursiveBlendParameterCount; i++)
                    {
                        string    recursiveBlendParameter    = blendTree.GetRecursiveBlendParameter(i);
                        float     recursiveBlendParameterMin = blendTree.GetRecursiveBlendParameterMin(i);
                        float     num  = blendTree.GetRecursiveBlendParameterMax(i);
                        EventType type = Event.current.type;
                        if (Event.current.button != 0 && Event.current.isMouse)
                        {
                            Event.current.type = EventType.Ignore;
                        }
                        if (Mathf.Approximately(num, recursiveBlendParameterMin))
                        {
                            num = recursiveBlendParameterMin + 1f;
                        }
                        EditorGUI.BeginChangeCheck();
                        float parameterValue = EditorGUILayout.Slider(GUIContent.Temp(recursiveBlendParameter, recursiveBlendParameter), this.blendTreeGraph.GetParameterValue(recursiveBlendParameter), recursiveBlendParameterMin, num, new GUILayoutOption[0]);
                        if (EditorGUI.EndChangeCheck())
                        {
                            this.blendTreeGraph.SetParameterValue(recursiveBlendParameter, parameterValue);
                            InspectorWindow.RepaintAllInspectors();
                        }
                        if (Event.current.button != 0)
                        {
                            Event.current.type = type;
                        }
                    }
                }
                else
                {
                    EditorGUILayout.LabelField("No blend parameter to display", new GUILayoutOption[0]);
                }
                if (node.animator != null)
                {
                    List <Edge> list = new List <Edge>(n.outputEdges);
                    node.UpdateAnimator();
                    if (this.m_Weights.Length != list.Count)
                    {
                        this.m_Weights = new float[list.Count];
                    }
                    BlendTreePreviewUtility.GetRootBlendTreeChildWeights(node.animator, 0, node.animator.GetCurrentAnimatorStateInfo(0).fullPathHash, this.m_Weights);
                    for (int j = 0; j < list.Count; j++)
                    {
                        Node node2 = list[j].toSlot.node as Node;
                        node2.weight  = node.weight * this.m_Weights[j];
                        list[j].color = node2.weightEdgeColor;
                    }
                }
            }
            GUILayout.EndVertical();
            this.HandleNodeInput(n as Node);
        }