Esempio n. 1
0
        public static void DrawGizmos(BGCurve curve, GizmoType gizmoType)
        {
            if (curve.PointsCount == 0)
            {
                return;
            }

            var settings = curve.Settings;

            if (!settings.ShowCurve || settings.VRay)
            {
                return;
            }

/*
 *          var settingsShowCurveMode = settings.ShowCurveMode;
 * //            if (true) return;
 *          if (settingsShowCurveMode == BGCurveSettings.ShowCurveModeEnum.CurveOrParentSelected && (gizmoType & GizmoType.InSelectionHierarchy) == 0) return;
 *          if (settingsShowCurveMode == BGCurveSettings.ShowCurveModeEnum.CurveSelected && (gizmoType & GizmoType.Selected) == 0) return;
 *
 *          if (BGCurvePointGOEditor.PointSelected) return;
 *
 *          if (Selection.Contains(curve.gameObject) && settings.VRay) return;
 */

            var playMode = EditorApplication.isPlaying;

            if (lastPlayMode != playMode)
            {
                lastPlayMode = playMode;

                foreach (var painterGizmo in curve2Painter)
                {
                    painterGizmo.Value.Dispose();
                }
                curve2Painter.Clear();
            }

            if (CurrentCurve != null && curve.GetInstanceID() == CurrentCurve.GetInstanceID())
            {
                if (CurrentGizmoPainter != null)
                {
                    CurrentGizmoPainter.DrawCurve();
                }
            }
            else
            {
                //curve is not selected in hierarchy
                var painter = BGEditorUtility.Ensure(curve2Painter, curve, () => new BGCurvePainterGizmo(NewMath(curve, settings), true));
                AdjustMath(settings, painter.Math);
                if (curve.ForceChangedEventMode != BGCurve.ForceChangedEventModeEnum.Off && !Application.isPlaying)
                {
                    painter.Math.Recalculate();
                }
                painter.DrawCurve();
            }
        }
Esempio n. 2
0
        public static void DrawGizmos(BGCurve curve, GizmoType gizmoType)
        {
            //draw current spline
            if (curve.PointsCount != 0)
            {
                var settings = curve.Settings;
                if (settings.ShowCurve && !settings.VRay)
                {
                    if (CurrentGizmoPainter != null)
                    {
                        CurrentGizmoPainter.DrawCurve();
                    }
                }
            }

            //why we do it?
            var playMode = EditorApplication.isPlaying;

            if (lastPlayMode != playMode)
            {
                lastPlayMode = playMode;

                foreach (var painterGizmo in curve2Painter)
                {
                    painterGizmo.Value.Dispose();
                }
                curve2Painter.Clear();
            }

            //draw other splines with showCurveOption==AnyCurveSelected
            if (AllCurves != null)
            {
                for (var i = 0; i < AllCurves.Length; i++)
                {
                    var allCurve = AllCurves[i];

                    var settings = allCurve.Settings;
                    if (settings.ShowCurveOption != BGCurveSettings.ShowCurveOptionsEnum.AnyCurveSelected || allCurve.Equals(curve))
                    {
                        continue;
                    }

                    var painter = BGEditorUtility.Ensure(curve2Painter, allCurve, () => new BGCurvePainterGizmo(NewMath(allCurve, settings), true));
                    AdjustMath(settings, painter.Math);
                    if (allCurve.ForceChangedEventMode != BGCurve.ForceChangedEventModeEnum.Off && !Application.isPlaying)
                    {
                        painter.Math.Recalculate();
                    }
                    painter.DrawCurve();
                }
            }
        }
Esempio n. 3
0
        public static void DrawGizmos(BGCurve curve, GizmoType gizmoType)
        {
            var playMode = EditorApplication.isPlaying;

            if (lastPlayMode != playMode)
            {
                lastPlayMode = playMode;

                foreach (var painterGizmo in curve2Painter)
                {
                    painterGizmo.Value.Dispose();
                }
                curve2Painter.Clear();
            }

            var settings = BGPrivateField.GetSettings(curve);

            if (!ComplyForDrawGizmos(curve, gizmoType, settings))
            {
                return;
            }

            if (CurrentCurve != null && curve.GetInstanceID() == CurrentCurve.GetInstanceID())
            {
                if (CurrentGizmoPainter != null)
                {
                    CurrentGizmoPainter.DrawCurve();
                }
            }
            else
            {
                //curve is not selected in hierarchy
                var painter = BGEditorUtility.Ensure(curve2Painter, curve, () => new BGCurvePainterGizmo(NewMath(curve, settings), true));
                AdjustMath(settings, painter.Math);
                if (curve.ForceChangedEventMode != BGCurve.ForceChangedEventModeEnum.Off && !Application.isPlaying)
                {
                    painter.Math.Recalculate();
                }
                painter.DrawCurve();
            }
        }