Esempio n. 1
0
 public override void Action()
 {
     CurvySplineExportWizard.Create();
 }
Esempio n. 2
0
    public override void OnInspectorGUI()
    {
        EditorGUILayout.PropertyField(tInterpolation, new GUIContent("Interpolation", "Interpolation Method"));
        EditorGUILayout.PropertyField(tClosed, new GUIContent("Close Spline", "Close spline?"));
        GUI.enabled = !tClosed.boolValue && tInterpolation.enumNames[tInterpolation.enumValueIndex] != "Linear";
        EditorGUILayout.PropertyField(tAutoEndTangents, new GUIContent("Auto End Tangents", "Handle End Control Points automatically?"));
        GUI.enabled = true;
        EditorGUILayout.PropertyField(tGranularity, new GUIContent("Granularity", "Approximation resolution"));
        tGranularity.intValue = Mathf.Max(1, tGranularity.intValue);
        EditorGUILayout.LabelField("Orientation", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(tOrientation, new GUIContent("Orientation", "How the Up-Vector should be calculated"));
        if (tOrientation.enumNames[tOrientation.enumValueIndex] == "Tangent")
        {
            EditorGUILayout.PropertyField(tInitialUp, new GUIContent("Initial Up-Vector", "How the first Up-Vector should be determined"));
            EditorGUILayout.PropertyField(tSwirl, new GUIContent("Swirl", "Orientation swirl mode"));
            if (tSwirl.enumNames[tSwirl.enumValueIndex] != "None")
            {
                EditorGUILayout.PropertyField(tSwirlTurns, new GUIContent("Turns", "Swirl turns"));
            }
        }
        EditorGUILayout.LabelField("Updates", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(tAutoRefresh, new GUIContent("Auto Refresh", "Refresh when Control Point position change?"));
        EditorGUILayout.PropertyField(tAutoRefreshLength, new GUIContent("Auto Refresh Length", "Recalculate Length on Refresh?"));
        EditorGUILayout.PropertyField(tAutoRefreshOrientation, new GUIContent("Auto Refresh Orientation", "Recalculate tangent normals and Up-Vectors on Refresh?"));

        if (tInterpolation.enumNames[tInterpolation.enumValueIndex] == "TCB")
        {
            EditorGUILayout.LabelField("TCB", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(tT, new GUIContent("Tension", "Tension for TCB-Spline"));
            EditorGUILayout.PropertyField(tC, new GUIContent("Continuity", "Continuity for TCB-Spline"));
            EditorGUILayout.PropertyField(tB, new GUIContent("Bias", "Bias for TCB-Spline"));

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button(new GUIContent("Set Catmul", "Set TCB to match Catmul Rom")))
            {
                tT.floatValue = 0; tC.floatValue = 0; tB.floatValue = 0;
            }
            if (GUILayout.Button(new GUIContent("Set Cubic", "Set TCB to match Simple Cubic")))
            {
                tT.floatValue = -1; tC.floatValue = 0; tB.floatValue = 0;
            }
            if (GUILayout.Button(new GUIContent("Set Linear", "Set TCB to match Linear")))
            {
                tT.floatValue = 0; tC.floatValue = -1; tB.floatValue = 0;
            }
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.LabelField("Miscellaneous", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(tUserValueSize, new GUIContent("User Value Size", "Size of User Value array"));
        EditorGUILayout.PropertyField(tShowUserValues, new GUIContent("Show in scene", "Show values in the scene view"));
        EditorGUILayout.LabelField("Gizmos", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(tShowGizmos, new GUIContent("Show Gizmos", "Show Spline Gizmos"));
        EditorGUILayout.PropertyField(tShowApprox, new GUIContent("Show Approximation", "Show Approximation"));
        EditorGUILayout.PropertyField(tShowTangents, new GUIContent("Show Tangents", "Show Tangents"));
        EditorGUILayout.PropertyField(tShowOrientation, new GUIContent("Show Orientation", "Show Orientation"));

        if (serializedObject.targetObject && serializedObject.ApplyModifiedProperties())
        {
            Target.Refresh(true, true, false);
            SceneView.RepaintAll();
        }

        EditorGUILayout.LabelField("Spline Info", EditorStyles.boldLabel);
        EditorGUILayout.LabelField("Total Length: " + Target.Length);
        EditorGUILayout.LabelField("Control Points: " + Target.ControlPointCount);
        EditorGUILayout.LabelField("Segments: " + Target.Count);

        EditorGUILayout.LabelField("Tools & Components", EditorStyles.boldLabel);
        GUILayout.BeginHorizontal();
        if (GUILayout.Button(new GUIContent(mTexAlignWizard, "Align wizard"), GUILayout.ExpandWidth(false)))
        {
            CurvySplineAlignWizard.Create();
        }
        if (GUILayout.Button(new GUIContent(mTexExportWizard, "Mesh Export wizard"), GUILayout.ExpandWidth(false)))
        {
            CurvySplineExportWizard.Create();
        }
        if (GUILayout.Button(new GUIContent(mTexCenterPivot, "Center Pivot"), GUILayout.ExpandWidth(false)))
        {
            Undo.RegisterUndo(EditorUtility.CollectDeepHierarchy(new Object[] { Target }), "Center Spline Pivot");
            CurvyUtility.centerPivot(Target);
        }
        GUILayout.Space(10);
        if (GUILayout.Button(new GUIContent(mTexClonePath, "Create Clone Path"), GUILayout.ExpandWidth(false)))
        {
            CurvySplinePathCloneBuilderInspector.CreateCloneBuilder();
        }
        if (GUILayout.Button(new GUIContent(mTexMeshPath, "Create Mesh Path"), GUILayout.ExpandWidth(false)))
        {
            CurvySplinePathMeshBuilderInspector.CreateMeshBuilder();
        }
        GUILayout.EndHorizontal();
        EditorGUILayout.LabelField("General", EditorStyles.boldLabel);
        GUILayout.BeginHorizontal();


        if (GUILayout.Button(new GUIContent(mTexPrefs, "Preferences"), GUILayout.ExpandWidth(false)))
        {
            CurvyPreferences.Open();
        }

        if (GUILayout.Button(new GUIContent(mTexHelp, "Help"), GUILayout.ExpandWidth(false)))
        {
            var mnu = new GenericMenu();
            mnu.AddItem(new GUIContent("Online Manual"), false, new GenericMenu.MenuFunction(OnShowManual));
            mnu.AddItem(new GUIContent("Website"), false, new GenericMenu.MenuFunction(OnShowWeb));
            mnu.AddSeparator("");
            mnu.AddItem(new GUIContent("Report a bug"), false, new GenericMenu.MenuFunction(OnBugReport));
            mnu.ShowAsContext();
        }

        GUILayout.EndHorizontal();

        Repaint();
    }