Ejemplo n.º 1
0
 private static void AdjustMath(BGCurveSettings settings, BGCurveBaseMath math)
 {
     if (settings.Sections != math.Configuration.Parts ||
         (settings.ShowTangents && !math.IsCalculated(BGCurveBaseMath.Field.Tangent)) ||
         (!settings.ShowTangents && math.IsCalculated(BGCurveBaseMath.Field.Tangent)))
     {
         math.Init(NewConfig(settings));
     }
 }
Ejemplo n.º 2
0
        private void PointButtons(BGCurvePointI point, int index, BGCurveSettings settings)
        {
            if (!settings.ShowPointMenu)
            {
                return;
            }

            var curve = point.Curve;

            //================== Copy
            if (BGEditorUtility.ButtonWithIcon(copyTexture, PointCopyPaste.Instance.CopyTooltip))
            {
                PointCopyPaste.Instance.Copy(point);
            }
            GUILayout.Space(2);

            //================== Paste
            if (BGEditorUtility.ButtonWithIcon(pasteTexture, PointCopyPaste.Instance.PasteTooltip))
            {
                PointCopyPaste.Instance.Paste(point);
            }
            GUILayout.Space(2);

            //================== Add before
            if (BGEditorUtility.ButtonWithIcon(addBeforeTexture, "Insert a point before this point"))
            {
                BGCurveEditor.AddPoint(curve, BGNewPointPositionManager.InsertBefore(curve, index, settings.ControlType, settings.Sections), index);
            }
            GUILayout.Space(2);


            //=========================== Move Up
            if (index > 0 && BGEditorUtility.ButtonWithIcon(moveUpTexture, "Move the point up"))
            {
                curve.Swap(index - 1, index);
            }
            GUILayout.Space(2);

            //=========================== Move Down
            if (index < curve.PointsCount - 1 && BGEditorUtility.ButtonWithIcon(moveDownTexture, "Move the point down"))
            {
                curve.Swap(index, index + 1);
            }
            GUILayout.Space(2);


            //=========================== Delete
            if (BGEditorUtility.ButtonWithIcon(deleteTexture, "Delete the point"))
            {
                BGCurveEditor.DeletePoint(curve, index);
                if (editorSelection != null)
                {
                    editorSelection.Remove(point);
                }
                GUIUtility.ExitGUI();
            }
        }
        protected static void PreviewControl(BGCurveSettings settings, Vector3 position, Vector3 controlWorld)
        {
            var size = BGEditorUtility.GetHandleSize(position, ScalePreviewPoint * .8f);

#if UNITY_5_6_OR_NEWER
            Handles.SphereHandleCap(0, controlWorld, Quaternion.identity, size, EventType.Repaint);
#else
            Handles.SphereCap(0, controlWorld, Quaternion.identity, size);
#endif
            Handles.DrawLine(position, controlWorld);
        }
        private BGCurvePoint CreatePoint(BGCurve curve, BGCurveSettings settings)
        {
            var math = overlay.Editor.Editor.Math;

            var from    = curve[pointIndex];
            var to      = pointIndex == curve.PointsCount - 1 ? curve[0] : curve[pointIndex + 1];
            var ratio   = (splineIntersectionDistance - math[pointIndex].DistanceFromStartToOrigin) / math[pointIndex].Distance;
            var tangent = BGEditorUtility.CalculateTangent(@from, to, ratio);

            var point = BGNewPointPositionManager.CreatePointBetween(curve, @from, to, settings.Sections, settings.ControlType, intersectPosition, tangent);

            return(point);
        }
        private void ShowControlLabel(BGCurveSettings settings, Plane[] frustum, Vector3 positionWorld, Vector3 positionLocal, string label)
        {
            BGEditorUtility.Assign(ref controlLabelStyle, () => new GUIStyle("Label")
            {
                normal = new GUIStyleState {
                    textColor = settings.LabelControlColor
                }
            });

            if (GeometryUtility.TestPlanesAABB(frustum, new Bounds(positionWorld, Vector3.one)))
            {
                Handles.Label(positionWorld, label + (settings.ShowControlPositions ? " " + positionLocal : ""), controlLabelStyle);
            }
        }
Ejemplo n.º 6
0
        public void OnSceneGUIStart(BGCurveSettings settings)
        {
            positionLabelStyle = new GUIStyle("Label")
            {
                normal = new GUIStyleState {
                    textColor = settings.LabelColor
                }
            };
            selectedPositionLabelStyle = new GUIStyle("Label")
            {
                normal = new GUIStyleState {
                    textColor = settings.LabelColorSelected
                }
            };

            controlLabelStyle = new GUIStyle("Label")
            {
                normal = new GUIStyleState {
                    textColor = settings.LabelControlColor
                }
            };
        }
