Example #1
0
    private void ShowCoordinatesData(RageSpline rageSpline)
    {
        EditorGUILayout.Separator();
        GuiExtensions.Horizontal (( ) => {
                                EditorGUILayout.LabelField ("Point  X|Y", "", GUILayout.MinWidth (40f));
                                EditorGUILayout.LabelField ("Handle In  X|Y", "", GUILayout.MinWidth (40f));
                                EditorGUILayout.LabelField ("Handle Out  X|Y", "", GUILayout.MinWidth (40f));
                             });
        EditorGUIUtility.LookLikeControls();

        for (int p = 0; p < selectedControlPoints.Count; p++) {
            int i = selectedControlPoints[p];
            switch (rageSpline.showCoordinates) {
                case RageSpline.ShowCoordinates.Local:
                    EditorGUILayout.BeginHorizontal();
                    Vector2 newPos = new Vector2();

                    newPos.x = EditorGUILayout.FloatField (rageSpline.GetPosition (i).x, GUILayout.MinWidth (30f));
                    newPos.y = EditorGUILayout.FloatField (rageSpline.GetPosition (i).y, GUILayout.MinWidth (30f));

                    rageSpline.SetPoint (i, newPos);

                    Vector2 newIn = new Vector2();
                    Vector2 newOut = new Vector2();

                    newIn.x = EditorGUILayout.FloatField (rageSpline.GetInControlPositionPointSpace (i).x, GUILayout.MinWidth (30f));
                    newIn.y = EditorGUILayout.FloatField (rageSpline.GetInControlPositionPointSpace (i).y, GUILayout.MinWidth (30f));
                    newOut.x = EditorGUILayout.FloatField (rageSpline.GetOutControlPositionPointSpace (i).x, GUILayout.MinWidth (30f));
                    newOut.y = EditorGUILayout.FloatField (rageSpline.GetOutControlPositionPointSpace (i).y, GUILayout.MinWidth (30f));

                    rageSpline.SetInControlPositionPointSpace (i, newIn);
                    rageSpline.SetOutControlPositionPointSpace (i, newOut);

                    EditorGUILayout.EndHorizontal();
                    break;
                case RageSpline.ShowCoordinates.World:
                    EditorGUILayout.BeginHorizontal();
                    Vector2 newPos2 = new Vector2();

                    newPos2.x = EditorGUILayout.FloatField (rageSpline.GetPositionWorldSpace (i).x, GUILayout.MinWidth (30f));
                    newPos2.y = EditorGUILayout.FloatField (rageSpline.GetPositionWorldSpace (i).y, GUILayout.MinWidth (30f));

                    rageSpline.SetPointWorldSpace (i, newPos2);

                    Vector2 newIn2 = new Vector2();
                    Vector2 newOut2 = new Vector2();

                    newIn2.x = EditorGUILayout.FloatField (rageSpline.GetInControlPositionWorldSpace (i).x, GUILayout.MinWidth (30f));
                    newIn2.y = EditorGUILayout.FloatField (rageSpline.GetInControlPositionWorldSpace (i).y, GUILayout.MinWidth (30f));
                    newOut2.x = EditorGUILayout.FloatField (rageSpline.GetOutControlPositionWorldSpace (i).x, GUILayout.MinWidth (30f));
                    newOut2.y = EditorGUILayout.FloatField (rageSpline.GetOutControlPositionWorldSpace (i).y, GUILayout.MinWidth (30f));

                    rageSpline.SetInControlPositionWorldSpace (i, newIn2);
                    rageSpline.SetOutControlPositionWorldSpace (i, newOut2);

                    EditorGUILayout.EndHorizontal();
                    break;
            }
        }
    }