Пример #1
0
 bool polyLineIsValid(SplinePolyLine pl)
 {
     return (pl!=null && pl.VertexMode==SplinePolyLine.VertexCalculation.ByApproximation ||
             !Mathf.Approximately(0,pl.Angle));
 }
        void CurveGUI(SplinePolyLine curve, bool canRemove)
        {
            GUILayout.BeginHorizontal();
            CurvySplineBase o = curve.Spline;
            curve.Spline = (CurvySplineBase)EditorGUILayout.ObjectField(new GUIContent("Spline", "Note: Curves from a SplineGroup needs to be connected!"), curve.Spline, typeof(CurvySplineBase), true);
            if (o != curve.Spline)
            {
                UnhookSpline(o);
            }
            HookSpline(curve.Spline);
            if (canRemove)
            {
                if (GUILayout.Button(new GUIContent(CurvyStyles.DeleteSmallTexture, "Remove"), GUILayout.ExpandWidth(false)))
                {
                    if (curve.Spline)
                        UnhookSpline(curve.Spline);
                    Curves.Remove(curve);
                    refreshNow = true;
                    GUIUtility.ExitGUI();
                }
            }
            GUILayout.EndHorizontal();

            curve.VertexMode = (SplinePolyLine.VertexCalculation)EditorGUILayout.EnumPopup(new GUIContent("Vertex Generation"), curve.VertexMode);

            switch (curve.VertexMode)
            {
                case SplinePolyLine.VertexCalculation.ByAngle:
                    curve.Angle = Mathf.Max(0,EditorGUILayout.FloatField(new GUIContent("Angle"), curve.Angle));
                    if (curve.Angle == 0)
                        EditorGUILayout.HelpBox("Angle must be >0", MessageType.Error);
                    curve.Distance = EditorGUILayout.FloatField(new GUIContent("Minimum Distance"), curve.Distance);
                    break;
            }

        }
Пример #3
0
 bool polyLineIsValid(SplinePolyLine pl)
 {
     return(pl != null && pl.VertexMode == SplinePolyLine.VertexCalculation.ByApproximation ||
            !Mathf.Approximately(0, pl.Angle));
 }