void DrawActiveOption()
        {
            //GUILayout.BeginHorizontal();
            int act = 0;

            if (mActive)
            {
                act |= 0x1;
            }
            if (mInactive)
            {
                act |= 0x2;
            }
            if (mNigative)
            {
                act |= 0x4;
            }
            act       = QuickGUI.MultiOptionBar(act, new string[] { "Active", "Inactive", "Revert" });
            mActive   = (act & 0x1) != 0;
            mInactive = (act & 0x2) != 0;
            mNigative = (act & 0x4) != 0;
        }
Пример #2
0
        public override void OnInspectorGUI()
        {
            GUI.skin.label.richText = true;
            CheckTarget();
            bool dirty = false;

            GUILayout.Space(10);
            ECurveType tp = (ECurveType)EditorGUILayout.EnumPopup(mPath.m_Type);

            if (tp != mPath.m_Type)
            {
                mPath.m_Type = tp;
                dirty        = true;
            }
            int insertAt = -1;
            int deleteAt = -1;

            mFreezeAxis = QuickGUI.MultiOptionBar(mFreezeAxis, freezeOption);
            mPointsArea = GUILayout.BeginScrollView(mPointsArea, GUILayout.MaxHeight(200));
            if (QuickGUI.DrawHeader("Sample Points", "sample points", false))
            {
                QuickGUI.BeginContents(170);
                for (int i = 1; i < caches.Length; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    int n = QuickGUI.GroupButton(addSubBtn, GUILayout.Width(40));
                    caches[i] = EditorGUILayout.Vector3Field(string.Format("P{0}{1}", i, i == mCurrentPoint?" [Moving]":""), caches[i]);
                    EditorGUILayout.EndHorizontal();
                    if (n != -1)
                    {
                        insertAt = n == 0 ? i : -1;
                        deleteAt = n == 1 ? i : -1;
                    }
                    if (Vector3.Distance(caches[i], mPath.m_Points[i]) > snapDis)
                    {
                        dirty             = true;
                        mPath.m_Points[i] = caches[i];
                    }
                }
                if (GUILayout.Button("+", GUILayout.Width(20)))
                {
                    insertAt = caches.Length;
                    deleteAt = -1;
                }
                QuickGUI.EndContents();
            }
            GUILayout.EndScrollView();

            if (insertAt > 0)
            {
                InsertAt(insertAt);
                dirty = true;
            }
            else if (deleteAt > 0)
            {
                DeleteAt(deleteAt);
                dirty = true;
            }

            if (dirty)
            {
                caches = new Vector3[mPath.m_Points.Length];
                System.Array.Copy(mPath.m_Points, caches, caches.Length);
                mPath.RecalculateLater();
                SceneView.RepaintAll();
            }
        }