Ejemplo n.º 7
0
 public SystemFieldControls(BGCurveSettings settings)
     : base(settings, new GUIContent("#2. Controls", "Point's Bezier control positions"))
 {
 }
Ejemplo n.º 8
0
 protected SystemVectorField(BGCurveSettings settings, GUIContent title)
     : base(settings, title)
 {
 }
Ejemplo n.º 9
0
 public SystemFieldPosition(BGCurveSettings settings)
     : base(settings, new GUIContent("#1. Positions", "Point's positions"))
 {
 }
Ejemplo n.º 10
0
        public void OnSceneGUI(BGCurvePointI point, int index, BGCurveSettings settings, Quaternion rotation, Plane[] frustum)
        {
            var math          = mathProvider();
            var positionWorld = math == null ? point.Curve[index].PositionWorld : math.GetPosition(index);

            //adjust rotation
            if (point.PointTransform != null)
            {
                rotation = BGCurveEditorPoints.GetRotation(point.PointTransform);
            }
            else if (point.Curve.PointsMode == BGCurve.PointsModeEnum.GameObjectsTransform)
            {
                rotation = BGCurveEditorPoints.GetRotation(((BGCurvePointGO)point).transform);
            }

            var isShowingGizmoz = settings.RestrictGizmozSettings.IsShowing(index);

            if (settings.ShowControlHandles && settings.ShowCurve && (editorSelection == null || !editorSelection.HasSelected() || editorSelection.SingleSelected(point)))
            {
                // ============================================== Controls Handles
                if (point.ControlType != BGCurvePoint.ControlTypeEnum.Absent)
                {
                    if (isShowingGizmoz)
                    {
                        var controlFirstWorld  = math == null ? point.Curve[index].ControlFirstWorld : math.GetControlFirst(index);
                        var controlSecondWorld = math == null ? point.Curve[index].ControlSecondWorld : math.GetControlSecond(index);

                        BGEditorUtility.SwapHandlesColor(settings.ControlHandlesColor, () =>
                        {
                            Handles.DrawLine(positionWorld, controlFirstWorld);
                            Handles.DrawLine(positionWorld, controlSecondWorld);

                            if (ShowingHandles)
                            {
                                // control handles different types
                                var newPositionFirst  = BGEditorUtility.Handle(GetUniqueNumber(index) - 1, settings.ControlHandlesType, controlFirstWorld, rotation, settings.ControlHandlesSettings);
                                var newPositionSecond = BGEditorUtility.Handle(GetUniqueNumber(index) - 2, settings.ControlHandlesType, controlSecondWorld, rotation, settings.ControlHandlesSettings);

                                if (BGEditorUtility.AnyChange(controlFirstWorld, newPositionFirst))
                                {
                                    point.ControlFirstWorld = newPositionFirst;
                                }
                                if (BGEditorUtility.AnyChange(controlSecondWorld, newPositionSecond))
                                {
                                    point.ControlSecondWorld = newPositionSecond;
                                }
                            }
                        });

                        if (settings.ShowControlLabels)
                        {
                            ShowControlLabel(settings, frustum, controlFirstWorld, point.ControlFirstLocal, "1");
                            ShowControlLabel(settings, frustum, controlSecondWorld, point.ControlSecondLocal, "2");
                        }
                    }
                }
            }

            //if only one point is selected and this is the selected point- do not print anything further
            if (editorSelection != null && editorSelection.HasSelected() && editorSelection.SingleSelected(point))
            {
                return;
            }

            // ============================================== Move Handles
            if ((editorSelection == null || !editorSelection.HasSelected()) && settings.ShowCurve && settings.ShowHandles && ShowingHandles && isShowingGizmoz)
            {
                var newPos = BGEditorUtility.Handle(GetUniqueNumber(index), settings.HandlesType, positionWorld, rotation, settings.HandlesSettings);

                if (BGEditorUtility.AnyChange(positionWorld, newPos))
                {
                    point.PositionWorld = newPos;
                }
            }
        }
 protected override BGCurvePoint CreatePointForPreview(Vector3 position, BGCurve curve, out float toLast, out float toFirst, BGCurveSettings settings)
 {
     toLast = toFirst = 0;
     return(CreatePoint(curve, settings));
 }
