Example #1
0
        void doBottomToolBar(Rect rect)
        {
            if (m_TreeView == null)
            {
                return;
            }

            GUILayout.BeginArea(rect);

            using (new EditorGUILayout.HorizontalScope())
            {
                GUIStyle style = "miniButton";

                if (GUILayout.Button("Expand All", style))
                {
                    m_TreeView.ExpandAll();
                }

                if (GUILayout.Button("Collapse All", style))
                {
                    m_TreeView.CollapseAll();
                }

                GUILayout.Label("Build: " + buildInfoManager.GetSelectedBuildDate() + " (" + buildInfoManager.GetSelectedBuildTarget() + ")");
                GUILayout.FlexibleSpace();
                GUILayout.Label(buildInfoManager.TreeView != null ? AssetDatabase.GetAssetPath(buildInfoManager.TreeView) : string.Empty);
                GUILayout.FlexibleSpace();

                if (((AH_MultiColumnHeader)m_TreeView.multiColumnHeader).mode == AH_MultiColumnHeader.Mode.SortedList || !string.IsNullOrEmpty(m_TreeView.searchString))
                {
                    if (GUILayout.Button("Return to Treeview", style))
                    {
                        m_TreeView.ShowTreeMode();
                    }
                }

                GUIContent exportContent = new GUIContent("Export list", "Export all the assets in the list above to a json file");
                if (GUILayout.Button(exportContent, style))
                {
                    AH_ElementList.DumpCurrentListToFile(m_TreeView);
                }
            }
            GUILayout.EndArea();
        }
        internal static void DumpCurrentListToFile(AH_TreeViewWithTreeModel m_TreeView)
        {
            var path = EditorUtility.SaveFilePanel(
                "Dump current list to file",
                AH_SerializationHelper.GetBuildInfoFolder(),
                "AH_Listdump_" + System.Environment.UserName,
                AH_SerializationHelper.FileDumpExtension);

            if (path.Length != 0)
            {
                List <AssetDumpData> elements = new List <AssetDumpData>();

                foreach (var element in m_TreeView.GetRows())
                {
                    populateDumpListRecursively(m_TreeView.treeModel.Find(element.id), ((AH_MultiColumnHeader)m_TreeView.multiColumnHeader).ShowMode, ref elements);
                }

                AH_ElementList objectToSave = new AH_ElementList(elements);
                AH_SerializationHelper.SerializeAndSave(objectToSave, path);
            }
        }