All Classes Namespaces Functions Variables Enumerations Enumerator Properties
plyCommon.plyNode Class Reference

Base class for nodes of the Graph and Nodes system. Nodes as linked entities that exist in a graph. More...

Inherits plyCommon.plyMetaDataInterface.

Inherited by DiaQ.DiaQNode_Dlg, DiaQ.DiaQNode_QAccept, DiaQ.DiaQNode_QReward, DiaQ.DiaQNode_QStatus, plyCommon.plyNode_Cond, plyCommon.plyNode_Dbg, plyCommon.plyNode_Msg, plyCommon.plyNode_SetVar, plyCommon.plyNode_Start, and plyCommon.plyNode_Wait.

Public Types

enum  ReturnCode { ReturnCode.Continue = -1, ReturnCode.WaitingForData = -2, ReturnCode.Stop = -3 }
 Return codes used in Enter(), Update(), etc More...
 

Public Member Functions

void Awake (plyGraph owningGraph)
 called by graph's Awake at runtime More...
 
void LogError (string message)
 show an error message that include the name of the node the error occurred in More...
 
void LogWarning (string message)
 show w warning message that include the name of the node the error occurred in More...
 
virtual string PrettyName ()
 Return a nice name for the Node More...
 
virtual void OnAddedToGraph ()
 This is called when the node is created by the graph editor. You may initialise __rect with the size that the node window should be in the graph editor. You may use it to initialize other values too. Be sure to call the base function first if you override this base.OnAddedToGraph(); More...
 
virtual int InitOutlinkCount ()
 This should return the number of out links that the node should be initialized with when first added to the graph. More...
 
virtual void CopyTo (plyNode n)
 Must override to perform copy. Be sure to call base.CopyTo() More...
 
virtual int Enter ()
 Called when the node is entered via (in-link). Returned value should be the index of next node to Enter() as per outLinks[] array or a (int)plyNode.ReturnCode. If you return ReturnCode.Continue then you must override Update else the graph will stop the first time Update is called for this node. More...
 
virtual int Update ()
 Called by graph manager as long as this node is the active one in the active graph. This will only be called if you returned ReturnCode.Continue in Enter(), causing this node to stay the active node. Returned value should be the index of next node to Enter() as per outLinks[] array or a (int)plyNode.ReturnCode More...
 
virtual void ReceiveData (object data)
 Called when some data is send to the active node. This can only be called for this node if you returned ReturnCode.Continue in Enter() and did not yet return any other code in Update() More...
 
Dictionary< string, plyMetaDataAllMetaData ()
 
List< plyMetaDataAllMetaDataList ()
 
plyMetaData GetMetaData (string name)
 Return reference to meta data object. Null if not found. More...
 
object GetMetaDataValue (string name)
 Return meta data value. Null if named meta data not found. More...
 
void SetMetaDataValue (string name, object val)
 Set meta data value. Will create the named meta data if not found and then set value. More...
 

Public Attributes

plyNode[] outLinks = new plyNode[0]
 The nodes that are linked to this one's outputs More...
 
int[] outLinkIds = new int[0]
 Ids of the nodes that are linked to. This and the outLinks array should always be of the same size. More...
 
int id = -1
 Unique identifier for node. Do not set this manually. The graph editor updates it as needed. More...
 
string customIdent = ""
 A custom identifier you may use to identify the node by More...
 
string comment = ""
 Node comment. Normally used as messages/ reminders in the graph editor More...
 
bool showComment = true
 Set true if comment should appear in the graph editor More...
 
plyMetaData[] metaData = new plyMetaData[0]
 Meta data is optional data/ information that the designer may associate with the node. Do not access at runtime. Use the provided functions. More...
 
Rect __rect = new Rect()
 Used by editor. You may update width/ height with the node window's size but should not change x and y as that is used to track the position of the node in the graph editor. More...
 

Properties

int __outlinks_offset [get, set]
 
object __node_ed [get, set]
 
plyGraph owningGraph [get, set]
 The (runtime) Graph that owns this node More...
 
Dictionary< string, plyMetaDataruntimeMetaData [get, set]
 

