Class BaseNode
Namespace: GraphProcessor
Assembly: com.alelievr.NodeGraphProcessor.Runtime.dll
Syntax
[Serializable]
public abstract class BaseNode
Constructors
| Improve this Doc View SourceBaseNode()
Declaration
protected BaseNode()
Fields
| Improve this Doc View SourcecanProcess
Declaration
public bool canProcess
Field Value
Type | Description |
---|---|
System.Boolean |
computeOrder
Declaration
public int computeOrder
Field Value
Type | Description |
---|---|
System.Int32 |
debug
Is debug visible
Declaration
public bool debug
Field Value
Type | Description |
---|---|
System.Boolean |
expanded
Is the node expanded
Declaration
public bool expanded
Field Value
Type | Description |
---|---|
System.Boolean |
graph
Declaration
[NonSerialized]
protected BaseGraph graph
Field Value
Type | Description |
---|---|
BaseGraph |
GUID
Declaration
public string GUID
Field Value
Type | Description |
---|---|
System.String |
inputPorts
Container of input ports
Declaration
[NonSerialized]
public readonly NodeInputPortContainer inputPorts
Field Value
Type | Description |
---|---|
NodeInputPortContainer |
nodeLock
Node locked state
Declaration
public bool nodeLock
Field Value
Type | Description |
---|---|
System.Boolean |
outputPorts
Container of output ports
Declaration
[NonSerialized]
public readonly NodeOutputPortContainer outputPorts
Field Value
Type | Description |
---|---|
NodeOutputPortContainer |
position
Declaration
public Rect position
Field Value
Type | Description |
---|---|
UnityEngine.Rect |
Properties
| Improve this Doc View SourceisLocked
Is the node is locked (if locked it can't be moved)
Declaration
public virtual bool isLocked { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
layoutStyle
Set a custom uss file for the node. We use a Resources.Load to get the stylesheet so be sure to put the correct resources path https://docs.unity3d.com/ScriptReference/Resources.Load.html
Declaration
public virtual string layoutStyle { get; }
Property Value
Type | Description |
---|---|
System.String |
name
Name of the node, it will be displayed in the title section
Declaration
public virtual string name { get; }
Property Value
Type | Description |
---|---|
System.String |
unlockable
If the node can be locked or not
Declaration
public virtual bool unlockable { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceAddMessage(String, NodeMessageType)
Add a message on the node
Declaration
public void AddMessage(string message, NodeMessageType messageType)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | |
NodeMessageType | messageType |
AddPort(Boolean, String, PortData)
Add a port
Declaration
public void AddPort(bool input, string fieldName, PortData portData)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | input | is input port |
System.String | fieldName | C# field name |
PortData | portData | Data of the port |
ClearMessages()
Remove all messages on the node
Declaration
public void ClearMessages()
CreateFromType(Type, Vector2)
Creates a node of type nodeType at a certain position
Declaration
public static BaseNode CreateFromType(Type nodeType, Vector2 position)
Parameters
Type | Name | Description |
---|---|---|
System.Type | nodeType | |
UnityEngine.Vector2 | position | position in the graph in pixels |
Returns
Type | Description |
---|---|
BaseNode | the node instance |
CreateFromType<T>(Vector2)
Creates a node of type T at a certain position
Declaration
public static T CreateFromType<T>(Vector2 position)
where T : BaseNode
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Vector2 | position | position in the graph in pixels |
Returns
Type | Description |
---|---|
T | the node instance |
Type Parameters
Name | Description |
---|---|
T | type of the node |
Disable()
Called when the node is disabled
Declaration
protected virtual void Disable()
Enable()
Called when the node is enabled
Declaration
protected virtual void Enable()
Finalize()
Declaration
protected void Finalize()
GetInputNodes()
Get all the nodes connected to the input ports of this node
Declaration
public IEnumerable<BaseNode> GetInputNodes()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<BaseNode> | an enumerable of node |
GetNodeFields()
Declaration
public virtual FieldInfo[] GetNodeFields()
Returns
Type | Description |
---|---|
System.Reflection.FieldInfo[] |
GetOutputNodes()
Get all the nodes connected to the output ports of this node
Declaration
public IEnumerable<BaseNode> GetOutputNodes()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<BaseNode> | an enumerable of node |
GetPort(String, String)
Get the port from field name and identifier
Declaration
public NodePort GetPort(string fieldName, string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName | C# field name |
System.String | identifier | Unique port identifier |
Returns
Type | Description |
---|---|
NodePort |
Initialize(BaseGraph)
Declaration
public void Initialize(BaseGraph graph)
Parameters
Type | Name | Description |
---|---|---|
BaseGraph | graph |
IsFieldInput(String)
Is the port an input
Declaration
public bool IsFieldInput(string fieldName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName |
Returns
Type | Description |
---|---|
System.Boolean |
OnEdgeConnected(SerializableEdge)
Declaration
public void OnEdgeConnected(SerializableEdge edge)
Parameters
Type | Name | Description |
---|---|---|
SerializableEdge | edge |
OnEdgeDisconnected(SerializableEdge)
Declaration
public void OnEdgeDisconnected(SerializableEdge edge)
Parameters
Type | Name | Description |
---|---|---|
SerializableEdge | edge |
OnNodeCreated()
Called only when the node is created, not when instantiated
Declaration
public virtual void OnNodeCreated()
OnProcess()
Declaration
public void OnProcess()
Process()
Override this method to implement custom processing
Declaration
protected virtual void Process()
RemoveMessage(String)
Remove a message on the node
Declaration
public void RemoveMessage(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message |
RemoveMessageContains(String)
Remove a message that contains
Declaration
public void RemoveMessageContains(string subMessage)
Parameters
Type | Name | Description |
---|---|---|
System.String | subMessage |
RemovePort(Boolean, NodePort)
Remove a port
Declaration
public void RemovePort(bool input, NodePort port)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | input | is input port |
NodePort | port | the port to delete |
RemovePort(Boolean, String)
Remove port(s) from field name
Declaration
public void RemovePort(bool input, string fieldName)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | input | is input |
System.String | fieldName | C# field name |
UpdateAllPorts()
Update all ports of the node
Declaration
public void UpdateAllPorts()
UpdatePortsForField(String)
Update the ports related to one C# property field
Declaration
public void UpdatePortsForField(string fieldName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName |
Events
| Improve this Doc View SourceonAfterEdgeConnected
Triggered after an edge was connected on the node
Declaration
public event Action<SerializableEdge> onAfterEdgeConnected
Event Type
Type | Description |
---|---|
System.Action<SerializableEdge> |
onAfterEdgeDisconnected
Triggered after an edge was disconnected on the node
Declaration
public event Action<SerializableEdge> onAfterEdgeDisconnected
Event Type
Type | Description |
---|---|
System.Action<SerializableEdge> |
onMessageAdded
Declaration
public event Action<string, NodeMessageType> onMessageAdded
Event Type
Type | Description |
---|---|
System.Action<System.String, NodeMessageType> |
onMessageRemoved
Declaration
public event Action<string> onMessageRemoved
Event Type
Type | Description |
---|---|
System.Action<System.String> |
onProcessed
Triggered when the node is processes
Declaration
public event BaseNode.ProcessDelegate onProcessed
Event Type
Type | Description |
---|---|
BaseNode.ProcessDelegate |