private void DrawInputs() { if (node.Inputs != null) { var i = 0; foreach (var input in node.Inputs) { if (GUI.Button(new Rect(0, nodeConfig.TopMargin + (nodeConfig.InputSize * i), nodeConfig.InputSize, nodeConfig.InputSize), "", GetConnectionStyle(input.IsWarm, input.Type))) { Event current = Event.current; if (current.button == 0) { editor.AddLinkFromInput(input); } else { DrawDescription = true; Description = input.Description; } } i++; } } }
public void DrawContent() { if (node.GetAttributes() != null) { var i = 0; foreach (var attribute in node.AttributesData) { EditorGUIUtility.labelWidth = 25; EditorGUIUtility.fieldWidth = 10; var attributeRect = new Rect(nodeConfig.AtrributeSize.x, nodeConfig.AtrributeSize.y + (nodeConfig.AtrributeSize.height * i), nodeConfig.AtrributeSize.width, nodeConfig.AtrributeSize.height); if (attribute.Value != null) { var currentAttributeValue = attribute.Value.GetString(); attribute.Value = AttributeStyleFactory.Draw(attribute.Type, attributeRect, attribute.Value); if (attribute.Value != null) { if (currentAttributeValue != attribute.Value.GetString()) { AttributeValueChanged(); } i++; } } } } if (node.Inputs != null) { var i = 0; foreach (var input in node.Inputs) { GUIStyle style; if (input.IsWarm == true) { if (input.Type == "Object") { style = nodeConfig.WarmInputObjectStyle; } else { style = nodeConfig.WarmInputStyle; } } else { if (input.Type == "Object") { style = nodeConfig.ColdInputObjectStyle; } else { style = nodeConfig.ColdInputStyle; } } if (GUI.Button(new Rect(0, nodeConfig.TopMargin + (nodeConfig.InputSize * i), nodeConfig.InputSize, nodeConfig.InputSize), "", style)) { Event current = Event.current; if (current.button == 0) { editor.AddLinkFromInput(input); } else { DrawDescription = true; Description = input.Description; } } i++; } } if (node.Outputs != null) { var i = 0; foreach (var output in node.Outputs) { GUIStyle style; if (output.IsWarm == true) { if (output.Type == "Object") { style = nodeConfig.WarmInputObjectStyle; } else { style = nodeConfig.WarmInputStyle; } } else { if (output.Type == "Object") { style = nodeConfig.ColdInputObjectStyle; } else { style = nodeConfig.ColdInputStyle; } } if (GUI.Button(new Rect(Rect.width - nodeConfig.OutputSize, nodeConfig.TopMargin + ((nodeConfig.OutputSize) * i), nodeConfig.OutputSize, nodeConfig.OutputSize), "", style)) { Event current = Event.current; if (current.button == 0) { editor.AddLinkFromOutput(output); } else { DrawDescription = true; Description = output.Description; } } i++; } } GUI.Label(new Rect(40, 0, 100, 16), node.Name, UnityEngine.GUI.skin.GetStyle("MiniLabel")); UnityEngine.GUI.Box(new Rect(0, 1, 20, 13), "", UnityEngine.GUI.skin.GetStyle("sv_label_0")); if (GUI.Button(new Rect(4, 1, 13, 13), "", GUI.skin.GetStyle("WinBtnClose"))) { DestroyNode(); } if (GUI.Button(new Rect(20, 1, 20, 13), "?", UnityEngine.GUI.skin.GetStyle("sv_label_0"))) { NodeHelpWindow.ShowHelpWindow(node.Name); } if (DrawDescription) { DrawHelp(Description); } }