Table of Contents

Class Node

Namespace
Artemis.Core
Assembly
Artemis.Core.dll

Represents a kind of node inside a NodeScript

public abstract class Node : BreakableModel, INode, IBreakableModel, IPluginFeatureDependent
Inheritance
object
CorePropertyChanged
Node
Implements
Derived
Inherited Members
Extension Methods

Constructors

Node()

Creates a new instance of the Node class with an empty name and description

protected Node()

Node(string, string)

Creates a new instance of the Node class with the provided name and description

protected Node(string name, string description)

Parameters

name string
description string

Properties

BrokenDisplayName

Gets the display name of this breakable model

public override string BrokenDisplayName { get; }

Property Value

string

Description

Gets the description of the node

public string Description { get; set; }

Property Value

string

HelpUrl

Gets or sets the help URL of the node

public string HelpUrl { get; set; }

Property Value

string

Id

Gets or sets the ID of the node.

public Guid Id { get; set; }

Property Value

Guid

IsDefaultNode

Gets a boolean indicating whether the node is a default node that connot be removed

public virtual bool IsDefaultNode { get; }

Property Value

bool

IsExitNode

Gets a boolean indicating whether the node is the exit node of the script

public virtual bool IsExitNode { get; }

Property Value

bool

IsLoading

Gets a boolean indicating whether the node is currently loading, use this to disable pin type changes etc.

public bool IsLoading { get; set; }

Property Value

bool

Name

Gets the name of the node

public string Name { get; set; }

Property Value

string

NodeData

Gets or sets the node data with information about this node

public NodeData? NodeData { get; set; }

Property Value

NodeData

PinCollections

Gets a read-only collection of the pin collections on this node

public IReadOnlyCollection<IPinCollection> PinCollections { get; }

Property Value

IReadOnlyCollection<IPinCollection>

Pins

Gets a read-only collection of the pins on this node

public IReadOnlyCollection<IPin> Pins { get; }

Property Value

IReadOnlyCollection<IPin>

X

Gets or sets the X-position of the node

public double X { get; set; }

Property Value

double

Y

Gets or sets the Y-position of the node

public double Y { get; set; }

Property Value

double

Methods

AddPin(Pin)

Adds an existing pin to the Pins collection.

public void AddPin(Pin pin)

Parameters

pin Pin

The pin to add

CreateInputPin(Type, string)

Creates a new input pin and adds it to the Pins collection

public InputPin CreateInputPin(Type type, string name = "")

Parameters

type Type

The type of value the pin will hold

name string

The name of the pin

Returns

InputPin

The newly created pin

CreateInputPinCollection(Type, string, int)

Creates a new input pin collection and adds it to the PinCollections collection

public InputPinCollection CreateInputPinCollection(Type type, string name = "", int initialCount = 1)

Parameters

type Type

The type of value the pins of this collection will hold

name string

The name of the pin collection

initialCount int

The amount of pins to initially add to the collection

Returns

InputPinCollection

The resulting input pin collection

CreateInputPinCollection<T>(string, int)

Creates a new input pin collection and adds it to the PinCollections collection

public InputPinCollection<T> CreateInputPinCollection<T>(string name = "", int initialCount = 1)

Parameters

name string

The name of the pin collection

initialCount int

The amount of pins to initially add to the collection

Returns

InputPinCollection<T>

The resulting input pin collection

Type Parameters

T

The type of value the pins of this collection will hold

CreateInputPin<T>(string)

Creates a new input pin and adds it to the Pins collection

public InputPin<T> CreateInputPin<T>(string name = "")

Parameters

name string

The name of the pin

Returns

InputPin<T>

The newly created pin

Type Parameters

T

The type of value the pin will hold

CreateOrAddInputPin(Type, string)

Creates or adds an input pin to the node using a bucket. The bucket might grow a bit over time as the user edits the node but pins won't get lost, enabling undo/redo in the editor.

public InputPin CreateOrAddInputPin(Type valueType, string displayName)

Parameters

valueType Type
displayName string

Returns

InputPin

CreateOrAddOutputPin(Type, string)

