protected virtual void OnSceneGUI() { BezierPoint3DEditor.handleCapSize = BezierPoint3DEditor.CircleCapSize; BezierCurve3DEditor.DrawPointsSceneGUI(this.point.Curve, this.point); BezierPoint3DEditor.handleCapSize = BezierPoint3DEditor.SphereCapSize; BezierPoint3DEditor.DrawPointSceneGUI(this.point, Handles.DotCap, Handles.SphereCap); }
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; }
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); }; }
protected virtual void OnSceneGUI() { BezierCurve3DEditor.DrawPointsSceneGUI(this.curve); }