/// <summary> /// Returns true if the connection was added successfully. /// </summary> /// <param name="input"></param> /// <returns></returns> public bool Add(NodeInput input) { if (!CanConnectInput(input)) { return(false); } // The input cannot be connected to anything. // This test is not inside the CanConnectInput() because // an action can remove the old connections automatically to make it // easier for the user to change connections between nodes. if (input.HasOutputConnected()) { // Changes to the inputs need to be properly handled by the Action system, // so it works with undo. Debug.LogWarning("Cannot add an input that is already connected"); return(false); } input.Connect(this); _inputs.Add(input); parentNode.OnNewInputConnection(input); return(true); }
private void cacheOldConnections() { // Check if the receiving node was already connected. if (_input != null && _input.HasOutputConnected()) { _oldConnectedOutput = _input.OutputConnection; } // Check if the origin node already had inputs if (!_output.bCanHaveMultipleConnections && _output.InputCount > 0) { _oldConnectedInputs = _output.Inputs.ToList(); } }