internal static BuildManagerTreeState CreateOrInitializeTreeState(BuildManagerTreeState state) { if (state == null) { state = new BuildManagerTreeState(); } if (state.treeViewState == null) { state.treeViewState = new TreeViewState(); } bool firstInit = state.columnHeaderState == null; var headerState = CreateMultiColumnHeaderState(); if (MultiColumnHeaderState.CanOverwriteSerializedFields(state.columnHeaderState, headerState)) { MultiColumnHeaderState.OverwriteSerializedFields(state.columnHeaderState, headerState); } state.columnHeaderState = headerState; state.columnHeader = new MultiColumnHeader(headerState); if (firstInit) { state.columnHeader.ResizeToFit(); } return(state); }
public BuildManagerTreeView(BuildManagerTreeState state, Func <List <BuildTreeViewItem> > getData) : base(state.treeViewState, state.columnHeader) { m_DataCallback = getData; rowHeight = 20f; showAlternatingRowBackgrounds = true; showBorder = true; customFoldoutYOffset = (rowHeight - EditorGUIUtility.singleLineHeight) * 0.5f; extraSpaceBeforeIconAndLabel = 18f; Reload(); }
private void OnEnable() { if (File.Exists(kSettingsPath)) { EditorJsonUtility.FromJsonOverwrite(File.ReadAllText(kSettingsPath), this); } if (m_BuildInstructions == null) { m_BuildInstructions = new List <BuildInstructions>(); } m_TreeState = BuildManagerTreeState.CreateOrInitializeTreeState(m_TreeState); m_TreeView = new BuildManagerTreeView(m_TreeState, RegenerateBuildItems); }