Example #1
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.HelpBox("This component is obsolete! Use SplineController instead!", MessageType.Warning);
            serializedObject.UpdateIfDirtyOrScript();

            if (CurvyGUI.Foldout(ref mFoldouts[0], "Source", CurvyEditorUtility.HelpURL("aligntospline", "source")))
            {
                var ppSpline = serializedObject.FindProperty("m_Spline");
                EditorGUILayout.PropertyField(ppSpline);
                if (ppSpline.objectReferenceValue == null)
                {
                    EditorGUILayout.HelpBox("No Source provided!", MessageType.Warning);
                }

                EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Dynamic"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("FastInterpolation"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("UpdateIn"));
            }

            if (CurvyGUI.Foldout(ref mFoldouts[1], "Options", CurvyEditorUtility.HelpURL("aligntospline", "options")))
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Mode"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Position"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("SetOrientation"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("Use2DOrientation"));
            }


            serializedObject.ApplyModifiedProperties();
        }
Example #2
0
        public override void OnInspectorGUI()
        {
            serializedObject.UpdateIfDirtyOrScript();

            if (CurvyGUI.Foldout(ref mFoldouts[0], "Source", CurvyEditorUtility.HelpURL("followspline", "source")))
            {
                var ppSpline = serializedObject.FindProperty("m_Spline");
                EditorGUILayout.PropertyField(ppSpline);
                if (ppSpline.objectReferenceValue == null)
                {
                    EditorGUILayout.HelpBox("No Source provided!", MessageType.Warning);
                }
                EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Dynamic"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("FastInterpolation"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("UpdateIn"));
            }

            if (CurvyGUI.Foldout(ref mFoldouts[1], "Options", CurvyEditorUtility.HelpURL("followspline", "options")))
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Mode"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("Speed"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("Clamping"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("SetOrientation"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("Use2DOrientation"));
            }
            EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Initial"));

            serializedObject.ApplyModifiedProperties();

            ShowPreviewButtons();
        }
Example #3
0
        void OnGUI()
        {
            GUILayout.BeginVertical();
            GUILayout.Label(new GUIContent(CurvyStyles.TexLogoBig));
            var r = new Rect(250, 70, 215, 40);

            DTGUI.PushContentColor(Color.black);

            var st = new GUIStyle(EditorStyles.label);

            st.alignment = TextAnchor.UpperRight;
            st.richText  = true;
            GUI.Label(r, "<b>Curvy " + CurvySpline.VERSION + "</b>\n(c) 2013-2015 Fluffy Underware", st);
            r.y += 40;
            GUI.Label(r, "<b>DevTools " + DT.VERSION + "</b>\n(c) 2015 Fluffy Underware", st);
            DTGUI.PopContentColor();
            GUILayout.Space(10);

            head("What's new?");

            if (buttonCol("Release notes", "View release notes and upgrade instructions!"))
            {
                OpenReleaseNotes();
            }
            foot();
            head("Learning Resources");
            if (buttonCol("View Examples", "Show examples folder"))
            {
                ShowExamples();
            }
            if (buttonCol("Tutorials", "Watch some tutorials"))
            {
                OpenTutorials();
            }
            if (buttonCol("Documentation", "Manuals! That magic source of wisdom!"))
            {
                OpenDocs();
            }
            if (buttonCol("API Reference", "Browse the API reference"))
            {
                OpenAPIDocs();
            }
            if (buttonCol("Support Forum", "Visit Support forum"))
            {
                OpenForum();
            }

            foot();
            head("Links");
            if (buttonCol("Website", "Visit Curvy's product website"))
            {
                OpenWeb();
            }

            if (buttonCol("Submit a bug report", "Found a bug? Please issue a bug report!"))
            {
                CurvyEditorUtility.SendBugReport();
            }
            foot();

            GUILayout.EndVertical();

            if (!heightHasBeenSet && Event.current.type == EventType.repaint)
            {
                setHeightToContent();
            }
        }
