void OnGUI() { Rect actionWindowRect = new Rect(106f, 100f, 300, 340f); using (new Horizontal()) { editorState.id = GUIUtility.GetControlID(this.GetHashCode(), FocusType.Passive); EditorUtil.painWindowRect = new Rect(canvasWindowRect); EditorUtil.painWindowRect.width -= 200; editorState.canvasRect = GUILayoutUtility.GetRect(canvasWindowRect.width - toobarWidth, canvasWindowRect.height); if (Event.current.type == EventType.Repaint) { editorState.Draw(); // 用这个矩形覆盖掉toolbar下面的东西 GUI.DrawTexture(ToolBarRect, EditorUtil.ToolBarBackground, ScaleMode.StretchToFill); } using (new Vertical()) { Rect tool = GUILayoutUtility.GetRect(toobarWidth, 40); editorState.OnGUI(); } } EditorInputSystem.HandleInputEvents(editorState); EditorInputSystem.HandleLateInputEvents(editorState); }
private static void HandleContextClicks(EditorInputInfo inputInfo) { CombinMeshEditor cme = inputInfo.editorState.editor as CombinMeshEditor; if (cme.focusedNode == null) { return; } if (Event.current.button == 1 && cme.focusedNode.drawRect.Contains(inputInfo.inputPos)) { GenericMenu contextMenu = new GenericMenu(); if (cme.focusedNode != null) { EditorInputSystem.FillContextMenu(inputInfo, contextMenu); } contextMenu.ShowAsContext(); Event.current.Use(); } }
private void OnFocus() { EditorInputSystem.SetupInput(editorState.eventTypeList); }