Node Modules

You are here:
< All Topics
Table of Contents

version >= 1.2.0
Node modules are a great way for adding additional functionality to your nodes.
Currently you can add the FRNodeControllable and FRNodeEventDispatcher module from the node wizard in the advanced tab.

FRNodeControllable

The FRNodeControllable module allows you to control a MonoBehaviour script – which implements the INodeControllable interface – from a node.
See the demo scene: NodeModules

Create a new custom node and add the FRNodeControllable module to it.

  1. Open node wizard

  2. Go to advanced tab and select FRNodeControllable.
    Create your node.

  3. Add your newly created node to your graph.

  4. Assign the graph to a FlowReactorComponent

  5. Click on the “refresh” button.
    You can now see a new list of all available nodes which have a FRNodeControllable module available.

  6. You can now drag your MonoBehaviour script component which implements the INodeControllable interface to the exposed field.

Add module to node by script

//
// Namespace
using FlowReactor.Nodes.Modules;

// Create new instance of type FRNodeControllable
FRNodeControllable moduleNodeControllable = new FRNodeControllable();

//

Every method in INodeControllable can be executed manually in a custom node as well.
Example:

//
FRNodeControllable moduleNodeControllable = new FRNodeControllable();

// Call OnInitialize method manually
moduleNodeControllable.CallInitializeNode(_flowRector, this);

// Call OnNodeExecute method manually
moduleNodeControllable.CallStartExecuteNode(_flowRector, this);

// Call OnNodeStopExecute method manually
moduleNodeControllable.CallStopExecuteNode(_flowRector, this);

// Call OnNode method manually
moduleNodeControllable.CallOnNode(_flowRector, this, null);
//
INodeControllable

The INodeControllable interface implements several methods which are being called automatically.

//
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using FlowReactor;

namespace FlowReactor.Nodes.Modules
{
public interface INodeControllable
{
// Automatically called on node initialization
void OnNodeInitialize(Node _node);
// Automatically called on node execution
void OnNodeExecute();
// Automatically called on node stop execution
void OnNodeStopExecute();
// Method for manual controllable method calls
void OnNode(Node _node, params object[] _parameters);
}
}
//

Example:

Simple example of a MonoBehaviour script which implements INodeControllable interface

//
// Namespace
using FlowReactor.Nodes.Modules

public class ControllableExample : MonoBehaviour, INodeControllable
{
public void OnNodeInitialize(Node _node)
{
Debug.Log("On Initialization");
}

public void OnNodeExecute()
{
Debug.Log("On Execute");
}

public void OnNodeStopExecute()
{
Debug.Log("On Stop Execute");
}

public void OnNode(Node _node,  object[] _parameters){}
}
//
FlowReactorNodeControllable

The FlowReactorNodeControllable is a simple runtime component which implements the INodeControllable interface and can be assigned to a node controllable FlowReactorComponent field.
The script can call Unity events based on the INodeControllable methods.

Please note, this component is an example for how to use the INodeControllable interface. You can drag any MonoBehaviour component to the FlowReactorComponent node controllable fields which implements an INodeControllable interface.

FRNodeEventDispatcher

The FRNodeEventDispatcher can be used to call FlowReactor events from a custom node.

To call an event, make sure your graph has an assigned eventboard with an event.
Also your custom node needs to have an instance of the FRNodeEventDispatcher module.
(create manually or with the node wizard)

In your custom node simply use following code to raise an event.

//
// you can also pass parameters to the RaiseEvent method. Make sure that these parameters type do match with the event in the eventboard.
eventDispatcher.RaiseEvent("MyEvent", "myEventStringParameter");
//
Create custom node utility module

You can easily create your own custom module by creating a new script and derive from FRNodeUtilityModule. Make sure to use the namespace: FlowReactor.NodeUtilityModules;

Your newly created module will be available in the node wizard in the advanced tab.

Node module description

Use the NodeModule attribute to add a description and custom variable definitions as well as custom inspector code.

//
[NodeModule("Node module description", "Additional variable definitions", "Custom inspector gui code")]
//

Example:

//
[NodeModule("Example description",
"public FRFloat customFloat",
"GUILayout.Label( " A custom label ");"]

//
Privacy Settings
We use cookies to enhance your experience while using our website. If you are using our Services via a browser you can restrict, block or remove cookies through your web browser settings. We also use content and scripts from third parties that may use tracking technologies. You can selectively provide your consent below to allow such third party embeds. For complete information about the cookies we use, data we collect and how we process them, please check our Privacy Policy
Youtube
Consent to display content from Youtube
Vimeo
Consent to display content from Vimeo
Google Maps
Consent to display content from Google