public override void NodeGUI(UnityEditor.Graphs.Node n) { GUILayoutUtility.GetRect((float)160f, (float)0f); base.SelectNode(n); n.NodeUI(this); base.DragNodes(); }
public override void AddNode(Graphs.Node node) { base.AddNode(node); var b = node as Block; _blockMap[b.runtimeInstance] = b; }
/// <summary> /// This function renders individuals nodes /// </summary> /// <param name="node">Node.</param> public override void NodeGUI(Graphs.Node node) { SelectNode(node); (node as Node).OnNodeUI(this); DragNodes(); }
private void OverrideSelection() { if (SelectionOverride != 0) { UnityEditor.Graphs.Node selectedNode = graph[SelectionOverride.ToString()]; if (selectedNode != null) { selection.Clear(); selection.Add(selectedNode); CenterGraph(selectedNode.position.position); } SelectionOverride = 0; } }
/// <summary> /// This function renders individuals Blocks /// </summary> /// <param name="node">Node.</param> public override void NodeGUI(Graphs.Node node) { var n = node as Block; if (n._attrs != null && n._attrs.iconTex != null) { float height = n.position.height - 15; float hdiff = n.position.height - height; float width = n.position.width; float wdiff = n.position.width - width; GUI.DrawTexture(new Rect(wdiff / 2, 10, width, height), n._attrs.iconTex, ScaleMode.ScaleToFit); } SelectNode(node); (node as Block).OnNodeUI(this); DragNodes(); }
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(); }
private float PositionNodeHierarchy(UnityEditor.Graphs.Node currentNode, Vector2 masterPosition, bool skipParents) { float height = VERTICAL_SPACING; if (!skipParents) { foreach (var outputEdge in currentNode.outputEdges) { UnityEditor.Graphs.Node node = outputEdge.toSlot.node; if (!positionedNodes.Contains(node)) { positionedNodes.Add(node); height += PositionNodeHierarchy(node, masterPosition + Vector2.right * HORIZONTAL_SPACING + Vector2.up * height, skipParents); } } } currentNode.position = new Rect(masterPosition + Vector2.up * height * 0.5f, currentNode.position.size); return(height); }
private static string GenerateConnectionKey(UnityEditor.Graphs.Node srcNode, UnityEditor.Graphs.Node dstNode) => (srcNode.GetInstanceID() + "->" + dstNode.GetInstanceID());
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); }
public override void NodeGUI(Node node) { base.NodeGUI(node); }