Example #4
0
        public override void OnInspectorGUI()
        {
            Toolbar.RegisterTargets(targets);

            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" && tInterpolation.enumNames[tInterpolation.enumValueIndex] != "Bezier";
            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);

            if (CurvyGUI.Foldout(ref mFoldouts[0], "Orientation", CurvyEditorUtility.HelpURL("curvyspline", "orientation")))
            {
                EditorGUILayout.PropertyField(tOrientation, new GUIContent("Orientation", "How the Up-Vector should be calculated"));
                GUI.enabled = Target.Interpolation != CurvyInterpolation.Bezier;
                EditorGUILayout.PropertyField(tSetCPRotation, new GUIContent("Set CP Rotation", "Rotate CP to match calculated Up-Vector3"));
                GUI.enabled = true;
                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"));
                    }
                }
            }
            if (CurvyGUI.Foldout(ref mFoldouts[1], "Updates", CurvyEditorUtility.HelpURL("curvyspline", "updates")))
            {
                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" && CurvyGUI.Foldout(ref mFoldouts[2], "TCB Settings", CurvyEditorUtility.HelpURL("curvyspline", "tcb")))
            {
                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();
            }



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

            if (CurvyGUI.Foldout(ref mFoldouts[3], "Spline Info"))
            {
                EditorGUILayout.LabelField("Control Points: " + Target.ControlPointCount);
                EditorGUILayout.LabelField("Segments: " + Target.Count);
                EditorGUILayout.LabelField("Total Length: " + Target.Length);
                EditorGUILayout.LabelField(new GUIContent("User Value Size: " + Target.UserValueSize, "Size of User Value array"));
            }
            Repaint();
        }
