Exemplo n.º 1
0
        void doFollowUpPopup(Rect r, CurvySplineSegment item)
        {
            var possibleTargets = (from cp in Target.ControlPoints
                                   where cp != item
                                   select cp).ToList();
            int sel = possibleTargets.IndexOf(item.FollowUp) + 1;

            var content = (from cp in possibleTargets
                           select cp.ToString()).ToList();

            content.Insert(0, " ");
            EditorGUI.BeginChangeCheck();

            if (item.FollowUp && item.FollowUp.gameObject == Selection.activeGameObject)
            {
                DTHandles.DrawSolidRectangleWithOutline(r.ScaleBy(2, 0).ShiftBy(1, -2), new Color(0f, 0, 0, 0.1f), new Color(.24f, .37f, .59f));
            }

            sel = EditorGUI.Popup(r, sel, content.ToArray());

            if (EditorGUI.EndChangeCheck())
            {
                if (sel > 0)
                {
                    item.SetFollowUp(possibleTargets[sel - 1]);
                }
                else
                {
                    item.SetFollowUp(null);
                }
            }
        }