public void OnDataSelected(object selected, int col) { ModelOverviewData overViewData = selected as ModelOverviewData; if (overViewData == null) { return; } if (m_showTable != null) { m_showTable.RefreshData(overViewData.GetObjects()); } }
public static ModelOverviewData CreateNew(ModelOverviewMode mode, ModelInfo modelInfo) { ModelOverviewData retData = new ModelOverviewData(); retData.Mode = mode; retData.ReadWriteEnable = modelInfo.ReadWriteEnable; retData.ImportMaterials = modelInfo.ImportMaterials; retData.OptimizeMesh = modelInfo.OptimizeMesh; retData.MeshDataID = modelInfo.GetMeshDataID(); retData.MeshDataStr = ModelInfo.GetMeshDataStr(retData.MeshDataID); retData.MeshCompression = modelInfo.MeshCompression; retData.VertexRangeStr = modelInfo.GetVertexRangeStr(); retData.TriangleRangeStr = modelInfo.GetTriangleRangeStr(); return(retData); }
public void SwitchMode(int mode) { m_mode = (ModelOverviewMode)mode; if (!m_flag[mode] && m_modelInfoList != null) { m_flag[mode] = true; List <object> data = m_data[mode]; for (int i = 0; i < m_modelInfoList.Count; ++i) { ModelInfo modelInfo = m_modelInfoList[i]; EditorUtility.DisplayProgressBar("刷新数据", System.IO.Path.GetFileName(modelInfo.Path), (i * 1.0f) / m_modelInfoList.Count); bool find = false; for (int j = 0; j < data.Count; ++j) { ModelOverviewData overViewData = data[j] as ModelOverviewData; if (overViewData.IsMatch(modelInfo)) { find = true; overViewData.AddObject(modelInfo); break; } } if (!find) { ModelOverviewData overViewData = ModelOverviewData.CreateNew(m_mode, modelInfo); overViewData.AddObject(modelInfo); data.Add(overViewData); } } EditorUtility.ClearProgressBar(); } if (m_dataTable != null) { ModelOverviewData.SwitchDataTableMode(m_mode, m_dataTable); m_dataTable.RefreshData(m_data[mode]); } }
public ModelOverviewViewer(EditorWindow hostWindow) { m_data = new List <object> [(int)ModelOverviewMode.Count]; m_flag = new bool[(int)ModelOverviewMode.Count]; for (int i = 0; i < (int)ModelOverviewMode.Count; ++i) { m_flag[i] = false; m_data[i] = new List <object>(); } m_dataTable = new TableView(hostWindow, typeof(ModelOverviewData)); ModelOverviewData.SwitchDataTableMode(m_mode, m_dataTable); m_showTable = new TableView(hostWindow, typeof(ModelInfo)); m_showTable.AddColumn("Path", "Path", 0.7f, TextAnchor.MiddleLeft); m_showTable.AddColumn("MemSize", "Memory", 0.1f, TextAnchor.MiddleCenter, "<fmt_bytes>"); m_showTable.AddColumn("vertexCount", "VertexCount", 0.1f); m_showTable.AddColumn("triangleCount", "TriangleCount", 0.1f); m_dataTable.OnSelected += OnDataSelected; m_showTable.OnSelected += OnInfoSelected; }