Exemplo n.º 1
0
    private void GeneralSettings(RageSpline rageSpline)
    {
        EditorGUIUtility.LookLikeControls(170f, 10f);
        GuiExtensions.Vertical (GUI.skin.box, ( ) => {
            GuiExtensions.Horizontal (( ) => EditorGUILayout.LabelField ("   General:", ""));
            var vDensity = EditorGUILayout.IntField("      Vertex density", rageSpline.VertexDensity);
            if (_currentVertexDensity != vDensity) {
                _currentVertexDensity = vDensity;
                rageSpline.VertexDensity = vDensity;
            }

            var vCount = EditorGUILayout.IntField ("      Vertex count", !rageSpline.lowQualityRender
                                                                        ? rageSpline.GetVertexCount()
                                                                        : rageSpline.vertexCount);
            if (vCount != _currentVertexCount) {
                _currentVertexCount = vCount;
                rageSpline.SetVertexCount(vCount);
            }
            rageSpline.SetAntialiasingWidth (EditorGUILayout.FloatField ("      Anti-aliasing width", rageSpline.GetAntialiasingWidth()));
            rageSpline.SetOptimize (EditorGUILayout.Toggle ("      Optimize", rageSpline.GetOptimize()));
            if (rageSpline.GetOptimize())
                rageSpline.SetOptimizeAngle(EditorGUILayout.FloatField("      Optimize Angle", rageSpline.GetOptimizeAngle()));
            rageSpline.PerspectiveMode = EditorGUILayout.Toggle("      3D Mode", rageSpline.PerspectiveMode);
            if (rageSpline.CurrentPerspective != rageSpline.PerspectiveMode) {
                rageSpline.SwitchPerspectiveMode();
                EditorUtility.SetDirty(target);
                rageSpline.CurrentPerspective = rageSpline.PerspectiveMode;
                rageSpline.RefreshMeshInEditor(true,true,true);
            }

            displayOptions = EditorGUILayout.Foldout(displayOptions, "    Display Options");
            if (displayOptions) {
                rageSpline.showSplineGizmos = EditorGUILayout.Toggle("          Show spline gizmos", rageSpline.showSplineGizmos);
                rageSpline.showOtherGizmos = EditorGUILayout.Toggle("          Show other gizmos", rageSpline.showOtherGizmos);
                rageSpline.showWireFrameInEditor = EditorGUILayout.Toggle("          Show wireframe", rageSpline.showWireFrameInEditor);
                rageSpline.hideHandles = !(EditorGUILayout.Toggle("          Show handles", !rageSpline.hideHandles));
                rageSpline.ShowTriangleCount = EditorGUILayout.Toggle("          Show tri count", rageSpline.ShowTriangleCount);
                if (rageSpline.ShowTriangleCount)
                    EditorGUILayout.FloatField("      Triangle Count", rageSpline.GetTriangleCount());
            }
        });
        EditorGUILayout.Separator();
    }