Logic Graphs
These are defined using the following message:
message LogicGraph {LogicGraphReference LogicGraphReference = 1;Platform PlatformType = 2;repeated LogicNode LogicNodes = 3;repeated LogicEdge LogicEdges = 4;map<int32, LogicSocket> LogicInputs = 5;map<int32, LogicSocket> LogicOutputs = 6;PlatformDetail FullPlatformDetails = 7;}
Platform Detail
The PlatformDetail FullPlatformDetails
is a message that includes all the information about a platform.
- Platform type (eg.
Unity
). - Platform version (eg.
2019.3.15f
). - Platform pipeline (eg.
HDRP
).
This should allow us to fully specify where a graph came from, and therefore if it needs any conversion to be able to be run on a slightly different (or vastly different) system.
Graph Input & Output Sockets
Each graph can itself have input and output sockets. These will be used when the graph gets embedded in another graph as a node. The node used to represent this graph, will take on its inputs and outputs.
Reading the Graph
Logic Graphs can also be read directly using:
message ReadLogicGraphsRequest {StudioReference StudioReference = 1;ProjectReference ProjectReference = 2;repeated LogicGraphReference Include = 3;Platform PlatformType = 4;}
The reason platform type is specified, is because each LogicNode has a transform embedded in it, and we apply the platform specific coordinate system for them.
Updating the Graph
The graph will be updated atomically by sending the whole graph again. This should contain all information and be a simple replace operation for the service.
Event based updates may be introduced later to allow for simpler access to the API from a web editor for example. These will basically be in-place edits done by the service, which then sends out the whole graph to the clients.
Storage in the Database
The logic graph is stored in a single document, with the logic nodes and logic edges being properties on that document. This will allow atomic updating of the logic graph, and allow for the plugins to diff & send the whole thing.
Internal References
References will need to be self consistent inside each graph, but as we can guarantee that they will never reference something outside of the logic graph, they only need to be unique relative to the other references inside the graph. This means that the plugins can have full control, and the service will leave them as the temporary references.
Logic Nodes
The logic nodes are represented by this message:
message LogicNode {LogicNodeReference Reference = 1;string Name = 2;Transform Transform = 3;oneof TypeReference {LogicNodeTypeReference LogicNodeTypeReference = 4;LogicGraphReference LogicGraphTypeReference = 6;}map<int32, LogicSocket> InputValues = 5;LogicNodeGraphType LogicNodeGraphType = 7;}
The logic node must have a type, this can be a reference to a standard 'single node' type defined below. Or this node can be representing another entire graph nested inside this one, in this case it's type reference is simply the reference to the other graph.
Input Values
The input values on a logic node are the values that have been set as a default for when no edge is passed in. This is optional, and doesn't define what sockets exist.
There are no equivalents for output values, as you can't define a default value for an output.
Logic Node Types
These node types may be platform specific, and therefore should have their naming prefixed appropriately, see Naming Conventions.
They are represented by these messages:
message LogicNodeType {LogicNodeTypeReference LogicNodeTypeReference = 1;string Name = 2;string Description = 3;LogicLanguage Language = 4;string Code = 5;Platform PlatformType = 6;map<int32, LogicSocket> LogicInputs = 7;map<int32, LogicSocket> LogicOutputs = 8;}
Unique Names
You must include the name, and the name must be unique.
The inputs and outputs fully define what is possible for the script to use and connect to.
This is customisable with other types if you specify the language, and include the code.
Logic Sockets
Data Types
Array Options
Other types
Appendix
List of Logic Node Types
Blender
- Blender_PrincipledBSDF
Unity
- Unity_StandardShader