diff --git a/.gitignore b/.gitignore
index 057baf1..6604425 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/Dialogue/
+/TextMesh Pro/
\ No newline at end of file
diff --git a/TNode/TNodeCore/Attribute/Ports/BatchInputAttribute.cs b/TNode/TNodeCore/Attribute/Ports/BatchInputAttribute.cs
deleted file mode 100644
index 76217b7..0000000
--- a/TNode/TNodeCore/Attribute/Ports/BatchInputAttribute.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-namespace TNodeCore.Attribute.Ports{
- public class BatchInputAttribute{
-
- }
-}
\ No newline at end of file
diff --git a/TNode/TNodeCore/GraphEditor.cs b/TNode/TNodeCore/Editor/GraphEditor.cs
similarity index 100%
rename from TNode/TNodeCore/GraphEditor.cs
rename to TNode/TNodeCore/Editor/GraphEditor.cs
diff --git a/TNode/TNodeCore/GraphEditor.cs.meta b/TNode/TNodeCore/Editor/GraphEditor.cs.meta
similarity index 100%
rename from TNode/TNodeCore/GraphEditor.cs.meta
rename to TNode/TNodeCore/Editor/GraphEditor.cs.meta
diff --git a/TNode/TNodeCore/Attribute.meta b/TNode/TNodeCore/Runtime/Attributes.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute.meta
rename to TNode/TNodeCore/Runtime/Attributes.meta
diff --git a/TNode/TNodeCore/Attribute/DisableOnInspector.cs b/TNode/TNodeCore/Runtime/Attributes/DisableOnInspector.cs
similarity index 100%
rename from TNode/TNodeCore/Attribute/DisableOnInspector.cs
rename to TNode/TNodeCore/Runtime/Attributes/DisableOnInspector.cs
diff --git a/TNode/TNodeCore/Attribute/DisableOnInspector.cs.meta b/TNode/TNodeCore/Runtime/Attributes/DisableOnInspector.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/DisableOnInspector.cs.meta
rename to TNode/TNodeCore/Runtime/Attributes/DisableOnInspector.cs.meta
diff --git a/TNode/TNodeCore/Attribute/GraphUsageAttribute.cs b/TNode/TNodeCore/Runtime/Attributes/GraphUsageAttribute.cs
similarity index 100%
rename from TNode/TNodeCore/Attribute/GraphUsageAttribute.cs
rename to TNode/TNodeCore/Runtime/Attributes/GraphUsageAttribute.cs
diff --git a/TNode/TNodeCore/Attribute/GraphUsageAttribute.cs.meta b/TNode/TNodeCore/Runtime/Attributes/GraphUsageAttribute.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/GraphUsageAttribute.cs.meta
rename to TNode/TNodeCore/Runtime/Attributes/GraphUsageAttribute.cs.meta
diff --git a/TNode/TNodeCore/Attribute/InternalUsageAttribute.cs b/TNode/TNodeCore/Runtime/Attributes/InternalUsageAttribute.cs
similarity index 100%
rename from TNode/TNodeCore/Attribute/InternalUsageAttribute.cs
rename to TNode/TNodeCore/Runtime/Attributes/InternalUsageAttribute.cs
diff --git a/TNode/TNodeCore/Attribute/InternalUsageAttribute.cs.meta b/TNode/TNodeCore/Runtime/Attributes/InternalUsageAttribute.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/InternalUsageAttribute.cs.meta
rename to TNode/TNodeCore/Runtime/Attributes/InternalUsageAttribute.cs.meta
diff --git a/TNode/TNodeCore/Attribute/NodeAttribute.cs b/TNode/TNodeCore/Runtime/Attributes/NodeAttribute.cs
similarity index 100%
rename from TNode/TNodeCore/Attribute/NodeAttribute.cs
rename to TNode/TNodeCore/Runtime/Attributes/NodeAttribute.cs
diff --git a/TNode/TNodeCore/Attribute/NodeAttribute.cs.meta b/TNode/TNodeCore/Runtime/Attributes/NodeAttribute.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/NodeAttribute.cs.meta
rename to TNode/TNodeCore/Runtime/Attributes/NodeAttribute.cs.meta
diff --git a/TNode/TNodeCore/Attribute/PortTypeConversion.cs b/TNode/TNodeCore/Runtime/Attributes/PortTypeConversion.cs
similarity index 100%
rename from TNode/TNodeCore/Attribute/PortTypeConversion.cs
rename to TNode/TNodeCore/Runtime/Attributes/PortTypeConversion.cs
diff --git a/TNode/TNodeCore/Attribute/PortTypeConversion.cs.meta b/TNode/TNodeCore/Runtime/Attributes/PortTypeConversion.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/PortTypeConversion.cs.meta
rename to TNode/TNodeCore/Runtime/Attributes/PortTypeConversion.cs.meta
diff --git a/TNode/TNodeCore/Attribute/Ports.meta b/TNode/TNodeCore/Runtime/Attributes/Ports.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/Ports.meta
rename to TNode/TNodeCore/Runtime/Attributes/Ports.meta
diff --git a/TNode/TNodeCore/Runtime/Attributes/Ports/BatchInputAttribute.cs b/TNode/TNodeCore/Runtime/Attributes/Ports/BatchInputAttribute.cs
new file mode 100644
index 0000000..47f51fd
--- /dev/null
+++ b/TNode/TNodeCore/Runtime/Attributes/Ports/BatchInputAttribute.cs
@@ -0,0 +1,5 @@
+namespace TNode.TNodeCore.Runtime.Attributes.Ports{
+ public class BatchInputAttribute{
+
+ }
+}
\ No newline at end of file
diff --git a/TNode/TNodeCore/Attribute/Ports/BatchInputAttribute.cs.meta b/TNode/TNodeCore/Runtime/Attributes/Ports/BatchInputAttribute.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/Ports/BatchInputAttribute.cs.meta
rename to TNode/TNodeCore/Runtime/Attributes/Ports/BatchInputAttribute.cs.meta
diff --git a/TNode/TNodeCore/Attribute/Ports/BatchOutputAttribute.cs b/TNode/TNodeCore/Runtime/Attributes/Ports/BatchOutputAttribute.cs
similarity index 100%
rename from TNode/TNodeCore/Attribute/Ports/BatchOutputAttribute.cs
rename to TNode/TNodeCore/Runtime/Attributes/Ports/BatchOutputAttribute.cs
diff --git a/TNode/TNodeCore/Attribute/Ports/BatchOutputAttribute.cs.meta b/TNode/TNodeCore/Runtime/Attributes/Ports/BatchOutputAttribute.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/Ports/BatchOutputAttribute.cs.meta
rename to TNode/TNodeCore/Runtime/Attributes/Ports/BatchOutputAttribute.cs.meta
diff --git a/TNode/TNodeCore/Attribute/Ports/InputAttribute.cs b/TNode/TNodeCore/Runtime/Attributes/Ports/InputAttribute.cs
similarity index 100%
rename from TNode/TNodeCore/Attribute/Ports/InputAttribute.cs
rename to TNode/TNodeCore/Runtime/Attributes/Ports/InputAttribute.cs
diff --git a/TNode/TNodeCore/Attribute/Ports/InputAttribute.cs.meta b/TNode/TNodeCore/Runtime/Attributes/Ports/InputAttribute.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/Ports/InputAttribute.cs.meta
rename to TNode/TNodeCore/Runtime/Attributes/Ports/InputAttribute.cs.meta
diff --git a/TNode/TNodeCore/Attribute/Ports/OutputAttribute.cs b/TNode/TNodeCore/Runtime/Attributes/Ports/OutputAttribute.cs
similarity index 100%
rename from TNode/TNodeCore/Attribute/Ports/OutputAttribute.cs
rename to TNode/TNodeCore/Runtime/Attributes/Ports/OutputAttribute.cs
diff --git a/TNode/TNodeCore/Attribute/Ports/OutputAttribute.cs.meta b/TNode/TNodeCore/Runtime/Attributes/Ports/OutputAttribute.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/Ports/OutputAttribute.cs.meta
rename to TNode/TNodeCore/Runtime/Attributes/Ports/OutputAttribute.cs.meta
diff --git a/TNode/TNodeCore/Attribute/Ports/PortAttribute.cs b/TNode/TNodeCore/Runtime/Attributes/Ports/PortAttribute.cs
similarity index 96%
rename from TNode/TNodeCore/Attribute/Ports/PortAttribute.cs
rename to TNode/TNodeCore/Runtime/Attributes/Ports/PortAttribute.cs
index fe49e84..d23eb6a 100644
--- a/TNode/TNodeCore/Attribute/Ports/PortAttribute.cs
+++ b/TNode/TNodeCore/Runtime/Attributes/Ports/PortAttribute.cs
@@ -22,6 +22,7 @@ namespace TNodeCore.Attribute.Ports{
public readonly string Name;
public readonly PortNameHandling NameHandling;
public Type HandledType;
+ public bool Multiple = true;
public TypeHandling TypeHandling{ get; set; }
public PortAttribute(string name,PortNameHandling nameHandling=PortNameHandling.Auto,TypeHandling typeHandling=TypeHandling.Declared){
this.Name = name;
diff --git a/TNode/TNodeCore/Attribute/Ports/PortAttribute.cs.meta b/TNode/TNodeCore/Runtime/Attributes/Ports/PortAttribute.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/Ports/PortAttribute.cs.meta
rename to TNode/TNodeCore/Runtime/Attributes/Ports/PortAttribute.cs.meta
diff --git a/TNode/TNodeCore/Attribute/RuntimeNodeAttribute.cs b/TNode/TNodeCore/Runtime/Attributes/RuntimeNodeAttribute.cs
similarity index 100%
rename from TNode/TNodeCore/Attribute/RuntimeNodeAttribute.cs
rename to TNode/TNodeCore/Runtime/Attributes/RuntimeNodeAttribute.cs
diff --git a/TNode/TNodeCore/Attribute/RuntimeNodeAttribute.cs.meta b/TNode/TNodeCore/Runtime/Attributes/RuntimeNodeAttribute.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/RuntimeNodeAttribute.cs.meta
rename to TNode/TNodeCore/Runtime/Attributes/RuntimeNodeAttribute.cs.meta
diff --git a/TNode/TNodeCore/Attribute/ShowInNodeViewAttribute.cs b/TNode/TNodeCore/Runtime/Attributes/ShowInNodeViewAttribute.cs
similarity index 100%
rename from TNode/TNodeCore/Attribute/ShowInNodeViewAttribute.cs
rename to TNode/TNodeCore/Runtime/Attributes/ShowInNodeViewAttribute.cs
diff --git a/TNode/TNodeCore/Attribute/ShowInNodeViewAttribute.cs.meta b/TNode/TNodeCore/Runtime/Attributes/ShowInNodeViewAttribute.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/ShowInNodeViewAttribute.cs.meta
rename to TNode/TNodeCore/Runtime/Attributes/ShowInNodeViewAttribute.cs.meta
diff --git a/TNode/TNodeCore/Attribute/ViewComponentAttribute.cs b/TNode/TNodeCore/Runtime/Attributes/ViewComponentAttribute.cs
similarity index 100%
rename from TNode/TNodeCore/Attribute/ViewComponentAttribute.cs
rename to TNode/TNodeCore/Runtime/Attributes/ViewComponentAttribute.cs
diff --git a/TNode/TNodeCore/Attribute/ViewComponentAttribute.cs.meta b/TNode/TNodeCore/Runtime/Attributes/ViewComponentAttribute.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Attribute/ViewComponentAttribute.cs.meta
rename to TNode/TNodeCore/Runtime/Attributes/ViewComponentAttribute.cs.meta
diff --git a/TNode/TNodeCore/Components.meta b/TNode/TNodeCore/Runtime/Components.meta
similarity index 100%
rename from TNode/TNodeCore/Components.meta
rename to TNode/TNodeCore/Runtime/Components.meta
diff --git a/TNode/TNodeCore/Components/RuntimeDataSaver.cs b/TNode/TNodeCore/Runtime/Components/RuntimeDataSaver.cs
similarity index 100%
rename from TNode/TNodeCore/Components/RuntimeDataSaver.cs
rename to TNode/TNodeCore/Runtime/Components/RuntimeDataSaver.cs
diff --git a/TNode/TNodeCore/Components/RuntimeDataSaver.cs.meta b/TNode/TNodeCore/Runtime/Components/RuntimeDataSaver.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Components/RuntimeDataSaver.cs.meta
rename to TNode/TNodeCore/Runtime/Components/RuntimeDataSaver.cs.meta
diff --git a/TNode/TNodeCore/Components/RuntimeGraph.cs b/TNode/TNodeCore/Runtime/Components/RuntimeGraph.cs
similarity index 54%
rename from TNode/TNodeCore/Components/RuntimeGraph.cs
rename to TNode/TNodeCore/Runtime/Components/RuntimeGraph.cs
index 0cdd8ea..f890154 100644
--- a/TNode/TNodeCore/Components/RuntimeGraph.cs
+++ b/TNode/TNodeCore/Runtime/Components/RuntimeGraph.cs
@@ -7,20 +7,53 @@ using UnityEngine;
namespace TNodeCore.Components{
public class RuntimeGraph:MonoBehaviour{
+ ///
+ /// Graph data reference to be used in runtime
+ ///
public GraphData graphData;
+ ///
+ /// Runtime copy of scene node data to hold references to scene objects
+ ///
public List sceneNodes;
+
+ ///
+ /// Map of node id to runtime node
+ ///
public readonly Dictionary RuntimeNodes = new Dictionary();
+ ///
+ /// The graph tool the current runtime graph is using
+ ///
private GraphTool _graphTool;
-
+ ///
+ /// Inner graph tool to help with graph operations
+ ///
private class GraphTool{
+
+ ///
+ /// Topological order of the graph nodes
+ ///
[NonSerialized]
public readonly List TopologicalOrder = new List();
+
+ ///
+ /// Entry nodes of the graph. These are the nodes that has no input.
+ ///
public readonly List EntryNodes = new List();
///
+ /// Cached data for Dependency traversal.
+ ///
+ public readonly Dictionary OutputCached = new Dictionary();
+
+ ///
+ /// Ssed to detect if the graph tool is caching the output data of the node
+ ///
+ private bool _isCachingOutput = false;
+ ///
/// elements are read only ,do not modify them
///
public readonly Dictionary RuntimeNodes;
+ //Traverse and process all nodes in a topological order,dependency of the node is already resolved.if you want to run specific node,you can use RunNodeDependently instead
public void DirectlyTraversal(){
foreach (var node in TopologicalOrder){
var links = node.InputLink;
@@ -30,26 +63,76 @@ namespace TNodeCore.Components{
node.NodeData.Process();
}
}
- public void DependencyTraversal(RuntimeNode runtimeNode){
+
+ ///
+ /// Cache out port data in the graph tool so that we can directly access the output.
+ /// The two function assume there will be no change happens in scene nodes or blackboard referenced data during the running,so in a dependency traversal for some
+ /// batch of nodes.the nodes could directly access the output data in the graph tool instead of waiting dependency traversal resolve the result of the output.
+ ///
+ public void StartCachingPort(){
+ _isCachingOutput = true;
+ }
+ public void EndCachingPort(){
+ _isCachingOutput = false;
+ OutputCached.Clear();
+ }
+ ///
+ /// Resolve dependencies by a deep first search,the depended nodes will be processed to satisfy the need of the the given runtime node
+ /// Note it's a recursive function.if you want directly traverse all nodes with dependency resolved ,use DirectlyTraversal() instead.
+ ///
+ /// The node you want to resolve dependency
+ /// search depth,no need provide a number when use outside
+ public void RunNodeDependently(RuntimeNode runtimeNode,int dependencyLevel=0){
var links = runtimeNode.InputLink;
foreach (var link in links){
var outputNode = RuntimeNodes[link.outPort.nodeDataId];
- DependencyTraversal(outputNode);
+ RunNodeDependently(outputNode,dependencyLevel+1);
HandlingLink(link);
}
+
+ if (dependencyLevel > DependencyLevelMax){
+ throw new Exception("Dependency anomaly detected,check if there is a loop in the graph");
+ }
+
+
+ //if the runtime node has no output ,it will not be processed
+ if (runtimeNode.OutputLink.Count == 0 && dependencyLevel != 0){
+ return;
+ }
runtimeNode.NodeData.Process();
+
+
}
-
+ ///
+ /// Max depth of dependency traversal,in case of some special situation. the dependency level bigger than this number will be considered as a loop.
+ ///
+ private const int DependencyLevelMax = 1145;
+ ///
+ /// Handling a node link to transfer data from it's output side to the input side
+ ///
+ /// Link you want to process
public void HandlingLink(NodeLink nodeLink){
+ //out node is node output data
+ //in node is node receive data
var inNode = RuntimeNodes[nodeLink.inPort.nodeDataId];
var outNode = RuntimeNodes[nodeLink.outPort.nodeDataId];
- //out node is node output data
- //in node is node receive data
- var outValue = outNode.GetOutput(nodeLink.outPort.portEntryName);
-
+
+ //TODO looks like this string would be too long to make a cache
+
+ var cachedKey = $"{outNode.NodeData.id}-{nodeLink.inPort.portEntryName}";
+ var outValue = OutputCached.ContainsKey(cachedKey) ? OutputCached[cachedKey] : outNode.GetOutput(nodeLink.outPort.portEntryName);;
+ if (_isCachingOutput){
+ OutputCached[cachedKey] = outValue;
+ }
inNode.SetInput(nodeLink.inPort.portEntryName, outValue);
}
+ ///
+ /// Constructor of the graph tool,it will traverse the graph and build the topological order of the graph.
+ ///
+ /// List of nodes you need to traversal to build graph tool
+ /// Map stores the mapping of node data id to runtime node
+
public GraphTool(List list, Dictionary graphNodes){
RuntimeNodes = graphNodes;
if (list == null) return;
@@ -87,10 +170,20 @@ namespace TNodeCore.Components{
}
+ ///
+ /// Holding the reference of the blackboard ,but it will be override by the runtime graph
+ ///
[SerializeReference]
public BlackboardData runtimeBlackboardData;
+ ///
+ /// Check if the runtime graph is build .a built graph has a graph tool set up
+ ///
[NonSerialized]
private bool _build = false;
+
+ ///
+ /// Build the graph tool and other dependencies for the runtime graph
+ ///
public void Build(){
var link = graphData.NodeLinks;
@@ -109,6 +202,11 @@ namespace TNodeCore.Components{
_build = true;
}
+ ///
+ /// Cast the node data to a runtime node
+ ///
+ /// Node data you provided
+ ///
public RuntimeNode Get(NodeData nodeData){
if(!_build)
Build();
@@ -117,20 +215,24 @@ namespace TNodeCore.Components{
}
return null;
}
-
+ ///
+ /// Get the runtime node from an id
+ ///
+ ///
+ ///
public RuntimeNode Get(string id){
if (RuntimeNodes.ContainsKey(id)){
return RuntimeNodes[id];
}
return null;
}
- //DFS search for resolving dependency
- public bool ResolveDependency(NodeData startNode){
+ //DFS search to run a node.
+ public bool RunOnDependency(NodeData startNode){
if(!_build)
Build();
if (_graphTool == null)
return false;
- _graphTool.DependencyTraversal(Get(startNode));
+ _graphTool.RunNodeDependently(Get(startNode));
return true;
}
public bool ResolveDependency(){
@@ -152,10 +254,20 @@ namespace TNodeCore.Components{
}
public List GetRuntimeNodesOfType(){
- return RuntimeNodes.Values.Where(x => x.NodeType == typeof(T)).ToList();
+ return RuntimeNodes.Values.Where(x => typeof(T).IsAssignableFrom(x.NodeType)).ToList();
}
public List GetRuntimeNodesOfType(Type type){
- return RuntimeNodes.Values.Where(x => x.NodeType == type).ToList();
+ return RuntimeNodes.Values.Where(x => type.IsAssignableFrom(type)).ToList();
+ }
+ public void RunNodesOfType(Type t){
+ var nodes = GetRuntimeNodesOfType(t);
+ _graphTool.StartCachingPort();
+ foreach (var runtimeNode in nodes){
+ RunOnDependency(runtimeNode.NodeData);
+ }
+ _graphTool.EndCachingPort();
+
+
}
private void ModifyOrCreateOutNode(NodeLink linkData){
var outNodeId = linkData.outPort.nodeDataId;
@@ -170,7 +282,7 @@ namespace TNodeCore.Components{
public void OnValidate(){
if(runtimeBlackboardData==null||runtimeBlackboardData.GetType()==typeof(BlackboardData)){
if (graphData != null)
- runtimeBlackboardData = graphData.blackboardData.Clone() as BlackboardData;
+ runtimeBlackboardData = graphData.blackboardData?.Clone() as BlackboardData;
}
}
@@ -186,6 +298,7 @@ namespace TNodeCore.Components{
public void Start(){
Build();
+
}
public virtual void RuntimeExecute(){
_graphTool.DirectlyTraversal();
diff --git a/TNode/TNodeCore/Components/RuntimeGraph.cs.meta b/TNode/TNodeCore/Runtime/Components/RuntimeGraph.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Components/RuntimeGraph.cs.meta
rename to TNode/TNodeCore/Runtime/Components/RuntimeGraph.cs.meta
diff --git a/TNode/TNodeCore/DataWrapper.cs b/TNode/TNodeCore/Runtime/DataWrapper.cs
similarity index 100%
rename from TNode/TNodeCore/DataWrapper.cs
rename to TNode/TNodeCore/Runtime/DataWrapper.cs
diff --git a/TNode/TNodeCore/DataWrapper.cs.meta b/TNode/TNodeCore/Runtime/DataWrapper.cs.meta
similarity index 100%
rename from TNode/TNodeCore/DataWrapper.cs.meta
rename to TNode/TNodeCore/Runtime/DataWrapper.cs.meta
diff --git a/TNode/TNodeCore/Models.meta b/TNode/TNodeCore/Runtime/Models.meta
similarity index 100%
rename from TNode/TNodeCore/Models.meta
rename to TNode/TNodeCore/Runtime/Models.meta
diff --git a/TNode/TNodeCore/Models/BlackboardData.cs b/TNode/TNodeCore/Runtime/Models/BlackboardData.cs
similarity index 100%
rename from TNode/TNodeCore/Models/BlackboardData.cs
rename to TNode/TNodeCore/Runtime/Models/BlackboardData.cs
diff --git a/TNode/TNodeCore/Models/BlackboardData.cs.meta b/TNode/TNodeCore/Runtime/Models/BlackboardData.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Models/BlackboardData.cs.meta
rename to TNode/TNodeCore/Runtime/Models/BlackboardData.cs.meta
diff --git a/TNode/TNodeCore/Models/BlackboardDragNodeData.cs b/TNode/TNodeCore/Runtime/Models/BlackboardDragNodeData.cs
similarity index 100%
rename from TNode/TNodeCore/Models/BlackboardDragNodeData.cs
rename to TNode/TNodeCore/Runtime/Models/BlackboardDragNodeData.cs
diff --git a/TNode/TNodeCore/Models/BlackboardDragNodeData.cs.meta b/TNode/TNodeCore/Runtime/Models/BlackboardDragNodeData.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Models/BlackboardDragNodeData.cs.meta
rename to TNode/TNodeCore/Runtime/Models/BlackboardDragNodeData.cs.meta
diff --git a/TNode/TNodeCore/Models/GraphData.cs b/TNode/TNodeCore/Runtime/Models/GraphData.cs
similarity index 100%
rename from TNode/TNodeCore/Models/GraphData.cs
rename to TNode/TNodeCore/Runtime/Models/GraphData.cs
diff --git a/TNode/TNodeCore/Models/GraphData.cs.meta b/TNode/TNodeCore/Runtime/Models/GraphData.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Models/GraphData.cs.meta
rename to TNode/TNodeCore/Runtime/Models/GraphData.cs.meta
diff --git a/TNode/TNodeCore/Models/IModel.cs b/TNode/TNodeCore/Runtime/Models/IModel.cs
similarity index 100%
rename from TNode/TNodeCore/Models/IModel.cs
rename to TNode/TNodeCore/Runtime/Models/IModel.cs
diff --git a/TNode/TNodeCore/Models/IModel.cs.meta b/TNode/TNodeCore/Runtime/Models/IModel.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Models/IModel.cs.meta
rename to TNode/TNodeCore/Runtime/Models/IModel.cs.meta
diff --git a/TNode/TNodeCore/Models/NodeData.cs b/TNode/TNodeCore/Runtime/Models/NodeData.cs
similarity index 100%
rename from TNode/TNodeCore/Models/NodeData.cs
rename to TNode/TNodeCore/Runtime/Models/NodeData.cs
diff --git a/TNode/TNodeCore/Models/NodeData.cs.meta b/TNode/TNodeCore/Runtime/Models/NodeData.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Models/NodeData.cs.meta
rename to TNode/TNodeCore/Runtime/Models/NodeData.cs.meta
diff --git a/TNode/TNodeCore/Models/NodeLink.cs b/TNode/TNodeCore/Runtime/Models/NodeLink.cs
similarity index 100%
rename from TNode/TNodeCore/Models/NodeLink.cs
rename to TNode/TNodeCore/Runtime/Models/NodeLink.cs
diff --git a/TNode/TNodeCore/Models/NodeLink.cs.meta b/TNode/TNodeCore/Runtime/Models/NodeLink.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Models/NodeLink.cs.meta
rename to TNode/TNodeCore/Runtime/Models/NodeLink.cs.meta
diff --git a/TNode/TNodeCore/Models/PortInfo.cs b/TNode/TNodeCore/Runtime/Models/PortInfo.cs
similarity index 100%
rename from TNode/TNodeCore/Models/PortInfo.cs
rename to TNode/TNodeCore/Runtime/Models/PortInfo.cs
diff --git a/TNode/TNodeCore/Models/PortInfo.cs.meta b/TNode/TNodeCore/Runtime/Models/PortInfo.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Models/PortInfo.cs.meta
rename to TNode/TNodeCore/Runtime/Models/PortInfo.cs.meta
diff --git a/TNode/TNodeCore/Models/SceneObjectWrapper.cs b/TNode/TNodeCore/Runtime/Models/SceneObjectWrapper.cs
similarity index 100%
rename from TNode/TNodeCore/Models/SceneObjectWrapper.cs
rename to TNode/TNodeCore/Runtime/Models/SceneObjectWrapper.cs
diff --git a/TNode/TNodeCore/Models/SceneObjectWrapper.cs.meta b/TNode/TNodeCore/Runtime/Models/SceneObjectWrapper.cs.meta
similarity index 100%
rename from TNode/TNodeCore/Models/SceneObjectWrapper.cs.meta
rename to TNode/TNodeCore/Runtime/Models/SceneObjectWrapper.cs.meta
diff --git a/TNode/TNodeCore/RuntimeCache.meta b/TNode/TNodeCore/Runtime/RuntimeCache.meta
similarity index 100%
rename from TNode/TNodeCore/RuntimeCache.meta
rename to TNode/TNodeCore/Runtime/RuntimeCache.meta
diff --git a/TNode/TNodeCore/RuntimeCache/IModelPropertyAccessor.cs b/TNode/TNodeCore/Runtime/RuntimeCache/IModelPropertyAccessor.cs
similarity index 100%
rename from TNode/TNodeCore/RuntimeCache/IModelPropertyAccessor.cs
rename to TNode/TNodeCore/Runtime/RuntimeCache/IModelPropertyAccessor.cs
diff --git a/TNode/TNodeCore/RuntimeCache/IModelPropertyAccessor.cs.meta b/TNode/TNodeCore/Runtime/RuntimeCache/IModelPropertyAccessor.cs.meta
similarity index 100%
rename from TNode/TNodeCore/RuntimeCache/IModelPropertyAccessor.cs.meta
rename to TNode/TNodeCore/Runtime/RuntimeCache/IModelPropertyAccessor.cs.meta
diff --git a/TNode/TNodeCore/RuntimeCache/RuntimeCache.cs b/TNode/TNodeCore/Runtime/RuntimeCache/RuntimeCache.cs
similarity index 98%
rename from TNode/TNodeCore/RuntimeCache/RuntimeCache.cs
rename to TNode/TNodeCore/Runtime/RuntimeCache/RuntimeCache.cs
index 8d0a3e6..d00cfb9 100644
--- a/TNode/TNodeCore/RuntimeCache/RuntimeCache.cs
+++ b/TNode/TNodeCore/Runtime/RuntimeCache/RuntimeCache.cs
@@ -267,6 +267,9 @@ namespace TNodeCore.RuntimeCache{
return (T) method.Invoke(data);
}
public static object GetValue(this IModel data, string path,Type type=null){
+ if(!RuntimeCache.Instance.CachedDelegatesForGettingValue.ContainsKey(type??data.GetType())){
+ return null;
+ }
var dic = RuntimeCache.Instance.CachedDelegatesForGettingValue[type ?? data.GetType()];
var method = dic.ContainsKey(path) ? dic[path] : null;
return method?.Invoke(data);
diff --git a/TNode/TNodeCore/RuntimeCache/RuntimeCache.cs.meta b/TNode/TNodeCore/Runtime/RuntimeCache/RuntimeCache.cs.meta
similarity index 100%
rename from TNode/TNodeCore/RuntimeCache/RuntimeCache.cs.meta
rename to TNode/TNodeCore/Runtime/RuntimeCache/RuntimeCache.cs.meta
diff --git a/TNode/TNodeGraphViewImpl/Editor/Inspector/NodeInspectorInNode.cs b/TNode/TNodeGraphViewImpl/Editor/Inspector/NodeInspectorInNode.cs
index 8581d05..561a006 100644
--- a/TNode/TNodeGraphViewImpl/Editor/Inspector/NodeInspectorInNode.cs
+++ b/TNode/TNodeGraphViewImpl/Editor/Inspector/NodeInspectorInNode.cs
@@ -80,7 +80,7 @@ namespace TNode.Editor.Inspector{
if(!test.IsRuntimeGraph) return;
var runtimeGraph = test.GetRuntimeGraph();
if (runtimeGraph != null){
- var res = runtimeGraph.ResolveDependency(_data);
+ var res = runtimeGraph.RunOnDependency(_data);
}
_data.OnTest();
}
diff --git a/TNode/TNodeGraphViewImpl/Editor/NodeViews/NodeView.cs b/TNode/TNodeGraphViewImpl/Editor/NodeViews/NodeView.cs
index 8fac55f..7f07be9 100644
--- a/TNode/TNodeGraphViewImpl/Editor/NodeViews/NodeView.cs
+++ b/TNode/TNodeGraphViewImpl/Editor/NodeViews/NodeView.cs
@@ -105,7 +105,8 @@ namespace TNodeGraphViewImpl.Editor.NodeViews{
foreach (var propertyInfo in propertyInfos){
if (propertyInfo.GetCustomAttributes(typeof(OutputAttribute),true).FirstOrDefault() is OutputAttribute attribute){
- Port port = InstantiatePort(Orientation.Horizontal, Direction.Output,Port.Capacity.Multi,BuildPortType(attribute,propertyInfo));
+
+ Port port = InstantiatePort(Orientation.Horizontal, Direction.Output,attribute.Multiple?Port.Capacity.Multi:Port.Capacity.Single,BuildPortType(attribute,propertyInfo));
this.outputContainer.Add(port);
var portName = ObjectNames.NicifyVariableName(BuildPortName(attribute,propertyInfo));
port.portName = portName;
@@ -115,7 +116,7 @@ namespace TNodeGraphViewImpl.Editor.NodeViews{
}
foreach (var propertyInfo in propertyInfos){
if(propertyInfo.GetCustomAttributes(typeof(InputAttribute),true).FirstOrDefault() is InputAttribute attribute){
- Port port = InstantiatePort(Orientation.Horizontal, Direction.Input,Port.Capacity.Single,BuildPortType(attribute,propertyInfo));
+ Port port = InstantiatePort(Orientation.Horizontal, Direction.Input,attribute.Multiple?Port.Capacity.Multi:Port.Capacity.Single,BuildPortType(attribute,propertyInfo));
this.inputContainer.Add(port);
var portName = BuildPortName(attribute,propertyInfo);
port.portName = portName;
diff --git a/TNode/package.json b/TNode/package.json
new file mode 100644
index 0000000..f0ab86a
--- /dev/null
+++ b/TNode/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "com.taoria.t-node",
+ "version": "0.0.1",
+ "displayName": "T-Node",
+ "description": "A graph edition tool for unity",
+ "unity": "2022.1",
+ "unityRelease": "0b5",
+ "dependencies": {
+ },
+ "keywords": [
+ "graph",
+ "node",
+ "wrapper"
+ ],
+ "author": {
+ "name": "taoria",
+ "email": "445625470@qq.com",
+ "url": "taoria@github.io"
+ }
+}
\ No newline at end of file
diff --git a/TNode/package.json.meta b/TNode/package.json.meta
new file mode 100644
index 0000000..272a06f
--- /dev/null
+++ b/TNode/package.json.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 3838bc14242907547b72a73ef55ce0e0
+PackageManifestImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant: