public override void NodeGUI(UnityEditor.Graphs.Node n)
 {
     GUILayoutUtility.GetRect((float)160f, (float)0f);
     base.SelectNode(n);
     n.NodeUI(this);
     base.DragNodes();
 }
Exemple #2
0
 public virtual void NodeGUI(Node n)
 {
     this.SelectNode(n);
     foreach (Slot current in n.inputSlots)
     {
         this.LayoutSlot(current, current.title, false, true, false, Styles.varPinIn);
     }
     n.NodeUI(this);
     foreach (Slot current2 in n.outputSlots)
     {
         this.LayoutSlot(current2, current2.title, true, false, true, Styles.varPinOut);
     }
     this.DragNodes();
 }
Exemple #3
0
        public override void NodeGUI(UnityEditor.Graphs.Node node)
        {
            SelectNode(node);

            foreach (var slot in node.inputSlots)
            {
                LayoutSlot(slot, slot.title, false, true, true, _pinIn);
            }

            node.NodeUI(this);

            foreach (var slot in node.outputSlots)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                LayoutSlot(slot, slot.title, true, false, true, _pinOut);
                EditorGUILayout.EndHorizontal();
            }
            DragNodes();
        }
 public override void NodeGUI(UnityEditor.Graphs.Node n)
 {
     UnityEditor.Graphs.AnimationBlendTree.Node node   = n as UnityEditor.Graphs.AnimationBlendTree.Node;
     UnityEditor.Animations.BlendTree           motion = node.motion as UnityEditor.Animations.BlendTree;
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(200f) };
     GUILayout.BeginVertical(options);
     foreach (Slot slot in n.inputSlots)
     {
         base.LayoutSlot(slot, this.LimitStringWidth(slot.title, 180f, UnityEditor.Graphs.Styles.varPinIn), false, false, false, UnityEditor.Graphs.Styles.varPinIn);
     }
     foreach (Slot slot2 in n.outputSlots)
     {
         base.LayoutSlot(slot2, this.LimitStringWidth(slot2.title, 180f, UnityEditor.Graphs.Styles.varPinOut), false, false, false, UnityEditor.Graphs.Styles.varPinOut);
     }
     n.NodeUI(this);
     EditorGUIUtility.labelWidth = 50f;
     if (motion != null)
     {
         if (motion.recursiveBlendParameterCount > 0)
         {
             for (int i = 0; i < motion.recursiveBlendParameterCount; i++)
             {
                 string    recursiveBlendParameter    = motion.GetRecursiveBlendParameter(i);
                 float     recursiveBlendParameterMin = motion.GetRecursiveBlendParameterMin(i);
                 float     recursiveBlendParameterMax = motion.GetRecursiveBlendParameterMax(i);
                 EventType type = Event.current.type;
                 if ((Event.current.button != 0) && Event.current.isMouse)
                 {
                     Event.current.type = EventType.Ignore;
                 }
                 if (Mathf.Approximately(recursiveBlendParameterMax, recursiveBlendParameterMin))
                 {
                     recursiveBlendParameterMax = recursiveBlendParameterMin + 1f;
                 }
                 EditorGUI.BeginChangeCheck();
                 float parameterValue = EditorGUILayout.Slider(GUIContent.Temp(recursiveBlendParameter, recursiveBlendParameter), this.blendTreeGraph.GetParameterValue(recursiveBlendParameter), recursiveBlendParameterMin, recursiveBlendParameterMax, 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 <UnityEditor.Graphs.Edge> list = new List <UnityEditor.Graphs.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++)
             {
                 UnityEditor.Graphs.AnimationBlendTree.Node node2 = list[j].toSlot.node as UnityEditor.Graphs.AnimationBlendTree.Node;
                 node2.weight  = node.weight * this.m_Weights[j];
                 list[j].color = node2.weightEdgeColor;
             }
         }
     }
     GUILayout.EndVertical();
     this.HandleNodeInput(n as UnityEditor.Graphs.AnimationBlendTree.Node);
 }