Creates or adds an output pin to the node using a bucket. The bucket might grow a bit over time as the user edits the node but pins won't get lost, enabling undo/redo in the editor.

public OutputPin CreateOrAddOutputPin(Type valueType, string displayName)

Parameters

valueType Type
displayName string

Returns

OutputPin

CreateOutputPin(Type, string)

Creates a new output pin and adds it to the Pins collection

public OutputPin CreateOutputPin(Type type, string name = "")

Parameters

type Type

The type of value the pin will hold

name string

The name of the pin

Returns

OutputPin

The newly created pin

CreateOutputPinCollection<T>(string, int)

Creates a new output pin collection and adds it to the PinCollections collection

public OutputPinCollection<T> CreateOutputPinCollection<T>(string name = "", int initialCount = 1)

Parameters

name string

The name of the pin collection

initialCount int

The amount of pins to initially add to the collection

Returns

OutputPinCollection<T>

The resulting output pin collection

Type Parameters

T

The type of value the pins of this collection will hold

CreateOutputPin<T>(string)

Creates a new output pin and adds it to the Pins collection

public OutputPin<T> CreateOutputPin<T>(string name = "")

Parameters

name string

The name of the pin

Returns

OutputPin<T>

The newly created pin

Type Parameters

T

The type of value the pin will hold

DeserializeStorage(string)

Deserializes the Artemis.Storage object and sets it

public virtual void DeserializeStorage(string serialized)

Parameters

serialized string

The serialized object

Evaluate()

Evaluates the value of the output pins of this node

public abstract void Evaluate()

GetFeatureDependencies()

Gets the plugin features this class depends on, may contain the same plugin feature twice if depending on it in multiple ways.

public virtual IEnumerable<PluginFeature> GetFeatureDependencies()

Returns

IEnumerable<PluginFeature>

A List<T> of PluginFeature this class depends on.

Initialize(INodeScript)

Called when the node was loaded from storage or newly created, at this point pin connections aren't reestablished yet.

public virtual void Initialize(INodeScript script)

Parameters

script INodeScript

The script the node is contained in

RemovePin(Pin)

Removes the provided pin from the node and it's Pins collection

public bool RemovePin(Pin pin)

Parameters

pin Pin

The pin to remove

Returns

bool

true if the pin was removed; otherwise false.

RemovePinCollection(PinCollection)

Removes the provided pinCollection from the node and it's PinCollections collection

public bool RemovePinCollection(PinCollection pinCollection)

Parameters

pinCollection PinCollection

The pin collection to remove

Returns

bool

true if the pin collection was removed; otherwise false.

Reset()

Resets the node causing all pins to re-evaluate the next time TryEvaluate() is called

public virtual void Reset()

SerializeStorage()

Serializes the Artemis.Storage object into a string

public virtual string SerializeStorage()

Returns

string

The serialized object

TryEvaluate()

Attempts to evaluate the value of the output pins of this node

public void TryEvaluate()

TryInitialize(INodeScript)

Attempts to initialize the node.

public void TryInitialize(INodeScript script)

Parameters

script INodeScript

The script the node is contained in

Events

PinAdded

Occurs when a pin was added to the node

public event EventHandler<SingleValueEventArgs<IPin>>? PinAdded

Event Type

EventHandler<SingleValueEventArgs<IPin>>

PinCollectionAdded

Occurs when a pin collection was added to the node

public event EventHandler<SingleValueEventArgs<IPinCollection>>? PinCollectionAdded

Event Type

EventHandler<SingleValueEventArgs<IPinCollection>>

PinCollectionRemoved

Occurs when a pin was removed from the node

public event EventHandler<SingleValueEventArgs<IPinCollection>>? PinCollectionRemoved

Event Type

EventHandler<SingleValueEventArgs<IPinCollection>>

PinRemoved

Occurs when a pin was removed from the node

public event EventHandler<SingleValueEventArgs<IPin>>? PinRemoved

Event Type

EventHandler<SingleValueEventArgs<IPin>>

Resetting

Called when the node resets

public event EventHandler? Resetting

Event Type

EventHandler