Пример #1
0
        public static void 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;
                ChiselEditorSettings.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);
            ChiselEditorUtility.ConsumeUnusedMouseEvents(BottomBarGUIHash, position);
        }
Пример #2
0
        public static void OnSceneGUI(SceneView sceneView)
        {
            // Calculate size of bottom bar and draw it
            Rect position = sceneView.position;

            position.x      = -2;
            position.y      = position.height - ChiselSceneGUIStyle.kBottomBarHeight + 1;
            position.width += 4;
            position.height = ChiselSceneGUIStyle.kBottomBarHeight;

            GUI.Window(kBottomBarID, position, OnBottomBarUI, string.Empty, ChiselSceneGUIStyle.toolbarStyle);

            ChiselEditorUtility.ConsumeUnusedMouseEvents(BottomBarGUIHash, position);
        }
Пример #3
0
        public void Show(Rect draggableArea)
        {
            currentDraggableArea = draggableArea;
            if (GUIUtility.hotControl == 0)
            {
                prevWindowRect = position;
            }

            currentDraggableArea.x      += kGap;
            currentDraggableArea.y      += kGap;
            currentDraggableArea.width  -= kGap + kGap;
            currentDraggableArea.height -= kGap + kGap;

            int windowId = GUIUtility.GetControlID(kWindowHash, FocusType.Passive);
            var prevSkin = GUI.skin;

            GUI.skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene);
            position = GUI.Window(windowId, position, HandleWindowLogic, title);
            GUI.skin = prevSkin;

            if (position.width < minWidth)
            {
                position.width = minWidth;
            }
            if (position.height < minHeight)
            {
                position.height = minHeight;
            }

            position.x = Mathf.Clamp(position.x, currentDraggableArea.xMin, currentDraggableArea.xMax - position.width);
            position.y = Mathf.Clamp(position.y, currentDraggableArea.yMin, currentDraggableArea.yMax - position.height);

            position.xMax = Mathf.Clamp(position.xMax, currentDraggableArea.xMin + position.width, currentDraggableArea.xMax);
            position.yMax = Mathf.Clamp(position.yMax, currentDraggableArea.yMin + position.height, currentDraggableArea.yMax);

            var tempPosition = position;

            tempPosition.height -= kWindowTitleBarHeight;
            ChiselEditorUtility.ConsumeUnusedMouseEvents(kWindowHash, tempPosition);
        }