void InitIfNeeded()
        {
            if (m_Initialized)
            {
                return;
            }

            if (m_TreeViewState == null)
            {
                m_TreeViewState = new TreeViewState();
            }


            if (m_MultiColumnHeaderState == null)
            {
                SerializedPropertyTreeView.Column[] columns = m_HeaderDelegate();

                string[] propNames = GetPropertyNames(columns);

                m_MultiColumnHeaderState = new MultiColumnHeaderState(columns);
                m_DataStore = new SerializedPropertyDataStore(propNames, m_GatherDelegate);
            }

            var header = new MultiColumnHeader(m_MultiColumnHeaderState);

            m_ColumnHeaderHeight = header.height;
            m_TreeView           = new SerializedPropertyTreeView(m_TreeViewState, header, m_DataStore);

            m_TreeView.DeserializeState(m_SerializationUID);
            m_TreeView.Reload();

            m_Initialized = true;
        }
Exemplo n.º 2
0
        public SerializedPropertyTreeView(TreeViewState state, MultiColumnHeader multicolumnHeader, SerializedPropertyDataStore dataStore, bool showFilterGUI) : base(state, multicolumnHeader)
        {
            m_DataStore = dataStore;
            // initialize internal data for the columns
            int colcnt = multiColumnHeader.state.columns.Length;

            m_ColumnsInternal = new ColumnInternal[colcnt];
            for (int i = 0; i < colcnt; i++)
            {
                Column c = Col(i);
                if (c.propertyName != null)
                {
                    m_ColumnsInternal[i].dependencyProps = new SerializedProperty[c.propertyName.Length];
                }
            }

            multiColumnHeader.sortingChanged        += OnSortingChanged;
            multiColumnHeader.visibleColumnsChanged += OnVisibleColumnChanged;

            showAlternatingRowBackgrounds = true;
            showBorder = true;
            rowHeight  = EditorGUIUtility.singleLineHeight;

            m_ShowFilterGUI = showFilterGUI;
        }
Exemplo n.º 3
0
        public SerializedPropertyTreeView(TreeViewState state, MultiColumnHeader multicolumnHeader, SerializedPropertyDataStore dataStore) : base(state, multicolumnHeader)
        {
            this.m_DataStore = dataStore;
            int num = base.multiColumnHeader.state.columns.Length;

            this.m_ColumnsInternal = new SerializedPropertyTreeView.ColumnInternal[num];
            for (int i = 0; i < num; i++)
            {
                SerializedPropertyTreeView.Column column = this.Col(i);
                if (column.propertyName != null)
                {
                    this.m_ColumnsInternal[i].dependencyProps = new SerializedProperty[column.propertyName.Length];
                }
            }
            base.multiColumnHeader.sortingChanged        += new MultiColumnHeader.HeaderCallback(this.OnSortingChanged);
            base.multiColumnHeader.visibleColumnsChanged += new MultiColumnHeader.HeaderCallback(this.OnVisibleColumnChanged);
            base.showAlternatingRowBackgrounds            = true;
            base.showBorder = true;
            base.rowHeight  = 18f;
        }
 private void InitIfNeeded()
 {
     if (!this.m_Initialized)
     {
         if (this.m_TreeViewState == null)
         {
             this.m_TreeViewState = new TreeViewState();
         }
         if (this.m_MultiColumnHeaderState == null)
         {
             string[] propNames;
             this.m_MultiColumnHeaderState = new MultiColumnHeaderState(this.m_HeaderDelegate(out propNames));
             this.m_DataStore = new SerializedPropertyDataStore(propNames, this.m_GatherDelegate);
         }
         MultiColumnHeader multiColumnHeader = new MultiColumnHeader(this.m_MultiColumnHeaderState);
         this.m_ColumnHeaderHeight = multiColumnHeader.height;
         this.m_TreeView           = new SerializedPropertyTreeView(this.m_TreeViewState, multiColumnHeader, this.m_DataStore);
         this.m_TreeView.DeserializeState(this.m_SerializationUID);
         this.m_TreeView.Reload();
         this.m_Initialized = true;
     }
 }