Example #1
0
        void OnSelectionChange()
        {
            CurvyGenerator gen = null;
            var            mod = DTSelection.GetAllAs <CGModule>();

            if (mod.Count > 0)
            {
                gen = mod[0].Generator;
            }
            if (gen == null)
            {
                gen = DTSelection.GetAs <CurvyGenerator>();
            }
            if (gen != null && (Generator == null || gen != Generator))
            {
                Initialize(gen);
                Repaint();
            }
            else
            if (mod.Count > 0 && CurvyProject.Instance.CGSynchronizeSelection)
            {
                Sel.Select(mod);
                Canvas.FocusSelection();
                Repaint();
            }
        }
Example #2
0
        protected override void OnCustomInspectorGUI()
        {
            GUILayout.Space(5);
            base.OnCustomInspectorGUI();
            var sel = DTSelection.GetAs <CurvySplineSegment>();

            if (sel)
            {
                sorted = new List <CurvySplineSegment>(Target.ControlPoints);
                sorted.Sort(delegate(CurvySplineSegment a, CurvySplineSegment b)
                {
                    if (a == sel || b == sel)
                    {
                        return((b == sel).CompareTo(a == sel));
                    }
                    else if (a.FollowUp == sel || b.FollowUp == sel)
                    {
                        return((b.FollowUp == sel).CompareTo(a.FollowUp == sel));
                    }
                    else
                    {
                        return(a.ToString().CompareTo(b.ToString()));
                    }
                });
            }
            else
            {
                sorted = Target.ControlPoints;
            }


            headerGUI(GUILayoutUtility.GetRect(0, 42));
            for (int i = 0; i < sorted.Count; i++)
            {
                itemGUI(GUILayoutUtility.GetRect(0, 42), i, true, true);
            }

            //if (Target.ControlPoints.Count == 2 && Target.ControlPoints[0].CanConnectTo(Target.ControlPoints[1],false))
            quickSetsGUI();
            if (GUILayout.Button("Delete Connection"))
            {
                Target.Delete();
                GUIUtility.ExitGUI();
            }
            GUILayout.Space(5);
        }