예제 #1
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="InName">The name of this node</param>
		/// <param name="InInputs">Inputs that this node depends on</param>
		/// <param name="InOutputNames">Names of the outputs that this node produces</param>
		/// <param name="InInputDependencies">Nodes which this node is dependent on for its inputs</param>
		/// <param name="InOrderDependencies">Nodes which this node needs to run after. Should include all input dependencies.</param>
		/// <param name="InControllingTrigger">The trigger which this node is behind</param>
		/// <param name="InRequiredTokens">Optional tokens which must be required for this node to run</param>
		public Node(string InName, NodeOutput[] InInputs, string[] InOutputNames, Node[] InInputDependencies, Node[] InOrderDependencies, ManualTrigger InControllingTrigger, FileReference[] InRequiredTokens)
		{
			Name = InName;
			Inputs = InInputs;

			List<NodeOutput> AllOutputs = new List<NodeOutput>();
			AllOutputs.Add(new NodeOutput(this, "#" + Name));
			AllOutputs.AddRange(InOutputNames.Where(x => String.Compare(x, Name, StringComparison.InvariantCultureIgnoreCase) != 0).Select(x => new NodeOutput(this, x)));
			Outputs = AllOutputs.ToArray();

			InputDependencies = InInputDependencies;
			OrderDependencies = InOrderDependencies;
			ControllingTrigger = InControllingTrigger;
			RequiredTokens = InRequiredTokens;
		}
예제 #2
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="InProducingNode">Node which produces the given output</param>
		/// <param name="InTagName">Name of the tag</param>
		public NodeOutput(Node InProducingNode, string InTagName)
		{
			ProducingNode = InProducingNode;
			TagName = InTagName;
		}
예제 #3
0
		/// <summary>
		/// Tries to resolve the given name to one or more nodes. Checks for aggregates, and actual nodes.
		/// </summary>
		/// <param name="Name">The name to search for</param>
		/// <param name="OutNodes">If the name is a match, receives an array of nodes and their output names</param>
		/// <returns>True if the name was found, false otherwise.</returns>
		public bool TryResolveReference(string Name, out Node[] OutNodes)
		{
			// Check if it's a tag reference or node reference
			if(Name.StartsWith("#"))
			{
				// Check if it's a regular node or output name
				NodeOutput Output;
				if(TagNameToNodeOutput.TryGetValue(Name, out Output))
				{
					OutNodes = new Node[]{ Output.ProducingNode };
					return true;
				}
			}
			else
			{
				// Check if it's a regular node or output name
				Node Node;
				if(NameToNode.TryGetValue(Name, out Node))
				{
					OutNodes = new Node[]{ Node };
					return true;
				}

				// Check if it's an aggregate name
				Node[] Nodes;
				if(AggregateNameToNodes.TryGetValue(Name, out Nodes))
				{
					OutNodes = Nodes;
					return true;
				}

				// Check if it's a group name
				Agent Agent;
				if(NameToAgent.TryGetValue(Name, out Agent))
				{
					OutNodes = Agent.Nodes.ToArray();
					return true;
				}
			}

			// Otherwise fail
			OutNodes = null;
			return false;
		}