private static void DrawMember (bool isInput, GraphEditor editor, Node node, ref Rect rect, SerializedObject serializedObject, Socket socket) { string name = node.GetSocketDisplayName(socket); bool editable = node.GetSocketFlags(socket).IsEditable(); bool linked = editor.Graph.Links.IsSocketLinkedTo(socket); rect.height = EditorGUIUtility.singleLineHeight; XGUI.ResetToStyle(null); XGUI.Normal.textColor = GraphEditor.Skin.nodeTextColor; if (editor.search.IsOpen) { XGUI.Normal.textColor = GraphEditor.Skin.TintColor( XGUI.Normal.textColor, GraphEditor.Skin.disabledNodeTextTint); } var clipboardHasValue = false; var hovering = rect.Contains(Event.current.mousePosition) && !editor.search.IsOpen; if (editable && !linked) { var type = node.GetSocketType(socket); var value = node.GetSocketValue(socket); clipboardHasValue = editor.Clipboard.ContainsKey(type); // Check for clipboard operations if (hovering) { switch (Event.current.type) { case EventType.MouseDown: if (Event.current.shift) { if (Event.current.button == 0) { usedClipboard = true; if (clipboardHasValue) { value = editor.Clipboard[type]; node.SetSocketValue(socket, value); } } else if (Event.current.button == 1) { usedClipboard = true; editor.Clipboard[type] = value; } Event.current.Use(); } break; case EventType.MouseUp: if (usedClipboard) { usedClipboard = false; Event.current.Use(); } break; } } XGUI.Enabled = !editor.search.IsOpen; var prop = serializedObject.FindProperty(socket.FieldName); if (type == typeof(bool)) { value = XGUI.ToggleLeft(rect, name, (bool)value); node.SetSocketValue(socket, value); } else if (prop != null) { EditorGUI.PropertyField(rect, prop, GUIContent.none, true); } else if (type == null) { XGUI.Enabled = false; XGUI.TextField(rect, "Unknown Type"); } else { value = GUIExtension.DrawField (rect, value, type, GUIContent.none, true); node.SetSocketValue(socket, value); } } else { XGUI.Label(rect, name); } // Prepare a tooltip if (hovering && editor.Tooltip == null) { var text = string.Format( "<color=#4aa><i>{0}</i></color> <b>{1}</b>\n{2}{3}{4}", node.GetSocketType(socket).Name, node.GetSocketDisplayName(socket), string.IsNullOrEmpty(node.GetSocketDescription(socket)) ? "<color=#aaa><i>No documentation</i></color>" : node.GetSocketDescription(socket), (editable && !linked ? "\n<color=#777><i>Shift + Right click to copy</i></color>" : ""), (clipboardHasValue ? "\n<color=#777><i>Shift + Left click to paste</i></color>" : "") ); editor.Tooltip = new Tooltip(text); } }