Api Facepunch ActionGraphs NodeLibrary
class

NodeLibrary

public sealed class NodeLibrary

Contains a library of NodeDefinitions, each with a unique identifier. Custom node definitions can be added with NodeDefinition), or from methods marked with either !:ActionNodeAttribute or !:ExpressionNodeAttribute when using Assembly).

Constructors

NodeLibrary(ITypeLoader typeLoader, IGraphLoader graphLoader)

Contains a library of NodeDefinitions, each with a unique identifier. An ITypeLoader is required to wrap reflection methods. Use an DefaultTypeLoader if no access control is needed.

Properties

Name Type Description
All IReadOnlyDictionary<String, NodeDefinition> Dictionary of all added definitions, indexed by their Identifiers.
Input NodeDefinition Node definition for the entry point of the graph. Each graph can only have one such entry point.
InputValue NodeDefinition Helper node for accessing a graph input parameter.
Output NodeDefinition Node definition for output signals of the graph. Each graph can have at most one primary output.
Graph NodeDefinition A node implemented by an action graph.
Variable NodeDefinition Node definition for getting or setting Variable values.
Constant NodeDefinition Node definition for providing constant values.
Property NodeDefinition Node definition for getting or setting static or instance properties.
CallMethod NodeDefinition Node definition for calling a named method.
NewInstance NodeDefinition Node definition for calling a constructor to create an instance.
NoOperation NodeDefinition A node that does nothing, just forwards an input to its output.
Comment NodeDefinition A node with no inputs or outputs, only metadata. Useful for holding documentation.
TypeLoader ITypeLoader
GraphLoader IGraphLoader

Methods

Void Add(NodeDefinition definition)

Add a custom node definition. The Identifier must be unique in this library. See also Assembly) for an easier way to implement custom nodes.

definition — Custom node definition to add.
Void ClearReflectionCache()
AddAssemblyResult AddAssembly(Assembly asm)

Adds a node definition for each method annotated with either !:ActionNodeAttribute or ExpressionNodeDefinition in the given assembly.

Boolean RemoveAssembly(Assembly assembly)
NodeDefinition Get(String identifier)

Gets a node definition by identifier. Returns null if not found.

identifier — Unique identifier of the node definition to find.
NodeDefinition Get(T func)

Gets a node definition by the method that implements it. Method must already be added with Assembly).

NodeDefinition Get(Type declaringType, String methodName)
NodeDefinition Get(MethodInfo method)
NodeDefinition Get(ExpressionType expressionType)

Gets a node definition by the operator it implements.

expressionType — Operator of the node definition to find.
Void InvalidateDefaultBindings()
Void Reset()

Removes all custom node definitions from this library.

Boolean IsPure(MethodBase method)

Returns true if the given method has been marked as pure. Pure methods have no (visible) side effects, and so can be turned into expression nodes.

method — Method to test.
Boolean IsProperty(ParameterInfo parameter)

Returns true if the given parameter should be a property on a node, rather than an input or output.

parameter — Parameter to test.
Boolean IsTarget(ParameterInfo parameter)
Boolean CanCacheType(Type type)
IEnumerable<ActionGraph> GetGraphs()

Gets all existing graphs created with this NodeLibrary.

IEnumerable<ActionGraph> GetGraphs(Guid guid)

Gets all existing graphs created with this NodeLibrary with the given .

Assembly: Facepunch.ActionGraphs Namespace: Facepunch.ActionGraphs Full Name: Facepunch.ActionGraphs.NodeLibrary