void RenderDecaledNode(int id, BaseNode node) { //node grid snapping when pressing cmd/crtl if (node.isDragged && e.command) { Vector2 pos = node.rect.position; //aproximative grid cell size float snapPixels = 25.6f; pos.x = Mathf.RoundToInt(Mathf.RoundToInt(pos.x / snapPixels) * snapPixels); pos.y = Mathf.RoundToInt(Mathf.RoundToInt(pos.y / snapPixels) * snapPixels); node.rect.position = pos; } //move the node if panPosition changed: node.rect = Utils.DecalRect(node.rect, graph.panPosition); Rect decaledRect; if (!nodeEditors.ContainsKey(node) || nodeEditors[node] == null) { nodeEditors[node] = UnityEditor.Editor.CreateEditor(node) as BaseNodeEditor; nodeEditors[node].Initialize(this); } decaledRect = GUILayout.Window(id, node.rect, (i) => { var nodeEditor = nodeEditors[node]; nodeEditor.isInsideGraph = true; nodeEditor.OnInspectorGUI(); nodeEditor.isInsideGraph = false; }, node.name, (node.isSelected) ? nodeSelectedStyle : nodeStyle, GUILayout.Height(node.viewHeight)); node.visualRect = decaledRect; node.rect = Utils.DecalRect(decaledRect, -graph.panPosition); //draw node header: //Draw the node header using the color scheme: if (e.type == EventType.Repaint) { float h = nodeStyle.border.top; float w = decaledRect.width - nodeStyle.border.right - nodeStyle.border.left; GUI.color = ColorTheme.GetNodeColor(node.colorSchemeName); nodeHeaderStyle.Draw(new Rect(decaledRect.x, decaledRect.y, w, h), false, false, false, false); GUI.color = Color.white; } if (node.debug) { Rect debugRect = decaledRect; debugRect.y -= 20; EditorGUI.LabelField(debugRect, "id: " + node.id); debugRect.y -= 20; EditorGUI.LabelField(debugRect, "comp order: " + node.computeOrder + " | can work: " + node.canWork); } }