Ejemplo n.º 12
0
 public static BGCurveBaseMath NewMath(BGCurve curve, BGCurveSettings settings)
 {
     return(new BGCurveBaseMath(curve, NewConfig(settings)));
 }
Ejemplo n.º 13
0
 //--------------------------------------- Settings
 public static void SetSettings(BGCurve curve, BGCurveSettings settings)
 {
     Set(curve, "settings", settings);
 }
Ejemplo n.º 14
0
 public static bool SaveDefault(BGCurveSettings settings)
 {
     return(Save(settings, DefaultFileName));
 }
Ejemplo n.º 15
0
 private static BGCurveBaseMath.Config NewConfig(BGCurveSettings settings)
 {
     return new BGCurveBaseMath.Config(settings.ShowTangents ? BGCurveBaseMath.Fields.PositionAndTangent : BGCurveBaseMath.Fields.Position) {Parts = settings.Sections};
 }
Ejemplo n.º 16
0
 protected override void BeforeDrawingSpheres(BGCurveSettings settings)
 {
     tempColorBeforeSpheresDraw = Handles.color;
     Handles.color = settings.SphereColor;
 }
Ejemplo n.º 17
0
 internal Vector3 GetLabelPosition(BGCurveSettings settings, Vector3 positionWorld)
 {
     return(settings.ShowSpheres ? positionWorld + Vector3.up * settings.SphereRadius : positionWorld + Vector3.up * 0.2f);
 }
Ejemplo n.º 18
0
 public override void DrawSphere(BGCurveSettings settings, Vector3 pos, float sphereRadius)
 {
     Handles.SphereCap(0, pos, Quaternion.identity, sphereRadius * 2);
 }
Ejemplo n.º 19
0
 protected virtual BGCurvePoint CreatePointForPreview(Vector3 position, BGCurve curve, out float toLast, out float toFirst, BGCurveSettings settings)
 {
     return(BGNewPointPositionManager.CreatePoint(position, curve, settings.ControlType, settings.Sections, out toLast, out toFirst, false));
 }
 protected override void AddPoint(BGCurve curve, Vector3 intersectionPosition, BGCurveSettings settings)
 {
     BGCurveEditor.AddPoint(curve, CreatePoint(curve, settings), pointIndex + 1);
 }
Ejemplo n.º 21
0
 public SystemFieldControlsType(BGCurveSettings settings)
     : base(settings, new GUIContent("#3. Control Type", "Point's control type (Absent, Bezier)"))
 {
 }
Ejemplo n.º 22
0
 public SystemFieldControlsType(BGCurveSettings settings)
     : base(settings, "Control Type")
 {
 }
Ejemplo n.º 23
0
 public SystemFieldTransform(BGCurveSettings settings)
     : base(settings, new GUIContent("#4. Transform", "Transform to use as point's position"))
 {
 }
Ejemplo n.º 24
0
 public virtual void DrawSphere(BGCurveSettings settings, Vector3 pos, float sphereRadius)
 {
     Gizmos.DrawSphere(pos, sphereRadius);
 }
 public void Reset()
 {
     Changed  = false;
     settings = BGPrivateField.GetSettings(curve);
 }
