/// <summary> /// Changes the type of a pin. Should only be called upon editor callback. /// </summary> /// <param name="context">Context which contains all editor node actions that need to be executed after this call</param> /// <param name="pin"></param> /// <param name="newType"></param> protected void ChangePinType(CNodeChangeContext context, CPin pin, Type newType) { if (pin is CInputPin inputPin) { inputPin.Type = newType; context.Actions.Add(new CPinTypeChangeAction(pin, newType)); } else if (pin is COutputPin outputPin) { outputPin.Type = newType; context.Actions.Add(new CPinTypeChangeAction(pin, newType)); } }
/// <summary> /// Adds a new execution pin. This should only be called upon editor callback. /// </summary> /// <param name="context">Context which contains all editor node actions that need to be executed after this call</param> /// <param name="newPin">The new execution pin that should be added</param> /// <param name="index">The index at which the execution pin should be inserted</param> /// <param name="bIsIn">Whether the pin acts as in or output</param> protected void AddExecutionPin(CNodeChangeContext context, CExecutionPin newPin, int index, bool bIsIn) { if (bIsIn) { InExecutionPins.Add(newPin); } else { OutExecutionPins.Add(newPin); } context.Actions.Add(new CAddPinChangeAction(newPin, index, bIsIn)); }
/// <summary> /// Adds a new value input pin. This should only be called upon editor callback. /// </summary> /// <param name="context">Context which contains all editor node actions that need to be executed after this call</param> /// <param name="newPin">The new input pin that should be added</param> /// <param name="index">The index at which the input pin should be inserted</param> protected void AddInputPin(CNodeChangeContext context, CInputPin newPin, int index) { InputPins.Add(newPin); context.Actions.Add(new CAddPinChangeAction(newPin, index, true)); }
/// <summary> /// Adds a new value output pin. This should only be called upon editor callback. /// </summary> /// <param name="context">Context which contains all editor node actions that need to be executed after this call</param> /// <param name="newPin">The new output pin that should be added</param> /// <param name="index">The index at which the output pin should be inserted</param> protected void AddOutputPin(CNodeChangeContext context, COutputPin newPin, int index) { OutputPins.Add(newPin); context.Actions.Add(new CAddPinChangeAction(newPin, index, false)); }
/// <summary> /// Changes the name of this node. Should only be called upon editor callback. /// </summary> /// <param name="context">Context which contains all editor node actions that need to be executed after this call</param> /// <param name="newName">The new name of the node</param> protected void ChangeNodeName(CNodeChangeContext context, string newName) { Name = newName; context.Actions.Add(new CNodeNameChangeAction(newName)); }
/// <summary> /// Changes the name of a pin. Should only be called upon editor callback. /// </summary> /// <param name="context">Context which contains all editor node actions that need to be executed after this call</param> /// <param name="pin">The pin whose name should be changed</param> /// <param name="newName">The new name of the pin</param> protected void ChangePinName(CNodeChangeContext context, CPin pin, string newName) { pin.Name = newName; context.Actions.Add(new CPinNameChangeAction(pin, newName)); }
/// <summary> /// Notifies the node that its 'Add Output' button has been clicked /// </summary> /// <param name="context">Context which contains all editor node actions that need to be executed after this call</param> public virtual void OnAddOutputPinButtonClicked(CNodeChangeContext context) { }
/// <summary> /// Notifies the node that the output of another pin has been connected to one of its input pins /// </summary> /// <param name="context">Context which contains all editor node actions that need to be executed after this call</param> /// <param name="pin">The pin on this node that got a new connection</param> /// <param name="otherpin">The pin this node has been connected to</param> /// <returns></returns> public virtual void OnInputConnectionChanged(CNodeChangeContext context, CInputPin pin, COutputPin otherpin) { }
// Editor functions /// <summary> /// Notifies the node that the literal value of one of its pins has been altered /// </summary> /// <param name="context">Context which contains all editor node actions that need to be executed after this call</param> /// <param name="pin">The pin whose literal value has been changed</param> /// <returns>If true the node will be redrawn in the node graph</returns> public virtual void OnInputLiteralChanged(CNodeChangeContext context, CInputPin pin) { }