RenderPassNode GenerateNode(string NodeName, string[] InPinName, string[] OutPinName, Rect DrawRect) { RenderPassNode node = new RenderPassNode { title = NodeName, }; if (InPinName.Length != 0) { for (uint i = 0; i <= InPinName.Length - 1; i++) { Port inputPin = GeneratePort(node, Direction.Input); inputPin.portName = InPinName[i]; inputPin.portColor = new Color(0.1f, 1, 0.25f); node.inputContainer.Add(inputPin); } } if (OutPinName.Length != 0) { for (uint j = 0; j <= OutPinName.Length - 1; j++) { Port outPin = GeneratePort(node, Direction.Output); outPin.portName = OutPinName[j]; outPin.portColor = new Color(1, 0.4f, 0); node.outputContainer.Add(outPin); } } node.RefreshPorts(); node.RefreshExpandedState(); node.SetPosition(DrawRect); node.styleSheets.Add(Resources.Load <StyleSheet>("StyleSheet/RenderPassNode")); return(node); }
Port GeneratePort(RenderPassNode node, Direction portDirection, Port.Capacity capacity = Port.Capacity.Single) { return(node.InstantiatePort(Orientation.Horizontal, portDirection, capacity, typeof(float))); }