Beispiel #1
0
        protected virtual void OnSceneGUI()
        {
            BezierPoint3DEditor.handleCapSize = BezierPoint3DEditor.CircleCapSize;
            BezierCurve3DEditor.DrawPointsSceneGUI(this.point.Curve, this.point);

            BezierPoint3DEditor.handleCapSize = BezierPoint3DEditor.SphereCapSize;
            BezierPoint3DEditor.DrawPointSceneGUI(this.point, Handles.DotHandleCap, Handles.SphereHandleCap);
        }
Beispiel #2
0
        private static void CreateBezeirCurve()
        {
            BezierCurve3D curve    = new GameObject("Bezier Curve", typeof(BezierCurve3D)).GetComponent <BezierCurve3D>();
            Vector3       position = Vector3.zero;

            if (Camera.current != null)
            {
                position = Camera.current.transform.position + Camera.current.transform.forward * 10f;
            }

            curve.transform.position = position;

            BezierCurve3DEditor.AddDefaultPoints(curve);

            Undo.RegisterCreatedObjectUndo(curve.gameObject, "Create Curve");

            Selection.activeGameObject = curve.gameObject;
        }
Beispiel #3
0
        protected virtual void OnEnable()
        {
            this.curve = (BezierCurve3D)this.target;
            if (curve.KeyPointsCount < 2)
            {
                while (curve.KeyPointsCount != 0)
                {
                    curve.RemoveKeyPointAt(this.curve.KeyPointsCount - 1);
                }

                BezierCurve3DEditor.AddDefaultPoints(this.curve);
            }

            this.keyPoints = new ReorderableList(this.serializedObject, serializedObject.FindProperty("keyPoints"), true, true, false, false);
            this.keyPoints.drawElementCallback = this.DrawElementCallback;
            this.keyPoints.drawHeaderCallback  =
                (Rect rect) =>
            {
                EditorGUI.LabelField(rect, string.Format("Points: {0}", this.keyPoints.serializedProperty.arraySize), EditorStyles.boldLabel);
            };
        }
Beispiel #4
0
 protected virtual void OnSceneGUI()
 {
     BezierCurve3DEditor.DrawPointsSceneGUI(this.curve);
 }