public void OnGUI(Rect rect, EditorWindow w) { background.Draw(rect, scrollPos); using (var scrollScope = new EditorGUILayout.ScrollViewScope(scrollPos)) { scrollPos = scrollScope.scrollPosition; w.BeginWindows(); var objs = VariantOperation.Objects; int i = 0; foreach (var o in objs) { o.DrawObject(i++, rect); } w.EndWindows(); if (objs.Any()) { spacerRectRightBottom.x = 600f; spacerRectRightBottom.y = i * (ObjectVariantInfo.Height + 20f) + 40f; GUILayoutUtility.GetRect(new GUIContent(string.Empty), GUIStyle.none, GUILayout.Width(spacerRectRightBottom.x), GUILayout.Height(spacerRectRightBottom.y)); } } HandleDragAndDropGUI(rect, w); }
public void Draw(EditorWindow window, Rect region, AbstractSocket currentDragingSocket) { if (this.centeredLabelStyle == null) { this.centeredLabelStyle = GUI.skin.GetStyle("Label"); } this.centeredLabelStyle.alignment = TextAnchor.MiddleCenter; EditorZoomArea.Begin(this.Zoom, region); if (this.Style.normal.background == null) { this.Style.normal.background = this.CreateBackgroundTexture(); } GUI.DrawTextureWithTexCoords(this.DrawArea, this.Style.normal.background, new Rect(0, 0, 1000, 1000)); this.DrawArea.Set(this.Position.x, this.Position.y, CanvasSize, CanvasSize); GUILayout.BeginArea(this.DrawArea); this.DrawEdges(); window.BeginWindows(); this.DrawNodes(); window.EndWindows(); this.DrawDragEdge(currentDragingSocket); for (int i = 0; i < this.Graph.GetNodeCount(); i++) { this.Graph.GetNodeAt(i).GUIDrawSockets(); } GUILayout.EndArea(); EditorZoomArea.End(); }
void DrawEditorNodes() { if (nodeConfig == null) { Setup(); } farNodeX = 0; farNodeY = 0; EditorWindow.BeginWindows(); var i = 0; if (Nodes == null) { return; } foreach (NodeView node in Nodes) { if (node == null) { return; } node.DrawWindow(i, DrawNodeWindow, false); i++; farNodeX = Mathf.Max(node.GetRect().x, farNodeX); farNodeY = Mathf.Max(node.GetRect().y, farNodeY); } EditorWindow.EndWindows(); }
public void DrawEditorNodes(Vector2 editorScrollPos) { farNodeX = 0; farNodeY = 0; editorWindow.BeginWindows(); var i = 0; if (Nodes == null) { return; } if (Event.current.button == 2) { editorScrollPos -= Event.current.delta * 0.5f; GUI.RequestRepaint(); } foreach (NodeView node in Nodes) { if (node == null) { return; } node.DrawWindow(i, DrawNodeWindow, false); i++; farNodeX = Mathf.Max(node.GetRect().x, farNodeX); farNodeY = Mathf.Max(node.GetRect().y, farNodeY); } editorWindow.EndWindows(); }
void DrawWindows(EditorWindow editor) { editor.BeginWindows(); { for (int i = 0; i < nodes.Count; i++) { nodes[i].OnGUI(i, scrollPos * -1); } } editor.EndWindows(); }
public void DrawProfilerNodes() { myParentWindow.BeginWindows(); for (int i = 0; i < nodes.Count; i++) { GUI.skin.window = nodes[i].nodeStyle; //nodes[i].SetPannedRect(panX,panY); nodes[i].DrawCurves(); nodes[i].windowRect = GUI.Window(i, nodes[i].windowRect, DrawNodeWindow, nodes[i].nodeTitle); } myParentWindow.EndWindows(); }
public void Draw(EditorWindow main, GAEditor editor) { main.BeginWindows(); rect = GUI.Window(0, rect, DrawWindow, "Box1"); main.EndWindows(); int size = GUI.skin.button.fontSize; GUI.skin.button.fontSize = 10; for (int i = 0; i < nodecs.Length; i++) { nodecs[i].Draw(main, editor); } GUI.skin.button.fontSize = size; }
public void OnGUI(EditorWindow editorWindow, Rect viewRect) { if (spriteMeshCache.selectedVertices.Count == 1) { windowRect.height = heightSingleSelection; } else { windowRect.height = heightMultiSelection; } windowRect.position = new Vector2(viewRect.width - windowRect.width - 5f, viewRect.height - windowRect.height - 5f); editorWindow.BeginWindows(); GUILayout.Window(1, windowRect, DoWindow, "Weight Editor"); editorWindow.EndWindows(); }
public void OnGUI(IEnumerable <IRectBasedGUI> targets) { _rect = GUILayoutUtility.GetRect(128, 1024, 128, 1024); _position = GUI.BeginScrollView(_rect, _position, _view); { DrawGrid(); _parent.BeginWindows(); { foreach (IRectBasedGUI target in targets) { target.OnGUI(_rect); } } _parent.EndWindows(); } GUI.EndScrollView(); }
public void Draw(EditorWindow window, Rect region, Socket currentDragingSocket) { EditorZoomArea.Begin(Zoom, region); this.DrawArea.Set(this.Position.x, this.Position.y, CanvasSize, CanvasSize); GUILayout.BeginArea(this.DrawArea, this.Style); this.DrawEdges(); window.BeginWindows(); this.DrawNodes(); window.EndWindows(); this.DrawDragEdge(currentDragingSocket); for (var i = 0; i < graph.GetNodeCount(); i++) { graph.GetNodeAt(i).GUIDrawSockets(); } GUILayout.EndArea(); EditorZoomArea.End(); }
public override void OnInspectorGUI() { EditorWindow currentWindow = MissingEditorAPI.currentInspectorWindow; if (currentWindow == null) { return; } Rect position = GUILayoutUtility.GetRect(1f, Screen.width, 1f, Screen.height); if (string.IsNullOrEmpty(_filePath)) { _filePath = AssetDatabase.GetAssetPath(target.GetInstanceID()); } // Draw on top of area of the inspectors that is not needed float overlap = 53f; position = new Rect(position.x, position.y - overlap, position.width, position.height + overlap); DrawRect(position, bgColor); InitIfNeeded(); const float topAreaHeight = 19f; Rect topAreaRect = new Rect(position.x, position.y, position.width, topAreaHeight); Rect codeViewRect = new Rect(position.x, position.y + topAreaHeight, position.width, position.height - topAreaHeight); currentWindow.BeginWindows(); if (_showingSettings) { _settingsDialog.OnGUI(codeViewRect); } TopArea(topAreaRect); CodeViewArea(codeViewRect); currentWindow.EndWindows(); BackupState(); }
public void Draw(EditorWindow window, Rect region, Socket currentDragingSocket) { EditorZoomArea.Begin(Zoom, region); if (this.Style.normal.background == null) this.Style.normal.background = CreateBackgroundTexture(); GUI.DrawTextureWithTexCoords(this.DrawArea, this.Style.normal.background, new Rect(0, 0, 1000, 1000)); this.DrawArea.Set(this.Position.x, this.Position.y, CanvasSize, CanvasSize); GUILayout.BeginArea(this.DrawArea); this.DrawEdges(); window.BeginWindows(); this.DrawNodes(); window.EndWindows(); this.DrawDragEdge(currentDragingSocket); for (var i = 0; i < Graph.GetNodeCount(); i++) { Graph.GetNodeAt(i).GUIDrawSockets(); } GUILayout.EndArea(); EditorZoomArea.End(); }
public EditorWindowBeginWindowsScope(EditorWindow self) { this.self = self; self.BeginWindows(); }
private Windows(EditorWindow editor) { _editor = editor; _editor.BeginWindows(); }
public void Draw(EditorWindow window, Rect region, AbstractSocket currentDragingSocket) { Event e = Event.current; InitWindowStyles(); if (e.type == EventType.MouseUp) { if (_draggingPathPointIndex != -1) { _draggingPathPointIndex = -1; Event.current.Use(); OnEdgePointDragEnd(); } } if (e.type == EventType.MouseDown) { _currentHelpText = null; _renamingNodeId = -1; } if (_centeredLabelStyle == null) { _centeredLabelStyle = GUI.skin.GetStyle("Label"); } _centeredLabelStyle.alignment = TextAnchor.MiddleCenter; EditorZoomArea.Begin(Zoom, region); if (Style.normal.background == null) { Style.normal.background = CreateBackgroundTexture(); } GUI.DrawTextureWithTexCoords(DrawArea, Style.normal.background, new Rect(0, 0, 1000, 1000)); DrawArea.Set(Position.x, Position.y, GDICanvasSize, GDICanvasSize); GUILayout.BeginArea(DrawArea); DrawEdges(region); window.BeginWindows(); DrawNodes(region); window.EndWindows(); DrawDragEdge(currentDragingSocket); GUILayout.EndArea(); EditorZoomArea.End(); if (e.type == EventType.MouseDrag) { if (e.button == 0) { if (_draggingPathPointIndex > -1 && _hoveringEdge != null) { Vector2 pos = ProjectToGDICanvas(e.mousePosition); pos.y += Config.PathPointSize; _hoveringEdge.SetPathPointAtIndex(_draggingPathPointIndex, pos); Event.current.Use(); } } } if (_hoveringEdge != null && Config.ShowEdgeHover) { string tooltipText = _hoveringEdge.Output.Parent.Name + "-> " + _hoveringEdge.Input.Parent.Name; float width = GUI.skin.textField.CalcSize(new GUIContent(tooltipText)).x; _tmpRect.Set(Event.current.mousePosition.x - width / 2f, e.mousePosition.y - 30, width, 20); DrawTooltip(_tmpRect, tooltipText); } HandleSelectionBox(); DrawHelpText(); if (!_initialEdgeCalcDone) { _initialEdgeCalcDone = true; Graph.UpdateEdgeBounds(); } GUI.SetNextControlName(Config.NullControlName); GUI.TextField(new Rect(0, 0, 0, 0), ""); if (GUI.GetNameOfFocusedControl().Equals(Config.NullControlName)) { if (e.keyCode == KeyCode.Delete) { DeleteSelectedNodes(null); } if ((e.control || e.command) && e.keyCode == KeyCode.C && _lastKeyCode != KeyCode.C) { CopySelection(); } if ((e.control || e.command) && e.keyCode == KeyCode.V && _lastKeyCode != KeyCode.V) { PasteFromClipboard(); } } _lastKeyCode = e.keyCode; }