void DoGridSettings()
        {
            GUILayout.Label(Contents.settingsHeader, Styles.header);

            EditorGUIUtility.labelWidth            = EditorGUI.CalcPrefixLabelWidth(Contents.opacitySlider, EditorStyles.label);
            m_SceneView.sceneViewGrids.gridOpacity = EditorGUILayout.Slider(Contents.opacitySlider, m_SceneView.sceneViewGrids.gridOpacity, 0, 1);
            EditorGUIUtility.labelWidth            = 0;
        }
示例#2
0
        public static void FourIntFields(Vector2 rectSize, GUIContent label, GUIContent labelX, GUIContent labelY, GUIContent labelZ, GUIContent labelW, ref int x, ref int y, ref int z, ref int w)
        {
            Rect rect = GUILayoutUtility.GetRect(rectSize.x, rectSize.y);

            Rect labelRect = rect;

            labelRect.width  = EditorGUIUtility.labelWidth;
            labelRect.height = EditorGUI.kSingleLineHeight;

            GUI.Label(labelRect, label);

            Rect fieldRect = rect;

            fieldRect.width -= EditorGUIUtility.labelWidth;
            fieldRect.height = EditorGUI.kSingleLineHeight;
            fieldRect.x     += EditorGUIUtility.labelWidth;
            fieldRect.width /= 2;
            fieldRect.width -= EditorGUI.kSpacingSubLabel;

            float oldLabelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = EditorGUI.CalcPrefixLabelWidth(labelX);

            GUI.SetNextControlName("FourIntFields_x");
            x            = EditorGUI.IntField(fieldRect, labelX, x);
            fieldRect.x += fieldRect.width + EditorGUI.kSpacing;
            GUI.SetNextControlName("FourIntFields_y");
            y            = EditorGUI.IntField(fieldRect, labelY, y);
            fieldRect.y += EditorGUI.kSingleLineHeight + EditorGUI.kVerticalSpacingMultiField;
            fieldRect.x -= fieldRect.width + EditorGUI.kSpacing;
            GUI.SetNextControlName("FourIntFields_z");
            z            = EditorGUI.IntField(fieldRect, labelZ, z);
            fieldRect.x += fieldRect.width + EditorGUI.kSpacing;
            GUI.SetNextControlName("FourIntFields_w");
            w = EditorGUI.IntField(fieldRect, labelW, w);

            EditorGUIUtility.labelWidth = oldLabelWidth;
        }