Documentation

Learn how to use FlowCanvas

Using the Graph Refactor

When a node type or reflected node reference is missing (for example because you decided to do some renaming in your code), FlowCanvas retains the original structure and serialization of the nodes and provides the Graph Refactor utility window to allows you to batch refactor all those missing/renamed elements and references to the new correct ones. Other tools either silently remove the missing elements, or provide no means to recover them at all, with the only option being to delete the missing nodes which obviously destroy your graph design and requires a lot of manual work.

Let’s take this example graph, which is using a reflected function named “DoSomething” in a custom component script named Example.

Now let’s suppose that we decide to rename the function “DoSomething” to “DoSomethingElse”. Doing so will result in the graph informing us that we have missing references.

If you happen to have the Graph Console opened as well, this fact will also be logged there and thus clicking on the console logs will allow you to automatically open up the related graph and focus on the related element as usual with all logs in the Graph Console!

You will notice that we get errors for missing ports as well. This is a byproduct of the missing function node. Since the function can not be resolved, no ports are added to the node. However if we fix the missing function node, the ports will also be fixed as a result.

The Graph Refactor

To fix the function node, the Graph Refactor comes to the rescue! (“Tools/ParadoxNotion/FlowCanvas/Graph Refactor”) or simply by the “{ }” button in the Graph Editor toolbar. Once you open up the Graph Refactor and hit the “Gather” button, information about the currently open graph in the editor will be gathered.

As the help text in the Graph Refactor suggests, we simply have to rename the information shown here to point to the new correct names. We know we have renamed the function “DoSomething” to “DoSomethingElse”, thus we only need to change the text “DoSomething” to “DoSomethingElse” and leave everything else as is. Once we do this and hit the “Save” button our graph will batch recover all occurrences (we only had one in this example) and retain the graph design as well as any previously serialized data in the node, like in this example A) the GameObject reference and B) and string “Awesome” that were both part of the input value ports.

Yes No Suggest edit
6 of 6 users found this section helpful
Suggest Edit