ConvertNode
When connecting data ports, you can use a script to create a node that performs data type conversion.
How to write a script
- Create a class that inherits from
LogicToolkit.ConvertNode
. - Apply
System.SerializableAttribute
to the type. - Define a method called
static bool Convertible(System.Type from, System.Type to)
to determine whether type conversion is possible. - Define a method called
protected override void Convert(IInputDataPort input, IOutputDataPort output)
and write the type conversion process.
When you connect a port with a data type that meets the conditions, a conversion node is automatically inserted. Each input/output port is created from the data type when connected.
Code example
The built-in EvaluateToQuaternionNode is implemented as follows.
|
|