Ejemplo n.º 26
0
            public static void OnSceneGui(Plane[] frustum, BGCurve curve, BGCurveSettings settings, BGCurveEditorPointsSelection editorSelection)
            {
                Array.Resize(ref visiblePoints, curve.PointsCount);
                curve.ForEach((point, i, count) => visiblePoints[i] = GeometryUtility.TestPlanesAABB(frustum, new Bounds(point.PositionWorld, Vector3.one)));


                var fieldsCount       = curve.FieldsCount;
                var fields            = curve.Fields;
                var showPointsNumbers = settings.ShowLabels;

                var fieldsWithHandlesCount = 0;
                var fieldsWithLabelCount   = 0;

                if (fieldsCount > 0)
                {
                    fieldsWithHandlesCount = fields.Count(FieldWithHandlesPredicate);
                    if (fieldsWithHandlesCount > 0)
                    {
                        Array.Resize(ref handlesColor, fieldsWithHandlesCount);
                        var cursor = 0;
                        for (var i = 0; i < fieldsCount; i++)
                        {
                            var f = fields[i];
                            if (!FieldWithHandlesPredicate(f))
                            {
                                continue;
                            }

                            if (FieldWithLabelPredicate(f))
                            {
                                fieldsWithLabelCount++;
                            }
                            handlesColor[cursor++] = BGPrivateField.GetHandlesColor(f);
                        }
                    }
                }

                // nothing to show
                if (!showPointsNumbers && fieldsWithHandlesCount == 0)
                {
                    return;
                }


                if (fieldsWithHandlesCount > 0)
                {
                    //not a label
                    curve.ForEach((point, i, length) =>
                    {
                        if (!visiblePoints[i] || !settings.RestrictGizmozSettings.IsShowing(i))
                        {
                            return;
                        }

                        var pos = point.PositionWorld;

                        var quanterionShown = false;
                        var fieldCursor     = 0;
                        for (var j = 0; j < fields.Length; j++)
                        {
                            var field       = fields[j];
                            var handlesType = (HandlesType)BGPrivateField.GetHandlesType(field);

                            if (handlesType == 0)
                            {
                                continue;
                            }

                            if (handlesType == HandlesType.Label)
                            {
                                fieldCursor++;
                                continue;
                            }

                            var color = handlesColor[fieldCursor++];
                            switch (handlesType)
                            {
                            case HandlesType.DistanceFromPoint:
                                BGEditorUtility.SwapHandlesColor(color, () =>
                                {
#if UNITY_5_6_OR_NEWER
                                    Handles.CircleHandleCap(0, pos, Quaternion.LookRotation(SceneView.currentDrawingSceneView.camera.transform.position - pos),
                                                            point.GetField <float>(field.FieldName), EventType.Repaint);
#else
                                    Handles.CircleCap(0, pos, Quaternion.LookRotation(SceneView.currentDrawingSceneView.camera.transform.position - pos),
                                                      point.GetField <float>(field.FieldName));
#endif
                                }
                                                                 );
                                break;

                            case HandlesType.BoundsAroundPoint:
                                Bounds bounds;
                                switch (field.Type)
                                {
                                case BGCurvePointField.TypeEnum.Bounds:
                                    bounds        = point.GetField <Bounds>(field.FieldName);
                                    bounds.center = pos;
                                    break;

                                default:
                                    //vector3
                                    var vector3 = point.GetField <Vector3>(field.FieldName);
                                    bounds      = new Bounds(pos, vector3);
                                    break;
                                }
                                BGEditorUtility.DrawBound(bounds, new Color(color.r, color.g, color.b, 0.05f), color);
                                break;

                            case HandlesType.Bounds:
                                var boundsValue = point.GetField <Bounds>(field.FieldName);
                                if (boundsValue.extents != Vector3.zero)
                                {
                                    BGEditorUtility.DrawBound(boundsValue, new Color(color.r, color.g, color.b, 0.05f), color);
                                    BGEditorUtility.SwapHandlesColor(color, () => Handles.DrawDottedLine(boundsValue.center, pos, 4));
                                }
                                break;

                            case HandlesType.Direction:
                                var vector3Value = point.GetField <Vector3>(field.FieldName);
                                if (vector3Value != Vector3.zero)
                                {
                                    BGEditorUtility.SwapHandlesColor(color, () =>
                                    {
#if UNITY_5_6_OR_NEWER
                                        Handles.ArrowHandleCap(0, pos, Quaternion.LookRotation(vector3Value),
                                                               vector3Value.magnitude, EventType.Repaint);
#else
                                        Handles.ArrowCap(0, pos, Quaternion.LookRotation(vector3Value), vector3Value.magnitude);
#endif
                                    });
                                }
                                break;

                            case HandlesType.Rotation:
                                if (quanterionShown)
                                {
                                    break;
                                }

                                quanterionShown = true;

                                var quaternionValue = point.GetField <Quaternion>(field.FieldName);
                                if (quaternionValue.x < BGCurve.Epsilon && quaternionValue.y < BGCurve.Epsilon && quaternionValue.z < BGCurve.Epsilon && quaternionValue.w < BGCurve.Epsilon)
                                {
                                    quaternionValue = Quaternion.identity;
                                }

                                var newValue = Handles.RotationHandle(quaternionValue, pos);
                                point.SetField(field.FieldName, newValue);


                                BGEditorUtility.SwapHandlesColor(color, () =>
                                {
                                    var rotated = newValue * Vector3.forward * BGEditorUtility.GetHandleSize(pos, 2);
                                    var toPos   = pos + rotated;
#if UNITY_5_6_OR_NEWER
                                    Handles.ArrowHandleCap(0, toPos, newValue, 1, EventType.Repaint);
#else
                                    Handles.ArrowCap(0, toPos, newValue, 1);
#endif
                                    Handles.DrawDottedLine(pos, toPos, 10);
                                });
                                break;

                            case HandlesType.Link:
                                switch (field.Type)
                                {
                                case BGCurvePointField.TypeEnum.GameObject:
                                    var go = point.GetField <GameObject>(field.FieldName);
                                    if (go != null)
                                    {
                                        BGEditorUtility.SwapHandlesColor(color, () => Handles.DrawDottedLine(go.transform.position, pos, 4));
                                    }
                                    break;

                                case BGCurvePointField.TypeEnum.BGCurve:
                                    var bgCurve = point.GetField <BGCurve>(field.FieldName);
                                    if (bgCurve != null)
                                    {
                                        BGEditorUtility.SwapHandlesColor(color, () => Handles.DrawDottedLine(bgCurve.transform.position, pos, 4));
                                    }
                                    break;

                                case BGCurvePointField.TypeEnum.BGCurvePointComponent:
                                    var pointComponent = point.GetField <BGCurvePointComponent>(field.FieldName);
                                    if (pointComponent != null)
                                    {
                                        BGEditorUtility.SwapHandlesColor(color, () => Handles.DrawDottedLine(pointComponent.PositionWorld, pos, 4));
                                    }
                                    break;

                                case BGCurvePointField.TypeEnum.BGCurvePointGO:
                                    var pointGO = point.GetField <BGCurvePointGO>(field.FieldName);
                                    if (pointGO != null)
                                    {
                                        BGEditorUtility.SwapHandlesColor(color, () => Handles.DrawDottedLine(pointGO.PositionWorld, pos, 4));
                                    }
                                    break;
                                }
                                break;
                            }
                        }
                    });
                }

                // nothing more to show
                if (!showPointsNumbers && fieldsWithLabelCount == 0)
                {
                    return;
                }

                //=============================== Labels

                //styles
                var labelColor    = settings.LabelColor;
                var selectedColor = settings.LabelColorSelected;
                var backColor     = BGCurveSettingsForEditor.I.Get <Color32>(BGCurveSettingsForEditor.ColorForLabelBackgroundKey);

                if (labelStyle == null || labelStyle.normal.textColor != labelColor || labelStyle.normal.background == null ||
                    latestLabelBackColor.r != backColor.r || latestLabelBackColor.g != backColor.g || latestLabelBackColor.b != backColor.b || latestLabelBackColor.a != backColor.a)
                {
                    latestLabelBackColor = backColor;
                    labelStyle           = new GUIStyle("Label")
                    {
                        richText = true,
                        border   = new RectOffset(2, 2, 2, 2),
                        clipping = TextClipping.Overflow,
                        wordWrap = false,
                        normal   =
                        {
                            background = BGEditorUtility.TextureWithBorder(8, 1, backColor, new Color32(backColor.r, backColor.g, backColor.b, 255)),
                            textColor  = labelColor
                        }
                    };

                    selectedlabelStyle = new GUIStyle(labelStyle)
                    {
                        normal =
                        {
                            background = BGEditorUtility.TextureWithBorder(8, 1, new Color(selectedColor.r, selectedColor.g, selectedColor.b, .1f), selectedColor),
                            textColor  = selectedColor
                        }
                    };
                }


                curve.ForEach((point, i, length) =>
                {
                    if (!visiblePoints[i])
                    {
                        return;
                    }

                    var pos = point.PositionWorld;

                    var style = !editorSelection.Contains(point) ? labelStyle : selectedlabelStyle;
                    var text  = "";

                    //point numbers and pos
                    if (showPointsNumbers)
                    {
                        text += "# : " + i + "\r\n";
                        if (settings.ShowPositions)
                        {
                            text += "P : " + pos + "\r\n";
                        }
                    }

                    //fields
                    if (fieldsWithLabelCount > 0)
                    {
                        for (var j = 0; j < fieldsCount; j++)
                        {
                            var field = fields[j];
                            if (!FieldWithHandlesPredicate(field) || !FieldWithLabelPredicate(field))
                            {
                                continue;
                            }

                            text += BGEditorUtility.ColorIt(field.FieldName + " : " + point.GetField(field.FieldName, BGCurvePoint.FieldTypes.GetType(field.Type)),
                                                            BGEditorUtility.ToHex(BGPrivateField.GetHandlesColor(field))) + "\r\n";
                        }
                    }

                    var normalized  = (SceneView.currentDrawingSceneView.camera.transform.position - pos).normalized;
                    var handleSize  = BGEditorUtility.GetHandleSize(pos, .25f);
                    var shiftLeft   = -Vector3.Cross(normalized, Vector3.up);
                    var shiftBottom = Vector3.Cross(normalized, Vector3.right) * .3f;
                    Handles.Label(pos + handleSize * shiftLeft + handleSize * shiftBottom, text.Substring(0, text.Length - 2), style);
                });
            }