Example #5
0
        public override void OnInspectorGUI()
        {
            Toolbar.RegisterTargets(targets);

            serializedObject.UpdateIfDirtyOrScript();
            if (Event.current.type == EventType.Layout)
            {
                mValid = Target.IsValidSegment;
            }

            if (mValid && (Target.Spline.Closed || !Target.IsFirstSegment))
            {
                EditorGUILayout.PropertyField(tSmoothTangent, new GUIContent("Smooth Tangent", "Smooth end tangent?"));
            }

            if (Target.Spline.Interpolation == CurvyInterpolation.Bezier && CurvyGUI.Foldout(ref mFoldouts[0], "Bezier Handles", CurvyEditorUtility.HelpURL("curvysplinesegment", "bezier")))
            {
                EditorGUILayout.PropertyField(tFreeHandles, new GUIContent("Free Move", "Move Handles individually?"));
                EditorGUILayout.Slider(tHandleScale, 0, 10, new GUIContent("Scale", "Handle Scaling"));

                Vector3 v = tHandleIn.vector3Value;
                EditorGUILayout.PropertyField(tHandleIn);
                if (v != tHandleIn.vector3Value && !tFreeHandles.boolValue)
                {
                    tHandleOut.vector3Value = -tHandleIn.vector3Value;
                }
                v = tHandleIn.vector3Value;
                EditorGUILayout.PropertyField(tHandleOut);
                if (v != tHandleOut.vector3Value && !tFreeHandles.boolValue)
                {
                    tHandleIn.vector3Value = -tHandleOut.vector3Value;
                }

                EditorGUILayout.LabelField("Smooth Handles", EditorStyles.boldLabel);

                SmoothingOffset = EditorGUILayout.Slider(new GUIContent("Offset", "Smoothing Offset"), SmoothingOffset, 0.1f, 1f);
                if (GUILayout.Button(new GUIContent("Smooth", "Set Handles by Catmul-Rom")))
                {
#if OLD_UNDO
                    Undo.RegisterUndo(targets, "Smooth Bezier Handles");
#else
                    Undo.RecordObjects(targets, "Smooth Bezier Handles");
#endif
                    foreach (CurvySplineSegment tgt in targets)
                    {
                        CurvyUtility.InterpolateBezierHandles(CurvyInterpolation.CatmulRom, SmoothingOffset, tgt.FreeHandles, tgt);
                    }
                    Target.Spline.RefreshImmediately(true, true, false);
                    SceneView.RepaintAll();
                }
            }


            if (mValid && Target.Spline.Interpolation == CurvyInterpolation.TCB && CurvyGUI.Foldout(ref mFoldouts[0], "TCB Settings", CurvyEditorUtility.HelpURL("curvysplinesegment", "tcb")))
            {
                EditorGUILayout.PropertyField(tSyncStartEnd, new GUIContent("Synchronize TCB", "Synchronize Start and End Values"));
                EditorGUILayout.PropertyField(tOT, new GUIContent("Local Tension", "Override Spline Tension?"));
                if (tOT.boolValue)
                {
                    EditorGUILayout.PropertyField(tT0, Target.SynchronizeTCB ? new GUIContent("Tension", "Tension") : new GUIContent("Start Tension", "Start Tension"));
                    if (!Target.SynchronizeTCB)
                    {
                        EditorGUILayout.PropertyField(tT1, new GUIContent("End Tension", "End Tension"));
                    }
                    else
                    {
                        tT1.floatValue = tT0.floatValue;
                    }
                }
                EditorGUILayout.PropertyField(tOC, new GUIContent("Local Continuity", "Override Spline Continuity?"));
                if (tOC.boolValue)
                {
                    EditorGUILayout.PropertyField(tC0, Target.SynchronizeTCB ? new GUIContent("Continuity", "Continuity") : new GUIContent("Start Continuity", "Start Continuity"));
                    if (!Target.SynchronizeTCB)
                    {
                        EditorGUILayout.PropertyField(tC1, new GUIContent("End Continuity", "End Continuity"));
                    }
                    else
                    {
                        tC1.floatValue = tC0.floatValue;
                    }
                }
                EditorGUILayout.PropertyField(tOB, new GUIContent("Local Bias", "Override Spline Bias?"));
                if (tOB.boolValue)
                {
                    EditorGUILayout.PropertyField(tB0, Target.SynchronizeTCB ? new GUIContent("Bias", "Bias") : new GUIContent("Start Bias", "Start Bias"));
                    if (!Target.SynchronizeTCB)
                    {
                        EditorGUILayout.PropertyField(tB1, new GUIContent("End Bias", "End Bias"));
                    }
                    else
                    {
                        tB1.floatValue = tB0.floatValue;
                    }
                }

                if (tOT.boolValue || tOC.boolValue || tOB.boolValue)
                {
                    EditorGUILayout.BeginHorizontal();

                    if (GUILayout.Button("Set Catmul"))
                    {
                        tT0.floatValue = 0; tC0.floatValue = 0; tB0.floatValue = 0;
                        tT1.floatValue = 0; tC1.floatValue = 0; tB1.floatValue = 0;
                    }
                    if (GUILayout.Button("Set Cubic"))
                    {
                        tT0.floatValue = -1; tC0.floatValue = 0; tB0.floatValue = 0;
                        tT1.floatValue = -1; tC1.floatValue = 0; tB1.floatValue = 0;
                    }
                    if (GUILayout.Button("Set Linear"))
                    {
                        tT0.floatValue = 0; tC0.floatValue = -1; tB0.floatValue = 0;
                        tT1.floatValue = 0; tC1.floatValue = -1; tB1.floatValue = 0;
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }

            if (CurvyGUI.Foldout(ref mFoldouts[1], "User Values", CurvyEditorUtility.HelpURL("curvysplinesegment", "uservalues")))
            {
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button(new GUIContent(mTexAddUserData, "Add User Value slot"), GUILayout.ExpandWidth(false), GUILayout.Height(mTexAddUserData.height)))
                {
                    Target.Spline.UserValueSize++;
                    Target.Spline.Refresh();
                    EditorUtility.SetDirty(Target.Spline);
                }


                if (GUILayout.Button(new GUIContent(mTexRemoveUserData, "Remove User Value slot"), GUILayout.ExpandWidth(false), GUILayout.Height(mTexRemoveUserData.height)))
                {
                    Target.Spline.UserValueSize--;
                    Target.Spline.Refresh();
                    EditorUtility.SetDirty(Target.Spline);
                }

                EditorGUILayout.EndHorizontal();

                if (Target.UserValues != null && Target.UserValues.Length > 0)
                {
                    ArrayGUI(serializedObject, "UserValues", false);
                }
            }


            if ((Target.Connection != null || Target.ConnectedBy.Count > 0) && CurvyGUI.Foldout(ref mFoldouts[2], "Connections", CurvyEditorUtility.HelpURL("curvysplinesegment", "connections")))
            {
                ConnectionGUI();
            }

            //EditorGUILayout.PropertyField(serializedObject.FindProperty("Node"));


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

            if (mValid && CurvyGUI.Foldout(ref mFoldouts[3], "Segment Info"))
            {
                EditorGUILayout.LabelField(new GUIContent("Distance: " + Target.Distance, "Distance from first Control Point"));
                EditorGUILayout.LabelField(new GUIContent("Length: " + Target.Length, "Length of this segment"));
            }
            if (CurvyGUI.Foldout(ref mFoldouts[4], "Spline Info"))
            {
                EditorGUILayout.LabelField("Total Length: " + Target.Spline.Length);
            }
        }
Example #6
0
 static void CTXFollowSpline()
 {
     Application.OpenURL(CurvyEditorUtility.HelpURL("followspline"));
 }
Example #7
0
 static void CTXAlignToSpline()
 {
     Application.OpenURL(CurvyEditorUtility.HelpURL("aligntospline"));
 }
Example #8
0
 static void CTXCurvySplineGroup()
 {
     Application.OpenURL(CurvyEditorUtility.HelpURL("curvysplinegroup"));
 }
Example #9
0
 static void CTXCurvySplineSegment()
 {
     Application.OpenURL(CurvyEditorUtility.HelpURL("curvysplinesegment"));
 }