public static Rect OnSceneGUI(SceneView sceneView) { // TODO: put somewhere else var curSkin = EditorGUIUtility.isProSkin; if (toolbarStyle == null || prevSkin != curSkin) { toolbarStyle = new GUIStyle(EditorStyles.toolbar); toolbarStyle.fixedHeight = kBottomBarHeight; toggleStyle = new GUIStyle(EditorStyles.toolbarButton); toggleStyle.fixedHeight = kBottomBarHeight; buttonStyle = new GUIStyle(EditorStyles.toolbarButton); buttonStyle.fixedHeight = kBottomBarHeight; floatWidthLayout = GUILayout.Width(kFloatFieldWidth); prevSkin = curSkin; CSGEditorSettings.Load(); } // Calculate size of bottom bar and draw it Rect position = sceneView.position; position.x = 0; position.y = position.height - kBottomBarHeight; position.height = kBottomBarHeight; GUILayout.Window(bottomBarGuiId, position, OnBottomBarUI, "", toolbarStyle); CSGEditorUtility.ConsumeUnusedMouseEvents(BottomBarGUIHash, position); Rect dragArea = sceneView.position; dragArea.x = 0; dragArea.y = kTopBarHeight; dragArea.height -= kBottomBarHeight + kTopBarHeight; return(dragArea); }
private static void GridOnSceneGUI(SceneView sceneView) { if (Event.current.type != EventType.Repaint) { return; } if (ShowUnityGrid) { ShowUnityGrid = false; CSGEditorSettings.Load(); CSGEditorSettings.ShowGrid = false; CSGEditorSettings.Save(); } if (Tools.pivotRotation == PivotRotation.Local) { var activeTransform = Selection.activeTransform; var rotation = Tools.handleRotation; var center = (activeTransform && activeTransform.parent) ? activeTransform.parent.position : Vector3.zero; UnitySceneExtensions.Grid.defaultGrid.GridToWorldSpace = Matrix4x4.TRS(center, rotation, Vector3.one); } else { UnitySceneExtensions.Grid.defaultGrid.GridToWorldSpace = Matrix4x4.identity; } if (CSGEditorSettings.ShowGrid) { var grid = UnitySceneExtensions.Grid.HoverGrid; if (grid == null) { grid = UnitySceneExtensions.Grid.ActiveGrid; } grid.Render(sceneView); } }