Ejemplo n.º 27
0
        internal void OnInspectorGui(BGCurvePointI point, int index, BGCurveSettings settings)
        {
            var mode2D = point.Curve.Mode2D;


            //point transform
            if (point.Curve.PointsMode != BGCurve.PointsModeEnum.Inlined && point.PointTransform != null)
            {
                var referenceToPoint = BGCurveReferenceToPoint.GetReferenceToPoint(point);
                if (referenceToPoint == null)
                {
                    point.PointTransform.gameObject.AddComponent <BGCurveReferenceToPoint>().Point = point;
                }
            }

            BGEditorUtility.HorizontalBox(() =>
            {
                if (editorSelection != null)
                {
                    editorSelection.InspectorSelectionRect(point);
                }

                BGEditorUtility.VerticalBox(() =>
                {
                    BGEditorUtility.SwapLabelWidth(60, () =>
                    {
                        if (!settings.ShowPointPosition && !settings.ShowPointControlType)
                        {
                            BGEditorUtility.Horizontal(() =>
                            {
                                //nothing to show- only label
                                EditorGUILayout.LabelField("Point " + index);
                                PointButtons(point, index, settings);
                            });
                            BGEditorUtility.StartIndent(1);
                        }
                        else
                        {
                            //control type
                            if (settings.ShowPointControlType)
                            {
                                BGEditorUtility.Horizontal(() =>
                                {
                                    point.ControlType = (BGCurvePoint.ControlTypeEnum)EditorGUILayout.EnumPopup("Point " + index, point.ControlType);
                                    PointButtons(point, index, settings);
                                });
                                BGEditorUtility.StartIndent(1);
                            }

                            //position
                            if (settings.ShowPointPosition)
                            {
                                if (!settings.ShowPointControlType)
                                {
                                    BGEditorUtility.Horizontal(() =>
                                    {
                                        PositionField("Point " + index, point, mode2D, index);
                                        PointButtons(point, index, settings);
                                    });
                                    BGEditorUtility.StartIndent(1);
                                }
                                else
                                {
                                    PositionField("Pos", point, mode2D, index);
                                }
                            }
                        }
                    });

                    // control positions
                    if (point.ControlType != BGCurvePoint.ControlTypeEnum.Absent && settings.ShowPointControlPositions)
                    {
                        // 1st
                        ControlField(point, mode2D, 1);

                        // 2nd
                        ControlField(point, mode2D, 2);
                    }

                    //transform
                    if (settings.ShowTransformField)
                    {
                        BGEditorUtility.ComponentField("Transform", point.PointTransform, transform =>
                        {
                            if (transform != null)
                            {
                                Undo.RecordObject(transform, "Object moved");

                                if (point.Curve.PointsMode != BGCurve.PointsModeEnum.Inlined)
                                {
                                    Undo.AddComponent <BGCurveReferenceToPoint>(transform.gameObject).Point = point;
                                }
                            }

                            if (point.PointTransform != null)
                            {
                                var referenceToPoint = BGCurveReferenceToPoint.GetReferenceToPoint(point);
                                if (referenceToPoint != null)
                                {
                                    Undo.DestroyObjectImmediate(referenceToPoint);
                                }
                            }

                            point.PointTransform = transform;
                        });
                    }


                    //fields
                    if (point.Curve.FieldsCount > 0)
                    {
                        ShowFields(point);
                    }

                    BGEditorUtility.EndIndent(1);
                });
            });
        }
Ejemplo n.º 28
0
 protected SystemField(BGCurveSettings settings, GUIContent title)
 {
     this.title = title;
     Settings   = settings;
 }
Ejemplo n.º 29
0
 protected virtual void BeforeDrawingSpheres(BGCurveSettings settings)
 {
 }
Ejemplo n.º 30
0
 //default implementation adds a point to the spline's end
 protected virtual void AddPoint(BGCurve curve, Vector3 intersectionPosition, BGCurveSettings settings)
 {
     BGCurveEditor.AddPoint(curve,
                            BGNewPointPositionManager.CreatePoint(intersectionPosition, curve, settings.ControlType, settings.Sections, true),
                            curve.PointsCount);
 }