protected override void OnItemDoubleClicked(GridViewData itemData) { AssetDependencyData adData = itemData.GetData <AssetDependencyData>(); SelectionUtility.PingObject(adData.assetPath); SelectionUtility.ActiveObject(adData.assetPath); }
private void CreateSelectedAsset(GridViewData data, string selectedAssetPath, List <int> selectedIDs) { AssetDependencyData adData = data.GetData <AssetDependencyData>(); if (adData.assetPath == selectedAssetPath) { selectedIDs.Add(data.ID); return; } if (adData.allDepends != null && Array.IndexOf(adData.allDepends, selectedAssetPath) >= 0) { if (!data.IsExpand) { foreach (var childAssetPath in adData.directlyDepends) { if (IsAssetIgnored(childAssetPath)) { continue; } AssetDependencyData childADData = AssetDependencyUtil.GetDependencyData(childAssetPath); GridViewData viewData = new GridViewData(childAssetPath, childADData); AddChildData(data, viewData); } data.IsExpand = true; } foreach (var childData in data.Children) { CreateSelectedAsset(childData, selectedAssetPath, selectedIDs); } } }
protected override void OnDataExpand(GridViewData data) { DSData dsData = data.GetData <DSData>(); if (dsData.isDir) { string[] files = Directory.GetFiles(dsData.path, "*.*", SearchOption.TopDirectoryOnly); string[] dirs = Directory.GetDirectories(dsData.path, "*", SearchOption.TopDirectoryOnly); if (dirs != null && dirs.Length > 0) { foreach (var dir in dirs) { AddChildData(data, new GridViewData(dir, new DSData() { path = dir, isDir = true, })); } } if (files != null && files.Length > 0) { foreach (var file in files) { AddChildData(data, new GridViewData(file, new DSData() { path = file, isDir = false, })); } } } }
protected override void OnDataExpand(GridViewData data) { if (data.IsExpand) { return; } AssetDependencyData adData = data.GetData <AssetDependencyData>(); if (adData.directlyDepends != null && adData.directlyDepends.Length > 0) { for (int i = 0; i < adData.directlyDepends.Length; ++i) { string assetPath = adData.directlyDepends[i]; if (IsAssetIgnored(assetPath)) { continue; } AssetDependencyData childADData = AssetDependencyUtil.GetDependencyData(assetPath); var childData = new GridViewData(assetPath, childADData); AddChildData(data, childData); } } }
public override bool HasChild(GridViewData data) { AssetDependencyData adData = data.GetData <AssetDependencyData>(); int count = (from d in adData.directlyDepends where Array.IndexOf(m_IgnoreExtensions, Path.GetExtension(d).ToLower()) < 0 select d).Count(); return(count > 0); }
protected override void OnItemDoubleClicked(GridViewData itemData) { AssetDependency adData = itemData.GetData <AssetDependency>(); if (adData == null) { return; } SelectionUtility.PingObject(adData.assetPath); }
public override bool HasChild(GridViewData data) { AssetDependency adData = data.GetData <AssetDependency>(); if (adData == null) { return(false); } return(adData.directlyDepends.Length > 0); }
public override bool HasChild(GridViewData data) { DSData dsData = data.GetData <DSData>(); if (dsData.isDir) { return(true); } else { return(false); } }
protected override void OnDrawRowItem(Rect rect, GridViewData itemData) { DSData data = itemData.GetData <DSData>(); if (data.isDir) { Texture2D texture = EGUIResources.DefaultFolderIcon; Rect iconRect = new Rect(rect.x, rect.y, rect.height, rect.height); EditorGUI.DrawPreviewTexture(iconRect, texture); rect.x += rect.height; rect.width -= rect.height; EditorGUI.LabelField(rect, data.path); } else { EditorGUI.LabelField(rect, data.path); } }
protected override void OnDrawColumnItem(Rect rect, int columnIndex, GridViewData columnItemData) { FileInfoData data = columnItemData.GetData <FileInfoData>(); string content = string.Empty; if (columnIndex == 0) { content = data.path; } else if (columnIndex == 1) { content = data.createDatetime; } else { content = data.fileSize.ToString(); } EditorGUI.LabelField(rect, content); }
protected override void OnDrawRowItem(Rect rect, GridViewData itemData) { AssetDependency adData = itemData.GetData <AssetDependency>(); if (adData == null) { EditorGUI.LabelField(rect, "The data is null"); return; } Rect iconRect = new Rect(rect.x, rect.y, rect.height, rect.height); UnityObject assetObj = adData.cachedUObject; if (assetObj == null) { assetObj = AssetDatabase.LoadAssetAtPath(adData.assetPath, typeof(UnityObject)); adData.cachedUObject = assetObj; } Texture2D previewIcon = adData.cachedPreview; if (previewIcon == null) { previewIcon = EGUIResources.GetAssetPreview(assetObj); adData.cachedPreview = previewIcon; } GUI.DrawTexture(iconRect, previewIcon, ScaleMode.ScaleAndCrop); if (Event.current.type == EventType.MouseUp && iconRect.Contains(Event.current.mousePosition)) { SelectionUtility.PingObject(assetObj); } Rect labelRect = new Rect(iconRect.x + iconRect.width, iconRect.y, rect.width - iconRect.width, iconRect.height); EditorGUI.LabelField(labelRect, adData.assetPath, EGUIStyles.MiddleLeftLabelStyle); if (assetObj is Texture) { Rect memorySizeRect = new Rect(rect.x + rect.width - 60, rect.y, 60, rect.height); long memorySize = AssetDatabaseUtility.GetTextureStorageSize(assetObj as Texture); EditorGUI.LabelField(memorySizeRect, EditorUtility.FormatBytes(memorySize)); } }
protected override void OnDrawRowItem(Rect rect, GridViewData itemData) { AssetDependencyData adData = itemData.GetData <AssetDependencyData>(); Rect iconRect = new Rect(rect.x, rect.y, rect.height, rect.height); UnityObject assetObj = AssetDatabase.LoadAssetAtPath(adData.assetPath, typeof(UnityObject)); Texture2D previewIcon = null; if (assetObj == null) { previewIcon = EGUIResources.ErrorIcon; } else if (!AssetPreview.IsLoadingAssetPreview(assetObj.GetInstanceID())) { previewIcon = AssetPreview.GetAssetPreview(assetObj); } if (previewIcon == null) { previewIcon = EGUIResources.MakeColorTexture((int)iconRect.width, (int)iconRect.height, Color.grey); } GUI.DrawTexture(iconRect, previewIcon, ScaleMode.ScaleAndCrop); if (Event.current.type == EventType.MouseUp && iconRect.Contains(Event.current.mousePosition)) { SelectionUtility.PingObject(assetObj); } Rect labelRect = new Rect(iconRect.x + iconRect.width, iconRect.y, rect.width - iconRect.width, iconRect.height); EditorGUI.LabelField(labelRect, adData.assetPath, EGUIStyles.MiddleLeftLabelStyle); if (assetObj is Texture) { Rect memorySizeRect = new Rect(rect.x + rect.width - 60, rect.y, 60, rect.height); long memorySize = AssetDatabaseUtility.GetTextureStorageSize(assetObj as Texture); EditorGUI.LabelField(memorySizeRect, EditorUtility.FormatBytes(memorySize)); } }
protected override void OnDataExpand(GridViewData data) { if (data.IsExpand) { return; } AssetDependency adData = data.GetData <AssetDependency>(); if (adData.directlyDepends != null && adData.directlyDepends.Length > 0) { for (int i = 0; i < adData.directlyDepends.Length; ++i) { string assetPath = adData.directlyDepends[i]; AssetDependency childADData = dependencyConfig.GetData(assetPath); if (childADData == null) { Debug.Log("SSSSSSSSSSS->" + assetPath); } var childData = new GridViewData(assetPath, childADData); AddChildData(data, childData); } } }