├── .gitattributes
├── Runtime.meta
├── Runtime
├── Node.meta
├── Context.meta
├── NodeIO.meta
├── Attributes.meta
├── Blackboard.meta
├── NodeIO
│ ├── Any.cs.meta
│ ├── Link.cs.meta
│ ├── BasePort.cs.meta
│ ├── ValuePort.cs.meta
│ ├── PortWithValue.cs.meta
│ ├── DynamicValuePort.cs.meta
│ ├── SerializedFieldInfo.cs.meta
│ ├── PortWithValue.cs
│ ├── Any.cs
│ ├── SerializedFieldInfo.cs
│ ├── BasePort.cs
│ ├── DynamicValuePort.cs
│ ├── Link.cs
│ └── ValuePort.cs
├── Attributes
│ ├── In.cs.meta
│ ├── Out.cs.meta
│ ├── RegisterTo.cs.meta
│ ├── DynamicRange.cs.meta
│ ├── DirectionalAttribute.cs.meta
│ ├── RegistrationAttribute.cs.meta
│ ├── RegisterTo.cs
│ ├── DirectionalAttribute.cs
│ ├── RegistrationAttribute.cs
│ ├── DynamicRange.cs
│ ├── In.cs
│ └── Out.cs
├── Context
│ ├── Context.cs.meta
│ └── Context.cs
├── GraphBlueprint.cs.meta
├── HasAssetGuid.cs.meta
├── Node
│ ├── IRootNode.cs.meta
│ ├── RuntimeNode.cs.meta
│ ├── SubgraphNode.cs.meta
│ ├── IRootNode.cs
│ ├── RuntimeNode.cs
│ └── SubgraphNode.cs
├── SerializableType.cs.meta
├── VirtualGraph.cs.meta
├── Blackboard
│ ├── Blackboards.cs.meta
│ ├── DataBlackboard.cs.meta
│ ├── IDataBlackboard.cs.meta
│ ├── IDataBlackboard.cs
│ ├── Blackboards.cs
│ └── DataBlackboard.cs
├── HasAssetGuid.cs
├── SerializableType.cs
├── VirtualGraph.cs
└── GraphBlueprint.cs
├── EditorOnly
├── Views.meta
├── Attributes.meta
├── BaseGraph.meta
├── Blackboard.meta
├── DataModels.meta
├── Extensions.meta
├── Settings.meta
├── Search Window.meta
├── Views
│ ├── Renamer.meta
│ ├── AutoView.cs.meta
│ ├── MovableView.cs.meta
│ ├── NodeView.cs.meta
│ ├── StackView.cs.meta
│ ├── CustomNodeView.cs.meta
│ ├── CustomStackNode.cs.meta
│ ├── DynamicPortView.cs.meta
│ ├── Renamer
│ │ ├── Renamer.cs.meta
│ │ ├── RenameWindow.cs
│ │ ├── Renamer.uxml.meta
│ │ ├── RenameWindow.cs.meta
│ │ ├── Renamer.uxml
│ │ └── Renamer.cs
│ ├── ViewRegistrationResolver.cs.meta
│ ├── MovableView.cs
│ ├── CustomNodeView.cs
│ ├── CustomStackNode.cs
│ ├── ViewRegistrationResolver.cs
│ ├── DynamicPortView.cs
│ ├── StackView.cs
│ ├── AutoView.cs
│ └── NodeView.cs
├── Blackboard
│ ├── FieldFactory.cs.meta
│ ├── BlackboardField.cs.meta
│ ├── BlackboardFieldFactory.cs.meta
│ ├── DataBlackboardView.cs.meta
│ ├── NavBlackboardNodeItem.cs.meta
│ ├── NavigationBlackboard.cs.meta
│ ├── BlackboardFieldFactory.cs
│ ├── NavBlackboardNodeItem.cs
│ ├── DataBlackboardView.cs
│ ├── BlackboardField.cs
│ ├── NavigationBlackboard.cs
│ └── FieldFactory.cs
├── DataModels
│ ├── EdgeModel.cs.meta
│ ├── GraphModel.cs.meta
│ ├── MovableModel.cs.meta
│ ├── NodeModel.cs.meta
│ ├── PortModel.cs.meta
│ ├── StackModel.cs.meta
│ ├── DynamicPortModel.cs.meta
│ ├── MovableModel.cs
│ ├── EdgeModel.cs
│ ├── PortModel.cs
│ ├── StackModel.cs
│ ├── DynamicPortModel.cs
│ ├── GraphModel.cs
│ └── NodeModel.cs
├── Extensions
│ ├── AssetHelper.cs.meta
│ ├── BlueprintHelper.cs.meta
│ ├── AssetClickedHandler.cs.meta
│ ├── ReflectionExtensions.cs.meta
│ ├── AssetClickedHandler.cs
│ ├── AssetHelper.cs
│ ├── ReflectionExtensions.cs
│ └── BlueprintHelper.cs
├── Settings
│ ├── GraphSettings.cs.meta
│ └── GraphSettings.cs
├── Attributes
│ ├── RegisterStackTo.cs.meta
│ ├── RegisterViewFor.cs.meta
│ ├── RegisterStackTo.cs
│ └── RegisterViewFor.cs
├── BaseGraph
│ ├── GraphClickedHandler.cs.meta
│ ├── NodeRegistrationResolver.cs.meta
│ ├── GraphifyView.cs.meta
│ ├── GraphfyWindow.cs.meta
│ ├── GraphClickedHandler.cs
│ ├── NodeRegistrationResolver.cs
│ └── GraphfyWindow.cs
├── Search Window
│ ├── GraphSearchWindow.cs.meta
│ ├── GraphNodeSearchTreeProvider.cs.meta
│ ├── GraphSearchWindow.cs
│ └── GraphNodeSearchTreeProvider.cs
├── Styles.meta
├── GraphFramework.GraphifyEditor.asmdef.meta
├── Styles
│ ├── BaseGraphViewStyle.uss.meta
│ └── BaseGraphViewStyle.uss
└── GraphFramework.GraphifyEditor.asmdef
├── Bridged
├── GraphEvaluator.meta
├── GraphEvaluator
│ ├── GraphEvaluator.cs.meta
│ ├── GraphEvaluatorEditor.cs.meta
│ ├── GraphEvaluator.cs
│ └── GraphEvaluatorEditor.cs
├── GraphFramework.GraphifyBridge.asmdef.meta
└── GraphFramework.GraphifyBridge.asmdef
├── LICENSE.meta
├── Readme.md.meta
├── package.json.meta
├── Bridged.meta
├── Settings.meta
├── EditorOnly.meta
├── GraphFramework.GraphifyRuntime.asmdef.meta
├── Settings
├── DefaultSettings.asset.meta
└── DefaultSettings.asset
├── package.json
├── GraphFramework.GraphifyRuntime.asmdef
├── LICENSE
└── Readme.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/Runtime.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b16ebff31bdd49ea8642f10e3c64aa9e
3 | timeCreated: 1604382581
--------------------------------------------------------------------------------
/Runtime/Node.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bc29c7f31c294a0e821c3a52df13e20e
3 | timeCreated: 1615546724
--------------------------------------------------------------------------------
/EditorOnly/Views.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e38500ad930c4117a0e11ea3f7442a07
3 | timeCreated: 1615560163
--------------------------------------------------------------------------------
/Runtime/Context.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 253f5d0e52c641d7893de331be437805
3 | timeCreated: 1618157997
--------------------------------------------------------------------------------
/Runtime/NodeIO.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6b807385d1d847e2bc1113f3906a2d64
3 | timeCreated: 1613971223
--------------------------------------------------------------------------------
/Bridged/GraphEvaluator.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4fa3a4eccc4a49ec8a1eeca22af785d7
3 | timeCreated: 1612701523
--------------------------------------------------------------------------------
/EditorOnly/Attributes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 326a0ef1e55a4b1cb2618e18d3029e07
3 | timeCreated: 1615770974
--------------------------------------------------------------------------------
/EditorOnly/BaseGraph.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ba8f66df240f42adba2a4383971db067
3 | timeCreated: 1602292335
--------------------------------------------------------------------------------
/EditorOnly/Blackboard.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3fd5367e22c0461caa0b5b132c171f6f
3 | timeCreated: 1602300718
--------------------------------------------------------------------------------
/EditorOnly/DataModels.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 67142889be9a41e08cb62309c63d8188
3 | timeCreated: 1614753322
--------------------------------------------------------------------------------
/EditorOnly/Extensions.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3670c369efa342b589dbf761430044f4
3 | timeCreated: 1615311647
--------------------------------------------------------------------------------
/EditorOnly/Settings.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: de968fea778a42b289fe65a63f11d7f3
3 | timeCreated: 1612795843
--------------------------------------------------------------------------------
/Runtime/Attributes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 39c5d45d1101499e9c6fd5bd2085eb3f
3 | timeCreated: 1612456331
--------------------------------------------------------------------------------
/Runtime/Blackboard.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2915032a4a3a465ea0b84361cc74b6c5
3 | timeCreated: 1617795569
--------------------------------------------------------------------------------
/Runtime/NodeIO/Any.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2343a887d83b488ab4ebed09741e9319
3 | timeCreated: 1616033233
--------------------------------------------------------------------------------
/Runtime/NodeIO/Link.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 50f1c12c6c4d4aa687b99dc8e9626a4b
3 | timeCreated: 1614940701
--------------------------------------------------------------------------------
/EditorOnly/Search Window.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8c1932b7ea65470c9c87138f343fc59e
3 | timeCreated: 1613521874
--------------------------------------------------------------------------------
/EditorOnly/Views/Renamer.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 05025b9ef3a149a6aec215303ce354e6
3 | timeCreated: 1616106614
--------------------------------------------------------------------------------
/Runtime/Attributes/In.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 02a8ec6bfc934b9aa97be082e11df889
3 | timeCreated: 1614046487
--------------------------------------------------------------------------------
/Runtime/Attributes/Out.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 48a80b7f40de4d8bb0ea10174f84e2bd
3 | timeCreated: 1614046498
--------------------------------------------------------------------------------
/Runtime/Context/Context.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 95a2f54086da49eea7c5b3c8c34e9bb2
3 | timeCreated: 1617346359
--------------------------------------------------------------------------------
/Runtime/GraphBlueprint.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f9c1666cfa1b498f966d1d2f3269622c
3 | timeCreated: 1600751443
--------------------------------------------------------------------------------
/Runtime/HasAssetGuid.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5656d8140d3f4658bc2a234c2cb2f9e9
3 | timeCreated: 1617248855
--------------------------------------------------------------------------------
/Runtime/Node/IRootNode.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f069dd25c90c4675abc4502fd60c60b4
3 | timeCreated: 1615547028
--------------------------------------------------------------------------------
/Runtime/Node/RuntimeNode.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d586e1fc59d54615b74f9e0e85b487c8
3 | timeCreated: 1604382576
--------------------------------------------------------------------------------
/Runtime/NodeIO/BasePort.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d0eb6a4e5a584645bd329a6515458dfb
3 | timeCreated: 1616719467
--------------------------------------------------------------------------------
/Runtime/NodeIO/ValuePort.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0b5660b2452a49bcaf19fc8d44c3b398
3 | timeCreated: 1613971228
--------------------------------------------------------------------------------
/Runtime/SerializableType.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 08b348fe0d524cc8be6f5f95f05a383e
3 | timeCreated: 1615311749
--------------------------------------------------------------------------------
/Runtime/VirtualGraph.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9a2544ad2dc64a9c8c27a62ebe47b835
3 | timeCreated: 1615930976
--------------------------------------------------------------------------------
/EditorOnly/Views/AutoView.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bf0abc66de3d43caa9a3414ac4e51793
3 | timeCreated: 1615827908
--------------------------------------------------------------------------------
/EditorOnly/Views/MovableView.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 60eaa1c06ee24122b48bfb09f67dde9b
3 | timeCreated: 1615319155
--------------------------------------------------------------------------------
/EditorOnly/Views/NodeView.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 927145d71bfe453182727f756537b994
3 | timeCreated: 1614753377
--------------------------------------------------------------------------------
/EditorOnly/Views/StackView.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 02dbe6f6be0844fdb3912a84c827995f
3 | timeCreated: 1615318126
--------------------------------------------------------------------------------
/Runtime/Attributes/RegisterTo.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9f0d381302ea49d7ae6335b798a8c439
3 | timeCreated: 1613523931
--------------------------------------------------------------------------------
/Runtime/Node/SubgraphNode.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d8447880893e49318538eba8cc939681
3 | timeCreated: 1617239222
--------------------------------------------------------------------------------
/Runtime/NodeIO/PortWithValue.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f4841745edb0430684c3924954a1eea6
3 | timeCreated: 1616720205
--------------------------------------------------------------------------------
/EditorOnly/Blackboard/FieldFactory.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 03d962cb8eaf4607a6b4b390c2e8269e
3 | timeCreated: 1617773208
--------------------------------------------------------------------------------
/EditorOnly/DataModels/EdgeModel.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e5266254d2244b1ea03bea33580d040b
3 | timeCreated: 1614846545
--------------------------------------------------------------------------------
/EditorOnly/DataModels/GraphModel.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 374fcfc2976e4d73a513c464818c44fc
3 | timeCreated: 1614830173
--------------------------------------------------------------------------------
/EditorOnly/DataModels/MovableModel.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 32fef6237fef47368ff8b8a4cec02891
3 | timeCreated: 1615560189
--------------------------------------------------------------------------------
/EditorOnly/DataModels/NodeModel.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c1570438075140aa8f2d4edcfad6c2e7
3 | timeCreated: 1614753344
--------------------------------------------------------------------------------
/EditorOnly/DataModels/PortModel.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 752ab329e09f438da94c2e5e81d1513b
3 | timeCreated: 1614857777
--------------------------------------------------------------------------------
/EditorOnly/DataModels/StackModel.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6cb25087522e4508be4c302e822bc881
3 | timeCreated: 1615318381
--------------------------------------------------------------------------------
/EditorOnly/Extensions/AssetHelper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e27938cecf674e86a060e1128bb7ddce
3 | timeCreated: 1615311838
--------------------------------------------------------------------------------
/EditorOnly/Settings/GraphSettings.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 328f34f4bdcf4f7a9af04a84fa020cd6
3 | timeCreated: 1612795857
--------------------------------------------------------------------------------
/EditorOnly/Views/CustomNodeView.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3ffd9289de234d1ba55fc75d3fdb53e8
3 | timeCreated: 1615771125
--------------------------------------------------------------------------------
/EditorOnly/Views/CustomStackNode.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a937ac272af04bc3832db6378019e77b
3 | timeCreated: 1616043799
--------------------------------------------------------------------------------
/EditorOnly/Views/DynamicPortView.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 275fcbadec9c41328b8945cfe899dbcb
3 | timeCreated: 1616823027
--------------------------------------------------------------------------------
/EditorOnly/Views/Renamer/Renamer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 30688e4210e84f4498a4e3d78e49f397
3 | timeCreated: 1616106672
--------------------------------------------------------------------------------
/Runtime/Attributes/DynamicRange.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 32ab41a827264f8b94424ca0074c7178
3 | timeCreated: 1617180520
--------------------------------------------------------------------------------
/Runtime/Blackboard/Blackboards.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 96cea79aec9340388609287224bd41c4
3 | timeCreated: 1617948144
--------------------------------------------------------------------------------
/Runtime/Blackboard/DataBlackboard.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0c447bb9c2ab4935806d88d7991bbf12
3 | timeCreated: 1617783444
--------------------------------------------------------------------------------
/Runtime/Blackboard/IDataBlackboard.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: acdd043d0276414299900ff39fad3b3c
3 | timeCreated: 1617795837
--------------------------------------------------------------------------------
/Runtime/NodeIO/DynamicValuePort.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 068c2a5afff647f091a41d13fde504a0
3 | timeCreated: 1616721898
--------------------------------------------------------------------------------
/Runtime/NodeIO/SerializedFieldInfo.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6baab3770ef14d8eab6c2b4b7a238b28
3 | timeCreated: 1614066305
--------------------------------------------------------------------------------
/Bridged/GraphEvaluator/GraphEvaluator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5b76c3172ea14ff4bf148dfbc12818b0
3 | timeCreated: 1612701523
--------------------------------------------------------------------------------
/EditorOnly/Attributes/RegisterStackTo.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 02e0f260336d4a8da607357b9a610f5f
3 | timeCreated: 1616044578
--------------------------------------------------------------------------------
/EditorOnly/Attributes/RegisterViewFor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f1e120beab4d4dd7ab43a00da3262577
3 | timeCreated: 1615770974
--------------------------------------------------------------------------------
/EditorOnly/Blackboard/BlackboardField.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: dec578328cc24871b71c01d138d8cc09
3 | timeCreated: 1618029969
--------------------------------------------------------------------------------
/EditorOnly/DataModels/DynamicPortModel.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2e7639abf8df4fb7b2264f710a62e84e
3 | timeCreated: 1616819176
--------------------------------------------------------------------------------
/EditorOnly/Extensions/BlueprintHelper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a7e2ceddce2f4795a0fa0b458edbe2bf
3 | timeCreated: 1617334623
--------------------------------------------------------------------------------
/Runtime/Attributes/DirectionalAttribute.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1dc39416ded34102b9cb3d374fd48149
3 | timeCreated: 1616094784
--------------------------------------------------------------------------------
/Bridged/GraphEvaluator/GraphEvaluatorEditor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 561b687874874132af786bc6fc6c005c
3 | timeCreated: 1612701788
--------------------------------------------------------------------------------
/EditorOnly/BaseGraph/GraphClickedHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 240a68fc2f0040709532f1b60be0904d
3 | timeCreated: 1615657834
--------------------------------------------------------------------------------
/EditorOnly/Blackboard/BlackboardFieldFactory.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: becd17b3d5eb49039d98df3f2f59a275
3 | timeCreated: 1617797562
--------------------------------------------------------------------------------
/EditorOnly/Blackboard/DataBlackboardView.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4a4cd10f109c4ca69d7ee0e39d1a2ca7
3 | timeCreated: 1617796241
--------------------------------------------------------------------------------
/EditorOnly/Blackboard/NavBlackboardNodeItem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3f6e9206364e418fa21214c22a9535e9
3 | timeCreated: 1602300731
--------------------------------------------------------------------------------
/EditorOnly/Blackboard/NavigationBlackboard.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d883bcc5341442589ee62ce6a9353d20
3 | timeCreated: 1602389683
--------------------------------------------------------------------------------
/EditorOnly/Extensions/AssetClickedHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2ddaf7fb5cb643f7ba41fbad2fd49da8
3 | timeCreated: 1615656670
--------------------------------------------------------------------------------
/EditorOnly/Extensions/ReflectionExtensions.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7f9ac294717845cabab9cb86fa67cb7e
3 | timeCreated: 1614040474
--------------------------------------------------------------------------------
/EditorOnly/Search Window/GraphSearchWindow.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 47eb8547fa7547d6b7af55c40115015e
3 | timeCreated: 1613521885
--------------------------------------------------------------------------------
/EditorOnly/Views/ViewRegistrationResolver.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1fc5e672cc2c4e8b996253ea7a2cfbde
3 | timeCreated: 1615770223
--------------------------------------------------------------------------------
/Runtime/Attributes/RegistrationAttribute.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ab70724bed1f4cc39ae498259798b958
3 | timeCreated: 1616044843
--------------------------------------------------------------------------------
/EditorOnly/BaseGraph/NodeRegistrationResolver.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 59164a6fdd7a473c80d7e4221ede832d
3 | timeCreated: 1615547176
--------------------------------------------------------------------------------
/EditorOnly/Search Window/GraphNodeSearchTreeProvider.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1e2254ae33fc45f1b91daa272fa0a7dd
3 | timeCreated: 1613524717
--------------------------------------------------------------------------------
/EditorOnly/DataModels/MovableModel.cs:
--------------------------------------------------------------------------------
1 | namespace GraphFramework.Editor
2 | {
3 | public interface MovableModel
4 | {
5 | void UpdatePosition();
6 | }
7 | }
--------------------------------------------------------------------------------
/Runtime/HasAssetGuid.cs:
--------------------------------------------------------------------------------
1 | namespace Graphify.Runtime
2 | {
3 | public interface HasAssetGuid
4 | {
5 | public string AssetGuid { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/LICENSE.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 48c03157e08b99e45b5c2b0918b2e447
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Readme.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f5548844f06013740a39230f2228656e
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/package.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3434cdec8d7f6c54e9add0c0bc0596c4
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/Node/IRootNode.cs:
--------------------------------------------------------------------------------
1 | namespace GraphFramework
2 | {
3 | ///
4 | /// Defines a node as a root node.
5 | ///
6 | public interface IRootNode
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/Bridged.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9ee516bb725546a288fd42525a147d29
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Settings.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ed3544c3b082fbb4cbfa21fc8e5b8923
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/EditorOnly.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6ae44b7969f0b3f44a04ed9ebecca98d
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/EditorOnly/Styles.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ea84ad44d37562d4db57aa2cc92b736b
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/GraphFramework.GraphifyRuntime.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 650f5d7751bbedc4597324ed0871ceac
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Bridged/GraphFramework.GraphifyBridge.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e571d491c81d8cf4e8e0d80e6c232318
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/EditorOnly/Views/MovableView.cs:
--------------------------------------------------------------------------------
1 | namespace GraphFramework.Editor
2 | {
3 | public interface MovableView
4 | {
5 | void OnDirty();
6 | void Display();
7 |
8 | MovableModel GetModel();
9 | }
10 | }
--------------------------------------------------------------------------------
/EditorOnly/GraphFramework.GraphifyEditor.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b21648eec87e1be4580b847a2999e252
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/Blackboard/IDataBlackboard.cs:
--------------------------------------------------------------------------------
1 | namespace GraphFramework
2 | {
3 | public interface IDataBlackboard
4 | {
5 | bool TryGetValue(string lookupKey, out T val);
6 | object this[string key] { set; get; }
7 | }
8 | }
--------------------------------------------------------------------------------
/Settings/DefaultSettings.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1df0b383dcca7954f94521f49358b2c5
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 11400000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "com.graphframework.graphify",
3 | "version": "6.1.0",
4 | "unity": "2020.2",
5 | "displayName": "Graphify",
6 | "description": "Graphify your game! See https://github.com/CoffeeVampir3/Graphify for details."
7 | }
8 |
--------------------------------------------------------------------------------
/Runtime/NodeIO/PortWithValue.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | namespace GraphFramework
4 | {
5 | internal interface PortWithValue
6 | {
7 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
8 | bool TryGetValue(int graphId, Link link, out T value);
9 | }
10 | }
--------------------------------------------------------------------------------
/EditorOnly/Views/Renamer/RenameWindow.cs:
--------------------------------------------------------------------------------
1 | using UnityEditor;
2 | using UnityEngine;
3 | using UnityEngine.UIElements;
4 |
5 | namespace GraphFramework.Editor
6 | {
7 | internal class RenameWindow : EditorWindow
8 | {
9 | [SerializeField]
10 | public VisualTreeAsset popupTree;
11 | }
12 | }
--------------------------------------------------------------------------------
/EditorOnly/BaseGraph/GraphifyView.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4b7551a8101a9e04cb3d59bbf9cff5b3
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/EditorOnly/Views/CustomNodeView.cs:
--------------------------------------------------------------------------------
1 | using UnityEditor;
2 | using UnityEngine.UIElements;
3 |
4 | namespace GraphFramework.Editor
5 | {
6 | public abstract class CustomNodeView : VisualElement
7 | {
8 | public abstract void CreateView(SerializedObject serializedRuntimeData, RuntimeNode forNode, NodeView forView);
9 | }
10 | }
--------------------------------------------------------------------------------
/Runtime/NodeIO/Any.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace GraphFramework
4 | {
5 | //The connection rules for Any are defined in the base GraphView class.
6 | ///
7 | /// A special class that indicates it can be connected to anything.
8 | ///
9 | [Serializable]
10 | public class Any
11 | {
12 | }
13 | }
--------------------------------------------------------------------------------
/EditorOnly/Views/Renamer/Renamer.uxml.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4972a74c8df6ee84a836e97cba3af307
3 | ScriptedImporter:
4 | internalIDToNameTable: []
5 | externalObjects: {}
6 | serializedVersion: 2
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 | script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
11 |
--------------------------------------------------------------------------------
/EditorOnly/Attributes/RegisterStackTo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using GraphFramework.Attributes;
3 |
4 | namespace GraphFramework.EditorOnly.Attributes
5 | {
6 | public class RegisterStackTo : RegistrationAttribute
7 | {
8 | public RegisterStackTo(Type registerTo, string nodePath = "") : base(registerTo, nodePath)
9 | {
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/EditorOnly/Styles/BaseGraphViewStyle.uss.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: efbcd2a4693b951488698a8a412eab88
3 | ScriptedImporter:
4 | internalIDToNameTable: []
5 | externalObjects: {}
6 | serializedVersion: 2
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 | script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
11 | disableValidation: 0
12 |
--------------------------------------------------------------------------------
/EditorOnly/Views/Renamer/RenameWindow.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 226cb6f5393a46f1a0f3b869dbec3ead
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences:
7 | - m_ViewDataDictionary: {instanceID: 0}
8 | - popupTree: {fileID: 9197481963319205126, guid: 4972a74c8df6ee84a836e97cba3af307, type: 3}
9 | executionOrder: 0
10 | icon: {instanceID: 0}
11 | userData:
12 | assetBundleName:
13 | assetBundleVariant:
14 |
--------------------------------------------------------------------------------
/Runtime/Attributes/RegisterTo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace GraphFramework.Attributes
4 | {
5 | ///
6 | /// Registers this object to the provided GraphController type.
7 | ///
8 | [AttributeUsage(AttributeTargets.Class)]
9 | public class RegisterTo : RegistrationAttribute
10 | {
11 | public RegisterTo(Type registerTo, string nodePath = "") : base(registerTo, nodePath)
12 | {
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/EditorOnly/BaseGraph/GraphfyWindow.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e76551d32beb5d840bca66609d5ba181
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences:
7 | - m_ViewDataDictionary: {instanceID: 0}
8 | - baseNodeDefaultStyle: {fileID: 7433441132597879392, guid: 11cc63bae6b4cbe498401ac99b0b852d, type: 3}
9 | executionOrder: 0
10 | icon: {instanceID: 0}
11 | userData:
12 | assetBundleName:
13 | assetBundleVariant:
14 |
--------------------------------------------------------------------------------
/EditorOnly/Blackboard/BlackboardFieldFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine.UIElements;
3 |
4 | namespace GraphFramework.Editor
5 | {
6 | public static class BlackboardFieldFactory
7 | {
8 | public static VisualElement Create(string fieldKey, Type t,
9 | object someObject, DataBlackboard bb, Action updateViewAction, VisualElement parent)
10 | {
11 | return new BlackboardField(fieldKey, t, someObject, bb, updateViewAction, parent);
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/EditorOnly/Blackboard/NavBlackboardNodeItem.cs:
--------------------------------------------------------------------------------
1 | using UnityEditor.Experimental.GraphView;
2 | using UnityEngine.UIElements;
3 |
4 | namespace GraphFramework.Editor
5 | {
6 | public class NavBlackboardNodeItem : VisualElement
7 | {
8 | public readonly Label label;
9 | public Node targetNode;
10 |
11 | public NavBlackboardNodeItem()
12 | {
13 | label = new Label {pickingMode = PickingMode.Ignore};
14 | Add(label);
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/GraphFramework.GraphifyRuntime.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "GraphFramework.GraphifyRuntime",
3 | "rootNamespace": "",
4 | "references": [
5 | "GUID:7104629240eb8a645904aa070efcaeb8"
6 | ],
7 | "includePlatforms": [],
8 | "excludePlatforms": [],
9 | "allowUnsafeCode": false,
10 | "overrideReferences": false,
11 | "precompiledReferences": [],
12 | "autoReferenced": true,
13 | "defineConstraints": [],
14 | "versionDefines": [],
15 | "noEngineReferences": false
16 | }
--------------------------------------------------------------------------------
/Bridged/GraphFramework.GraphifyBridge.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "GraphFramework.GraphifyBridge",
3 | "rootNamespace": "",
4 | "references": [
5 | "GUID:650f5d7751bbedc4597324ed0871ceac",
6 | "GUID:b21648eec87e1be4580b847a2999e252"
7 | ],
8 | "includePlatforms": [],
9 | "excludePlatforms": [],
10 | "allowUnsafeCode": false,
11 | "overrideReferences": false,
12 | "precompiledReferences": [],
13 | "autoReferenced": true,
14 | "defineConstraints": [],
15 | "versionDefines": [],
16 | "noEngineReferences": false
17 | }
--------------------------------------------------------------------------------
/EditorOnly/GraphFramework.GraphifyEditor.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "GraphFramework.GraphifyEditor",
3 | "rootNamespace": "",
4 | "references": [
5 | "GUID:650f5d7751bbedc4597324ed0871ceac",
6 | "GUID:7104629240eb8a645904aa070efcaeb8"
7 | ],
8 | "includePlatforms": [
9 | "Editor"
10 | ],
11 | "excludePlatforms": [],
12 | "allowUnsafeCode": false,
13 | "overrideReferences": false,
14 | "precompiledReferences": [],
15 | "autoReferenced": false,
16 | "defineConstraints": [],
17 | "versionDefines": [],
18 | "noEngineReferences": false
19 | }
--------------------------------------------------------------------------------
/Settings/DefaultSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &11400000
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 11500000, guid: 328f34f4bdcf4f7a9af04a84fa020cd6, type: 3}
13 | m_Name: DefaultSettings
14 | m_EditorClassIdentifier:
15 | registeredToControllerType:
16 | serializedTypeName:
17 | isDefault: 1
18 | graphViewStyle: {fileID: 7433441132597879392, guid: efbcd2a4693b951488698a8a412eab88, type: 3}
19 |
--------------------------------------------------------------------------------
/Runtime/Attributes/DirectionalAttribute.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine.Scripting;
2 |
3 | namespace GraphFramework.Attributes
4 | {
5 | public abstract class DirectionalAttribute : PreserveAttribute
6 | {
7 | public Capacity capacity;
8 | public Direction direction;
9 | public ConnectionRules rules;
10 | public bool showBackingValue = false;
11 | }
12 |
13 | public enum Capacity
14 | {
15 | Single,
16 | Multi
17 | }
18 |
19 | public enum Direction
20 | {
21 | Input,
22 | Output
23 | }
24 |
25 | public enum ConnectionRules
26 | {
27 | Exact,
28 | Inherited,
29 | None
30 | }
31 | }
--------------------------------------------------------------------------------
/EditorOnly/Views/CustomStackNode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace GraphFramework.Editor
5 | {
6 | public abstract class CustomStackNode
7 | {
8 | internal readonly List registeredTypes = new List();
9 | protected CustomStackNode()
10 | {
11 | //This is a virtual call in the constructor, but the order of operations isint an issue
12 | //for this case.
13 | Registration();
14 | }
15 |
16 | protected abstract void Registration();
17 |
18 | protected void Accepts() where T : RuntimeNode
19 | {
20 | registeredTypes.Add(typeof(T));
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/Runtime/Attributes/RegistrationAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace GraphFramework.Attributes
4 | {
5 | public abstract class RegistrationAttribute : Attribute
6 | {
7 | public readonly Type registeredGraphType = null;
8 | public readonly string registeredPath = null;
9 |
10 | ///
11 | /// Registers to the provided controller with the given unique searchable path.
12 | /// (Use no path for registering root nodes if they shouldn't be creatable.)
13 | ///
14 | public RegistrationAttribute(Type registerTo, string nodePath = "")
15 | {
16 | registeredGraphType = registerTo;
17 | registeredPath = nodePath;
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/Runtime/Attributes/DynamicRange.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 |
4 | namespace GraphFramework.EditorOnly.Attributes
5 | {
6 | [AttributeUsage(AttributeTargets.Field)]
7 | public class DynamicRange : Attribute
8 | {
9 | public readonly int min;
10 | public readonly int max;
11 |
12 | public DynamicRange(int min = 0, int max = 0)
13 | {
14 | if (min < 0 || max < 0 || min > max)
15 | {
16 | Debug.LogError("Invalid Dynamic Range Attribute Settings, this attribute will be ignored!");
17 | this.min = 0;
18 | this.max = int.MaxValue;
19 | return;
20 | }
21 |
22 | this.min = min;
23 | this.max = max;
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/EditorOnly/Attributes/RegisterViewFor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 |
4 | namespace GraphFramework.EditorOnly.Attributes
5 | {
6 | [AttributeUsage(AttributeTargets.Class)]
7 | public class RegisterViewFor : Attribute
8 | {
9 | public readonly Type runtimeNodeType;
10 | ///
11 | /// Registers a custom view for the given runtime node type.
12 | ///
13 | public RegisterViewFor(Type runtimeNodeType)
14 | {
15 | if (!typeof(RuntimeNode).IsAssignableFrom(runtimeNodeType))
16 | {
17 | Debug.LogError("Attempted to register a custom view for something other than a runtime node.");
18 | return;
19 | }
20 |
21 | this.runtimeNodeType = runtimeNodeType;
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/Runtime/SerializableType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 |
4 | namespace GraphFramework
5 | {
6 | [Serializable]
7 | public class SerializableType : ISerializationCallbackReceiver
8 | {
9 | [SerializeField, HideInInspector]
10 | private string serializedTypeName = "";
11 | [NonSerialized]
12 | public Type type = null;
13 |
14 | public SerializableType(System.Type t)
15 | {
16 | type = t;
17 | }
18 |
19 | public void OnBeforeSerialize()
20 | {
21 | if (type != null)
22 | {
23 | serializedTypeName = type.AssemblyQualifiedName;
24 | } else {
25 | serializedTypeName = "";
26 | }
27 | }
28 |
29 | public void OnAfterDeserialize()
30 | {
31 | type = Type.GetType(serializedTypeName);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Runtime/NodeIO/SerializedFieldInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using UnityEngine;
4 |
5 | namespace GraphFramework
6 | {
7 | ///
8 | /// Allows us to serialize a field info for use at some later point.
9 | ///
10 | [Serializable]
11 | public class SerializedFieldInfo
12 | {
13 | [SerializeField]
14 | private string fieldName;
15 | [SerializeField]
16 | private SerializableType declaringType;
17 | public string FieldName => fieldName;
18 |
19 | public FieldInfo FieldFromInfo => declaringType.type.GetField(fieldName,
20 | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
21 |
22 | public SerializedFieldInfo(FieldInfo info)
23 | {
24 | fieldName = info.Name;
25 | declaringType = new SerializableType(info.DeclaringType);
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/EditorOnly/Extensions/AssetClickedHandler.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace GraphFramework.Editor
4 | {
5 | internal abstract class AssetClickedHandler-
6 | where Item : ScriptableObject
7 | {
8 | ///
9 | /// Helper function to check if a clicked asset is one of the type we care about, if
10 | /// it is, it will out the clicked asset item and return true, otherwise returns false.
11 | ///
12 | protected static bool IsOpenedAssetTargetType(int instanceID, out Item openedItem)
13 | {
14 | var targetItems = AssetHelper.FindAssetsOf
- ();
15 |
16 | openedItem = null;
17 | foreach (var targetItem in targetItems)
18 | {
19 | if (targetItem.GetInstanceID() != instanceID) continue;
20 | openedItem = targetItem;
21 | return true;
22 | }
23 |
24 | return false;
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/EditorOnly/Views/Renamer/Renamer.uxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Runtime/VirtualGraph.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace GraphFramework.Runtime
4 | {
5 | ///
6 | /// A "virtual" instance of a graph controller which is executable.
7 | ///
8 | public class VirtualGraph
9 | {
10 | internal readonly GraphBlueprint parentGraphBlueprint;
11 | internal readonly Dictionary localBlackboardCopy;
12 | public readonly int virtualId;
13 |
14 | // Do not attempt to construct virtual graphs outside of the graph controller,
15 | // the parent graph controller must allocate the port virtualizations first.
16 | internal VirtualGraph(GraphBlueprint parent, DataBlackboard localBb, int id)
17 | {
18 | parentGraphBlueprint = parent;
19 | virtualId = id;
20 | localBlackboardCopy = localBb != null ? localBb.Copy() : null;
21 | }
22 |
23 | ~VirtualGraph()
24 | {
25 | parentGraphBlueprint.ReleaseVirtualGraph(this);
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/Runtime/Context/Context.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Runtime.CompilerServices;
3 | using GraphFramework.Runtime;
4 |
5 | namespace GraphFramework
6 | {
7 | public class Context
8 | {
9 | public readonly VirtualGraph virtGraph;
10 | private readonly Stack contextStack = new Stack();
11 |
12 | public Context(VirtualGraph virtGraph)
13 | {
14 | this.virtGraph = virtGraph;
15 | }
16 |
17 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
18 | public int Count()
19 | {
20 | return contextStack.Count;
21 | }
22 |
23 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
24 | public void Push(RuntimeNode node)
25 | {
26 | contextStack.Push(node);
27 | }
28 |
29 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
30 | public RuntimeNode Pop()
31 | {
32 | var m = contextStack.Pop();
33 | return m;
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 CoffeeVampir3
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/EditorOnly/Views/ViewRegistrationResolver.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Reflection;
4 | using GraphFramework.EditorOnly.Attributes;
5 | using UnityEditor;
6 |
7 | namespace GraphFramework.Editor
8 | {
9 | public static class ViewRegistrationResolver
10 | {
11 | public static bool TryGetCustom(Type forType, out Type registeredType)
12 | {
13 | registeredType = null;
14 | var viewTypeList = TypeCache.GetTypesWithAttribute();
15 | foreach (var viewType in viewTypeList)
16 | {
17 | var attribs = viewType.GetCustomAttributes();
18 | if (!(attribs.FirstOrDefault(
19 | e => e is RegisterViewFor) is RegisterViewFor rvForAttrib))
20 | return false;
21 |
22 | if (forType.IsAssignableFrom(rvForAttrib.runtimeNodeType))
23 | {
24 | registeredType = viewType;
25 | return true;
26 | }
27 | }
28 |
29 |
30 | return false;
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/EditorOnly/BaseGraph/GraphClickedHandler.cs:
--------------------------------------------------------------------------------
1 | using UnityEditor;
2 | using UnityEditor.Callbacks;
3 |
4 | namespace GraphFramework.Editor
5 | {
6 | ///
7 | /// Handles the case when any graph controller asset is double-clicked.
8 | ///
9 | internal class GraphClickedHandler : AssetClickedHandler
10 | {
11 | [OnOpenAsset(1)]
12 | public static bool OnSerializedGraphOpened(int instanceID, int line)
13 | {
14 | if (!IsOpenedAssetTargetType(instanceID, out var controller))
15 | return false;
16 |
17 | var model = AssetHelper.FindNestedAssetOfType(controller, controller.editorGraphGuid);
18 | if (model == null)
19 | {
20 | model = GraphModel.BootstrapController(controller);
21 | }
22 |
23 | EditorWindow window = EditorWindow.GetWindow(model.graphWindowType.type);
24 | if (window == null || !(window is GraphfyWindow graphWindow)) return false;
25 |
26 | graphWindow.LoadGraphExternal(model);
27 | return true;
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/EditorOnly/DataModels/EdgeModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 |
4 | namespace GraphFramework.Editor
5 | {
6 | [Serializable]
7 | public class EdgeModel
8 | {
9 | [SerializeReference]
10 | protected internal NodeModel inputModel;
11 | [SerializeReference]
12 | protected internal NodeModel outputModel;
13 | [SerializeReference]
14 | protected internal PortModel inputPortModel;
15 | [SerializeReference]
16 | protected internal PortModel outputPortModel;
17 | [SerializeReference]
18 | protected internal string inputConnectionGuid;
19 | [SerializeReference]
20 | protected internal string outputConnectionGuid;
21 |
22 | public EdgeModel(NodeModel inputNode, PortModel inputPort,
23 | NodeModel outputNode, PortModel outputPort,
24 | string inputConnectionGuid, string outputConnectionGuid)
25 | {
26 | this.inputModel = inputNode;
27 | this.outputModel = outputNode;
28 | this.inputPortModel = inputPort;
29 | this.outputPortModel = outputPort;
30 | this.inputConnectionGuid = inputConnectionGuid;
31 | this.outputConnectionGuid = outputConnectionGuid;
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/Runtime/Node/RuntimeNode.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 | using UnityEngine;
3 |
4 | //Internals visible so we can hide away potentially dangerous stuff
5 | [assembly: InternalsVisibleTo("GraphFramework.GraphifyBridge")]
6 | [assembly: InternalsVisibleTo("GraphFramework.GraphifyEditor")]
7 | namespace GraphFramework
8 | {
9 | public abstract class RuntimeNode : ScriptableObject
10 | {
11 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
12 | ///
13 | /// Evaluates a node for the given graph id.
14 | ///
15 | internal virtual RuntimeNode Evaluate(Context evContext)
16 | {
17 | int graphId = evContext.virtGraph.virtualId;
18 | //Make sure we're looking up the right graph index when we lookup our port values.
19 | BasePort.CurrentGraphIndex = graphId;
20 | Blackboards.virtGraph = evContext.virtGraph;
21 | return OnEvaluate(evContext);
22 | }
23 |
24 | ///
25 | /// Evaluates a node. Because of how virtualization works, if you need to store context-sensitive data
26 | /// in the node, use the provided contextId to store the values in a dictionary or lookup scheme.
27 | ///
28 | public virtual RuntimeNode OnEvaluate(Context evContext)
29 | {
30 | return null;
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Runtime/Blackboard/Blackboards.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using GraphFramework.Runtime;
3 |
4 | namespace GraphFramework
5 | {
6 | public static class Blackboards
7 | {
8 | //Set in the graph evaluator init and runtime node eval.
9 | internal static VirtualGraph virtGraph = null;
10 | public static Dictionary Local => virtGraph.localBlackboardCopy;
11 | public static Dictionary Global => virtGraph.parentGraphBlueprint.globalBlackboard.data;
12 |
13 | public static bool Query(string queryKey, out object item)
14 | {
15 | foreach (var board in virtGraph.parentGraphBlueprint.pooledBlackboards)
16 | {
17 | if (board.TryGetValue(queryKey, out item))
18 | {
19 | return true;
20 | }
21 | }
22 | item = null;
23 | return false;
24 | }
25 |
26 | public static bool Query(string queryKey, out T item)
27 | {
28 | foreach (var board in virtGraph.parentGraphBlueprint.pooledBlackboards)
29 | {
30 | if (board.TryGetValue(queryKey, out item))
31 | {
32 | return true;
33 | }
34 | }
35 |
36 | item = default;
37 | return false;
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/Runtime/Node/SubgraphNode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 |
4 | namespace GraphFramework
5 | {
6 | [Serializable]
7 | public class SubgraphNode : RuntimeNode
8 | {
9 | //Referenced via GUID so it's undo-safe.
10 | [HideInInspector]
11 | public string childBpGuid;
12 | [HideInInspector]
13 | public string parentBpGuid;
14 | [HideInInspector]
15 | public SubgraphNode childNode;
16 |
17 | private bool isRunning = false;
18 | internal override RuntimeNode Evaluate(Context evContext)
19 | {
20 | int graphId = evContext.virtGraph.virtualId;
21 | BasePort.CurrentGraphIndex = graphId;
22 | Blackboards.virtGraph = evContext.virtGraph;
23 |
24 | //We returned up the stack
25 | if (isRunning)
26 | {
27 | isRunning = false;
28 | return OnEvaluate(evContext);
29 | }
30 | //We are the parent
31 | if (childNode != null)
32 | {
33 | evContext.Push(this);
34 | var childEval = childNode.Evaluate(evContext);
35 | isRunning = true;
36 | return childEval;
37 | }
38 |
39 | //We are the child
40 | if (childNode == null)
41 | {
42 | return OnEvaluate(evContext);
43 | }
44 |
45 | return null;
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/EditorOnly/Extensions/AssetHelper.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Graphify.Runtime;
3 | using UnityEditor;
4 | using UnityEngine;
5 |
6 | namespace GraphFramework.Editor
7 | {
8 | public static class AssetHelper
9 | {
10 | ///
11 | /// Finds all assets of type T, accounts for subnesting.
12 | ///
13 | public static List FindAssetsOf() where T : UnityEngine.Object
14 | {
15 | var searchStr = "t:" + typeof(T).Name;
16 | var charGuids = AssetDatabase.FindAssets(searchStr);
17 | var items = new List();
18 | foreach (var chGuid in charGuids)
19 | {
20 | var path = AssetDatabase.GUIDToAssetPath(chGuid);
21 | var assetsAtPath = AssetDatabase.LoadAllAssetsAtPath(path);
22 | foreach (var asset in assetsAtPath)
23 | {
24 | if (!(asset is T item))
25 | continue;
26 | items.Add(item);
27 | }
28 | }
29 |
30 | return items;
31 | }
32 |
33 | public static T FindNestedAssetOfType(Object mainAsset, string searchGuid)
34 | where T : HasAssetGuid
35 | {
36 | var path = AssetDatabase.GetAssetPath(mainAsset);
37 |
38 | var objs = AssetDatabase.LoadAllAssetsAtPath(path);
39 |
40 | foreach (var obj in objs)
41 | {
42 | if (!(obj is T item)) continue;
43 | if(item.AssetGuid == searchGuid)
44 | return item;
45 | }
46 |
47 | return default;
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # Turn Anything Into a Graph!
4 |
5 | Graphify is an ultra-lightweight Unity Api for quickly and easily making anything into a graph! It's 100% built using Unity's new UI Toolkit, and allows users to easily extend the graph using their own UI Toolkit code. Graphify has been designed for speed, consisting of a virtualization scheme and fast evaluation means you can create and run thousands of graphs at a time with no issues.
6 |
7 | # Features:
8 |
9 | 1. Graph & Node automatic creation, visualization, and serialization.
10 | 2. Edit graphs realtime in play mode without needing to recompile.
11 | 3. Runtime structure and evaluation API for using the graphs at runtime.
12 | 4. Total seperation of editor code and runtime code. No editor code gets compiled into your build.
13 | 5. Subgraph-nodes (Nodes which are themselves a graph)
14 | 6. Copy & Paste and Undo.
15 | 7. Scoped Blackboard API
16 |
17 | # Installing:
18 |
19 | Install via UPM using `https://github.com/CoffeeVampir3/Graphify.git#upm` with the built-in unity package manager (Unity 2020+)
20 |
21 |  -> 
22 |
23 | # Where Are The Docs?!
24 |
25 | In the Wiki! Check out the [Quickstart Guide](https://github.com/CoffeeVampir3/Graphify/wiki/Quickstart-Guide) for a fast start or see [Comprehensive Wiki](https://github.com/CoffeeVampir3/Graphify/wiki/Home)
26 |
--------------------------------------------------------------------------------
/EditorOnly/Extensions/ReflectionExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 |
5 | namespace GraphFramework.Editor
6 | {
7 | internal static class ReflectionExtensions
8 | {
9 | public static List GetLocalFieldsWithAttribute(this Type t, out List fieldAttribs)
10 | where TargetAttr : Attribute
11 | {
12 | var allFields = t.GetFields(BindingFlags.Public |
13 | BindingFlags.Instance | BindingFlags.NonPublic);
14 |
15 | var fieldList = new List();
16 |
17 | fieldAttribs = new List();
18 | foreach (var f in allFields)
19 | {
20 | var attribs = f.GetCustomAttributes();
21 |
22 | foreach (var attr in attribs)
23 | {
24 | if (!(attr is TargetAttr))
25 | continue;
26 | fieldList.Add(f);
27 | fieldAttribs.Add(attr);
28 | break;
29 | }
30 | }
31 | return fieldList;
32 | }
33 |
34 | public static System.Type[] GetGenericClassConstructorArguments(this System.Type candidateType, System.Type openGenericType)
35 | {
36 | while (true)
37 | {
38 | //We've found our target class.
39 | if (candidateType.IsGenericType &&
40 | candidateType.GetGenericTypeDefinition() == openGenericType)
41 | return candidateType.GetGenericArguments();
42 |
43 | //Keep looking
44 | System.Type baseType = candidateType.BaseType;
45 | if (baseType == null) return null;
46 | candidateType = baseType;
47 | }
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/EditorOnly/Settings/GraphSettings.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using UnityEditor;
4 | using UnityEngine;
5 | using UnityEngine.UIElements;
6 |
7 | namespace GraphFramework.Editor
8 | {
9 | ///
10 | /// A class that allows us to save global settings for our graph controller (by type)
11 | ///
12 | public class GraphSettings : ScriptableObject
13 | {
14 | [HideInInspector]
15 | public SerializableType registeredToControllerType;
16 | [SerializeField, HideInInspector]
17 | private bool isDefault = false;
18 | public StyleSheet graphViewStyle;
19 |
20 | private static GraphSettings CreateGraphSettings(System.Type controllerType, List allSettings)
21 | {
22 | var defaultSettings = allSettings.FirstOrDefault(
23 | e => e.isDefault);
24 |
25 | if (defaultSettings == null)
26 | {
27 | Debug.LogError("Coffee Graph was unable to locate a default graph view settings file.");
28 | return null;
29 | }
30 |
31 | GraphSettings settings = Instantiate(defaultSettings);
32 | settings.registeredToControllerType = new SerializableType(controllerType);
33 | AssetDatabase.AddObjectToAsset(settings,
34 | defaultSettings);
35 | AssetDatabase.SaveAssets();
36 | AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(settings));
37 | settings.name = "Settings For: " + controllerType.Name;
38 | settings.isDefault = false;
39 |
40 | return settings;
41 | }
42 |
43 | public static GraphSettings CreateOrGetSettings(GraphModel graphModel)
44 | {
45 | var allSettings = AssetHelper.FindAssetsOf();
46 |
47 | return allSettings.FirstOrDefault();
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/Runtime/Attributes/In.cs:
--------------------------------------------------------------------------------
1 | namespace GraphFramework.Attributes
2 | {
3 | //Using preserve attribute so we don't get this stripped out in IL2CPP compilations
4 | ///
5 | /// Defines a ValuePort as an input with the given capacity.
6 | ///
7 | public class In : DirectionalAttribute
8 | {
9 | //Explicit constructors so they show up in autocomplete.
10 | public In()
11 | {
12 | capacity = Capacity.Single;
13 | direction = Direction.Input;
14 | rules = ConnectionRules.Exact;
15 | this.showBackingValue = false;
16 | }
17 |
18 | public In(bool showBackingValue)
19 | {
20 | capacity = Capacity.Single;
21 | direction = Direction.Input;
22 | rules = ConnectionRules.Exact;
23 | this.showBackingValue = showBackingValue;
24 | }
25 |
26 | public In(Capacity portCapacity)
27 | {
28 | capacity = portCapacity;
29 | direction = Direction.Input;
30 | rules = ConnectionRules.Exact;
31 | this.showBackingValue = false;
32 | }
33 |
34 | public In(ConnectionRules rules)
35 | {
36 | capacity = Capacity.Single;
37 | direction = Direction.Input;
38 | this.rules = rules;
39 | this.showBackingValue = false;
40 | }
41 |
42 | public In(bool showBackingValue, Capacity portCapacity)
43 | {
44 | capacity = portCapacity;
45 | direction = Direction.Input;
46 | rules = ConnectionRules.Exact;
47 | this.showBackingValue = showBackingValue;
48 | }
49 |
50 | public In(bool showBackingValue = false, Capacity portCapacity = Capacity.Single, ConnectionRules rules = ConnectionRules.Exact)
51 | {
52 | capacity = portCapacity;
53 | direction = Direction.Input;
54 | this.rules = rules;
55 | this.showBackingValue = showBackingValue;
56 | }
57 | }
58 | }
--------------------------------------------------------------------------------
/Runtime/Attributes/Out.cs:
--------------------------------------------------------------------------------
1 | namespace GraphFramework.Attributes
2 | {
3 | //Using preserve attribute so we don't get this stripped out in IL2CPP compilations
4 | ///
5 | /// Defines a ValuePort as an output with the given capacity.
6 | ///
7 | public class Out : DirectionalAttribute
8 | {
9 | //Explicit constructors so they show up in autocomplete.
10 | public Out()
11 | {
12 | capacity = Capacity.Single;
13 | direction = Direction.Output;
14 | rules = ConnectionRules.Exact;
15 | this.showBackingValue = false;
16 | }
17 |
18 | public Out(bool showBackingValue)
19 | {
20 | capacity = Capacity.Single;
21 | direction = Direction.Output;
22 | rules = ConnectionRules.Exact;
23 | this.showBackingValue = showBackingValue;
24 | }
25 |
26 | public Out(Capacity portCapacity)
27 | {
28 | capacity = portCapacity;
29 | direction = Direction.Output;
30 | rules = ConnectionRules.Exact;
31 | this.showBackingValue = false;
32 | }
33 |
34 | public Out(ConnectionRules rules)
35 | {
36 | capacity = Capacity.Single;
37 | direction = Direction.Output;
38 | this.rules = rules;
39 | this.showBackingValue = false;
40 | }
41 |
42 | public Out(bool showBackingValue, Capacity portCapacity)
43 | {
44 | capacity = portCapacity;
45 | direction = Direction.Output;
46 | rules = ConnectionRules.Exact;
47 | this.showBackingValue = showBackingValue;
48 | }
49 |
50 | public Out(bool showBackingValue = false, Capacity portCapacity = Capacity.Single, ConnectionRules rules = ConnectionRules.Exact)
51 | {
52 | capacity = portCapacity;
53 | direction = Direction.Output;
54 | this.rules = rules;
55 | this.showBackingValue = showBackingValue;
56 | }
57 | }
58 | }
--------------------------------------------------------------------------------
/Runtime/NodeIO/BasePort.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Runtime.CompilerServices;
4 | using UnityEngine;
5 |
6 | namespace GraphFramework
7 | {
8 | [Serializable]
9 | public abstract class BasePort
10 | {
11 | //Internals shared with graph editor.
12 | [SerializeReference, HideInInspector]
13 | protected internal List links = new List();
14 | public static int CurrentGraphIndex { get; set; }
15 |
16 | public void Clear()
17 | {
18 | links.Clear();
19 | }
20 |
21 | ///
22 | /// The list of links this port has.
23 | ///
24 | public List Links => links;
25 |
26 | ///
27 | /// Resets the value of a virtual port back to it's original value.
28 | ///
29 | public abstract void Reset(int graphId);
30 |
31 | ///
32 | /// Returns true if this port has any links.
33 | ///
34 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
35 | public bool IsLinked()
36 | {
37 | return links.Count > 0;
38 | }
39 |
40 | ///
41 | /// Returns true if this port has more than one link.
42 | ///
43 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
44 | public bool HasMultipleLinks()
45 | {
46 | return links.Count > 1;
47 | }
48 |
49 | ///
50 | /// Returns the node for the first link or null.
51 | ///
52 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
53 | public RuntimeNode FirstNode()
54 | {
55 | return links.Count > 0 ? links[0].Node : null;
56 | }
57 |
58 | ///
59 | /// Returns the first link or null.
60 | ///
61 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
62 | public Link FirstLink()
63 | {
64 | return links.Count > 0 ? links[0] : null;
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/EditorOnly/DataModels/PortModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 | using UnityEditor;
5 | using UnityEditor.Experimental.GraphView;
6 | using UnityEngine;
7 |
8 | namespace GraphFramework.Editor
9 | {
10 | [Serializable]
11 | public class PortModel
12 | {
13 | [SerializeReference]
14 | protected internal SerializableType portValueType = null;
15 | [SerializeReference]
16 | protected internal SerializableType portCompleteType = null;
17 | [SerializeReference]
18 | protected internal SerializedFieldInfo serializedValueFieldInfo;
19 | [SerializeField]
20 | protected internal List linkGuids = new List();
21 | [SerializeField]
22 | protected internal string portName;
23 | [SerializeField]
24 | protected internal int dynamicIndex;
25 | [SerializeField]
26 | protected internal Orientation orientation;
27 | [SerializeField]
28 | protected internal Direction direction;
29 | [SerializeField]
30 | protected internal Port.Capacity capacity;
31 | [NonSerialized]
32 | protected internal Port view;
33 |
34 | public Port CreateView(NodeView nv)
35 | {
36 | view = nv.InstantiatePort(orientation, direction, capacity, portValueType.type);
37 | return view;
38 | }
39 |
40 | public PortModel(Orientation orientation,
41 | Direction direction,
42 | Port.Capacity capacity,
43 | Type portValueType,
44 | FieldInfo fieldInfo,
45 | int dynamicIndex = -1)
46 | {
47 | this.orientation = orientation;
48 | this.direction = direction;
49 | this.capacity = capacity;
50 | this.portValueType = new SerializableType(portValueType);
51 | this.serializedValueFieldInfo = new SerializedFieldInfo(fieldInfo);
52 | this.portName = ObjectNames.NicifyVariableName(fieldInfo.Name);
53 | this.portCompleteType = new SerializableType(fieldInfo.FieldType);
54 | this.dynamicIndex = dynamicIndex;
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/EditorOnly/Extensions/BlueprintHelper.cs:
--------------------------------------------------------------------------------
1 | using UnityEditor;
2 | using UnityEngine;
3 |
4 | namespace GraphFramework.Editor
5 | {
6 | public class BlueprintHelper
7 | {
8 | private readonly SerializedObject serializedBp;
9 | private readonly SerializedProperty bpNodes;
10 | private readonly SerializedProperty bpGraphs;
11 |
12 | public BlueprintHelper(GraphBlueprint blueprint)
13 | {
14 | serializedBp = new SerializedObject(blueprint);
15 | bpNodes = serializedBp.FindProperty(nameof(blueprint.nodes));
16 | bpGraphs = serializedBp.FindProperty(nameof(blueprint.childGraphs));
17 | }
18 |
19 | public void Apply()
20 | {
21 | serializedBp.ApplyModifiedPropertiesWithoutUndo();
22 | }
23 |
24 | public void AddNode(RuntimeNode node)
25 | {
26 | bpNodes.InsertArrayElementAtIndex(bpNodes.arraySize);
27 | SerializedProperty sp = bpNodes.GetArrayElementAtIndex(bpNodes.arraySize - 1);
28 | sp.objectReferenceValue = node;
29 | }
30 |
31 | public void RemoveNode(RuntimeNode node)
32 | {
33 | for (int i = 0; i < bpNodes.arraySize; i++)
34 | {
35 | var sp = bpNodes.GetArrayElementAtIndex(i);
36 | if (sp.objectReferenceValue != node) continue;
37 | bpNodes.DeleteArrayElementAtIndex(i);
38 | return;
39 | }
40 | }
41 |
42 | public void AddGraph(GraphBlueprint graph)
43 | {
44 | bpGraphs.InsertArrayElementAtIndex(bpGraphs.arraySize);
45 | SerializedProperty sp = bpGraphs.GetArrayElementAtIndex(bpGraphs.arraySize - 1);
46 | sp.objectReferenceValue = graph;
47 | }
48 |
49 | public void RemoveGraph(GraphBlueprint graph)
50 | {
51 | for (int i = 0; i < bpGraphs.arraySize; i++)
52 | {
53 | var sp = bpGraphs.GetArrayElementAtIndex(i);
54 | if (sp.objectReferenceValue != graph) continue;
55 | bpGraphs.DeleteArrayElementAtIndex(i);
56 | return;
57 | }
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/EditorOnly/Search Window/GraphSearchWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEditor.Experimental.GraphView;
4 | using UnityEngine;
5 |
6 | namespace GraphFramework.Editor
7 | {
8 | public class GraphSearchWindow : ScriptableObject, ISearchWindowProvider
9 | {
10 | private GraphifyView graphView;
11 |
12 | public void Init(GraphifyView parentGraphView)
13 | {
14 | graphView = parentGraphView;
15 | }
16 |
17 | ///
18 | /// Creates a search true using the reflection data provided by RegisterToGraph
19 | /// attribute.
20 | ///
21 | public List CreateSearchTree(SearchWindowContext context)
22 | {
23 | var tree = GraphNodeSearchTreeProvider.
24 | CreateNodeSearchTreeFor(graphView.graphModel.serializedGraphBlueprint.GetType());
25 |
26 | return tree;
27 | }
28 |
29 | ///
30 | /// When an entry is selected, create that given node type and give it a default name
31 | /// based on the name segment of the registered path.
32 | ///
33 | public bool OnSelectEntry(SearchTreeEntry searchTreeEntry, SearchWindowContext context)
34 | {
35 | if (!(searchTreeEntry.userData is System.Type nodeType)) return false;
36 |
37 | if (typeof(RuntimeNode).IsAssignableFrom(nodeType))
38 | {
39 | graphView.CreateNewNode(searchTreeEntry.name, nodeType, context.screenMousePosition);
40 | return true;
41 | }
42 |
43 | //Register Stack registers to a GraphController.
44 | if (!typeof(CustomStackNode).IsAssignableFrom(nodeType)) return false;
45 |
46 | //Create a custom stack instance which runs the registration code... Yeah it's a bit weird but w/e
47 | if (!(Activator.CreateInstance(nodeType) is CustomStackNode act)) return false;
48 | graphView.CreateNewStack(searchTreeEntry.name, act.registeredTypes.ToArray(),
49 | context.screenMousePosition);
50 | return true;
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/EditorOnly/DataModels/StackModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using UnityEngine;
5 |
6 | namespace GraphFramework.Editor
7 | {
8 | [Serializable]
9 | public class StackModel : MovableModel
10 | {
11 | [SerializeField]
12 | protected string nodeTitle = "Untitled.";
13 | [SerializeField]
14 | protected Rect position = Rect.zero;
15 | [SerializeField]
16 | protected List allowedTypes = null;
17 |
18 | [NonSerialized]
19 | private StackView view;
20 | public StackView View => view;
21 |
22 | public static StackModel InstantiateModel(string nodeName, Type[] allowedTypes)
23 | {
24 | var model = new StackModel {nodeTitle = nodeName};
25 | if (allowedTypes != null && allowedTypes.Length > 0)
26 | {
27 | model.allowedTypes = new List(allowedTypes.Length);
28 | foreach (var type in allowedTypes)
29 | {
30 | model.allowedTypes.Add(new SerializableType(type));
31 | }
32 | }
33 |
34 | return model;
35 | }
36 |
37 | public StackView CreateView()
38 | {
39 | view = new StackView(this);
40 | view.Display();
41 | return view;
42 | }
43 |
44 | public void UpdatePosition()
45 | {
46 | position = view.GetPosition();
47 | }
48 |
49 | public bool IsTypeAllowed(Type t)
50 | {
51 | if (allowedTypes == null || allowedTypes.Count == 0)
52 | return true;
53 | return allowedTypes.Any(sType => t == sType.type);
54 | }
55 |
56 | public string NodeTitle
57 | {
58 | get => nodeTitle;
59 |
60 | set
61 | {
62 | nodeTitle = value;
63 | view?.OnDirty();
64 | }
65 | }
66 |
67 | public Rect Position
68 | {
69 | get => position;
70 | set
71 | {
72 | position = value;
73 | view?.OnDirty();
74 | }
75 | }
76 | }
77 | }
--------------------------------------------------------------------------------
/EditorOnly/Views/DynamicPortView.cs:
--------------------------------------------------------------------------------
1 | using UnityEditor.Experimental.GraphView;
2 | using UnityEngine;
3 | using UnityEngine.UIElements;
4 |
5 | namespace GraphFramework.Editor
6 | {
7 | public class DynamicPortView : VisualElement
8 | {
9 | public DynamicPortView(string portName, DynamicPortModel model, Direction dir)
10 | {
11 | VisualElement buttonContainer = new VisualElement();
12 | Label title = new Label{text = portName};
13 | buttonContainer.style.alignContent = new StyleEnum(Align.Stretch);
14 | Button plusButton = new Button {text = "+"};
15 | Button minusButton = new Button {text = "-"};
16 | plusButton.style.fontSize = 12f;
17 | minusButton.style.fontSize = 15f;
18 | plusButton.style.width = 18f;
19 | plusButton.style.height = 18f;
20 | minusButton.style.width = 18f;
21 | minusButton.style.height = 18f;
22 | plusButton.style.unityTextAlign = new StyleEnum(TextAnchor.MiddleCenter);
23 | minusButton.style.unityTextAlign = new StyleEnum(TextAnchor.MiddleCenter);
24 | plusButton.clicked += model.OnAddClicked;
25 | minusButton.clicked += model.OnRemoveClicked;
26 | buttonContainer.Add(title);
27 |
28 | switch (dir)
29 | {
30 | case Direction.Input:
31 | buttonContainer.style.flexDirection = new StyleEnum(FlexDirection.RowReverse);
32 | buttonContainer.Add(minusButton);
33 | buttonContainer.Add(plusButton);
34 | style.justifyContent = new StyleEnum(Justify.FlexStart);
35 | style.alignItems = new StyleEnum(Align.FlexStart);
36 | break;
37 | case Direction.Output:
38 | buttonContainer.style.flexDirection = new StyleEnum(FlexDirection.Row);
39 | buttonContainer.Add(plusButton);
40 | buttonContainer.Add(minusButton);
41 | style.justifyContent = new StyleEnum(Justify.FlexEnd);
42 | style.alignItems = new StyleEnum(Align.FlexEnd);
43 | break;
44 | }
45 |
46 | style.flexGrow = 1;
47 | style.flexDirection = new StyleEnum(FlexDirection.Column);
48 | Add(buttonContainer);
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/EditorOnly/Views/Renamer/Renamer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 | using UnityEngine;
4 | using UnityEngine.UIElements;
5 |
6 | namespace GraphFramework.Editor
7 | {
8 | internal class Renamer : VisualElement
9 | {
10 | private readonly Action namedCallback = null;
11 | private TextField nameField = null;
12 | private RenameWindow window = null;
13 |
14 | public Renamer(Action onNameCallback)
15 | {
16 | namedCallback = onNameCallback;
17 | }
18 |
19 | private void ListenForKeys(KeyUpEvent evnt)
20 | {
21 | switch (evnt.keyCode)
22 | {
23 | case KeyCode.Return:
24 | OnOkay();
25 | return;
26 | case KeyCode.Escape:
27 | OnCancel();
28 | return;
29 | }
30 | }
31 |
32 | public void Popup()
33 | {
34 | window = EditorWindow.GetWindow();
35 |
36 | var root = window.popupTree.Instantiate();
37 |
38 | var okayBtn = root.Q