├── .gitignore ├── Atom.GraphProcessor.asmdef ├── Atom.GraphProcessor.asmdef.meta ├── Core.meta ├── Core ├── Attributes.meta ├── Attributes │ ├── NodeMenuAttribute.cs │ ├── NodeMenuAttribute.cs.meta │ ├── NodeTitleAttribute.cs │ ├── NodeTitleAttribute.cs.meta │ ├── NodeTitleColorAttribute.cs │ ├── NodeTitleColorAttribute.cs.meta │ ├── NodeTooltipAttribute.cs │ └── NodeTooltipAttribute.cs.meta ├── Commands.meta ├── Commands │ ├── Commands.cs │ └── Commands.cs.meta ├── DataType.meta ├── DataType │ ├── Color.cs │ ├── Color.cs.meta │ ├── Vector2.cs │ ├── Vector2.cs.meta │ ├── Vector3.cs │ └── Vector3.cs.meta ├── Interfaces.meta ├── Interfaces │ ├── IGetPortValue.cs │ ├── IGetPortValue.cs.meta │ ├── IGraphElementProcessor.cs │ ├── IGraphElementProcessor.cs.meta │ ├── IGraphElementView.cs │ ├── IGraphElementView.cs.meta │ ├── IGraphOwner.cs │ ├── IGraphOwner.cs.meta │ ├── ISubGraph.cs │ └── ISubGraph.cs.meta ├── Models.meta ├── Models │ ├── BaseConnection.cs │ ├── BaseConnection.cs.meta │ ├── BaseGraph.cs │ ├── BaseGraph.cs.meta │ ├── BaseNode.cs │ ├── BaseNode.cs.meta │ ├── Group.cs │ ├── Group.cs.meta │ ├── StickyNote.cs │ └── StickyNote.cs.meta ├── Util.meta ├── Util │ ├── ConstValues.cs │ ├── ConstValues.cs.meta │ ├── GraphProcessorUtil.cs │ └── GraphProcessorUtil.cs.meta ├── ViewModels.meta └── ViewModels │ ├── BaseConnectionProcessor.cs │ ├── BaseConnectionProcessor.cs.meta │ ├── BaseGraphProcessor.Connections.cs │ ├── BaseGraphProcessor.Connections.cs.meta │ ├── BaseGraphProcessor.Groups.cs │ ├── BaseGraphProcessor.Groups.cs.meta │ ├── BaseGraphProcessor.Nodes.cs │ ├── BaseGraphProcessor.Nodes.cs.meta │ ├── BaseGraphProcessor.Notes.cs │ ├── BaseGraphProcessor.Notes.cs.meta │ ├── BaseGraphProcessor.cs │ ├── BaseGraphProcessor.cs.meta │ ├── BaseGroupProcessor.cs │ ├── BaseGroupProcessor.cs.meta │ ├── BaseNodeProcessor.cs │ ├── BaseNodeProcessor.cs.meta │ ├── BasePortProcessor.cs │ ├── BasePortProcessor.cs.meta │ ├── StickyNoteProcessor.cs │ └── StickyNoteProcessor.cs.meta ├── Examples.meta ├── Examples ├── FlowExample.meta ├── FlowExample │ ├── Editor.meta │ ├── Editor │ │ ├── FlowGraphView.cs │ │ ├── FlowGraphView.cs.meta │ │ ├── FlowGraphWindow.cs │ │ ├── FlowGraphWindow.cs.meta │ │ ├── StartNodeView.cs │ │ └── StartNodeView.cs.meta │ ├── New Flow Graph Asset.asset │ ├── New Flow Graph Asset.asset.meta │ ├── Runtime.meta │ └── Runtime │ │ ├── FlowGraphAsset.cs │ │ ├── FlowGraphAsset.cs.meta │ │ ├── FlowNode.cs │ │ ├── FlowNode.cs.meta │ │ ├── RefreshWwiseNode.cs │ │ ├── RefreshWwiseNode.cs.meta │ │ ├── SVNUpdateNode.cs │ │ ├── SVNUpdateNode.cs.meta │ │ ├── StartNode.cs │ │ └── StartNode.cs.meta ├── MathExample.meta └── MathExample │ ├── Editor.meta │ ├── Editor │ ├── ExampleNodeView.cs │ ├── ExampleNodeView.cs.meta │ ├── FloatNodeView.cs │ ├── FloatNodeView.cs.meta │ ├── LogNodeView.cs │ ├── LogNodeView.cs.meta │ ├── SampleConnectionView.cs │ ├── SampleConnectionView.cs.meta │ ├── SampleGraphView.cs │ ├── SampleGraphView.cs.meta │ ├── SampleGraphWindow.cs │ └── SampleGraphWindow.cs.meta │ ├── MathExample.unity │ ├── MathExample.unity.meta │ ├── New Sample Graph Asset.asset │ ├── New Sample Graph Asset.asset.meta │ ├── Runtime.meta │ └── Runtime │ ├── AddNode.cs │ ├── AddNode.cs.meta │ ├── FloatNode.cs │ ├── FloatNode.cs.meta │ ├── LogNode.cs │ ├── LogNode.cs.meta │ ├── SampleGraph.cs │ ├── SampleGraph.cs.meta │ ├── SampleGraphAsset.cs │ ├── SampleGraphAsset.cs.meta │ ├── SampleGraphTest.cs │ ├── SampleGraphTest.cs.meta │ ├── SubNode.cs │ └── SubNode.cs.meta ├── LICENSE ├── LICENSE.meta ├── README.md ├── README.md.meta ├── ScreenShot_1.png ├── ScreenShot_1.png.meta ├── ScreenShot_2.png ├── ScreenShot_2.png.meta ├── UnityEX.meta └── UnityEX ├── Editor.meta ├── Editor ├── Attributes.meta ├── Attributes │ ├── CustomViewAttribute.cs │ └── CustomViewAttribute.cs.meta ├── Inspectors.meta ├── Inspectors │ ├── BaseConnectionInspector.cs │ ├── BaseConnectionInspector.cs.meta │ ├── BaseGraphInspector.cs │ ├── BaseGraphInspector.cs.meta │ ├── BaseNodeInspector.cs │ └── BaseNodeInspector.cs.meta ├── Others.meta ├── Others │ ├── BaseSimpleNodeView.cs │ ├── BaseSimpleNodeView.cs.meta │ ├── BetterEdgeControl.cs │ ├── BetterEdgeControl.cs.meta │ ├── BetterGridBackground.cs │ ├── BetterGridBackground.cs.meta │ ├── EdgeConnectorListener.cs │ ├── EdgeConnectorListener.cs.meta │ ├── FlowPoint.cs │ ├── FlowPoint.cs.meta │ ├── InspectObject.cs │ └── InspectObject.cs.meta ├── Resources.meta ├── Resources │ ├── GraphProcessor.meta │ └── GraphProcessor │ │ ├── Skin.meta │ │ ├── Skin │ │ ├── Default Skin.asset │ │ └── Default Skin.asset.meta │ │ ├── Textures.meta │ │ ├── Textures │ │ ├── Infinity.png │ │ ├── Infinity.png.meta │ │ ├── PlayIcon.png │ │ ├── PlayIcon.png.meta │ │ ├── PlayIcon1.png │ │ ├── PlayIcon1.png.meta │ │ ├── Save.png │ │ └── Save.png.meta │ │ ├── USS.meta │ │ ├── USS │ │ ├── BaseConnectionView.uss │ │ ├── BaseConnectionView.uss.meta │ │ ├── BaseGraphView.uss │ │ ├── BaseGraphView.uss.meta │ │ ├── BaseNodeView.uss │ │ ├── BaseNodeView.uss.meta │ │ ├── BasePortView.uss │ │ ├── BasePortView.uss.meta │ │ ├── BaseSimpleNodeView.uss │ │ ├── BaseSimpleNodeView.uss.meta │ │ ├── BasicStyle.uss │ │ ├── BasicStyle.uss.meta │ │ ├── GroupView.uss │ │ ├── GroupView.uss.meta │ │ ├── StickyNodeView.uss │ │ └── StickyNodeView.uss.meta │ │ ├── UXML.meta │ │ └── UXML │ │ ├── GraphWindow.uxml │ │ └── GraphWindow.uxml.meta ├── Utils.meta ├── Utils │ ├── GraphProcessorEditorSettings.cs │ ├── GraphProcessorEditorSettings.cs.meta │ ├── GraphProcessorEditorStyles.cs │ ├── GraphProcessorEditorStyles.cs.meta │ ├── GraphProcessorEditorUtil.cs │ └── GraphProcessorEditorUtil.cs.meta ├── Views.meta └── Views │ ├── BaseConnectionView.cs │ ├── BaseConnectionView.cs.meta │ ├── BaseGraphView.cs │ ├── BaseGraphView.cs.meta │ ├── BaseGraphWindow.cs │ ├── BaseGraphWindow.cs.meta │ ├── BaseNodeView.cs │ ├── BaseNodeView.cs.meta │ ├── BasePortView.cs │ ├── BasePortView.cs.meta │ ├── Defaults.meta │ ├── Defaults │ ├── DefaultConnectionViewcs.cs │ ├── DefaultConnectionViewcs.cs.meta │ ├── DefaultGraphView.cs │ ├── DefaultGraphView.cs.meta │ ├── DefaultGraphWindow.cs │ ├── DefaultGraphWindow.cs.meta │ ├── DefaultNodeView.cs │ ├── DefaultNodeView.cs.meta │ ├── DefaultPortViewcs.cs │ └── DefaultPortViewcs.cs.meta │ ├── GraphViewContext.cs │ ├── GraphViewContext.cs.meta │ ├── GroupView.cs │ ├── GroupView.cs.meta │ ├── Internals.meta │ ├── Internals │ ├── BaseConnectionView.Internal.cs │ ├── BaseConnectionView.Internal.cs.meta │ ├── BaseGraphView.Internal.cs │ ├── BaseGraphView.Internal.cs.meta │ ├── BaseNodeView.Internal.cs │ ├── BaseNodeView.Internal.cs.meta │ ├── BasePortView.Internal.cs │ ├── BasePortView.Internal.cs.meta │ ├── BaseVisualElement.cs │ ├── BaseVisualElement.cs.meta │ ├── GroupView.Internal.cs │ └── GroupView.Internal.cs.meta │ ├── NodeMenuWindow.cs │ ├── NodeMenuWindow.cs.meta │ ├── StickyNoteView.cs │ └── StickyNoteView.cs.meta ├── Runtime.meta └── Runtime ├── ExtMethodsForUnity.cs ├── ExtMethodsForUnity.cs.meta ├── GraphAssetOwner.cs ├── GraphAssetOwner.cs.meta ├── Inaterfaces.meta └── Inaterfaces ├── IGraphAsset.cs ├── IGraphAsset.cs.meta ├── IGraphAssetOwner.cs └── IGraphAssetOwner.cs.meta /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | 13 | # Asset meta data should only be ignored when the corresponding asset is also ignored 14 | !/[Aa]ssets/**/*.meta 15 | 16 | # Uncomment this line if you wish to ignore the asset store tools plugin 17 | # /[Aa]ssets/AssetStoreTools* 18 | 19 | # Autogenerated Jetbrains Rider plugin 20 | [Aa]ssets/Plugins/Editor/JetBrains* 21 | 22 | # Visual Studio cache directory 23 | .vs/ 24 | 25 | # Gradle cache directory 26 | .gradle/ 27 | 28 | # Autogenerated VS/MD/Consulo solution and project files 29 | ExportedObj/ 30 | .consulo/ 31 | *.csproj 32 | *.unityproj 33 | *.sln 34 | *.suo 35 | *.tmp 36 | *.user 37 | *.userprefs 38 | *.pidb 39 | *.booproj 40 | *.svd 41 | *.pdb 42 | *.mdb 43 | *.opendb 44 | *.VC.db 45 | 46 | # Unity3D generated meta files 47 | *.pidb.meta 48 | *.pdb.meta 49 | *.mdb.meta 50 | 51 | # Unity3D generated file on crash reports 52 | sysinfo.txt 53 | 54 | # Builds 55 | *.apk 56 | *.unitypackage 57 | 58 | # Crashlytics generated file 59 | crashlytics-build.properties 60 | 61 | -------------------------------------------------------------------------------- /Atom.GraphProcessor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Atom.GraphProcessor", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:5957643ee62fb75498d29ee03d7011ef", 6 | "GUID:343deaaf83e0cee4ca978e7df0b80d21", 7 | "GUID:2bafac87e7f4b9b418d9448d219b01ab" 8 | ], 9 | "includePlatforms": [], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [], 16 | "versionDefines": [], 17 | "noEngineReferences": false 18 | } -------------------------------------------------------------------------------- /Atom.GraphProcessor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 563d9f79a73247849a4c82325e8175cb 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: faa07fcf2c231534cbbeffd860989b8f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Core/Attributes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ae7dac74c00ff344a78841bbe380289 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Core/Attributes/NodeMenuAttribute.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | 18 | namespace Atom.GraphProcessor 19 | { 20 | /// 节点菜单,和自定义节点名 21 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 22 | public class NodeMenuAttribute : Attribute 23 | { 24 | /// 节点路径 25 | public string path; 26 | /// 是否要显示在节点菜单中 27 | public bool hidden; 28 | 29 | public NodeMenuAttribute(string path) 30 | { 31 | this.path = path; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Core/Attributes/NodeMenuAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 111e7832a1849ed4392956b1e5d59e24 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Attributes/NodeTitleAttribute.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | 18 | namespace Atom.GraphProcessor 19 | { 20 | /// 节点标题 21 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] 22 | public class NodeTitleAttribute : Attribute 23 | { 24 | /// 节点标题名称 25 | public string title; 26 | 27 | public NodeTitleAttribute(string title) 28 | { 29 | this.title = title; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Core/Attributes/NodeTitleAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6ad14c54aea62f40bdc2a4a3c306b22 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Attributes/NodeTitleColorAttribute.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | 18 | namespace Atom.GraphProcessor 19 | { 20 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 21 | public class NodeTitleColorAttribute : Attribute 22 | { 23 | public readonly InternalColor color; 24 | 25 | public NodeTitleColorAttribute(float r, float g, float b) 26 | { 27 | color = new InternalColor(r, g, b, 1); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Core/Attributes/NodeTitleColorAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43fdaea1aeff271428ee7d734f90eb17 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Attributes/NodeTooltipAttribute.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | 18 | namespace Atom.GraphProcessor 19 | { 20 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] 21 | public class NodeTooltipAttribute : Attribute 22 | { 23 | public readonly string Tooltip; 24 | 25 | public NodeTooltipAttribute(string tooltip) 26 | { 27 | Tooltip = tooltip; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Core/Attributes/NodeTooltipAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c848abd890f59c47bce4fb09e5b6831 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Commands.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5dbda285a4047b149bb41db0b740a587 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Core/Commands/Commands.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9007a60f85641af4ea6aed604689dafa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/DataType.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63a764149b1bc1940a1d92b63cd83105 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Core/DataType/Color.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | 18 | namespace Atom.GraphProcessor 19 | { 20 | [Serializable] 21 | public struct InternalColor : IEquatable 22 | { 23 | public float r; 24 | public float g; 25 | public float b; 26 | public float a; 27 | 28 | public InternalColor(float r, float g, float b) 29 | { 30 | this.r = r; 31 | this.g = g; 32 | this.b = b; 33 | this.a = 1; 34 | } 35 | 36 | public InternalColor(float r, float g, float b, float a) 37 | { 38 | this.r = r; 39 | this.g = g; 40 | this.b = b; 41 | this.a = a; 42 | } 43 | 44 | public bool Equals(InternalColor other) 45 | { 46 | return r.Equals(other.r) && g.Equals(other.g) && b.Equals(other.b) && a.Equals(other.a); 47 | } 48 | 49 | public override bool Equals(object obj) 50 | { 51 | return obj is InternalColor other && Equals(other); 52 | } 53 | 54 | public override int GetHashCode() 55 | { 56 | unchecked 57 | { 58 | var hashCode = r.GetHashCode(); 59 | hashCode = (hashCode * 397) ^ g.GetHashCode(); 60 | hashCode = (hashCode * 397) ^ b.GetHashCode(); 61 | hashCode = (hashCode * 397) ^ a.GetHashCode(); 62 | return hashCode; 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Core/DataType/Color.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 102d567def69cc048a72eb304998c8dd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/DataType/Vector2.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | 18 | namespace Atom.GraphProcessor 19 | { 20 | [Serializable] 21 | public struct InternalVector2Int : IEquatable 22 | { 23 | public int x; 24 | public int y; 25 | 26 | public InternalVector2Int(int x, int y) 27 | { 28 | this.x = x; 29 | this.y = y; 30 | } 31 | 32 | private static readonly InternalVector2Int zeroVector = new InternalVector2Int(0, 0); 33 | 34 | private static readonly InternalVector2Int oneVector = new InternalVector2Int(1, 1); 35 | 36 | private static readonly InternalVector2Int upVector = new InternalVector2Int(0, 1); 37 | 38 | private static readonly InternalVector2Int downVector = new InternalVector2Int(0, -1); 39 | 40 | private static readonly InternalVector2Int leftVector = new InternalVector2Int(-1, 0); 41 | 42 | private static readonly InternalVector2Int rightVector = new InternalVector2Int(1, 0); 43 | 44 | public static InternalVector2Int zero => zeroVector; 45 | 46 | public static InternalVector2Int one => oneVector; 47 | 48 | public static InternalVector2Int up => upVector; 49 | 50 | public static InternalVector2Int down => downVector; 51 | 52 | public static InternalVector2Int left => leftVector; 53 | 54 | public static InternalVector2Int right => rightVector; 55 | 56 | public static implicit operator InternalVector3Int(InternalVector2Int other) 57 | { 58 | return new InternalVector3Int(other.x, other.y, 0); 59 | } 60 | 61 | public static InternalVector2Int operator +(InternalVector2Int lhs, InternalVector2Int rhs) 62 | { 63 | return new InternalVector2Int(lhs.x + rhs.x, lhs.y + rhs.y); 64 | } 65 | 66 | public static InternalVector2Int operator -(InternalVector2Int lhs, InternalVector2Int rhs) 67 | { 68 | return new InternalVector2Int(lhs.x - rhs.x, lhs.y - rhs.y); 69 | } 70 | 71 | public static bool operator ==(InternalVector2Int lhs, InternalVector2Int rhs) 72 | { 73 | return lhs.x == rhs.x && lhs.y == rhs.y; 74 | } 75 | 76 | public static bool operator !=(InternalVector2Int lhs, InternalVector2Int rhs) 77 | { 78 | return !(lhs == rhs); 79 | } 80 | 81 | public override bool Equals(object other) 82 | { 83 | if (!(other is InternalVector2Int)) 84 | return false; 85 | return Equals((InternalVector2Int)other); 86 | } 87 | 88 | public bool Equals(InternalVector2Int other) 89 | { 90 | return x == other.x && y == other.y; 91 | } 92 | 93 | public override int GetHashCode() 94 | { 95 | return x.GetHashCode() ^ (y.GetHashCode() << 2); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Core/DataType/Vector2.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6de2d7d414e50fd458da6db20e8c5262 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/DataType/Vector3.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | 21 | namespace Atom.GraphProcessor 22 | { 23 | [Serializable] 24 | public struct InternalVector3Int 25 | { 26 | public int x; 27 | public int y; 28 | public int z; 29 | 30 | public InternalVector3Int(int x, int y, int z) 31 | { 32 | this.x = x; 33 | this.y = y; 34 | this.z = z; 35 | } 36 | 37 | private static readonly InternalVector3Int zeroVector = new InternalVector3Int(0, 0, 0); 38 | 39 | private static readonly InternalVector3Int oneVector = new InternalVector3Int(1, 1, 1); 40 | 41 | private static readonly InternalVector3Int upVector = new InternalVector3Int(0, 1, 0); 42 | 43 | private static readonly InternalVector3Int downVector = new InternalVector3Int(0, -1, 0); 44 | 45 | private static readonly InternalVector3Int leftVector = new InternalVector3Int(-1, 0, 0); 46 | 47 | private static readonly InternalVector3Int rightVector = new InternalVector3Int(1, 0, 0); 48 | 49 | private static readonly InternalVector3Int forwardVector = new InternalVector3Int(0, 0, 1); 50 | 51 | private static readonly InternalVector3Int backVector = new InternalVector3Int(0, 0, -1); 52 | 53 | public static InternalVector3Int zero => zeroVector; 54 | 55 | public static InternalVector3Int one => oneVector; 56 | 57 | public static InternalVector3Int forward => forwardVector; 58 | 59 | public static InternalVector3Int back => backVector; 60 | 61 | public static InternalVector3Int up => upVector; 62 | 63 | public static InternalVector3Int down => downVector; 64 | 65 | public static InternalVector3Int left => leftVector; 66 | 67 | public static InternalVector3Int right => rightVector; 68 | 69 | public static implicit operator InternalVector2Int(InternalVector3Int other) 70 | { 71 | return new InternalVector2Int(other.x, other.y); 72 | } 73 | 74 | public static InternalVector3Int operator +(InternalVector3Int lhs, InternalVector3Int rhs) 75 | { 76 | return new InternalVector3Int(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z); 77 | } 78 | 79 | public static InternalVector3Int operator -(InternalVector3Int lhs, InternalVector3Int rhs) 80 | { 81 | return new InternalVector3Int(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z); 82 | } 83 | 84 | public static bool operator ==(InternalVector3Int lhs, InternalVector3Int rhs) 85 | { 86 | return lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z; 87 | } 88 | 89 | public static bool operator !=(InternalVector3Int lhs, InternalVector3Int rhs) 90 | { 91 | return !(lhs == rhs); 92 | } 93 | 94 | public override bool Equals(object other) 95 | { 96 | if (!(other is InternalVector3Int)) 97 | return false; 98 | return Equals((InternalVector3Int)other); 99 | } 100 | 101 | public bool Equals(InternalVector3Int other) 102 | { 103 | return x == other.x && y == other.y && z == other.z; 104 | } 105 | 106 | public override int GetHashCode() 107 | { 108 | return x.GetHashCode() ^ y.GetHashCode() << 2 ^ z.GetHashCode() >> 2; 109 | } 110 | } 111 | } -------------------------------------------------------------------------------- /Core/DataType/Vector3.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab9d583471e830045aeb09335aab5853 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Interfaces.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a6b65fbaba0a194bba198879bc2624a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Core/Interfaces/IGetPortValue.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | namespace Atom.GraphProcessor 18 | { 19 | public interface IGetPortValue 20 | { 21 | object GetValue(string portName); 22 | } 23 | 24 | public interface IGetPortValue 25 | { 26 | T GetValue(string portName); 27 | } 28 | 29 | public interface ISetPortValue 30 | { 31 | void GetValue(string portName, object value); 32 | } 33 | 34 | public interface ISetPortValue 35 | { 36 | void GetValue(string portName, T value); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Core/Interfaces/IGetPortValue.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0fe49ed62b10b68408a982b8a455b462 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Interfaces/IGraphElementProcessor.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | 21 | namespace Atom.GraphProcessor 22 | { 23 | public interface IGraphElementProcessor 24 | { 25 | object Model { get; } 26 | 27 | Type ModelType { get; } 28 | } 29 | 30 | public interface IGraphElementProcessor : IGraphElementProcessor 31 | { 32 | 33 | } 34 | 35 | public interface IGraphElementProcessor_Scope 36 | { 37 | public InternalVector2Int Position { get; set; } 38 | } 39 | } -------------------------------------------------------------------------------- /Core/Interfaces/IGraphElementProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc76be076b0a605449eeae5427d574c4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Interfaces/IGraphElementView.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | namespace Atom.GraphProcessor.Editors 18 | { 19 | public interface IGraphElementView 20 | { 21 | IGraphElementProcessor V { get; } 22 | 23 | void Init(); 24 | 25 | void UnInit(); 26 | } 27 | 28 | public interface IGraphElementView : IGraphElementView where T: IGraphElementProcessor 29 | { 30 | T ViewModel { get; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Core/Interfaces/IGraphElementView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99a79fc1ecaa8ca4181747cce3a2e626 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Interfaces/IGraphOwner.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | namespace Atom.GraphProcessor 18 | { 19 | public interface IGraphOwner 20 | { 21 | BaseGraphProcessor Graph { get; } 22 | } 23 | } -------------------------------------------------------------------------------- /Core/Interfaces/IGraphOwner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb0a9854c223c8748b22b21d842c48c6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Interfaces/ISubGraph.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | namespace Atom.GraphProcessor 18 | { 19 | public interface ISubGraph 20 | { 21 | BaseGraphProcessor Parent { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Core/Interfaces/ISubGraph.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ac868ddd7e3aa3468c545c391a03e9b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Models.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf115774aba648442ab2a796e56b63d2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Core/Models/BaseConnection.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | 21 | namespace Atom.GraphProcessor 22 | { 23 | #if UNITY_5_3_OR_NEWER 24 | [Serializable] 25 | public class BaseConnection 26 | { 27 | [UnityEngine.HideInInspector] public int fromNode; 28 | [UnityEngine.HideInInspector] public string fromPort; 29 | [UnityEngine.HideInInspector] public int toNode; 30 | [UnityEngine.HideInInspector] public string toPort; 31 | } 32 | #else 33 | [Serializable] 34 | public class BaseConnection 35 | { 36 | public int fromNode; 37 | public string fromPort; 38 | public int toNode; 39 | public string toPort; 40 | } 41 | #endif 42 | } -------------------------------------------------------------------------------- /Core/Models/BaseConnection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 60a7fbb31d38c494fb038a93af6f1f4c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Models/BaseGraph.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | 22 | namespace Atom.GraphProcessor 23 | { 24 | #if UNITY_5_3_OR_NEWER 25 | [Serializable] 26 | public class BaseGraph 27 | { 28 | public float zoom = 1; 29 | public InternalVector2Int pan = new InternalVector2Int(0, 0); 30 | [UnityEngine.SerializeReference] public List nodes = new List(); 31 | [UnityEngine.SerializeReference] public List connections = new List(); 32 | public List groups = new List(); 33 | public List notes = new List(); 34 | } 35 | #else 36 | [Serializable] 37 | public class BaseGraph 38 | { 39 | public float zoom = 1; 40 | public InternalVector2Int pan = new InternalVector2Int(0, 0); 41 | public List nodes = new List(); 42 | public List connections = new List(); 43 | public List groups = new List(); 44 | public List notes = new List(); 45 | } 46 | #endif 47 | } -------------------------------------------------------------------------------- /Core/Models/BaseGraph.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95c0b3a70a9791c47abdfe75d48837f2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Models/BaseNode.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | 21 | namespace Atom.GraphProcessor 22 | { 23 | #if UNITY_5_4_OR_NEWER 24 | [Serializable] 25 | public abstract class BaseNode 26 | { 27 | [UnityEngine.HideInInspector] public int id; 28 | [UnityEngine.HideInInspector] public InternalVector2Int position; 29 | } 30 | #else 31 | [Serializable] 32 | public abstract class BaseNode 33 | { 34 | public int id; 35 | public InternalVector2Int position; 36 | } 37 | #endif 38 | } -------------------------------------------------------------------------------- /Core/Models/BaseNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 544db857bc277914a8c7820c983234ce 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Models/Group.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | using System; 18 | using System.Collections.Generic; 19 | 20 | namespace Atom.GraphProcessor 21 | { 22 | [Serializable] 23 | public sealed class Group 24 | { 25 | public int id; 26 | public string groupName; 27 | public InternalVector2Int position; 28 | public InternalVector2Int size; 29 | public InternalColor backgroundColor = new InternalColor(0.3f, 0.3f, 0.3f, 0.3f); 30 | public List nodes = new List(); 31 | } 32 | } -------------------------------------------------------------------------------- /Core/Models/Group.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61962af02cf4c1c428dcb0c9a72347e5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/Models/StickyNote.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | using System; 18 | 19 | namespace Atom.GraphProcessor 20 | { 21 | [Serializable] 22 | public sealed class StickyNote 23 | { 24 | public int id; 25 | public InternalVector2Int position; 26 | public InternalVector2Int size; 27 | public string title; 28 | public string content; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Core/Models/StickyNote.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ffe0a60e6064fba9463418d0857da44 3 | timeCreated: 1706384849 -------------------------------------------------------------------------------- /Core/Util.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4f1aeaf3bbd40e79a8f2c51408c64f0 3 | timeCreated: 1678089083 -------------------------------------------------------------------------------- /Core/Util/ConstValues.cs: -------------------------------------------------------------------------------- 1 | namespace Atom.GraphProcessor 2 | { 3 | public static class ConstValues 4 | { 5 | public const string FLOW_IN_PORT_NAME = "Flow-In"; 6 | public const string FLOW_OUT_PORT_NAME = "Flow-Out"; 7 | public const string NODE_TITLE_NAME = nameof(BaseNodeProcessor.Title); 8 | public const string NODE_TITLE_COLOR_NAME = nameof(BaseNodeProcessor.TitleColor); 9 | public const string NODE_TOOLTIP_NAME = nameof(BaseNodeProcessor.Tooltip); 10 | } 11 | } -------------------------------------------------------------------------------- /Core/Util/ConstValues.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b95a7c370744e25892d19ac341580ad 3 | timeCreated: 1724216874 -------------------------------------------------------------------------------- /Core/Util/GraphProcessorUtil.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Reflection; 22 | using System.Runtime.CompilerServices; 23 | 24 | namespace Atom.GraphProcessor 25 | { 26 | public struct ToggleValue 27 | { 28 | public bool enable; 29 | public T value; 30 | } 31 | 32 | public class NodeStaticInfo 33 | { 34 | public string path; 35 | public string[] menu; 36 | public bool hidden; 37 | public string title; 38 | public string tooltip; 39 | public ToggleValue customTitleColor; 40 | } 41 | 42 | public static class GraphProcessorUtil 43 | { 44 | private static bool s_Initialized; 45 | private static Dictionary s_NodeStaticInfos = new Dictionary(); 46 | 47 | public static Dictionary NodeStaticInfos 48 | { 49 | get { return s_NodeStaticInfos; } 50 | } 51 | 52 | static GraphProcessorUtil() 53 | { 54 | Init(true); 55 | } 56 | 57 | public static void Init(bool force) 58 | { 59 | if (!force && s_Initialized) 60 | return; 61 | 62 | if (s_NodeStaticInfos == null) 63 | s_NodeStaticInfos = new Dictionary(); 64 | else 65 | s_NodeStaticInfos.Clear(); 66 | 67 | foreach (var t in TypesCache.GetTypesDerivedFrom()) 68 | { 69 | if (t.IsAbstract) 70 | continue; 71 | 72 | var nodeStaticInfo = new NodeStaticInfo(); 73 | nodeStaticInfo.title = t.Name; 74 | nodeStaticInfo.tooltip = string.Empty; 75 | nodeStaticInfo.customTitleColor = new ToggleValue(); 76 | NodeStaticInfos.Add(t, nodeStaticInfo); 77 | var nodeMenuAttribute = t.GetCustomAttribute(typeof(NodeMenuAttribute)) as NodeMenuAttribute; 78 | if (nodeMenuAttribute != null) 79 | { 80 | if (!string.IsNullOrEmpty(nodeMenuAttribute.path)) 81 | { 82 | nodeStaticInfo.path = nodeMenuAttribute.path; 83 | nodeStaticInfo.menu = nodeMenuAttribute.path.Split('/'); 84 | nodeStaticInfo.title = nodeStaticInfo.menu[nodeStaticInfo.menu.Length - 1]; 85 | } 86 | else 87 | { 88 | nodeStaticInfo.path = t.Name; 89 | nodeStaticInfo.menu = new string[] { t.Name }; 90 | nodeStaticInfo.title = t.Name; 91 | } 92 | 93 | nodeStaticInfo.hidden = nodeMenuAttribute.hidden; 94 | } 95 | else 96 | { 97 | nodeStaticInfo.path = t.Name; 98 | nodeStaticInfo.menu = new string[] { t.Name }; 99 | nodeStaticInfo.title = t.Name; 100 | nodeStaticInfo.hidden = false; 101 | } 102 | 103 | var titleAttribute = t.GetCustomAttribute(typeof(NodeTitleAttribute)) as NodeTitleAttribute; 104 | if (titleAttribute != null && !string.IsNullOrEmpty(titleAttribute.title)) 105 | nodeStaticInfo.title = titleAttribute.title; 106 | 107 | var tooltipAttribute = t.GetCustomAttribute(typeof(NodeTooltipAttribute)) as NodeTooltipAttribute; 108 | if (tooltipAttribute != null) 109 | nodeStaticInfo.tooltip = tooltipAttribute.Tooltip; 110 | 111 | var titleColorAttribute = t.GetCustomAttribute(typeof(NodeTitleColorAttribute)) as NodeTitleColorAttribute; 112 | if (titleColorAttribute != null) 113 | { 114 | nodeStaticInfo.customTitleColor.enable = true; 115 | nodeStaticInfo.customTitleColor.value = titleColorAttribute.color; 116 | } 117 | } 118 | 119 | s_Initialized = true; 120 | } 121 | 122 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 123 | public static T ModelAs(this IGraphElementProcessor graphElement) where T : class 124 | { 125 | return graphElement.Model as T; 126 | } 127 | 128 | public static T Model(this IGraphElementProcessor graphElement) where T : class 129 | { 130 | return graphElement.Model as T; 131 | } 132 | } 133 | } -------------------------------------------------------------------------------- /Core/Util/GraphProcessorUtil.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61ef62c6ad68316459ac69f0134b9f07 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/ViewModels.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c9e64fa53c23f442b6c5dd4377f0a4f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Core/ViewModels/BaseConnectionProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b393fdf09df20fc4995ef9f7ab60feac 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/ViewModels/BaseGraphProcessor.Connections.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32edc9dcd612489d878ac1c4f2406477 3 | timeCreated: 1728378013 -------------------------------------------------------------------------------- /Core/ViewModels/BaseGraphProcessor.Groups.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | 22 | namespace Atom.GraphProcessor 23 | { 24 | public partial class BaseGraphProcessor 25 | { 26 | #region Fields 27 | private Groups groups; 28 | 29 | public event Action OnGroupAdded; 30 | public event Action OnGroupRemoved; 31 | 32 | #endregion 33 | 34 | #region Properties 35 | 36 | public Groups Groups => groups; 37 | 38 | #endregion 39 | 40 | private void InitGroups() 41 | { 42 | this.groups = new Groups(); 43 | 44 | for (int i = 0; i < Model.groups.Count; i++) 45 | { 46 | var group = Model.groups[i]; 47 | if (group == null) 48 | { 49 | Model.groups.RemoveAt(i--); 50 | continue; 51 | } 52 | 53 | for (int j = group.nodes.Count - 1; j >= 0; j--) 54 | { 55 | if (!nodes.ContainsKey(group.nodes[j])) 56 | group.nodes.RemoveAt(j); 57 | } 58 | 59 | var groupVM = (GroupProcessor)ViewModelFactory.ProduceViewModel(group); 60 | groupVM.Owner = this; 61 | groups.AddGroup(groupVM); 62 | } 63 | } 64 | 65 | #region API 66 | 67 | public void AddGroup(GroupProcessor group) 68 | { 69 | groups.AddGroup(group); 70 | Model.groups.Add(group.Model); 71 | group.Owner = this; 72 | OnGroupAdded?.Invoke(group); 73 | } 74 | 75 | public void RemoveGroup(GroupProcessor group) 76 | { 77 | groups.RemoveGroup(group); 78 | Model.groups.Remove(group.Model); 79 | OnGroupRemoved?.Invoke(group); 80 | } 81 | 82 | public virtual GroupProcessor NewGroup(string groupName) 83 | { 84 | var group = new Group() 85 | { 86 | id = NewID(), 87 | groupName = groupName 88 | }; 89 | return ViewModelFactory.ProduceViewModel(group) as GroupProcessor; 90 | } 91 | 92 | #endregion 93 | } 94 | 95 | public class Groups 96 | { 97 | private Dictionary groupMap = new Dictionary(); 98 | private Dictionary nodeGroupMap = new Dictionary(); 99 | 100 | public IReadOnlyDictionary GroupMap 101 | { 102 | get { return groupMap; } 103 | } 104 | 105 | public IReadOnlyDictionary NodeGroupMap 106 | { 107 | get { return nodeGroupMap; } 108 | } 109 | 110 | public void AddNodeToGroup(GroupProcessor group, BaseNodeProcessor node) 111 | { 112 | var nodes = new BaseNodeProcessor[] { node }; 113 | if (nodeGroupMap.TryGetValue(node.ID, out var _group)) 114 | { 115 | if (_group == group) 116 | { 117 | return; 118 | } 119 | else 120 | { 121 | _group.Model.nodes.Remove(node.ID); 122 | _group.NotifyNodeRemoved(nodes); 123 | } 124 | } 125 | 126 | nodeGroupMap[node.ID] = group; 127 | group.Model.nodes.Add(node.ID); 128 | group.NotifyNodeAdded(nodes); 129 | } 130 | 131 | public void RemoveNodeFromGroup(BaseNodeProcessor node) 132 | { 133 | if (!nodeGroupMap.TryGetValue(node.ID, out var group)) 134 | return; 135 | 136 | var nodes = new BaseNodeProcessor[] { node }; 137 | nodeGroupMap.Remove(node.ID); 138 | group.Model.nodes.Remove(node.ID); 139 | group.NotifyNodeRemoved(nodes); 140 | } 141 | 142 | public void AddGroup(GroupProcessor group) 143 | { 144 | this.groupMap.Add(group.ID, group); 145 | foreach (var pair in groupMap) 146 | { 147 | foreach (var nodeID in pair.Value.Nodes) 148 | { 149 | this.nodeGroupMap[nodeID] = pair.Value; 150 | } 151 | } 152 | } 153 | 154 | public void RemoveGroup(GroupProcessor group) 155 | { 156 | foreach (var nodeID in group.Nodes) 157 | { 158 | nodeGroupMap.Remove(nodeID); 159 | } 160 | 161 | groupMap.Remove(group.ID); 162 | } 163 | } 164 | } -------------------------------------------------------------------------------- /Core/ViewModels/BaseGraphProcessor.Groups.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3cc72944ce0b43e1ad77be35287a5550 3 | timeCreated: 1726280308 -------------------------------------------------------------------------------- /Core/ViewModels/BaseGraphProcessor.Nodes.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | 22 | namespace Atom.GraphProcessor 23 | { 24 | public partial class BaseGraphProcessor 25 | { 26 | #region Fields 27 | 28 | private Dictionary nodes; 29 | 30 | public event Action OnNodeAdded; 31 | public event Action OnNodeRemoved; 32 | 33 | #endregion 34 | 35 | #region Properties 36 | 37 | public IReadOnlyDictionary Nodes => nodes; 38 | 39 | #endregion 40 | 41 | private void BeginInitNodes() 42 | { 43 | this.nodes = new Dictionary(Model.nodes.Count); 44 | for (var index = 0; index < Model.nodes.Count; index++) 45 | { 46 | var node = Model.nodes[index]; 47 | if (node == null) 48 | continue; 49 | var nodeProcessor = (BaseNodeProcessor)ViewModelFactory.ProduceViewModel(node); 50 | nodeProcessor.Owner = this; 51 | nodeProcessor.Index = index; 52 | nodes.Add(node.id, nodeProcessor); 53 | } 54 | } 55 | 56 | private void EndInitNodes() 57 | { 58 | foreach (var node in nodes.Values) 59 | { 60 | node.Enable(); 61 | } 62 | } 63 | 64 | #region API 65 | 66 | public BaseNodeProcessor AddNode(InternalVector2Int position) where T : BaseNode, new() 67 | { 68 | return AddNode(TypeCache.TYPE, position); 69 | } 70 | 71 | public BaseNodeProcessor AddNode(Type nodeType, InternalVector2Int position) 72 | { 73 | var nodeVM = NewNode(nodeType, position); 74 | AddNode(nodeVM); 75 | return nodeVM; 76 | } 77 | 78 | public BaseNodeProcessor AddNode(BaseNode nodeData) 79 | { 80 | var nodeVM = ViewModelFactory.ProduceViewModel(nodeData) as BaseNodeProcessor; 81 | AddNode(nodeVM); 82 | return nodeVM; 83 | } 84 | 85 | public void AddNode(BaseNodeProcessor node) 86 | { 87 | nodes.Add(node.ID, node); 88 | model.nodes.Add(node.Model); 89 | node.Owner = this; 90 | node.Index = model.nodes.Count - 1; 91 | node.Enable(); 92 | OnNodeAdded?.Invoke(node); 93 | } 94 | 95 | public void RemoveNodeByID(int id) 96 | { 97 | RemoveNode(Nodes[id]); 98 | } 99 | 100 | public void RemoveNode(BaseNodeProcessor node) 101 | { 102 | if (node.Owner != this) 103 | throw new NullReferenceException("节点不是此Graph中"); 104 | 105 | if (groups.NodeGroupMap.TryGetValue(node.ID, out var group)) 106 | groups.RemoveNodeFromGroup(node); 107 | 108 | Disconnect(node); 109 | nodes.Remove(node.ID); 110 | model.nodes.Remove(node.Model); 111 | node.Disable(); 112 | for (int index = 0; index < model.nodes.Count; index++) 113 | { 114 | var nodeData = model.nodes[index]; 115 | nodes[nodeData.id].Index = index; 116 | } 117 | OnNodeRemoved?.Invoke(node); 118 | } 119 | 120 | public virtual BaseNodeProcessor NewNode(Type nodeType, InternalVector2Int position) 121 | { 122 | var node = Activator.CreateInstance(nodeType) as BaseNode; 123 | node.id = NewID(); 124 | node.position = position; 125 | return ViewModelFactory.ProduceViewModel(node) as BaseNodeProcessor; 126 | } 127 | 128 | public virtual BaseNodeProcessor NewNode(InternalVector2Int position) where TNode : BaseNode, new() 129 | { 130 | var node = new TNode() 131 | { 132 | id = NewID(), 133 | position = position 134 | }; 135 | return ViewModelFactory.ProduceViewModel(node) as BaseNodeProcessor; 136 | } 137 | 138 | #endregion 139 | } 140 | } -------------------------------------------------------------------------------- /Core/ViewModels/BaseGraphProcessor.Nodes.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ba75c778aca4100911a2ce306d6b30d 3 | timeCreated: 1728378257 -------------------------------------------------------------------------------- /Core/ViewModels/BaseGraphProcessor.Notes.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | 22 | namespace Atom.GraphProcessor 23 | { 24 | public partial class BaseGraphProcessor 25 | { 26 | #region Fields 27 | 28 | private Dictionary notes; 29 | 30 | public event Action OnNoteAdded; 31 | public event Action OnNoteRemoved; 32 | 33 | #endregion 34 | 35 | #region Properties 36 | 37 | public IReadOnlyDictionary Notes => notes; 38 | 39 | #endregion 40 | 41 | private void InitNotes() 42 | { 43 | this.notes = new Dictionary(System.Math.Min(Model.connections.Count, 4)); 44 | foreach (var note in model.notes) 45 | { 46 | notes.Add(note.id, (StickyNoteProcessor)ViewModelFactory.ProduceViewModel(note)); 47 | } 48 | } 49 | 50 | #region API 51 | 52 | public void AddNote(string title, string content, InternalVector2Int position) 53 | { 54 | var note = new StickyNote(); 55 | note.id = NewID(); 56 | note.position = position; 57 | note.title = title; 58 | note.content = content; 59 | var noteVm = ViewModelFactory.ProduceViewModel(note) as StickyNoteProcessor; 60 | 61 | AddNote(noteVm); 62 | } 63 | 64 | public void AddNote(StickyNoteProcessor note) 65 | { 66 | notes.Add(note.ID, note); 67 | Model.notes.Add(note.Model); 68 | OnNoteAdded?.Invoke(note); 69 | } 70 | 71 | public void RemoveNote(int id) 72 | { 73 | if (!notes.TryGetValue(id, out var note)) 74 | return; 75 | notes.Remove(note.ID); 76 | Model.notes.Remove(note.Model); 77 | OnNoteRemoved?.Invoke(note); 78 | } 79 | 80 | #endregion 81 | } 82 | } -------------------------------------------------------------------------------- /Core/ViewModels/BaseGraphProcessor.Notes.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4768db9623944c2ad6993643599a707 3 | timeCreated: 1726280615 -------------------------------------------------------------------------------- /Core/ViewModels/BaseGraphProcessor.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using Atom; 22 | 23 | namespace Atom.GraphProcessor 24 | { 25 | [ViewModel(typeof(BaseGraph))] 26 | public partial class BaseGraphProcessor : ViewModel 27 | { 28 | #region Fields 29 | 30 | private BaseGraph model; 31 | private Type modelType; 32 | 33 | #endregion 34 | 35 | 36 | #region Properties 37 | 38 | public BaseGraph Model => model; 39 | 40 | public Type ModelType => modelType; 41 | 42 | public InternalVector2Int Pan 43 | { 44 | get => Model.pan; 45 | set => SetFieldValue(ref Model.pan, value, nameof(BaseGraph.pan)); 46 | } 47 | 48 | public float Zoom 49 | { 50 | get => Model.zoom; 51 | set => SetFieldValue(ref Model.zoom, value, nameof(BaseGraph.zoom)); 52 | } 53 | 54 | public EventStation Events { get; } 55 | 56 | public BlackboardProcessor Blackboard { get; } 57 | 58 | #endregion 59 | 60 | public BaseGraphProcessor(BaseGraph model) 61 | { 62 | this.model = model; 63 | this.modelType = model.GetType(); 64 | this.model.pan = Model.pan == default ? InternalVector2Int.zero : Model.pan; 65 | this.model.zoom = Model.zoom == 0 ? 1 : Model.zoom; 66 | this.model.notes = Model.notes == null ? new List() : Model.notes; 67 | 68 | this.Events = new EventStation(); 69 | this.Blackboard = new BlackboardProcessor(new Blackboard(), Events); 70 | 71 | BeginInitNodes(); 72 | BeginInitConnections(); 73 | EndInitConnections(); 74 | EndInitNodes(); 75 | InitGroups(); 76 | InitNotes(); 77 | } 78 | 79 | #region API 80 | 81 | public int NewID() 82 | { 83 | var id = 0; 84 | do 85 | { 86 | id++; 87 | } while (nodes.ContainsKey(id) || groups.GroupMap.ContainsKey(id) || notes.ContainsKey(id) || id == 0); 88 | 89 | return id; 90 | } 91 | 92 | #endregion 93 | } 94 | } -------------------------------------------------------------------------------- /Core/ViewModels/BaseGraphProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a4158233fe73954586ef50bb4ca0bef 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/ViewModels/BaseGroupProcessor.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using Atom; 20 | using System; 21 | using System.Collections.Generic; 22 | 23 | namespace Atom.GraphProcessor 24 | { 25 | [ViewModel(typeof(Group))] 26 | public class GroupProcessor : ViewModel, IGraphElementProcessor, IGraphElementProcessor_Scope 27 | { 28 | #region Fileds 29 | 30 | private Group model; 31 | private Type modelType; 32 | public event Action onNodeAdded; 33 | public event Action onNodeRemoved; 34 | 35 | #endregion 36 | 37 | #region Property 38 | 39 | public Group Model => model; 40 | public Type ModelType => modelType; 41 | 42 | object IGraphElementProcessor.Model => model; 43 | 44 | Type IGraphElementProcessor.ModelType => modelType; 45 | 46 | public int ID => Model.id; 47 | 48 | public IReadOnlyList Nodes => Model.nodes; 49 | 50 | public BaseGraphProcessor Owner { get; internal set; } 51 | 52 | public string GroupName 53 | { 54 | get => Model.groupName; 55 | set => SetFieldValue(ref Model.groupName, value, nameof(Model.groupName)); 56 | } 57 | 58 | public InternalVector2Int Position 59 | { 60 | get => Model.position; 61 | set => SetFieldValue(ref Model.position, value, nameof(Model.position)); 62 | } 63 | 64 | public InternalColor BackgroundColor 65 | { 66 | get => Model.backgroundColor; 67 | set => SetFieldValue(ref Model.backgroundColor, value, nameof(Model.backgroundColor)); 68 | } 69 | 70 | #endregion 71 | 72 | public GroupProcessor(Group model) 73 | { 74 | this.model = model; 75 | this.modelType = model.GetType(); 76 | this.model.position = model.position == default ? InternalVector2Int.zero : model.position; 77 | } 78 | 79 | internal void NotifyNodeAdded(BaseNodeProcessor[] node) 80 | { 81 | onNodeAdded?.Invoke(node); 82 | } 83 | 84 | internal void NotifyNodeRemoved(BaseNodeProcessor[] node) 85 | { 86 | onNodeRemoved?.Invoke(node); 87 | } 88 | } 89 | } -------------------------------------------------------------------------------- /Core/ViewModels/BaseGroupProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af6b9f8573ef3b84a9651b4f7bc25f35 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/ViewModels/BaseNodeProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eca7335b3deefe344b6d1c3e47901b6f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/ViewModels/BasePortProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f05a7451bf47b1649992fd5500b66420 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Core/ViewModels/StickyNoteProcessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Atom.GraphProcessor 4 | { 5 | [ViewModel(typeof(StickyNote))] 6 | public sealed class StickyNoteProcessor : ViewModel, IGraphElementProcessor, IGraphElementProcessor_Scope 7 | { 8 | private StickyNote model; 9 | private Type modelType; 10 | 11 | public StickyNote Model => model; 12 | public Type ModelType => modelType; 13 | 14 | object IGraphElementProcessor.Model => model; 15 | 16 | Type IGraphElementProcessor.ModelType => modelType; 17 | 18 | /// 唯一标识 19 | public int ID => Model.id; 20 | 21 | public InternalVector2Int Position 22 | { 23 | get => Model.position; 24 | set => SetFieldValue(ref Model.position, value, nameof(StickyNote.position)); 25 | } 26 | 27 | public InternalVector2Int Size 28 | { 29 | get => Model.size; 30 | set => SetFieldValue(ref Model.size, value, nameof(StickyNote.size)); 31 | } 32 | 33 | public string Title 34 | { 35 | get => Model.title; 36 | set => SetFieldValue(ref Model.title, value, nameof(StickyNote.title)); 37 | } 38 | 39 | public string Content 40 | { 41 | get => Model.content; 42 | set => SetFieldValue(ref Model.content, value, nameof(StickyNote.content)); 43 | } 44 | 45 | public StickyNoteProcessor(StickyNote model) 46 | { 47 | this.model = model; 48 | this.modelType = model.GetType(); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Core/ViewModels/StickyNoteProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1253fcb8ba948f78b3a258b398b5a6b 3 | timeCreated: 1706385204 -------------------------------------------------------------------------------- /Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eae7c221629668044a15ff454406c556 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Examples/FlowExample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 66748532c1ab0c2459305038a343c8d3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Examples/FlowExample/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a41a804338104644493af12eca3d0946 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Examples/FlowExample/Editor/FlowGraphView.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | #region 注 释 3 | 4 | /*** 5 | * 6 | * Title: 7 | * 8 | * Description: 9 | * 10 | * Date: 11 | * Version: 12 | * Writer: 半只龙虾人 13 | * Github: https://github.com/haloman9527 14 | * Blog: https://www.haloman.net/ 15 | * 16 | */ 17 | 18 | #endregion 19 | 20 | using Atom; 21 | using Atom.GraphProcessor; 22 | using Atom.GraphProcessor.Editors; 23 | using System; 24 | using System.Collections.Generic; 25 | using UnityEditor.Experimental.GraphView; 26 | using UnityEngine; 27 | 28 | public class FlowGraphView : BaseGraphView 29 | { 30 | protected override void BuildNodeMenu(NodeMenuWindow nodeMenu) 31 | { 32 | foreach (var pair in GraphProcessorUtil.NodeStaticInfos) 33 | { 34 | if (!typeof(FlowNode).IsAssignableFrom(pair.Key)) 35 | continue; 36 | var nodeStaticInfo = pair.Value; 37 | if (nodeStaticInfo.hidden) 38 | continue; 39 | 40 | var path = nodeStaticInfo.path; 41 | var menu = nodeStaticInfo.menu; 42 | nodeMenu.entries.Add(new NodeMenuWindow.NodeEntry(path, menu, pair.Key)); 43 | } 44 | } 45 | 46 | protected override BaseConnectionView NewConnectionView(BaseConnectionProcessor connection) 47 | { 48 | return new SampleConnectionView(); 49 | } 50 | } 51 | #endif -------------------------------------------------------------------------------- /Examples/FlowExample/Editor/FlowGraphView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d94a4ddae9de418b9a40cd993472a180 3 | timeCreated: 1700990107 -------------------------------------------------------------------------------- /Examples/FlowExample/Editor/FlowGraphWindow.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | #region 注 释 3 | 4 | /*** 5 | * 6 | * Title: 7 | * 8 | * Description: 9 | * 10 | * Date: 11 | * Version: 12 | * Writer: 半只龙虾人 13 | * Github: https://github.com/haloman9527 14 | * Blog: https://www.haloman.net/ 15 | * 16 | */ 17 | 18 | #endregion 19 | 20 | using Atom.GraphProcessor; 21 | using Atom.GraphProcessor.Editors; 22 | using System.Collections.Generic; 23 | using Atom; 24 | using Sirenix.Serialization; 25 | using UnityEngine; 26 | using UnityEngine.UIElements; 27 | 28 | [CustomView(typeof(FlowGraph))] 29 | public class FlowGraphWindow : BaseGraphWindow 30 | { 31 | protected override BaseGraphView NewGraphView() 32 | { 33 | return new FlowGraphView(); 34 | } 35 | 36 | protected override void OnKeyDownCallback(KeyDownEvent evt) 37 | { 38 | base.OnKeyDownCallback(evt); 39 | if (evt.commandKey || evt.ctrlKey) 40 | { 41 | switch (evt.keyCode) 42 | { 43 | case KeyCode.D: 44 | Duplicate(); 45 | evt.StopImmediatePropagation(); 46 | break; 47 | } 48 | } 49 | } 50 | 51 | private void Duplicate() 52 | { 53 | if (GraphView == null) 54 | return; 55 | // 收集所有节点,连线 56 | Dictionary nodes = new Dictionary(); 57 | List connections = new List(); 58 | List groups = new List(); 59 | foreach (var item in GraphView.selection) 60 | { 61 | switch (item) 62 | { 63 | case BaseNodeView nodeView: 64 | nodes.Add(nodeView.ViewModel.ID, nodeView.ViewModel.Model); 65 | break; 66 | case BaseConnectionView connectionView: 67 | connections.Add(connectionView.ViewModel.Model); 68 | break; 69 | case GroupView groupView: 70 | groups.Add(groupView.ViewModel.Model); 71 | break; 72 | } 73 | } 74 | 75 | var nodesStr = Sirenix.Serialization.SerializationUtility.SerializeValue(nodes, DataFormat.Binary); 76 | var connectionsStr = Sirenix.Serialization.SerializationUtility.SerializeValue(connections, DataFormat.Binary); 77 | var groupsStr = Sirenix.Serialization.SerializationUtility.SerializeValue(groups, DataFormat.Binary); 78 | 79 | nodes = Sirenix.Serialization.SerializationUtility.DeserializeValue>(nodesStr, DataFormat.Binary); 80 | connections = Sirenix.Serialization.SerializationUtility.DeserializeValue>(connectionsStr, DataFormat.Binary); 81 | groups = Sirenix.Serialization.SerializationUtility.DeserializeValue>(groupsStr, DataFormat.Binary); 82 | 83 | var graph = GraphView.ViewModel; 84 | var nodeMaps = new Dictionary(); 85 | 86 | GraphView.ClearSelection(); 87 | 88 | foreach (var pair in nodes) 89 | { 90 | pair.Value.id = graph.NewID(); 91 | pair.Value.position += new InternalVector2Int(50, 50); 92 | var vm = ViewModelFactory.ProduceViewModel(pair.Value) as BaseNodeProcessor; 93 | GraphView.Context.Do(new AddNodeCommand(graph, vm)); 94 | nodeMaps[pair.Key] = vm; 95 | GraphView.AddToSelection(GraphView.NodeViews[vm.ID]); 96 | } 97 | 98 | foreach (var connection in connections) 99 | { 100 | if (nodeMaps.TryGetValue(connection.fromNode, out var from)) 101 | connection.fromNode = from.ID; 102 | 103 | if (nodeMaps.TryGetValue(connection.toNode, out var to)) 104 | connection.toNode = to.ID; 105 | 106 | var vm = ViewModelFactory.ProduceViewModel(connection) as BaseConnectionProcessor; 107 | GraphView.AddToSelection(GraphView.ConnectionViews[vm]); 108 | } 109 | 110 | foreach (var group in groups) 111 | { 112 | for (int i = group.nodes.Count - 1; i >= 0; i--) 113 | { 114 | if (nodeMaps.TryGetValue(group.nodes[i], out var node)) 115 | group.nodes[i] = node.ID; 116 | else 117 | group.nodes.RemoveAt(i); 118 | } 119 | 120 | group.id = graph.NewID(); 121 | GraphView.Context.Do(new AddGroupCommand(graph, group)); 122 | GraphView.AddToSelection(GraphView.GroupViews[group.id]); 123 | } 124 | } 125 | } 126 | #endif -------------------------------------------------------------------------------- /Examples/FlowExample/Editor/FlowGraphWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7841a4045dffc2409ae74eb62240930 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/FlowExample/Editor/StartNodeView.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using Atom.GraphProcessor.Editors; 3 | using Atom.UnityEditors; 4 | using UnityEditor; 5 | using UnityEngine.UIElements; 6 | 7 | [CustomView(typeof(SVNUpdateNode))] 8 | public class SVNUpdateNodeView : BaseNodeView 9 | { 10 | private Editor editor; 11 | 12 | public SVNUpdateNodeView() 13 | { 14 | controls.Add(new IMGUIContainer(DrawEditor)); 15 | } 16 | 17 | protected override void DoInit() 18 | { 19 | editor = ObjectInspectorEditor.CreateEditor(this); 20 | } 21 | 22 | private void DrawEditor() 23 | { 24 | if (editor == null) 25 | return; 26 | 27 | var wideMode = EditorGUIUtility.wideMode; 28 | EditorGUIUtility.wideMode = true; 29 | EditorGUI.BeginChangeCheck(); 30 | editor.OnInspectorGUI(); 31 | if (EditorGUI.EndChangeCheck()) 32 | this.MarkDirtyRepaint(); 33 | EditorGUIUtility.wideMode = wideMode; 34 | } 35 | } 36 | #endif -------------------------------------------------------------------------------- /Examples/FlowExample/Editor/StartNodeView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f90b91b23b6d4dbcb4370ec08d64cd5b 3 | timeCreated: 1701529773 -------------------------------------------------------------------------------- /Examples/FlowExample/New Flow Graph Asset.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: 23d16cf4816bca545aa0215113b5fe31, type: 3} 13 | m_Name: New Flow Graph Asset 14 | m_EditorClassIdentifier: 15 | data: 16 | zoom: 3.5178764 17 | pan: 18 | x: -103 19 | y: 165 20 | nodes: 21 | - rid: 7707644130126725127 22 | - rid: 7707644130126725128 23 | connections: 24 | - rid: 7707644130126725129 25 | groups: [] 26 | notes: [] 27 | startNodeID: 0 28 | references: 29 | version: 2 30 | RefIds: 31 | - rid: 7707644130126725127 32 | type: {class: StartNode, ns: , asm: Atom.GraphProcessor} 33 | data: 34 | id: 0 35 | position: 36 | x: 100 37 | y: 100 38 | - rid: 7707644130126725128 39 | type: {class: RefreshWwiseNode, ns: , asm: Atom.GraphProcessor} 40 | data: 41 | id: 1 42 | position: 43 | x: 292 44 | y: 100 45 | - rid: 7707644130126725129 46 | type: {class: BaseConnection, ns: Atom.GraphProcessor, asm: Atom.GraphProcessor} 47 | data: 48 | fromNode: 0 49 | fromPort: Flow-Out 50 | toNode: 1 51 | toPort: Flow-In 52 | -------------------------------------------------------------------------------- /Examples/FlowExample/New Flow Graph Asset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d2fa2a4331c645a468f7d095f2e030e8 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Examples/FlowExample/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a9d76bae5d6d354da114e6a31acc8be 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Examples/FlowExample/Runtime/FlowGraphAsset.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Atom.GraphProcessor; 3 | using Atom; 4 | using Sirenix.OdinInspector; 5 | using UnityEngine; 6 | 7 | [CreateAssetMenu] 8 | public class FlowGraphAsset : ScriptableObject, IGraphAsset 9 | { 10 | [SerializeField] 11 | private FlowGraph data; 12 | 13 | public Type GraphType => typeof(FlowGraph); 14 | 15 | public void SaveGraph(BaseGraph graph) => this.data = (FlowGraph)graph; 16 | 17 | public BaseGraph LoadGraph() => data; 18 | 19 | [Button] 20 | public void Reset() 21 | { 22 | SaveGraph(new FlowGraph()); 23 | } 24 | } 25 | 26 | [Serializable] 27 | public class FlowGraph : BaseGraph 28 | { 29 | public int startNodeID; 30 | } 31 | 32 | [ViewModel(typeof(FlowGraph))] 33 | public class FlowGraphProcessor : BaseGraphProcessor 34 | { 35 | private StartNodeProcessor StartNode { get; } 36 | 37 | public FlowGraphProcessor(FlowGraph model) : base(model) 38 | { 39 | if (Nodes.TryGetValue(model.startNodeID, out var _node) && _node is StartNodeProcessor) 40 | { 41 | StartNode = _node as StartNodeProcessor; 42 | } 43 | 44 | if (StartNode == null) 45 | { 46 | StartNode = AddNode(new StartNode() { position = new InternalVector2Int(100, 100) }) as StartNodeProcessor; 47 | model.startNodeID = StartNode.ID; 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Examples/FlowExample/Runtime/FlowGraphAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 23d16cf4816bca545aa0215113b5fe31 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/FlowExample/Runtime/FlowNode.cs: -------------------------------------------------------------------------------- 1 | using Atom.GraphProcessor; 2 | using Atom; 3 | 4 | public abstract class FlowNode : BaseNode 5 | { 6 | 7 | } 8 | 9 | [ViewModel(typeof(FlowNode))] 10 | public abstract class FlowNodeProcessor : BaseNodeProcessor 11 | { 12 | public FlowNodeProcessor(BaseNode model) : base(model) 13 | { 14 | AddPort(new BasePortProcessor(ConstValues.FLOW_IN_PORT_NAME, BasePort.Direction.Left, BasePort.Capacity.Multi)); 15 | AddPort(new BasePortProcessor(ConstValues.FLOW_OUT_PORT_NAME, BasePort.Direction.Right, BasePort.Capacity.Single)); 16 | } 17 | 18 | protected abstract void Execute(); 19 | 20 | public void FlowNext() 21 | { 22 | FlowTo(ConstValues.FLOW_OUT_PORT_NAME); 23 | } 24 | 25 | public void FlowTo(string port) 26 | { 27 | foreach (FlowNodeProcessor item in GetConnections(ConstValues.FLOW_OUT_PORT_NAME)) 28 | { 29 | if (item == null) 30 | continue; 31 | 32 | item.Execute(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Examples/FlowExample/Runtime/FlowNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e707e2488adb0c944b659eba136c01f3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/FlowExample/Runtime/RefreshWwiseNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Atom.GraphProcessor; 3 | using Atom; 4 | using Sirenix.OdinInspector; 5 | 6 | [NodeMenu("刷新Wwise信息")] 7 | public class RefreshWwiseNode : FlowNode 8 | { 9 | 10 | } 11 | 12 | [ViewModel(typeof(RefreshWwiseNode))] 13 | public class RefreshWwiseNodeProcessor : FlowNodeProcessor 14 | { 15 | public RefreshWwiseNodeProcessor(RefreshWwiseNode model) : base(model) 16 | { 17 | 18 | } 19 | 20 | protected override void Execute() 21 | { 22 | FlowNext(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Examples/FlowExample/Runtime/RefreshWwiseNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 23462bb07d614fa085a99a4941185461 3 | timeCreated: 1701002127 -------------------------------------------------------------------------------- /Examples/FlowExample/Runtime/SVNUpdateNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Atom.GraphProcessor; 3 | using Atom; 4 | using Sirenix.OdinInspector; 5 | 6 | [NodeMenu("SVN Update")] 7 | public class SVNUpdateNode : FlowNode 8 | { 9 | [FolderPath] 10 | [LabelText("目标文件夹")] 11 | public List folders = new List(); 12 | } 13 | 14 | [ViewModel(typeof(SVNUpdateNode))] 15 | public class SvnUpdateNodeProcessor : FlowNodeProcessor 16 | { 17 | public SvnUpdateNodeProcessor(SVNUpdateNode model) : base(model) 18 | { 19 | 20 | } 21 | 22 | protected override void Execute() 23 | { 24 | FlowNext(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Examples/FlowExample/Runtime/SVNUpdateNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 90d80e7307564702bb73eedccb8ac561 3 | timeCreated: 1701001788 -------------------------------------------------------------------------------- /Examples/FlowExample/Runtime/StartNode.cs: -------------------------------------------------------------------------------- 1 | using Atom.GraphProcessor; 2 | using Atom; 3 | 4 | [NodeMenu("Start", hidden = true)] 5 | public class StartNode : FlowNode 6 | { 7 | } 8 | 9 | [ViewModel(typeof(StartNode))] 10 | public class StartNodeProcessor : FlowNodeProcessor 11 | { 12 | public StartNodeProcessor(StartNode model) : base(model) 13 | { 14 | } 15 | 16 | protected override void Execute() 17 | { 18 | FlowNext(); 19 | } 20 | } -------------------------------------------------------------------------------- /Examples/FlowExample/Runtime/StartNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86c15eddcfca408e9bcbccf8af6eca84 3 | timeCreated: 1700990820 -------------------------------------------------------------------------------- /Examples/MathExample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 085e4bcab36cdbb4a985ea006b5abb9b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Examples/MathExample/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b731d067c1d983a47bb4c3bdad4238ad 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Examples/MathExample/Editor/ExampleNodeView.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | #if UNITY_EDITOR 18 | using Atom; 19 | using Atom.GraphProcessor.Editors; 20 | using UnityEditor.UIElements; 21 | using UnityEngine.UIElements; 22 | 23 | public abstract class ExampleNodeView : BaseNodeView 24 | { 25 | } 26 | #endif -------------------------------------------------------------------------------- /Examples/MathExample/Editor/ExampleNodeView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1341c28a54e74968a78c78ec990dec4e 3 | timeCreated: 1700934258 -------------------------------------------------------------------------------- /Examples/MathExample/Editor/FloatNodeView.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | #if UNITY_EDITOR 20 | using System.Collections.ObjectModel; 21 | using Atom; 22 | using Atom.GraphProcessor.Editors; 23 | using UnityEditor.UIElements; 24 | using UnityEngine.UIElements; 25 | 26 | [CustomView(typeof(FloatNode))] 27 | public class FloatNodeView : BaseNodeView 28 | { 29 | public FloatField valueField; 30 | 31 | public FloatNodeView() 32 | { 33 | valueField = new FloatField(); 34 | valueField.style.marginLeft = 3; 35 | valueField.style.marginRight = 3; 36 | valueField.RegisterValueChangedCallback(OnFloatFieldChanged); 37 | controls.Add(valueField); 38 | } 39 | 40 | protected override void DoInit() 41 | { 42 | base.DoInit(); 43 | var v = ViewModel as FloatNodeProcessor; 44 | this.valueField.SetValueWithoutNotify(v.Value); 45 | this.ViewModel.RegisterValueChanged(nameof(FloatNode.num), OnFloatNumChanged); 46 | } 47 | 48 | protected override void DoUnInit() 49 | { 50 | ObservableCollection a = new ObservableCollection(); 51 | a.Add(0); 52 | this.ViewModel.UnregisterValueChanged(nameof(FloatNode.num), OnFloatNumChanged); 53 | base.DoUnInit(); 54 | } 55 | 56 | private void OnFloatFieldChanged(ChangeEvent evt) 57 | { 58 | var v = ViewModel as FloatNodeProcessor; 59 | v.Value = evt.newValue; 60 | } 61 | 62 | private void OnFloatNumChanged(ViewModel.ValueChangedArg arg) 63 | { 64 | valueField.SetValueWithoutNotify(arg.newValue); 65 | } 66 | } 67 | #endif -------------------------------------------------------------------------------- /Examples/MathExample/Editor/FloatNodeView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 55ee7ddc2cde5ff4b9290e63e9a65a65 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/MathExample/Editor/LogNodeView.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | #if UNITY_EDITOR 18 | using Atom.GraphProcessor; 19 | using Atom.GraphProcessor.Editors; 20 | using UnityEngine.UIElements; 21 | 22 | [CustomView(typeof(LogNode))] 23 | public class LogNodeView : BaseNodeView 24 | { 25 | Button btnDebug; 26 | 27 | public LogNodeView() : base() 28 | { 29 | btnDebug = new Button(); 30 | btnDebug.text = "Log"; 31 | btnDebug.clicked += OnClick; 32 | this.controls.Add(btnDebug); 33 | } 34 | 35 | protected override void DoInit() 36 | { 37 | base.DoInit(); 38 | PortViews[ConstValues.FLOW_IN_PORT_NAME].PortLabel.AddToClassList("hidden"); 39 | } 40 | 41 | private void OnClick() 42 | { 43 | (ViewModel as LogNodeProcessor).DebugInput(); 44 | } 45 | } 46 | #endif -------------------------------------------------------------------------------- /Examples/MathExample/Editor/LogNodeView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 23c3fc2c792f4894bb2e6dce590477a2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/MathExample/Editor/SampleConnectionView.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | #if UNITY_EDITOR 18 | using Atom.GraphProcessor.Editors; 19 | using UnityEditor.Experimental.GraphView; 20 | 21 | public class SampleConnectionView : BaseConnectionView 22 | { 23 | protected override EdgeControl CreateEdgeControl() 24 | { 25 | return new BetterEdgeControl(this) 26 | { 27 | capRadius = 4f, 28 | interceptWidth = 6f 29 | }; 30 | } 31 | } 32 | #endif -------------------------------------------------------------------------------- /Examples/MathExample/Editor/SampleConnectionView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dab9a65b07fff92489c4d65d3a0b7bbb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/MathExample/Editor/SampleGraphView.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | #if UNITY_EDITOR 20 | using Atom; 21 | using Atom.GraphProcessor; 22 | using Atom.GraphProcessor.Editors; 23 | using System; 24 | using System.Collections.Generic; 25 | using UnityEditor.Experimental.GraphView; 26 | using UnityEngine; 27 | 28 | public class SampleGraphView : BaseGraphView 29 | { 30 | protected override void BuildNodeMenu(NodeMenuWindow nodeMenu) 31 | { 32 | foreach (var nodeType in GetNodeTypes()) 33 | { 34 | if (nodeType.IsAbstract) 35 | continue; 36 | var nodeStaticInfo = GraphProcessorUtil.NodeStaticInfos[nodeType]; 37 | if (nodeStaticInfo.hidden) 38 | continue; 39 | 40 | var path = nodeStaticInfo.path; 41 | var menu = nodeStaticInfo.menu; 42 | nodeMenu.entries.Add(new NodeMenuWindow.NodeEntry(path, menu, nodeType)); 43 | } 44 | } 45 | private IEnumerable GetNodeTypes() 46 | { 47 | yield return typeof(FloatNode); 48 | yield return typeof(AddNode); 49 | yield return typeof(SubNode); 50 | yield return typeof(LogNode); 51 | } 52 | 53 | protected override BaseConnectionView NewConnectionView(BaseConnectionProcessor connection) 54 | { 55 | return new SampleConnectionView(); 56 | } 57 | } 58 | #endif -------------------------------------------------------------------------------- /Examples/MathExample/Editor/SampleGraphView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 38a45390383b46d4b9ef80de9ac7817c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/MathExample/Editor/SampleGraphWindow.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | #if UNITY_EDITOR 20 | using Atom.GraphProcessor; 21 | using Atom.GraphProcessor.Editors; 22 | using System.Collections.Generic; 23 | using Atom; 24 | using Sirenix.Serialization; 25 | using UnityEditor; 26 | using UnityEditor.UIElements; 27 | using UnityEngine; 28 | using UnityEngine.UIElements; 29 | 30 | [CustomView(typeof(SampleGraph))] 31 | public class SampleGraphWindow : BaseGraphWindow 32 | { 33 | protected override BaseGraphView NewGraphView() 34 | { 35 | return new SampleGraphView(); 36 | } 37 | 38 | protected override void OnKeyDownCallback(KeyDownEvent evt) 39 | { 40 | base.OnKeyDownCallback(evt); 41 | if (evt.commandKey || evt.ctrlKey) 42 | { 43 | switch (evt.keyCode) 44 | { 45 | case KeyCode.D: 46 | Duplicate(); 47 | evt.StopImmediatePropagation(); 48 | break; 49 | } 50 | } 51 | } 52 | 53 | private void Duplicate() 54 | { 55 | if (GraphView == null) 56 | return; 57 | // 收集所有节点,连线 58 | Dictionary nodes = new Dictionary(); 59 | List connections = new List(); 60 | List groups = new List(); 61 | foreach (var item in GraphView.selection) 62 | { 63 | switch (item) 64 | { 65 | case BaseNodeView nodeView: 66 | nodes.Add(nodeView.ViewModel.ID, nodeView.ViewModel.Model); 67 | break; 68 | case BaseConnectionView connectionView: 69 | connections.Add(connectionView.ViewModel.Model); 70 | break; 71 | case GroupView groupView: 72 | groups.Add(groupView.ViewModel.Model); 73 | break; 74 | } 75 | } 76 | 77 | var nodesStr = Sirenix.Serialization.SerializationUtility.SerializeValue(nodes, DataFormat.Binary); 78 | var connectionsStr = Sirenix.Serialization.SerializationUtility.SerializeValue(connections, DataFormat.Binary); 79 | var groupsStr = Sirenix.Serialization.SerializationUtility.SerializeValue(groups, DataFormat.Binary); 80 | 81 | nodes = Sirenix.Serialization.SerializationUtility.DeserializeValue>(nodesStr, DataFormat.Binary); 82 | connections = Sirenix.Serialization.SerializationUtility.DeserializeValue>(connectionsStr, DataFormat.Binary); 83 | groups = Sirenix.Serialization.SerializationUtility.DeserializeValue>(groupsStr, DataFormat.Binary); 84 | 85 | var graph = GraphView.ViewModel; 86 | var nodeMaps = new Dictionary(); 87 | 88 | GraphView.ClearSelection(); 89 | 90 | foreach (var pair in nodes) 91 | { 92 | pair.Value.id = graph.NewID(); 93 | pair.Value.position += new InternalVector2Int(50, 50); 94 | var vm = ViewModelFactory.ProduceViewModel(pair.Value) as BaseNodeProcessor; 95 | GraphView.Context.Do(new AddNodeCommand(graph, vm)); 96 | nodeMaps[pair.Key] = vm; 97 | GraphView.AddToSelection(GraphView.NodeViews[vm.ID]); 98 | } 99 | 100 | foreach (var connection in connections) 101 | { 102 | if (nodeMaps.TryGetValue(connection.fromNode, out var from)) 103 | connection.fromNode = from.ID; 104 | 105 | if (nodeMaps.TryGetValue(connection.toNode, out var to)) 106 | connection.toNode = to.ID; 107 | 108 | var vm = ViewModelFactory.ProduceViewModel(connection) as BaseConnectionProcessor; 109 | GraphView.Context.Do(new ConnectCommand(graph, vm)); 110 | GraphView.AddToSelection(GraphView.ConnectionViews[vm]); 111 | } 112 | 113 | foreach (var group in groups) 114 | { 115 | for (int i = group.nodes.Count - 1; i >= 0; i--) 116 | { 117 | if (nodeMaps.TryGetValue(group.nodes[i], out var node)) 118 | group.nodes[i] = node.ID; 119 | else 120 | group.nodes.RemoveAt(i); 121 | } 122 | 123 | group.id = graph.NewID(); 124 | GraphView.Context.Do(new AddGroupCommand(graph, group)); 125 | GraphView.AddToSelection(GraphView.GroupViews[group.id]); 126 | } 127 | } 128 | } 129 | #endif -------------------------------------------------------------------------------- /Examples/MathExample/Editor/SampleGraphWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0045b06aa9d9021468595ac7f9a12ce0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/MathExample/MathExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fe167e162753d740b2e77962bde3621 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Examples/MathExample/New Sample Graph Asset.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: 2ed98b335395fee418448245d6850db9, type: 3} 13 | m_Name: New Sample Graph Asset 14 | m_EditorClassIdentifier: 15 | data: 16 | zoom: 1.3225 17 | pan: 18 | x: 96 19 | y: 24 20 | nodes: 21 | - rid: 1375571719555645889 22 | - rid: 1375571719555645890 23 | - rid: 1375571719555645891 24 | - rid: 1375571719555645892 25 | connections: 26 | - rid: 1375571719555645893 27 | - rid: 1375571719555645894 28 | - rid: 1375571719555645895 29 | groups: [] 30 | notes: [] 31 | references: 32 | version: 2 33 | RefIds: 34 | - rid: 1375571719555645889 35 | type: {class: FloatNode, ns: , asm: Atom.GraphProcessor} 36 | data: 37 | id: 2 38 | position: 39 | x: 427 40 | y: 306 41 | num: 126 42 | - rid: 1375571719555645890 43 | type: {class: AddNode, ns: , asm: Atom.GraphProcessor} 44 | data: 45 | id: 3 46 | position: 47 | x: 539 48 | y: 244 49 | - rid: 1375571719555645891 50 | type: {class: LogNode, ns: , asm: Atom.GraphProcessor} 51 | data: 52 | id: 4 53 | position: 54 | x: 691 55 | y: 264 56 | - rid: 1375571719555645892 57 | type: {class: FloatNode, ns: , asm: Atom.GraphProcessor} 58 | data: 59 | id: 1 60 | position: 61 | x: 427 62 | y: 221 63 | num: 12413 64 | - rid: 1375571719555645893 65 | type: {class: BaseConnection, ns: Atom.GraphProcessor, asm: Atom.GraphProcessor} 66 | data: 67 | fromNode: 3 68 | fromPort: Flow-Out 69 | toNode: 4 70 | toPort: Flow-In 71 | - rid: 1375571719555645894 72 | type: {class: BaseConnection, ns: Atom.GraphProcessor, asm: Atom.GraphProcessor} 73 | data: 74 | fromNode: 1 75 | fromPort: Flow-Out 76 | toNode: 3 77 | toPort: InputA 78 | - rid: 1375571719555645895 79 | type: {class: BaseConnection, ns: Atom.GraphProcessor, asm: Atom.GraphProcessor} 80 | data: 81 | fromNode: 2 82 | fromPort: Flow-Out 83 | toNode: 3 84 | toPort: InputB 85 | -------------------------------------------------------------------------------- /Examples/MathExample/New Sample Graph Asset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2a0169845db09b48a1824f3cfa2750f 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Examples/MathExample/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6688fd62a7073ea4fb311e149651060a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/AddNode.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using Atom; 17 | using Atom.GraphProcessor; 18 | 19 | [NodeTooltip("加法节点")] 20 | [NodeMenu("Add")] 21 | public class AddNode : BaseNode { } 22 | 23 | [ViewModel(typeof(AddNode))] 24 | public class AddNodeProcessor : BaseNodeProcessor, IGetPortValue, IGetPortValue 25 | { 26 | public AddNodeProcessor(BaseNode model) : base(model) 27 | { 28 | AddPort(new BasePortProcessor("InputA", BasePort.Direction.Left, BasePort.Capacity.Single, typeof(float))); 29 | AddPort(new BasePortProcessor("InputB", BasePort.Direction.Left, BasePort.Capacity.Single, typeof(float))); 30 | AddPort(new BasePortProcessor(ConstValues.FLOW_OUT_PORT_NAME, BasePort.Direction.Right, BasePort.Capacity.Multi, typeof(float)) 31 | { 32 | HideLabel = true 33 | }); 34 | } 35 | 36 | public object GetValue(string port) 37 | { 38 | var inputAValue = Ports["InputA"].GetConnectionValue(); 39 | var inputBValue = Ports["InputB"].GetConnectionValue(); 40 | return inputAValue + inputBValue; 41 | } 42 | 43 | float IGetPortValue.GetValue(string port) 44 | { 45 | var inputAValue = Ports["InputA"].GetConnectionValue(); 46 | var inputBValue = Ports["InputB"].GetConnectionValue(); 47 | return inputAValue + inputBValue; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/AddNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 11f1b10ca64bfd54d8a94278780c5428 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/FloatNode.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using Atom; 20 | using Atom.GraphProcessor; 21 | using UnityEngine; 22 | 23 | [NodeTooltip("浮点数节点")] 24 | [NodeMenu("Float")] 25 | public class FloatNode : BaseNode 26 | { 27 | public float num; 28 | } 29 | 30 | [ViewModel(typeof(FloatNode))] 31 | public class FloatNodeProcessor : BaseNodeProcessor, IGetPortValue, IGetPortValue 32 | { 33 | public FloatNode TModel { get; } 34 | 35 | public float Value 36 | { 37 | get => TModel.num; 38 | set => SetFieldValue(ref TModel.num, value, nameof(FloatNode.num)); 39 | } 40 | 41 | public FloatNodeProcessor(FloatNode model) : base(model) 42 | { 43 | TModel = model; 44 | AddPort(new BasePortProcessor(ConstValues.FLOW_OUT_PORT_NAME, BasePort.Direction.Right, BasePort.Capacity.Multi, typeof(object))); 45 | } 46 | 47 | public object GetValue(string port) 48 | { 49 | return TModel.num; 50 | } 51 | 52 | float IGetPortValue.GetValue(string port) 53 | { 54 | return TModel.num; 55 | } 56 | } -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/FloatNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 70b98cf22e0221f4a86a0e92b489a9ef 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/LogNode.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using Atom; 17 | using Atom.GraphProcessor; 18 | using UnityEngine; 19 | 20 | [NodeMenu("Log")] 21 | public class LogNode : BaseNode { } 22 | 23 | [ViewModel(typeof(LogNode))] 24 | public class LogNodeProcessor : BaseNodeProcessor 25 | { 26 | public LogNodeProcessor(BaseNode model) : base(model) 27 | { 28 | AddPort(new BasePortProcessor(ConstValues.FLOW_IN_PORT_NAME, BasePort.Direction.Left, BasePort.Capacity.Single)); 29 | } 30 | 31 | public void DebugInput() 32 | { 33 | Debug.Log(Ports[ConstValues.FLOW_IN_PORT_NAME].GetConnectionValue()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/LogNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8351c645761f0df4584cf0c9fd2fb0c7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/SampleGraph.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using Atom; 17 | using Atom.GraphProcessor; 18 | using System; 19 | 20 | [Serializable] 21 | public class SampleGraph : BaseGraph { } 22 | 23 | [ViewModel(typeof(SampleGraph))] 24 | public class SampleGraphProcessor : BaseGraphProcessor 25 | { 26 | public SampleGraphProcessor(BaseGraph model) : base(model) { } 27 | } 28 | -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/SampleGraph.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cec111181af0e674ea5d59ee3b2db3a5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/SampleGraphAsset.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | using Atom.GraphProcessor; 20 | using System; 21 | using Sirenix.OdinInspector; 22 | using UnityEngine; 23 | 24 | [CreateAssetMenu] 25 | public class SampleGraphAsset : ScriptableObject, IGraphAsset 26 | { 27 | [SerializeField] 28 | private SampleGraph data; 29 | 30 | public Type GraphType => typeof(SampleGraph); 31 | 32 | public void SaveGraph(BaseGraph graph) => this.data = (SampleGraph)graph; 33 | 34 | public BaseGraph LoadGraph() => data; 35 | 36 | [Button] 37 | public void Reset() 38 | { 39 | SaveGraph(new SampleGraph()); 40 | } 41 | } -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/SampleGraphAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ed98b335395fee418448245d6850db9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/SampleGraphTest.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using Atom.GraphProcessor; 17 | using UnityEngine; 18 | 19 | public class SampleGraphTest : GraphAssetOwner 20 | { 21 | private void Update() 22 | { 23 | foreach (var node in T_Graph.Nodes.Values) 24 | { 25 | if (node is LogNodeProcessor debugNode) 26 | { 27 | debugNode.DebugInput(); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/SampleGraphTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1164b4925701bb4d99f653f65933da7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/SubNode.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | using System.Collections.Generic; 18 | using Atom; 19 | using Atom.GraphProcessor; 20 | 21 | [NodeMenu("Sub")] 22 | public class SubNode : BaseNode 23 | { 24 | public List ports = new List(); 25 | } 26 | 27 | [ViewModel(typeof(SubNode))] 28 | public class SubNodeProcessor : BaseNodeProcessor, IGetPortValue, IGetPortValue 29 | { 30 | public SubNodeProcessor(BaseNode model) : base(model) 31 | { 32 | AddPort(new BasePortProcessor("InputA", BasePort.Direction.Left, BasePort.Capacity.Single, typeof(float))); 33 | AddPort(new BasePortProcessor("InputB", BasePort.Direction.Left, BasePort.Capacity.Single, typeof(float))); 34 | AddPort(new BasePortProcessor(ConstValues.FLOW_OUT_PORT_NAME, BasePort.Direction.Right, BasePort.Capacity.Multi, typeof(float)) 35 | { 36 | HideLabel = true 37 | }); 38 | } 39 | 40 | public object GetValue(string port) 41 | { 42 | var inputAValue = Ports["InputA"].GetConnectionValue(); 43 | var inputBValue = Ports["InputB"].GetConnectionValue(); 44 | return inputAValue - inputBValue; 45 | } 46 | 47 | float IGetPortValue.GetValue(string port) 48 | { 49 | var inputAValue = Ports["InputA"].GetConnectionValue(); 50 | var inputBValue = Ports["InputB"].GetConnectionValue(); 51 | return inputAValue - inputBValue; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Examples/MathExample/Runtime/SubNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e75b7e4d824222d48a8d0b7bc8321d54 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 半只龙虾人 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. -------------------------------------------------------------------------------- /LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63c190a9013c9db47b44e60cdca6c6a9 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GraphProcessor 2 | 由[NodeGraphProcessor](https://github.com/alelievr/NodeGraphProcessor.git)魔改而来的节点编辑器 3 | 4 | MVVM架构 5 | 6 | 依赖[0.0_Common](https://github.com/HalfLobsterMan/0.0_Common.git) 7 | 8 | 依赖[Odin Inspector](https://odininspector.com) 9 | 10 | 11 | 12 | > 截图 13 | # ![](ScreenShot_1.png) 14 | # ![](ScreenShot_2.png) 15 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74315c459be873c49b95db5ad2508db3 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ScreenShot_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haloman9527/3.0_GraphProcessor/e10c636932977b74bc544e3a056b6589d4a312f6/ScreenShot_1.png -------------------------------------------------------------------------------- /ScreenShot_1.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 586f1c5ae736ef94fb6e5169f8621ad9 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 0 38 | wrapV: 0 39 | wrapW: 0 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /ScreenShot_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haloman9527/3.0_GraphProcessor/e10c636932977b74bc544e3a056b6589d4a312f6/ScreenShot_2.png -------------------------------------------------------------------------------- /ScreenShot_2.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e768ea829742a048bd244f5ee685cab 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 0 38 | wrapV: 0 39 | wrapW: 0 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /UnityEX.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 76f170d85d3015a4ab99e64bd63973cf 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79226983084e99f40a2b76b997f57fe6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Attributes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1955e9bdee421a4f94034463a15c14a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Attributes/CustomViewAttribute.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using System; 18 | 19 | namespace Atom.GraphProcessor.Editors 20 | { 21 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] 22 | public class CustomViewAttribute : Attribute 23 | { 24 | public Type targetType; 25 | 26 | public CustomViewAttribute(Type targetType) 27 | { 28 | this.targetType = targetType; 29 | } 30 | } 31 | } 32 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Attributes/CustomViewAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 524dee285f5838047ace31caea700055 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Inspectors.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af15404eac404e34f8396017f36bdaa3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Inspectors/BaseConnectionInspector.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using Atom.UnityEditors; 18 | using Sirenix.OdinInspector.Editor; 19 | using UnityEditor; 20 | using UnityEngine; 21 | 22 | namespace Atom.GraphProcessor.Editors 23 | { 24 | [CustomObjectEditor(typeof(BaseConnectionView))] 25 | public class BaseConnectionInspector : ObjectEditor 26 | { 27 | PropertyTree propertyTree; 28 | 29 | public override void OnEnable() 30 | { 31 | var view = Target as BaseNodeView; 32 | if (view == null || view.ViewModel == null) 33 | return; 34 | if (view.BindingProperty != null) 35 | { 36 | } 37 | else 38 | { 39 | propertyTree = PropertyTree.Create(view.ViewModel.Model); 40 | propertyTree.DrawMonoScriptObjectField = true; 41 | } 42 | } 43 | 44 | public override sealed void OnInspectorGUI() 45 | { 46 | var view = Target as BaseConnectionView; 47 | if (view == null || view.ViewModel == null) 48 | return; 49 | 50 | if (false && view.BindingProperty != null) 51 | { 52 | view.BindingProperty.serializedObject.Update(); 53 | EditorGUILayout.PropertyField(view.BindingProperty, GUIContent.none, true); 54 | if (view.BindingProperty.serializedObject.hasModifiedProperties) 55 | { 56 | view.BindingProperty.serializedObject.ApplyModifiedProperties(); 57 | } 58 | 59 | SourceEditor?.Repaint(); 60 | } 61 | else 62 | { 63 | if (propertyTree != null) 64 | { 65 | propertyTree.BeginDraw(false); 66 | foreach (var property in propertyTree.EnumerateTree(false, true)) 67 | { 68 | switch (property.Name) 69 | { 70 | case nameof(BaseConnection.fromNode): 71 | case nameof(BaseConnection.fromPort): 72 | case nameof(BaseConnection.toNode): 73 | case nameof(BaseConnection.toPort): 74 | continue; 75 | } 76 | property.Draw(); 77 | } 78 | propertyTree.EndDraw(); 79 | SourceEditor.Repaint(); 80 | } 81 | } 82 | } 83 | 84 | public override void OnDisable() 85 | { 86 | base.OnDisable(); 87 | propertyTree?.Dispose(); 88 | } 89 | } 90 | } 91 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Inspectors/BaseConnectionInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 65694265866d57b4fade7d84d612329a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Inspectors/BaseGraphInspector.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | #if UNITY_EDITOR 20 | using Atom.UnityEditors; 21 | using UnityEngine; 22 | using Sirenix.OdinInspector.Editor; 23 | 24 | namespace Atom.GraphProcessor.Editors 25 | { 26 | [CustomObjectEditor(typeof(BaseGraphView))] 27 | public class BaseGraphInspector : ObjectEditor 28 | { 29 | static GUIHelper.ContextDataCache ContextDataCache = new GUIHelper.ContextDataCache(); 30 | 31 | protected PropertyTree propertyTree; 32 | 33 | public override void OnEnable() 34 | { 35 | var view = Target as BaseGraphView; 36 | if (view.ViewModel != null) 37 | propertyTree = PropertyTree.Create(view.ViewModel.Model); 38 | } 39 | 40 | public override void OnInspectorGUI() 41 | { 42 | var view = Target as BaseGraphView; 43 | if (view == null || view.ViewModel == null) 44 | return; 45 | 46 | if (!ContextDataCache.TryGetContextData("BigLabel", out var bigLabel)) 47 | { 48 | bigLabel.value = new GUIStyle(GUI.skin.label); 49 | bigLabel.value.fontSize = 18; 50 | bigLabel.value.fontStyle = FontStyle.Bold; 51 | bigLabel.value.alignment = TextAnchor.MiddleLeft; 52 | bigLabel.value.stretchWidth = true; 53 | } 54 | 55 | EditorGUILayoutExtension.BeginVerticalBoxGroup(); 56 | GUILayout.Label(string.Concat("Nodes:", view.ViewModel.Nodes.Count), bigLabel.value); 57 | GUILayout.Label(string.Concat("Connections:", view.ViewModel.Connections.Count), bigLabel.value); 58 | GUILayout.Label(string.Concat("Groups:", view.ViewModel.Groups.GroupMap.Count), bigLabel.value); 59 | EditorGUILayoutExtension.EndVerticalBoxGroup(); 60 | } 61 | 62 | public override void OnDisable() 63 | { 64 | base.OnDisable(); 65 | propertyTree?.Dispose(); 66 | } 67 | } 68 | } 69 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Inspectors/BaseGraphInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f40bc58f69bcf7e45950196eae03f974 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Inspectors/BaseNodeInspector.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | #if UNITY_EDITOR 20 | using Atom.UnityEditors; 21 | using Sirenix.OdinInspector.Editor; 22 | using UnityEditor; 23 | using UnityEngine; 24 | 25 | namespace Atom.GraphProcessor.Editors 26 | { 27 | [CustomObjectEditor(typeof(BaseNodeView))] 28 | public class BaseNodeInspector : ObjectEditor 29 | { 30 | private PropertyTree propertyTree; 31 | 32 | public override void OnEnable() 33 | { 34 | var view = Target as BaseNodeView; 35 | if (view == null || view.ViewModel == null) 36 | return; 37 | if (view.BindingProperty != null) 38 | { 39 | } 40 | else 41 | { 42 | propertyTree = PropertyTree.Create(view.ViewModel.Model); 43 | propertyTree.DrawMonoScriptObjectField = true; 44 | } 45 | } 46 | 47 | public override sealed void OnInspectorGUI() 48 | { 49 | var view = Target as BaseNodeView; 50 | if (view == null || view.ViewModel == null) 51 | return; 52 | 53 | if (false && view.BindingProperty != null) 54 | { 55 | view.BindingProperty.serializedObject.Update(); 56 | EditorGUILayout.PropertyField(view.BindingProperty, GUIContent.none, true); 57 | if (view.BindingProperty.serializedObject.hasModifiedProperties) 58 | { 59 | view.BindingProperty.serializedObject.ApplyModifiedProperties(); 60 | } 61 | 62 | SourceEditor?.Repaint(); 63 | } 64 | else 65 | { 66 | if (propertyTree != null) 67 | { 68 | propertyTree.BeginDraw(false); 69 | foreach (var property in propertyTree.EnumerateTree(false, true)) 70 | { 71 | switch (property.Path) 72 | { 73 | case nameof(BaseNode.id): 74 | case nameof(BaseNode.position): 75 | continue; 76 | } 77 | 78 | property.Draw(); 79 | } 80 | 81 | propertyTree.EndDraw(); 82 | SourceEditor?.Repaint(); 83 | } 84 | } 85 | } 86 | 87 | public override void OnDisable() 88 | { 89 | base.OnDisable(); 90 | propertyTree?.Dispose(); 91 | } 92 | } 93 | 94 | [UnityEditor.CustomPropertyDrawer(typeof(BaseNode))] 95 | public class BaseNodeDrawer : UnityEditor.PropertyDrawer 96 | { 97 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 98 | { 99 | var end = property.GetEndProperty(); 100 | var enterChildren = true; 101 | while (property.NextVisible(enterChildren) && !SerializedProperty.EqualContents(property, end)) 102 | { 103 | enterChildren = false; 104 | EditorGUILayout.PropertyField(property, true); 105 | } 106 | } 107 | 108 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 109 | { 110 | return 0; 111 | } 112 | } 113 | } 114 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Inspectors/BaseNodeInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: daaecc84fd5ea154386406ae2ebe347a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Others.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa35218f90686c94999328b8d2da88fb 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Others/BaseSimpleNodeView.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using UnityEngine.UIElements; 18 | 19 | namespace Atom.GraphProcessor.Editors 20 | { 21 | public abstract class BaseSimpleNodeView : BaseNodeView where M : BaseNodeProcessor 22 | { 23 | protected BaseSimpleNodeView() : base() 24 | { 25 | this.AddToClassList("simple-node-view"); 26 | styleSheets.Add(GraphProcessorEditorStyles.DefaultStyles.BaseSimpleNodeViewStyle); 27 | m_CollapseButton.style.display = DisplayStyle.None; 28 | } 29 | } 30 | 31 | public class BaseSimpleNodeView : BaseSimpleNodeView { } 32 | } 33 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Others/BaseSimpleNodeView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 532a450d0a3554e4aae6e9d9c296a052 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Others/BetterEdgeControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa6e37c5bcee3f5459e15dbb029e3dd5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Others/BetterGridBackground.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | #if UNITY_EDITOR 20 | using System; 21 | using System.Collections; 22 | using System.Collections.Generic; 23 | using UnityEditor.Experimental.GraphView; 24 | using UnityEngine; 25 | using UnityEngine.UIElements; 26 | 27 | namespace Atom.GraphProcessor.Editors 28 | { 29 | public class BetterGridBackground : GridBackground 30 | { 31 | private static CustomStyleProperty s_CenterLineColorProperty = new CustomStyleProperty("--center-line-color"); 32 | 33 | private static readonly Color s_DefaultCenterLineColor = new Color(0f, 0.91f, 1f); 34 | 35 | private Color m_CenterLineColor = BetterGridBackground.s_DefaultCenterLineColor; 36 | private Color centerLineColor => this.m_CenterLineColor; 37 | 38 | private VisualElement m_Container; 39 | 40 | public BetterGridBackground() : base() 41 | { 42 | this.RegisterCallback(new EventCallback(this.OnCustomStyleResolved1)); 43 | } 44 | 45 | private void OnCustomStyleResolved1(CustomStyleResolvedEvent e) 46 | { 47 | ICustomStyle customStyle = e.customStyle; 48 | if (customStyle.TryGetValue(BetterGridBackground.s_CenterLineColorProperty, out var centerLineColor)) 49 | this.m_CenterLineColor = centerLineColor; 50 | } 51 | 52 | protected override void ImmediateRepaint() 53 | { 54 | base.ImmediateRepaint(); 55 | 56 | this.m_Container = this.parent is UnityEditor.Experimental.GraphView.GraphView parent ? parent.contentViewContainer : throw new InvalidOperationException("GridBackground can only be added to a GraphView"); 57 | Rect layout1 = m_Container.layout; 58 | layout1.x = 0; 59 | layout1.y = 0; 60 | 61 | var matrix = m_Container.transform.matrix; 62 | 63 | Vector2 hMin = new Vector3(layout1.x, layout1.y + layout1.height / 2); 64 | Vector2 hMax = new Vector3(layout1.xMax, layout1.y + layout1.height / 2); 65 | 66 | hMin.y += layout1.y * hMin.y; 67 | hMin = m_Container.WorldToLocal(hMin); 68 | hMax = m_Container.WorldToLocal(hMax); 69 | hMin.y = 0; 70 | hMax.y = 0; 71 | hMin = m_Container.LocalToWorld(hMin); 72 | hMax = m_Container.LocalToWorld(hMax); 73 | 74 | if (hMin.y >= layout1.yMin && hMax.y <= layout.yMax) 75 | { 76 | GL.Begin(1); 77 | GL.Color(centerLineColor); 78 | GL.Vertex(hMin); 79 | GL.Vertex(hMax); 80 | GL.End(); 81 | } 82 | } 83 | } 84 | } 85 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Others/BetterGridBackground.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d89576453c19cf34cbfb4af585371f26 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Others/EdgeConnectorListener.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using UnityEngine; 18 | using UnityEditor.Experimental.GraphView; 19 | 20 | namespace Atom.GraphProcessor.Editors 21 | { 22 | public class EdgeConnectorListener : IEdgeConnectorListener 23 | { 24 | /// 拖拽到符合条件的接口上松开时触发 25 | public virtual void OnDrop(GraphView graphView, Edge edge) 26 | { 27 | BaseGraphView tempGraphView = graphView as BaseGraphView; 28 | 29 | BasePortProcessor from = (edge.output as BasePortView).ViewModel; 30 | BasePortProcessor to = (edge.input as BasePortView).ViewModel; 31 | // 如果连线不是一个新建的连线就重定向 32 | if (edge.userData is BaseConnectionProcessor) 33 | tempGraphView.Context.Do(new ConnectCommand(tempGraphView.ViewModel, from, to)); 34 | else 35 | tempGraphView.Context.Do(new ConnectCommand(tempGraphView.ViewModel, from, to)); 36 | } 37 | 38 | /// 拖到空白松开时触发 39 | public void OnDropOutsidePort(Edge edge, Vector2 position) { } 40 | } 41 | } 42 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Others/EdgeConnectorListener.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a5f511b8a7344642b80c17f89c8e2b4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Others/FlowPoint.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | #if UNITY_EDITOR 18 | using UnityEditor; 19 | using UnityEditor.Experimental.GraphView; 20 | using UnityEngine; 21 | using UnityEngine.UIElements; 22 | 23 | namespace Atom.GraphProcessor.Editors 24 | { 25 | public class FlowPoint : Manipulator 26 | { 27 | VisualElement point { get; set; } 28 | 29 | protected override void RegisterCallbacksOnTarget() 30 | { 31 | if (target is Edge edge) 32 | { 33 | point = new VisualElement(); 34 | point.AddToClassList("flow-point"); 35 | point.style.left = 0; 36 | point.style.top = 0; 37 | target.Add(point); 38 | 39 | target.schedule.Execute(() => 40 | { 41 | UpdateCapPoint(edge, (float)(EditorApplication.timeSinceStartup % 3 / 3)); 42 | }).Until(() => point == null); 43 | } 44 | } 45 | 46 | protected override void UnregisterCallbacksFromTarget() 47 | { 48 | if (point != null) 49 | { 50 | target.Remove(point); 51 | point = null; 52 | } 53 | } 54 | 55 | public void UpdateCapPoint(Edge edgeView, float t) 56 | { 57 | Vector3 v = Lerp(edgeView.edgeControl.controlPoints, t); 58 | point.style.left = v.x; 59 | point.style.top = v.y; 60 | } 61 | 62 | Vector2 Lerp(Vector2[] points, float t) 63 | { 64 | t = Mathf.Clamp01(t); 65 | float totalLength = 0; 66 | for (int i = 0; i < points.Length - 1; i++) 67 | { 68 | totalLength += Vector2.Distance(points[i], points[i + 1]); 69 | } 70 | 71 | float pointLength = Mathf.Lerp(0, totalLength, t); 72 | 73 | float tempLength = 0; 74 | for (int i = 0; i < points.Length - 1; i++) 75 | { 76 | float d = Vector2.Distance(points[i], points[i + 1]); 77 | if (pointLength <= tempLength + d) 78 | return Vector2.Lerp(points[i], points[i + 1], (pointLength - tempLength) / d); 79 | tempLength += d; 80 | } 81 | return points[0]; 82 | } 83 | } 84 | } 85 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Others/FlowPoint.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7bb1b9ff1310a34a8560624db770187 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Others/InspectObject.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Atom.GraphProcessor.UnityEX.Editor 4 | { 5 | public class InspectObject : ScriptableObject 6 | { 7 | [SerializeReference] 8 | public BaseGraph graph; 9 | } 10 | } -------------------------------------------------------------------------------- /UnityEX/Editor/Others/InspectObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 17453d5134ad416db32c05b6487bc286 3 | timeCreated: 1736929841 -------------------------------------------------------------------------------- /UnityEX/Editor/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee8213e0bc6f2ab459067a93c5d286f1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e25547e17e90e74bbfa5af379d793d2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/Skin.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d03dfe338a472e4592ad6b9f62a73de 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/Skin/Default Skin.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: f2660acfc3c8ba14a868ad72985c9445, type: 3} 13 | m_Name: Default Skin 14 | m_EditorClassIdentifier: 15 | otherSkins: [] 16 | styleSheets: 17 | - name: basic 18 | styleSheet: {fileID: 11400000, guid: a7a80b2be90b77d409e6ac7c6c37b02a, type: 3} 19 | - name: graph 20 | styleSheet: {fileID: 11400000, guid: 1918e85c91369f14db2c01acc772d72e, type: 3} 21 | - name: node 22 | styleSheet: {fileID: 11400000, guid: 880cb074686d49842b7d83f3a0889022, type: 3} 23 | - name: port 24 | styleSheet: {fileID: 11400000, guid: a109bf339c0c734448cd45e1ee7f3b9e, type: 3} 25 | - name: edge 26 | styleSheet: {fileID: 11400000, guid: 4d69480669ddc6149a9e3ea31c6903bf, type: 3} 27 | - name: group 28 | styleSheet: {fileID: 11400000, guid: 61857deebbb1c074ab1be12de2d416c0, type: 3} 29 | - name: simple node 30 | styleSheet: {fileID: 11400000, guid: 5dc2b2b77f2a6594b94b8c4916594fac, type: 3} 31 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/Skin/Default Skin.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07a74c7d748a2dd4a88601341fd06c53 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c69c5079bbcfe5e47be23cdd90b78bf3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/Textures/Infinity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haloman9527/3.0_GraphProcessor/e10c636932977b74bc544e3a056b6589d4a312f6/UnityEX/Editor/Resources/GraphProcessor/Textures/Infinity.png -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/Textures/Infinity.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2a940a464aa438f42a2e366a094f8803 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 0 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 2048 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 1 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | - serializedVersion: 3 87 | buildTarget: Android 88 | maxTextureSize: 2048 89 | resizeAlgorithm: 0 90 | textureFormat: -1 91 | textureCompression: 1 92 | compressionQuality: 50 93 | crunchedCompression: 0 94 | allowsAlphaSplitting: 0 95 | overridden: 0 96 | androidETC2FallbackOverride: 0 97 | forceMaximumCompressionQuality_BC6H_BC7: 0 98 | spriteSheet: 99 | serializedVersion: 2 100 | sprites: [] 101 | outline: [] 102 | physicsShape: [] 103 | bones: [] 104 | spriteID: 5e97eb03825dee720800000000000000 105 | internalID: 0 106 | vertices: [] 107 | indices: 108 | edges: [] 109 | weights: [] 110 | secondaryTextures: [] 111 | spritePackingTag: 112 | pSDRemoveMatte: 0 113 | pSDShowRemoveMatteOption: 0 114 | userData: 115 | assetBundleName: 116 | assetBundleVariant: 117 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/Textures/PlayIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haloman9527/3.0_GraphProcessor/e10c636932977b74bc544e3a056b6589d4a312f6/UnityEX/Editor/Resources/GraphProcessor/Textures/PlayIcon.png -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/Textures/PlayIcon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ed41396e4d2a32044b88f52f40a6d883 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 0 9 | linearTexture: 1 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: 0.25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 4 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -3 28 | maxTextureSize: 1024 29 | textureSettings: 30 | filterMode: 1 31 | aniso: 1 32 | mipBias: -1 33 | wrapMode: 1 34 | nPOTScale: 0 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | allowsAlphaSplitting: 0 39 | spriteMode: 0 40 | spriteExtrude: 1 41 | spriteMeshType: 1 42 | alignment: 0 43 | spritePivot: {x: 0.5, y: 0.5} 44 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 45 | spritePixelsToUnits: 100 46 | alphaIsTransparency: 1 47 | spriteTessellationDetail: -1 48 | textureType: 2 49 | buildTargetSettings: [] 50 | spriteSheet: 51 | sprites: [] 52 | outline: [] 53 | spritePackingTag: 54 | userData: 55 | assetBundleName: 56 | assetBundleVariant: 57 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/Textures/PlayIcon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haloman9527/3.0_GraphProcessor/e10c636932977b74bc544e3a056b6589d4a312f6/UnityEX/Editor/Resources/GraphProcessor/Textures/PlayIcon1.png -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/Textures/PlayIcon1.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc189eaffe755ac4cbb8b156e996bbfb 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 0 38 | wrapV: 0 39 | wrapW: 0 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/Textures/Save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haloman9527/3.0_GraphProcessor/e10c636932977b74bc544e3a056b6589d4a312f6/UnityEX/Editor/Resources/GraphProcessor/Textures/Save.png -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/Textures/Save.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab2b50d79ec7e224e92c8e22e5f39c4d 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: 1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 256 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 1 73 | - serializedVersion: 3 74 | buildTarget: Standalone 75 | maxTextureSize: 256 76 | resizeAlgorithm: 0 77 | textureFormat: -1 78 | textureCompression: 1 79 | compressionQuality: 50 80 | crunchedCompression: 0 81 | allowsAlphaSplitting: 0 82 | overridden: 0 83 | androidETC2FallbackOverride: 0 84 | forceMaximumCompressionQuality_BC6H_BC7: 1 85 | - serializedVersion: 3 86 | buildTarget: Android 87 | maxTextureSize: 256 88 | resizeAlgorithm: 0 89 | textureFormat: -1 90 | textureCompression: 1 91 | compressionQuality: 50 92 | crunchedCompression: 0 93 | allowsAlphaSplitting: 0 94 | overridden: 0 95 | androidETC2FallbackOverride: 0 96 | forceMaximumCompressionQuality_BC6H_BC7: 1 97 | spriteSheet: 98 | serializedVersion: 2 99 | sprites: [] 100 | outline: [] 101 | physicsShape: [] 102 | bones: [] 103 | spriteID: 5e97eb03825dee720800000000000000 104 | internalID: 0 105 | vertices: [] 106 | indices: 107 | edges: [] 108 | weights: [] 109 | secondaryTextures: [] 110 | spritePackingTag: 111 | pSDRemoveMatte: 0 112 | pSDShowRemoveMatteOption: 0 113 | userData: 114 | assetBundleName: 115 | assetBundleVariant: 116 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07a6cc25e029ce8498bd8f6f0c43d962 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/BaseConnectionView.uss: -------------------------------------------------------------------------------- 1 | .edge { 2 | --edge-width: 2; 3 | --layer: -10; 4 | } 5 | 6 | .edge:hover { 7 | --edge-width: 7; 8 | } 9 | 10 | .edge:checked { 11 | --edge-width: 5; 12 | } 13 | 14 | .flow-point { 15 | width: 6px; 16 | height: 6px; 17 | background-color: #FFFF00; 18 | margin-top: -3px; 19 | margin-bottom: -3px; 20 | margin-left: -3px; 21 | margin-right: -3px; 22 | border-top-left-radius: 3px; 23 | border-bottom-left-radius: 3px; 24 | border-top-right-radius: 3px; 25 | border-bottom-right-radius: 3px; 26 | } -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/BaseConnectionView.uss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d69480669ddc6149a9e3ea31c6903bf 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: stylesheet 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} 11 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/BaseGraphView.uss: -------------------------------------------------------------------------------- 1 | GridBackground { 2 | --grid-background-color: rgb(30, 30, 30); 3 | --line-color: rgba(193, 196, 192, 0.05); 4 | --thick-line-color: rgba(193, 196, 192, 0.07); 5 | --spacing: 30; 6 | --thick-lines: 5; 7 | } 8 | 9 | .scope.group { 10 | /*background-image: resource("GraphProcessor/Textures/Wallpaper 4 Desaturated");*/ 11 | -unity-background-scale-mode: scale-and-crop; 12 | } -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/BaseGraphView.uss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1918e85c91369f14db2c01acc772d72e 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: stylesheet 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} 11 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/BaseNodeView.uss: -------------------------------------------------------------------------------- 1 | #node-border { 2 | background-color: rgba(0, 0, 0, 0.8); 3 | border-radius: 3px; 4 | border-width: 1px; 5 | } 6 | 7 | #selection-border { 8 | border-radius: 4px; 9 | } 10 | 11 | #node-border > #title { 12 | background-color: rgba(0, 0, 0, 0.0); 13 | height: 25px; 14 | } 15 | 16 | #node-border > #title > #title-input { 17 | align-items: center; 18 | height: 100%; 19 | width: 25px; 20 | padding: 3px; 21 | } 22 | 23 | #node-border > #title > #title-output { 24 | align-items: center; 25 | height: 100%; 26 | width: 25px; 27 | padding: 3px; 28 | } 29 | 30 | #node-border > #title > #title-input > .port > #connector { 31 | height: 10px; 32 | width: 10px; 33 | } 34 | 35 | #node-border > #title > #title-input > .port > #connector > #cap { 36 | height: 6px; 37 | width: 6px; 38 | } 39 | 40 | #node-border > #title > #title-output > .port > #connector { 41 | height: 10px; 42 | width: 10px; 43 | } 44 | 45 | #node-border > #title > #title-output > .port > #connector > #cap { 46 | height: 6px; 47 | width: 6px; 48 | } 49 | 50 | #node-border > #title > #title-icon { 51 | width: 12px; 52 | height: 12px; 53 | margin-left: 5px; 54 | align-self: center; 55 | -unity-background-scale-mode: scale-to-fit; 56 | visibility: hidden; 57 | display: none; 58 | } 59 | 60 | #node-border > #title > #title-label { 61 | color: #FF6387; 62 | padding-left: 5px; 63 | padding-right: 5px; 64 | margin: 0; 65 | align-self: center; 66 | flex-wrap: Wrap; 67 | flex-grow: 1; 68 | } 69 | 70 | #node-border > #title > #title-button-container { 71 | visibility: hidden; 72 | display: none; 73 | } 74 | 75 | #node-border > #contents > #top > #input { 76 | align-self: flex-start; 77 | margin-right: 5px; 78 | background-color: rgba(0, 0, 0, 0.23); 79 | border-top-right-radius: 10px; 80 | border-bottom-right-radius: 10px; 81 | } 82 | 83 | #node-border > #contents > #top > #output { 84 | align-self: flex-start; 85 | margin-left: 5px; 86 | background-color: rgba(0, 0, 0, 0.23); 87 | border-top-left-radius: 10px; 88 | border-bottom-left-radius: 10px; 89 | } 90 | 91 | #node-border > #contents > #controls { 92 | padding-top: 1px; 93 | padding-bottom: 2px; 94 | flex-grow: 1; 95 | } 96 | 97 | #node-border > #top-input { 98 | height: 15px; 99 | justify-content: center; 100 | align-items: center; 101 | flex-direction: row; 102 | background-color: rgba(78, 89, 113, 0.0); 103 | border-color: black; 104 | } 105 | 106 | #node-border > #bottom-input { 107 | height: 15px; 108 | justify-content: center; 109 | align-items: center; 110 | flex-direction: row; 111 | background-color: rgba(78, 89, 113, 0.0); 112 | border-color: black; 113 | } 114 | 115 | #divider { 116 | background-color: rgba(255, 128, 0, 1); 117 | } -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/BaseNodeView.uss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 880cb074686d49842b7d83f3a0889022 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: stylesheet 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} 11 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/BasePortView.uss: -------------------------------------------------------------------------------- 1 | .port { 2 | flex-direction: row; 3 | align-items: center; 4 | padding-left: 5px; 5 | padding-right: 5px; 6 | --port-color: #ffc400; 7 | } 8 | 9 | .port > #type { 10 | color: aliceblue; 11 | } 12 | 13 | .port.vertical { 14 | height: 15px; 15 | } 16 | 17 | #input > .port.capacity-Single > #connector.connectorBox { 18 | border-radius: 1px; 19 | } 20 | 21 | #input > .port.capacity-Multi > #connector.connectorBox { 22 | border-radius: 8px; 23 | } 24 | 25 | #input > .port.capacity-Single > #connector.connectorBox > #cap.connectorCap { 26 | border-radius: 0px; 27 | } 28 | 29 | #input > .port.capacity-Multi > #connector.connectorBox > #cap.connectorCap { 30 | border-radius: 4px; 31 | } 32 | 33 | #output > .port.capacity-Single > #connector.connectorBox { 34 | border-radius: 1px; 35 | } 36 | 37 | #output > .port.capacity-Multi > #connector.connectorBox { 38 | border-radius: 8px; 39 | } 40 | 41 | #output > .port.capacity-Single > #connector.connectorBox > #cap.connectorCap { 42 | border-radius: 0px; 43 | } 44 | 45 | #output > .port.capacity-Multi > #connector.connectorBox > #cap.connectorCap { 46 | border-radius: 4px; 47 | } 48 | 49 | #title-output > .port { 50 | --port-color: #00FFFF; 51 | } 52 | 53 | #title-input > .port { 54 | --port-color: #00FFFF; 55 | } 56 | 57 | #title-input > .port > #type { 58 | display: none; 59 | } 60 | 61 | #title-output > .port > #type { 62 | display: none; 63 | } 64 | 65 | #title-input > .port > #connector { 66 | border-top-left-radius: 0px; 67 | border-bottom-left-radius: 0px; 68 | } 69 | 70 | #title-output > .port > #connector { 71 | border-top-left-radius: 0px; 72 | border-bottom-left-radius: 0px; 73 | } 74 | 75 | #title-input > .port > #connector > #cap { 76 | border-top-left-radius: 0px; 77 | border-bottom-left-radius: 0px; 78 | } 79 | 80 | #title-output > .port > #connector > #cap { 81 | border-top-left-radius: 0px; 82 | border-bottom-left-radius: 0px; 83 | } 84 | 85 | /*#title-input > .port.rl > #connector {*/ 86 | /* border-top-right-radius: 0px;*/ 87 | /* border-bottom-right-radius: 0px;*/ 88 | /*}*/ 89 | 90 | /*#title-output > .port.rl > #connector {*/ 91 | /* border-top-right-radius: 0px;*/ 92 | /* border-bottom-right-radius: 0px;*/ 93 | /*}*/ 94 | 95 | /*#title-input > .port.rl > #connector > #cap {*/ 96 | /* border-top-right-radius: 0px;*/ 97 | /* border-bottom-right-radius: 0px;*/ 98 | /*}*/ 99 | 100 | /*#title-output > .port.rl > #connector > #cap {*/ 101 | /* border-top-right-radius: 0px;*/ 102 | /* border-bottom-right-radius: 0px;*/ 103 | /*}*/ 104 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/BasePortView.uss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a109bf339c0c734448cd45e1ee7f3b9e 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: stylesheet 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} 11 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/BaseSimpleNodeView.uss: -------------------------------------------------------------------------------- 1 | .node { 2 | min-width: 80px; 3 | } 4 | 5 | #node-border { 6 | border-radius: 8px; 7 | } 8 | 9 | #selection-border { 10 | border-radius: 9px; 11 | } 12 | 13 | #node-border > #title > #title-label { 14 | margin-left: 2px; 15 | margin-right: 2px; 16 | font-size: 12px; 17 | align-self: center; 18 | -unity-text-align: middle-center; 19 | } 20 | 21 | #node-border > #title > #title-button-container { 22 | display: none; 23 | } 24 | 25 | #node-border > #title > #input { 26 | flex-direction: row-reverse; 27 | align-items: center; 28 | flex-direction: row; 29 | } 30 | 31 | #node-border > #title > #output { 32 | flex-direction: row-reverse; 33 | align-items: center; 34 | flex-direction: row; 35 | } 36 | 37 | #node-border > .highlight { 38 | border-radius: 8px; 39 | } -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/BaseSimpleNodeView.uss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5dc2b2b77f2a6594b94b8c4916594fac 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: stylesheet 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} 11 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/BasicStyle.uss: -------------------------------------------------------------------------------- 1 | .unity-text-element { 2 | -unity-font-style: bold; 3 | } 4 | 5 | .unity-toolbar { 6 | border-width: 0px; 7 | } 8 | 9 | .unity-toolbar #ToolbarCenter { 10 | flex-grow: 1; 11 | } 12 | 13 | .unity-toolbar > ToolbarButton { 14 | width: 80px; 15 | -unity-text-align: middle-center; 16 | } 17 | 18 | .unity-toolbar #ToolbarLeft > ToolbarButton { 19 | border-left-width: 0; 20 | } 21 | 22 | .unity-toolbar #ToolbarRight > ToolbarButton { 23 | border-right-width: 0; 24 | } 25 | 26 | .hidden { 27 | display: none; 28 | visibility: hidden; 29 | } 30 | 31 | .highlight { 32 | background-color: rgba(0, 255, 255, 1); 33 | border-radius: 7px 34 | } 35 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/BasicStyle.uss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7a80b2be90b77d409e6ac7c6c37b02a 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: stylesheet 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} 11 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/GroupView.uss: -------------------------------------------------------------------------------- 1 | #group-border{ 2 | position: absolute; 3 | height: 100%; 4 | width: 100%; 5 | } 6 | 7 | #titleContainer > #titleLabel { 8 | padding-right: 70px; 9 | } 10 | 11 | #titleContainer > #titleField { 12 | padding-right: 70px; 13 | } 14 | 15 | #titleContainer > #titleField > #unity-text-input { 16 | padding-top: 0px; 17 | -unity-text-align: middle-center; 18 | -unity-font-style: bold; 19 | font-size: 15px; 20 | } 21 | 22 | #backgroundColorField { 23 | position: absolute; 24 | width: 50px; 25 | right: 10px; 26 | top: 6px; 27 | } -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/GroupView.uss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61857deebbb1c074ab1be12de2d416c0 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: stylesheet 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} 11 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/StickyNodeView.uss: -------------------------------------------------------------------------------- 1 | #node-border { 2 | min-width: 200; 3 | min-height: 200; 4 | background-color: #FCD76E; 5 | padding: 2px; 6 | } 7 | 8 | #node-border > #title { 9 | display: none; 10 | } 11 | 12 | #contents > #divider { 13 | display: none; 14 | } 15 | 16 | .unity-text-element { 17 | -unity-font-style: normal; 18 | } 19 | 20 | 21 | #contents > #controls > #titleLabel { 22 | flex-grow: 0; 23 | height: 30px; 24 | border-width: 1px; 25 | border-color: #44C0FF; 26 | font-size: 18px; 27 | -unity-text-align: middle-center; 28 | color: #3C3C3C; 29 | } 30 | 31 | #contents > #controls > #title { 32 | flex-grow: 0; 33 | height: 30px; 34 | display: none; 35 | } 36 | 37 | #contents > #controls > #title > #unity-text-input > .unity-text-element { 38 | font-size: 18px; 39 | -unity-text-align: middle-center; 40 | } 41 | 42 | #contents > #controls > #contentsLabel { 43 | flex-grow: 1; 44 | border-width: 1px; 45 | border-color: #44C0FF; 46 | border-top-width: 0; 47 | font-size: 15px; 48 | color: #3C3C3C; 49 | } 50 | 51 | #contents > #controls > #contents { 52 | flex-grow: 1; 53 | display: none; 54 | } 55 | 56 | #contents > #controls > #contents > #unity-text-input > VisualElement > .unity-text-element { 57 | font-size: 15px; 58 | } -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/USS/StickyNodeView.uss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a8ec64251a24d14a807c321a928edb0 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: stylesheet 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} 11 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/UXML.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 33f972a1a03644d43b892464f552ca48 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/UXML/GraphWindow.uxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Resources/GraphProcessor/UXML/GraphWindow.uxml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04d10734dec176a408dec8e6df930f30 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} 11 | -------------------------------------------------------------------------------- /UnityEX/Editor/Utils.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 773c65a36f4256141a610878182a450b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Utils/GraphProcessorEditorSettings.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System.Runtime.CompilerServices; 3 | using Atom.UnityEditors; 4 | 5 | namespace Atom.GraphProcessor.Editors 6 | { 7 | public class GraphProcessorEditorSettings 8 | { 9 | public static EditorPrefsVariable MiniMapActive { get; } = new EditorPrefsVariable(GetKey()); 10 | 11 | public static string GetKey([CallerMemberName] string memberName = null) 12 | { 13 | return $"{nameof(GraphProcessorEditorSettings)}.{memberName}"; 14 | } 15 | } 16 | } 17 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Utils/GraphProcessorEditorSettings.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07d1d6fe2089423e957bda80d8049d46 3 | timeCreated: 1736931451 -------------------------------------------------------------------------------- /UnityEX/Editor/Utils/GraphProcessorEditorStyles.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | #if UNITY_EDITOR 20 | using UnityEngine; 21 | using UnityEngine.UIElements; 22 | 23 | namespace Atom.GraphProcessor.Editors 24 | { 25 | public static class GraphProcessorEditorStyles 26 | { 27 | public static Styles DefaultStyles { get; private set; } = new Styles() 28 | { 29 | GraphWindowTree = Resources.Load("GraphProcessor/UXML/GraphWindow"), 30 | 31 | BasicStyle = Resources.Load("GraphProcessor/USS/BasicStyle"), 32 | BaseGraphViewStyle = Resources.Load("GraphProcessor/USS/BaseGraphView"), 33 | BaseNodeViewStyle = Resources.Load("GraphProcessor/USS/BaseNodeView"), 34 | BaseSimpleNodeViewStyle = Resources.Load("GraphProcessor/USS/BaseSimpleNodeView"), 35 | BasePortViewStyle = Resources.Load("GraphProcessor/USS/BasePortView"), 36 | BaseConnectionViewStyle = Resources.Load("GraphProcessor/USS/BaseConnectionView"), 37 | GroupViewStyle = Resources.Load("GraphProcessor/USS/GroupView"), 38 | StickyNodeStyle = Resources.Load("GraphProcessor/USS/StickyNodeView"), 39 | StickyNoteStyle = Resources.Load("GraphProcessor/USS/StickyNoteView"), 40 | }; 41 | 42 | public class Styles 43 | { 44 | public VisualTreeAsset GraphWindowTree; 45 | 46 | public StyleSheet BasicStyle; 47 | public StyleSheet BaseGraphViewStyle; 48 | public StyleSheet BaseNodeViewStyle; 49 | public StyleSheet BaseSimpleNodeViewStyle; 50 | public StyleSheet BasePortViewStyle; 51 | public StyleSheet BaseConnectionViewStyle; 52 | public StyleSheet GroupViewStyle; 53 | public StyleSheet StickyNodeStyle; 54 | public StyleSheet StickyNoteStyle; 55 | } 56 | } 57 | } 58 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Utils/GraphProcessorEditorStyles.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3bca7113a472068489ca0948c25343e6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Utils/GraphProcessorEditorUtil.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | #if UNITY_EDITOR 20 | using System; 21 | using System.Collections.Generic; 22 | using Atom; 23 | using UnityEditor; 24 | 25 | namespace Atom.GraphProcessor.Editors 26 | { 27 | public static class GraphProcessorEditorUtil 28 | { 29 | private static Dictionary s_ViewTypesCache; 30 | 31 | static GraphProcessorEditorUtil() 32 | { 33 | Init(); 34 | } 35 | 36 | private static void Init() 37 | { 38 | s_ViewTypesCache = new Dictionary(); 39 | foreach (var type in TypeCache.GetTypesWithAttribute()) 40 | { 41 | if (type.IsAbstract) continue; 42 | foreach (var attribute in type.GetCustomAttributes(false)) 43 | { 44 | if (!(attribute is CustomViewAttribute customViewAttribute)) 45 | continue; 46 | s_ViewTypesCache[customViewAttribute.targetType] = type; 47 | } 48 | } 49 | } 50 | 51 | public static Type GetViewType(Type targetType) 52 | { 53 | var viewType = (Type)null; 54 | while (viewType == null) 55 | { 56 | s_ViewTypesCache.TryGetValue(targetType, out viewType); 57 | if (targetType.BaseType == null) 58 | break; 59 | targetType = targetType.BaseType; 60 | } 61 | 62 | return viewType; 63 | } 64 | 65 | public static BaseGraph Clone(this BaseGraph graph) 66 | { 67 | var cloneGraph = Activator.CreateInstance(graph.GetType()) as BaseGraph; 68 | EditorUtility.CopySerializedManagedFieldsOnly(graph, cloneGraph); 69 | return cloneGraph; 70 | } 71 | } 72 | } 73 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Utils/GraphProcessorEditorUtil.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0db03c160257a384d99c71181b490a26 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5080b7996a0288d4b9f0c217c8d45b28 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/BaseConnectionView.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | #if UNITY_EDITOR 17 | using UnityEditor.Experimental.GraphView; 18 | 19 | namespace Atom.GraphProcessor.Editors 20 | { 21 | public partial class BaseConnectionView 22 | { 23 | protected override EdgeControl CreateEdgeControl() 24 | { 25 | return new BetterEdgeControl(this); 26 | } 27 | 28 | protected virtual void BindProperties() { } 29 | 30 | protected virtual void UnbindProperties() { } 31 | 32 | protected virtual void OnInitialized() { } 33 | } 34 | } 35 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/BaseConnectionView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d2e3581f2207b84c9a7a474d9058a21 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/BaseGraphView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddf2a31487c834548b27b8f54d87a3e2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/BaseGraphWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e5dbba7c772ad84c982493e1deb5195 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/BaseNodeView.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | #if UNITY_EDITOR 20 | using System; 21 | using Atom.UnityEditors; 22 | using UnityEditor; 23 | using UnityEditor.Experimental.GraphView; 24 | using UnityEngine; 25 | using UnityEngine.UIElements; 26 | 27 | namespace Atom.GraphProcessor.Editors 28 | { 29 | public abstract partial class BaseNodeView 30 | { 31 | protected virtual BasePortView NewPortView(BasePortProcessor port) 32 | { 33 | return Activator.CreateInstance(GraphProcessorEditorUtil.GetViewType(port.ModelType), port, new EdgeConnectorListener()) as BasePortView; 34 | } 35 | 36 | public override void BuildContextualMenu(ContextualMenuPopulateEvent evt) 37 | { 38 | foreach (var script in EditorUtilityExtension.FindAllScriptFromType(ViewModel.GetType())) 39 | { 40 | evt.menu.AppendAction($"Open Script/" + script.name, _ => { AssetDatabase.OpenAsset(script); }); 41 | } 42 | 43 | foreach (var script in EditorUtilityExtension.FindAllScriptFromType(ViewModel.Model.GetType())) 44 | { 45 | evt.menu.AppendAction($"Open Script/" + script.name, _ => { AssetDatabase.OpenAsset(script); }); 46 | } 47 | 48 | evt.menu.AppendSeparator(); 49 | } 50 | 51 | public override void OnSelected() 52 | { 53 | base.OnSelected(); 54 | BringToFront(); 55 | } 56 | 57 | public virtual bool CheckDrawControls() 58 | { 59 | return controls.childCount > 0; 60 | } 61 | 62 | protected virtual void DoInit() 63 | { 64 | } 65 | 66 | protected virtual void DoUnInit() 67 | { 68 | } 69 | 70 | public void HighlightOn() 71 | { 72 | nodeBorder.AddToClassList("highlight"); 73 | } 74 | 75 | public void HighlightOff() 76 | { 77 | nodeBorder.RemoveFromClassList("highlight"); 78 | } 79 | 80 | public void Flash() 81 | { 82 | HighlightOn(); 83 | schedule.Execute(_ => { HighlightOff(); }).ExecuteLater(2000); 84 | } 85 | 86 | public void AddBadge(IconBadge badge) 87 | { 88 | Add(badge); 89 | badges.Add(badge); 90 | badge.AttachTo(topContainer, SpriteAlignment.TopRight); 91 | } 92 | 93 | public void RemoveBadge(Func callback) 94 | { 95 | badges.RemoveAll(b => 96 | { 97 | if (callback(b)) 98 | { 99 | b.Detach(); 100 | b.RemoveFromHierarchy(); 101 | return true; 102 | } 103 | 104 | return false; 105 | }); 106 | } 107 | } 108 | 109 | public class BaseNodeView : BaseNodeView where T : BaseNodeProcessor 110 | { 111 | public T T_ViewModel 112 | { 113 | get { return base.ViewModel as T; } 114 | } 115 | } 116 | } 117 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/BaseNodeView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 086eab6d5cc937542b6121b25ff39746 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/BasePortView.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | #if UNITY_EDITOR 20 | using UnityEditor.Experimental.GraphView; 21 | 22 | namespace Atom.GraphProcessor.Editors 23 | { 24 | public abstract partial class BasePortView 25 | { 26 | public BasePortView(BasePortProcessor port, IEdgeConnectorListener connectorListener) : this( 27 | orientation: (port.Direction == BasePort.Direction.Left || port.Direction == BasePort.Direction.Right) ? Orientation.Horizontal : Orientation.Vertical, 28 | direction: (port.Direction == BasePort.Direction.Left || port.Direction == BasePort.Direction.Top) ? Direction.Input : Direction.Output, 29 | capacity: port.Capacity == BasePort.Capacity.Single ? Capacity.Single : Capacity.Multi, 30 | port.portType, connectorListener) 31 | { 32 | } 33 | 34 | protected virtual void DoInit() 35 | { 36 | } 37 | 38 | protected virtual void DoUnInit() 39 | { 40 | } 41 | } 42 | } 43 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/BasePortView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 35fd6bb6a49b77749a75fa458e54d71a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Defaults.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 437add78318d4861a32df3fc48d45415 3 | timeCreated: 1701012697 -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Defaults/DefaultConnectionViewcs.cs: -------------------------------------------------------------------------------- 1 |  2 | #if UNITY_EDITOR 3 | 4 | namespace Atom.GraphProcessor.Editors 5 | { 6 | [CustomView(typeof(BaseConnection))] 7 | public class DefaultConnectionView : BaseConnectionView 8 | { 9 | 10 | } 11 | } 12 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Defaults/DefaultConnectionViewcs.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 06d08f557a3949aa9ca52ef407ba35ce 3 | timeCreated: 1736933108 -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Defaults/DefaultGraphView.cs: -------------------------------------------------------------------------------- 1 |  2 | #if UNITY_EDITOR 3 | namespace Atom.GraphProcessor.Editors 4 | { 5 | [CustomView(typeof(BaseGraph))] 6 | public class DefaultGraphView : BaseGraphView 7 | { 8 | } 9 | } 10 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Defaults/DefaultGraphView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43c3cdc31915491c856902f521d784ec 3 | timeCreated: 1701014334 -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Defaults/DefaultGraphWindow.cs: -------------------------------------------------------------------------------- 1 |  2 | #if UNITY_EDITOR 3 | namespace Atom.GraphProcessor.Editors 4 | { 5 | [CustomView(typeof(BaseGraph))] 6 | public class DefaultGraphWindow : BaseGraphWindow 7 | { 8 | 9 | } 10 | } 11 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Defaults/DefaultGraphWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2b92de9126b4658829094d7bdc5207b 3 | timeCreated: 1701012713 -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Defaults/DefaultNodeView.cs: -------------------------------------------------------------------------------- 1 |  2 | #if UNITY_EDITOR 3 | namespace Atom.GraphProcessor.Editors 4 | { 5 | [CustomView(typeof(BaseNode))] 6 | public class DefaultNodeView : BaseNodeView 7 | { 8 | 9 | } 10 | } 11 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Defaults/DefaultNodeView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad64a96903294e38845a3c7299e2a625 3 | timeCreated: 1701014160 -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Defaults/DefaultPortViewcs.cs: -------------------------------------------------------------------------------- 1 |  2 | #if UNITY_EDITOR 3 | using System; 4 | using UnityEditor.Experimental.GraphView; 5 | 6 | namespace Atom.GraphProcessor.Editors 7 | { 8 | [CustomView(typeof(BasePort))] 9 | public class DefaultPortView : BasePortView 10 | { 11 | protected DefaultPortView(Orientation orientation, Direction direction, Capacity capacity, Type type, IEdgeConnectorListener connectorListener) : base(orientation, direction, capacity, type, connectorListener) 12 | { 13 | } 14 | 15 | public DefaultPortView(BasePortProcessor port, IEdgeConnectorListener connectorListener) : base(port, connectorListener) 16 | { 17 | } 18 | } 19 | } 20 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Defaults/DefaultPortViewcs.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c915b55907314e7f9c6d431e5d724663 3 | timeCreated: 1701014246 -------------------------------------------------------------------------------- /UnityEX/Editor/Views/GraphViewContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | #if UNITY_EDITOR 5 | namespace Atom.GraphProcessor.Editors 6 | { 7 | [Serializable] 8 | public class GraphViewContext 9 | { 10 | private FrameCommands frameCommands; 11 | 12 | public BaseGraphWindow graphWindow; 13 | public CommandDispatcher commandDispatcher; 14 | 15 | public void Do(Action @do, Action @undo) 16 | { 17 | Do(new CommandDispatcher.ActionCommand(@do, @do, @undo)); 18 | } 19 | 20 | public void Do(ICommand command) 21 | { 22 | command.Do(); 23 | frameCommands ??= new FrameCommands(); 24 | frameCommands.RegisterCommand(command); 25 | } 26 | 27 | public void FrameEnd() 28 | { 29 | if (frameCommands != null) 30 | { 31 | commandDispatcher.Register(frameCommands); 32 | frameCommands = null; 33 | } 34 | } 35 | 36 | public sealed class FrameCommands : ICommand 37 | { 38 | public List commands = new List(); 39 | 40 | public void RegisterCommand(ICommand command) 41 | { 42 | commands.Add(command); 43 | } 44 | 45 | public void Do() 46 | { 47 | for (var index = 0; index < commands.Count; index++) 48 | { 49 | var command = commands[index]; 50 | command.Do(); 51 | } 52 | } 53 | 54 | public void Redo() 55 | { 56 | for (var index = 0; index < commands.Count; index++) 57 | { 58 | var command = commands[index]; 59 | command.Redo(); 60 | } 61 | } 62 | 63 | public void Undo() 64 | { 65 | for (var index = commands.Count - 1; index >= 0; index--) 66 | { 67 | var command = commands[index]; 68 | command.Undo(); 69 | } 70 | } 71 | } 72 | } 73 | } 74 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/GraphViewContext.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 285cf8ca9d6548e09d8de3806fbc9a58 3 | timeCreated: 1737085086 -------------------------------------------------------------------------------- /UnityEX/Editor/Views/GroupView.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | #if UNITY_EDITOR 20 | 21 | namespace Atom.GraphProcessor.Editors 22 | { 23 | [CustomView(typeof(Group))] 24 | public sealed partial class GroupView 25 | { 26 | } 27 | } 28 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/GroupView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcfcbf20079a1b643ad66d280ed3b17f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Internals.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ca7a4ec0d786c247984dff9363dfe1f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Internals/BaseConnectionView.Internal.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | #if UNITY_EDITOR 20 | using UnityEditor; 21 | using UnityEditor.Experimental.GraphView; 22 | using UnityEngine.UIElements; 23 | 24 | namespace Atom.GraphProcessor.Editors 25 | { 26 | public partial class BaseConnectionView : Edge, IGraphElementView 27 | { 28 | public BaseConnectionProcessor ViewModel { get; private set; } 29 | public IGraphElementProcessor V => ViewModel; 30 | public BaseGraphView Owner { get; private set; } 31 | public SerializedProperty BindingProperty { get; private set; } 32 | 33 | public BaseConnectionView() 34 | { 35 | styleSheets.Add(GraphProcessorEditorStyles.DefaultStyles.BaseConnectionViewStyle); 36 | this.RegisterCallback(OnMouseEnter); 37 | } 38 | 39 | #region Initialize 40 | 41 | public void SetUp(BaseConnectionProcessor connection, BaseGraphView graphView) 42 | { 43 | ViewModel = connection; 44 | Owner = graphView; 45 | } 46 | 47 | public void Init() 48 | { 49 | this.OnIndexChanged(-1, ViewModel.Index); 50 | this.ViewModel.onIndexChanged += OnIndexChanged; 51 | this.RegisterCallback(OnClick); 52 | this.DoInit(); 53 | } 54 | 55 | public void UnInit() 56 | { 57 | this.UnregisterCallback(OnClick); 58 | this.DoUnInit(); 59 | } 60 | 61 | protected virtual void DoInit() 62 | { 63 | } 64 | 65 | protected virtual void DoUnInit() 66 | { 67 | } 68 | 69 | #endregion 70 | 71 | #region Callbacks 72 | 73 | private void OnIndexChanged(int oldIndex, int newIndex) 74 | { 75 | if (this.Owner.Context.graphWindow.UnityGraphAssetSO != null) 76 | { 77 | this.Owner.Context.graphWindow.UnityGraphAssetSO.Update(); 78 | this.BindingProperty = this.Owner.Context.graphWindow.UnityGraphAssetSO.FindProperty($"data.nodes.Array.data[{newIndex}]"); 79 | } 80 | } 81 | 82 | private void OnMouseEnter(MouseEnterEvent evt) 83 | { 84 | this.BringToFront(); 85 | } 86 | 87 | private void OnClick(ClickEvent evt) 88 | { 89 | if (evt.clickCount == 2) 90 | { 91 | } 92 | } 93 | 94 | #endregion 95 | } 96 | } 97 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Internals/BaseConnectionView.Internal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 469ccd2392cee7b49b9047b4f1139dec 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Internals/BaseGraphView.Internal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e22529d4bc7a4147a41c7cd5afb178f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Internals/BaseNodeView.Internal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 466016b49c7b1cf4ba53a21d66853498 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Internals/BasePortView.Internal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0858ee2b9d8597a48a0552f0bda585ba 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Internals/BaseVisualElement.cs: -------------------------------------------------------------------------------- 1 |  2 | #if UNITY_EDITOR 3 | using UnityEngine.UIElements; 4 | 5 | namespace Atom.GraphProcessor.Editors 6 | { 7 | public class BaseVisualElement : VisualElement 8 | { 9 | public enum ChildChangedType 10 | { 11 | Added, 12 | Removed 13 | } 14 | 15 | public class ChildChangedEvent : EventBase 16 | { 17 | public ChildChangedType type; 18 | public VisualElement target; 19 | } 20 | 21 | public new void Add(VisualElement child) 22 | { 23 | base.Add(child); 24 | var evt = ChildChangedEvent.GetPooled(); 25 | evt.type = ChildChangedType.Added; 26 | evt.target = child; 27 | this.SendEvent(evt); 28 | } 29 | 30 | public new void Remove(VisualElement child) 31 | { 32 | base.Remove(child); 33 | var evt = ChildChangedEvent.GetPooled(); 34 | evt.type = ChildChangedType.Removed; 35 | evt.target = child; 36 | this.SendEvent(evt); 37 | } 38 | } 39 | } 40 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Internals/BaseVisualElement.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5f7146b645e4000a9e9fb366862dff5 3 | timeCreated: 1705553831 -------------------------------------------------------------------------------- /UnityEX/Editor/Views/Internals/GroupView.Internal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f7d739231e615c4fb25b50e1187d249 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/NodeMenuWindow.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | 3 | /*** 4 | * 5 | * Title: 6 | * 7 | * Description: 8 | * 9 | * Date: 10 | * Version: 11 | * Writer: 半只龙虾人 12 | * Github: https://github.com/haloman9527 13 | * Blog: https://www.haloman.net/ 14 | * 15 | */ 16 | 17 | #endregion 18 | 19 | #if UNITY_EDITOR 20 | using System; 21 | using System.Collections.Generic; 22 | using UnityEngine; 23 | using UnityEditor.Experimental.GraphView; 24 | using UnityEngine.UIElements; 25 | 26 | namespace Atom.GraphProcessor.Editors 27 | { 28 | public class NodeMenuWindow : ScriptableObject, ISearchWindowProvider 29 | { 30 | #region Define 31 | 32 | public interface INodeEntry 33 | { 34 | string Path { get; } 35 | 36 | string[] Menu { get; } 37 | 38 | void CreateNode(BaseGraphView graphView, InternalVector2Int position); 39 | } 40 | 41 | public class NodeEntry : INodeEntry 42 | { 43 | private readonly string path; 44 | private readonly string[] menu; 45 | public readonly Type nodeType; 46 | 47 | public string Path 48 | { 49 | get { return path; } 50 | } 51 | 52 | public string[] Menu 53 | { 54 | get { return menu; } 55 | } 56 | 57 | public NodeEntry(string path, string[] menu, Type nodeType) 58 | { 59 | this.path = path; 60 | this.menu = menu; 61 | this.nodeType = nodeType; 62 | } 63 | 64 | public void CreateNode(BaseGraphView graphView, InternalVector2Int position) 65 | { 66 | graphView.Context.Do(new AddNodeCommand(graphView.ViewModel, nodeType, position)); 67 | } 68 | } 69 | #endregion 70 | 71 | private string treeName; 72 | private BaseGraphView graphView; 73 | public List entries = new List(256); 74 | 75 | public void Initialize(string treeName, BaseGraphView graphView) 76 | { 77 | this.treeName = treeName; 78 | this.graphView = graphView; 79 | } 80 | 81 | public bool OnSelectEntry(SearchTreeEntry searchTreeEntry, SearchWindowContext context) 82 | { 83 | var windowRoot = graphView.Context.graphWindow.rootVisualElement; 84 | var windowMousePosition = windowRoot.ChangeCoordinatesTo(windowRoot.parent, context.screenMousePosition - graphView.Context.graphWindow.position.position); 85 | var graphMousePosition = graphView.contentViewContainer.WorldToLocal(windowMousePosition); 86 | 87 | var nodeEntry = searchTreeEntry.userData as INodeEntry; 88 | nodeEntry.CreateNode(graphView, graphMousePosition.ToInternalVector2Int()); 89 | 90 | graphView.Context.graphWindow.Focus(); 91 | return true; 92 | } 93 | 94 | public List CreateSearchTree(SearchWindowContext context) 95 | { 96 | var tree = new List(entries.Count + 1); 97 | tree.Add(new SearchTreeGroupEntry(new GUIContent(treeName))); 98 | 99 | HashSet groups = new HashSet(); 100 | foreach (var nodeEntry in entries) 101 | { 102 | var nodeName = nodeEntry.Menu[nodeEntry.Menu.Length - 1]; 103 | 104 | if (nodeEntry.Menu.Length > 1) 105 | { 106 | var groupPath = ""; 107 | for (int i = 0; i < nodeEntry.Menu.Length - 1; i++) 108 | { 109 | var title = nodeEntry.Menu[i]; 110 | groupPath += title; 111 | if (!groups.Contains(groupPath)) 112 | { 113 | tree.Add(new SearchTreeGroupEntry(new GUIContent(title)) 114 | { 115 | level = i + 1 116 | }); 117 | groups.Add(groupPath); 118 | } 119 | } 120 | } 121 | 122 | tree.Add(new SearchTreeEntry(new GUIContent(nodeName)) 123 | { 124 | level = nodeEntry.Menu.Length, 125 | userData = nodeEntry 126 | }); 127 | } 128 | 129 | return tree; 130 | } 131 | } 132 | } 133 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/NodeMenuWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e41ac938a114d240815109754dad232 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Editor/Views/StickyNoteView.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEditor.Experimental.GraphView; 3 | using UnityEngine; 4 | 5 | namespace Atom.GraphProcessor.Editors 6 | { 7 | public sealed class StickyNoteView : UnityEditor.Experimental.GraphView.StickyNote, IGraphElementView 8 | { 9 | public StickyNoteProcessor ViewModel { get; private set; } 10 | public IGraphElementProcessor V => ViewModel; 11 | 12 | public BaseGraphView Owner { get; private set; } 13 | 14 | public StickyNoteView() 15 | { 16 | } 17 | 18 | public void SetUp(StickyNoteProcessor note, BaseGraphView graphView) 19 | { 20 | this.ViewModel = note; 21 | this.Owner = graphView; 22 | // 初始化 23 | base.SetPosition(new Rect(ViewModel.Position.ToVector2(), ViewModel.Size.ToVector2())); 24 | this.title = note.Title; 25 | this.contents = note.Content; 26 | } 27 | 28 | public void Init() 29 | { 30 | ViewModel.RegisterValueChanged(nameof(StickyNote.position), OnPositionChanged); 31 | ViewModel.RegisterValueChanged(nameof(StickyNote.size), OnSizeChanged); 32 | ViewModel.RegisterValueChanged(nameof(StickyNote.title), OnTitleChanged); 33 | ViewModel.RegisterValueChanged(nameof(StickyNote.content), OnContentsChanged); 34 | 35 | this.RegisterCallback(OnChanged); 36 | } 37 | 38 | public void UnInit() 39 | { 40 | ViewModel.UnregisterValueChanged(nameof(StickyNote.position), OnPositionChanged); 41 | ViewModel.UnregisterValueChanged(nameof(StickyNote.size), OnSizeChanged); 42 | ViewModel.UnregisterValueChanged(nameof(StickyNote.title), OnTitleChanged); 43 | ViewModel.UnregisterValueChanged(nameof(StickyNote.content), OnContentsChanged); 44 | 45 | this.UnregisterCallback(OnChanged); 46 | } 47 | 48 | private void OnChanged(StickyNoteChangeEvent evt) 49 | { 50 | switch (evt.change) 51 | { 52 | case StickyNoteChange.Title: 53 | { 54 | var oldTitle = ViewModel.Title; 55 | var newTitle = this.title; 56 | Owner.Context.Do(() => { ViewModel.Title = newTitle; }, () => { ViewModel.Title = oldTitle; }); 57 | break; 58 | } 59 | case StickyNoteChange.Contents: 60 | { 61 | var oldContent = ViewModel.Content; 62 | var newContent = this.contents; 63 | Owner.Context.Do(() => { ViewModel.Content = newContent; }, () => { ViewModel.Content = oldContent; }); 64 | break; 65 | } 66 | case StickyNoteChange.Theme: 67 | break; 68 | case StickyNoteChange.FontSize: 69 | break; 70 | case StickyNoteChange.Position: 71 | { 72 | var oldPosition = ViewModel.Position; 73 | var oldSize = ViewModel.Size; 74 | this.schedule.Execute(() => 75 | { 76 | var newPosition = GetPosition().position.ToInternalVector2Int(); 77 | var newSize = GetPosition().size.ToInternalVector2Int(); 78 | Owner.Context.Do(() => 79 | { 80 | ViewModel.Position = newPosition; 81 | ViewModel.Size = newSize; 82 | }, () => 83 | { 84 | ViewModel.Position = oldPosition; 85 | ViewModel.Size = oldSize; 86 | }); 87 | }).ExecuteLater(20); 88 | 89 | break; 90 | } 91 | } 92 | } 93 | 94 | void OnPositionChanged(ViewModel.ValueChangedArg arg) 95 | { 96 | base.SetPosition(new Rect(arg.newValue.ToVector2(), GetPosition().size)); 97 | Owner.SetDirty(); 98 | } 99 | 100 | void OnSizeChanged(ViewModel.ValueChangedArg arg) 101 | { 102 | base.SetPosition(new Rect(GetPosition().position, arg.newValue.ToVector2())); 103 | Owner.SetDirty(); 104 | } 105 | 106 | private void OnContentsChanged(ViewModel.ValueChangedArg arg) 107 | { 108 | this.contents = arg.newValue; 109 | Owner.SetDirty(); 110 | } 111 | 112 | private void OnTitleChanged(ViewModel.ValueChangedArg arg) 113 | { 114 | this.title = arg.newValue; 115 | Owner.SetDirty(); 116 | } 117 | } 118 | } 119 | #endif -------------------------------------------------------------------------------- /UnityEX/Editor/Views/StickyNoteView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1310304a037b49d584f0137cc6d1ba40 3 | timeCreated: 1706385777 -------------------------------------------------------------------------------- /UnityEX/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddaa06508ba0c6c4f94d968b489ecf0e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Runtime/ExtMethodsForUnity.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 为Unity编写的一些扩展方法 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | namespace Atom.GraphProcessor 18 | { 19 | public static class UnityExtMethods 20 | { 21 | public static UnityEngine.Color ToColor(this InternalColor self) 22 | { 23 | return new UnityEngine.Color(self.r, self.g, self.b, self.a); 24 | } 25 | 26 | public static InternalColor ToInternalColor(this UnityEngine.Color self) 27 | { 28 | return new InternalColor(self.r, self.g, self.b, self.a); 29 | } 30 | 31 | public static UnityEngine.Vector2 ToVector2(this InternalVector2Int self) 32 | { 33 | return new UnityEngine.Vector2(self.x, self.y); 34 | } 35 | 36 | public static UnityEngine.Vector2Int ToVector2Int(this InternalVector2Int self) 37 | { 38 | return new UnityEngine.Vector2Int(self.x, self.y); 39 | } 40 | 41 | public static InternalVector2Int ToInternalVector2Int(this UnityEngine.Vector2 self) 42 | { 43 | return new InternalVector2Int((int)self.x, (int)self.y); 44 | } 45 | 46 | public static UnityEngine.Vector3 ToVector3(this InternalVector3Int self) 47 | { 48 | return new UnityEngine.Vector3(self.x, self.y, self.z); 49 | } 50 | 51 | public static UnityEngine.Vector3Int ToVector3Int(this InternalVector3Int self) 52 | { 53 | return new UnityEngine.Vector3Int(self.x, self.y, self.z); 54 | } 55 | 56 | public static InternalVector3Int ToInternalVector3Int(this UnityEngine.Vector3 self) 57 | { 58 | return new InternalVector3Int((int)self.x, (int)self.y, (int)self.z); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /UnityEX/Runtime/ExtMethodsForUnity.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 550f7b6ebbf43d84b811e9df11730753 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Runtime/GraphAssetOwner.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | 17 | using System; 18 | using Atom; 19 | using UnityEngine; 20 | 21 | using UnityObject = UnityEngine.Object; 22 | 23 | namespace Atom.GraphProcessor 24 | { 25 | public abstract class GraphAssetOwner : MonoBehaviour, IGraphAssetOwner 26 | where TGraphAsset : UnityObject, IGraphAsset 27 | where TGraph : BaseGraphProcessor 28 | { 29 | #region Fields 30 | private TGraph graph = null; 31 | [SerializeField] 32 | private TGraphAsset graphAsset = null; 33 | #endregion 34 | 35 | #region Properties 36 | 37 | public IGraphAsset GraphAsset 38 | { 39 | get { return graphAsset; } 40 | } 41 | 42 | public BaseGraphProcessor Graph 43 | { 44 | get { return T_Graph; } 45 | } 46 | 47 | public TGraphAsset T_GraphAsset 48 | { 49 | get { return graphAsset; } 50 | } 51 | 52 | public virtual TGraph T_Graph 53 | { 54 | get 55 | { 56 | if (graph == null && graphAsset != null) 57 | { 58 | var graphData = graphAsset.LoadGraph(); 59 | graph = ViewModelFactory.ProduceViewModel(graphData) as TGraph; 60 | } 61 | 62 | return graph; 63 | } 64 | set { graph = value; } 65 | } 66 | #endregion 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /UnityEX/Runtime/GraphAssetOwner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d42a92dd109f83943af307e148f9342e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Runtime/Inaterfaces.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26fcbccc895c41d4cbdcca4006624d0a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEX/Runtime/Inaterfaces/IGraphAsset.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | 18 | namespace Atom.GraphProcessor 19 | { 20 | public interface IGraphAsset 21 | { 22 | Type GraphType { get; } 23 | 24 | void SaveGraph(BaseGraph graph); 25 | 26 | BaseGraph LoadGraph(); 27 | } 28 | } -------------------------------------------------------------------------------- /UnityEX/Runtime/Inaterfaces/IGraphAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7653d7a5ef3f50e4086dd7a69fca2b8f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityEX/Runtime/Inaterfaces/IGraphAssetOwner.cs: -------------------------------------------------------------------------------- 1 | #region 注 释 2 | /*** 3 | * 4 | * Title: 5 | * 6 | * Description: 7 | * 8 | * Date: 9 | * Version: 10 | * Writer: 半只龙虾人 11 | * Github: https://github.com/haloman9527 12 | * Blog: https://www.haloman.net/ 13 | * 14 | */ 15 | #endregion 16 | using System; 17 | 18 | using UnityObject = UnityEngine.Object; 19 | 20 | namespace Atom.GraphProcessor 21 | { 22 | public interface IGraphAssetOwner : IGraphOwner 23 | { 24 | IGraphAsset GraphAsset { get; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /UnityEX/Runtime/Inaterfaces/IGraphAssetOwner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9fb2c7ca9dc3cd40a231054534c39cb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | --------------------------------------------------------------------------------