1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-03-26 22:49:02 +08:00

Undo vscode auto-formatting of readme

This commit is contained in:
Greg Poole 2019-06-26 23:17:36 +10:00
parent a4c632c8cb
commit 5ec65b3ebe

View File

@ -10,7 +10,6 @@
[Support Me on Ko-fi](https://ko-fi.com/Z8Z5DYWA) [Support Me on Ko-fi](https://ko-fi.com/Z8Z5DYWA)
### xNode ### xNode
Thinking of developing a node-based plugin? Then this is for you. You can download it as an archive and unpack to a new unity project, or connect it as git submodule. Thinking of developing a node-based plugin? Then this is for you. You can download it as an archive and unpack to a new unity project, or connect it as git submodule.
xNode is super userfriendly, intuitive and will help you reap the benefits of node graphs in no time. xNode is super userfriendly, intuitive and will help you reap the benefits of node graphs in no time.
@ -21,38 +20,33 @@ With a minimal footprint, it is ideal as a base for custom state machines, dialo
</p> </p>
### Key features ### Key features
* Lightweight in runtime
- Lightweight in runtime * Very little boilerplate code
- Very little boilerplate code * Strong separation of editor and runtime code
- Strong separation of editor and runtime code * No runtime reflection (unless you need to edit/build node graphs at runtime. In this case, all reflection is cached.)
- No runtime reflection (unless you need to edit/build node graphs at runtime. In this case, all reflection is cached.) * Does not rely on any 3rd party plugins
- Does not rely on any 3rd party plugins * Custom node inspector code is very similar to regular custom inspector code
- Custom node inspector code is very similar to regular custom inspector code * Supported from Unity 5.3 and up
- Supported from Unity 5.3 and up
### Wiki ### Wiki
* [Getting started](https://github.com/Siccity/xNode/wiki/Getting%20Started) - create your very first node node and graph
- [Getting started](https://github.com/Siccity/xNode/wiki/Getting%20Started) - create your very first node node and graph * [Examples branch](https://github.com/Siccity/xNode/tree/examples) - look at other small projects
- [Examples branch](https://github.com/Siccity/xNode/tree/examples) - look at other small projects
### Installing with Unity Package Manager ### Installing with Unity Package Manager
To install this project as a dependency using the Unity Package Manager, To install this project as a dependency using the Unity Package Manager,
add the following line to your project's `manifest.json`: add the following line to your project's `manifest.json`:
``` ```
"com.github.siccity.xnode": "git+https://github.com/siccity/xNode", "com.github.siccity.xnode": "git+https://github.com/siccity/xNode.git"
``` ```
Then, to access the `XNode` namespace from your code, make sure you have a valid [Assembly Definition](https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html) set up, If you are using [Assembly Definitions](https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html) in your project, you will need to add `XNode` and/or `XNodeEditor` as Assembly Definition References.
with `xNode` set as an Assembly Reference.
### Node example: ### Node example:
```csharp ```csharp
// public classes deriving from Node are registered as nodes for use within a graph // public classes deriving from Node are registered as nodes for use within a graph
public class MathNode : Node { public class MathNode : Node {
// Adding [Input] or [Output] is all you need to do to register a field as a valid port on your node // Adding [Input] or [Output] is all you need to do to register a field as a valid port on your node
[Input] public float a; [Input] public float a;
[Input] public float b; [Input] public float b;
// The value of an output node field is not used for anything, but could be used for caching output results // The value of an output node field is not used for anything, but could be used for caching output results
@ -62,7 +56,7 @@ public class MathNode : Node {
// The value of 'mathType' will be displayed on the node in an editable format, similar to the inspector // The value of 'mathType' will be displayed on the node in an editable format, similar to the inspector
public MathType mathType = MathType.Add; public MathType mathType = MathType.Add;
public enum MathType { Add, Subtract, Multiply, Divide} public enum MathType { Add, Subtract, Multiply, Divide}
// GetValue should be overridden to return a value for any specified output port // GetValue should be overridden to return a value for any specified output port
public override object GetValue(NodePort port) { public override object GetValue(NodePort port) {