/// <summary> /// EDITOR: Add a left connector to the node when it is first created /// </summary> /// <param name="singleConnection"></param> protected void AddInput(bool singleConnection = false) { this.input = ScriptableObject.CreateInstance <AudioNodeInput>(); AssetDatabase.AddObjectToAsset(this.input, this); this.input.name = this.name + "Input"; this.input.ParentNode = this; this.input.SetSingleConnection(singleConnection); }
/// <summary> /// Perform necessary actions for the a mouse button being released this frame /// </summary> /// <param name="e">The input event handled by Unity</param> private void HandleMouseUp(Event e) { this.leftButtonDown = false; if (this.rightButtonClicked && !this.hasPanned) { this.selectedNode = GetNodeAtPosition(e.mousePosition); this.selectedOutput = GetOutputAtPosition(e.mousePosition); AudioNodeInput tempInput = GetInputAtPosition(e.mousePosition); if (tempInput != null) { InputContextMenu(e.mousePosition); } else if (this.selectedOutput != null) { OutputContextMenu(e.mousePosition); } else if (this.selectedNode == null) { CanvasContextMenu(e.mousePosition); } else { ModifyNodeContextMenu(e.mousePosition); } } else { if (this.selectedOutput != null) { AudioNodeInput hoverInput = GetInputAtPosition(e.mousePosition); if (hoverInput != null) { hoverInput.AddConnection(this.selectedOutput); } } } this.panGraph = false; this.hasPanned = false; this.selectedOutput = null; this.rightButtonClicked = false; this.leftButtonDown = false; }
/// <summary> /// Arrange the order of connections for an input connector /// </summary> /// <param name="positionObject">The position of the input connector</param> public void SortInput(object positionObject) { AudioNodeInput tempInput = GetInputAtPosition((Vector2)positionObject); tempInput.SortConnections(); }
/// <summary> /// Remove all connections from an input connector /// </summary> /// <param name="positionObject">The position of the input connector</param> public void ClearInput(object positionObject) { AudioNodeInput tempInput = GetInputAtPosition((Vector2)positionObject); tempInput.RemoveAllConnections(); }