Detailed Description

Base class for nodes of the Graph and Nodes system. Nodes as linked entities that exist in a graph.

Member Enumeration Documentation

Return codes used in Enter(), Update(), etc

Enumerator
Continue 

This node is not yet ready to return a value. Use this with nodes that are waiting for user input or have a build in delay/ wait time, and will be ready at some point in Update()

WaitingForData 

Basically same as Continue but helps identify those nodes that are not returning the next node or stop since it is waiting for data.

Stop 

Stop graph execution now

Member Function Documentation

void plyCommon.plyNode.Awake ( plyGraph  owningGraph)

called by graph's Awake at runtime

virtual void plyCommon.plyNode.CopyTo ( plyNode  n)
virtual

Must override to perform copy. Be sure to call base.CopyTo()

virtual int plyCommon.plyNode.Enter ( )
virtual

Called when the node is entered via (in-link). Returned value should be the index of next node to Enter() as per outLinks[] array or a (int)plyNode.ReturnCode. If you return ReturnCode.Continue then you must override Update else the graph will stop the first time Update is called for this node.

plyMetaData plyCommon.plyNode.GetMetaData ( string  name)

Return reference to meta data object. Null if not found.

Implements plyCommon.plyMetaDataInterface.

object plyCommon.plyNode.GetMetaDataValue ( string  name)

Return meta data value. Null if named meta data not found.

Implements plyCommon.plyMetaDataInterface.

virtual int plyCommon.plyNode.InitOutlinkCount ( )
virtual

This should return the number of out links that the node should be initialized with when first added to the graph.

void plyCommon.plyNode.LogError ( string  message)

show an error message that include the name of the node the error occurred in

void plyCommon.plyNode.LogWarning ( string  message)

show w warning message that include the name of the node the error occurred in

virtual void plyCommon.plyNode.OnAddedToGraph ( )
virtual

This is called when the node is created by the graph editor. You may initialise __rect with the size that the node window should be in the graph editor. You may use it to initialize other values too. Be sure to call the base function first if you override this base.OnAddedToGraph();

virtual string plyCommon.plyNode.PrettyName ( )
virtual

Return a nice name for the Node

virtual void plyCommon.plyNode.ReceiveData ( object  data)
virtual

Called when some data is send to the active node. This can only be called for this node if you returned ReturnCode.Continue in Enter() and did not yet return any other code in Update()

void plyCommon.plyNode.SetMetaDataValue ( string  name,
object  val 
)

Set meta data value. Will create the named meta data if not found and then set value.

Implements plyCommon.plyMetaDataInterface.

virtual int plyCommon.plyNode.Update ( )
virtual

Called by graph manager as long as this node is the active one in the active graph. This will only be called if you returned ReturnCode.Continue in Enter(), causing this node to stay the active node. Returned value should be the index of next node to Enter() as per outLinks[] array or a (int)plyNode.ReturnCode

Member Data Documentation

Rect plyCommon.plyNode.__rect = new Rect()

Used by editor. You may update width/ height with the node window's size but should not change x and y as that is used to track the position of the node in the graph editor.

string plyCommon.plyNode.comment = ""

Node comment. Normally used as messages/ reminders in the graph editor

string plyCommon.plyNode.customIdent = ""

A custom identifier you may use to identify the node by

int plyCommon.plyNode.id = -1

Unique identifier for node. Do not set this manually. The graph editor updates it as needed.

plyMetaData [] plyCommon.plyNode.metaData = new plyMetaData[0]

Meta data is optional data/ information that the designer may associate with the node. Do not access at runtime. Use the provided functions.

int [] plyCommon.plyNode.outLinkIds = new int[0]

Ids of the nodes that are linked to. This and the outLinks array should always be of the same size.

plyNode [] plyCommon.plyNode.outLinks = new plyNode[0]

The nodes that are linked to this one's outputs

bool plyCommon.plyNode.showComment = true

Set true if comment should appear in the graph editor

Property Documentation

plyGraph plyCommon.plyNode.owningGraph
getset

The (runtime) Graph that owns this node