public void Refresh() { m_DependentAssets.Clear(); foreach (var itr in m_ConcreteAssets) { m_DependentAssets.AddRange(itr.GetDependencies()); } BundleModel.Save(); }
protected void DeleteBundles(object context) { var selectedNodes = context as List <BundleTreeItem>; if (selectedNodes == null) { return; } BundleModel.HandleBundleDelete(selectedNodes.Select(x => x.BundleData)); ReloadAndSelect(new List <int>()); }
protected void CreateNewAssetBundle(object context) { BundleDataInfo info = null; var selectedNodes = context as List <BundleTreeItem>; if (selectedNodes != null && selectedNodes.Count > 0) { info = selectedNodes[0].BundleData as BundleDataInfo; } var newBundle = BundleModel.CreateEmptyBundle(info); ReloadAndSelect(newBundle.nameHashCode, true); }
protected override DragAndDropVisualMode HandleDragAndDrop(DragAndDropArgs args) { if (IsValidDragDrop(args)) { if (args.performDrop) { BundleModel.MoveAssetToBundle(DragAndDrop.paths, m_SourceBundles[0].m_Name); foreach (var bundle in m_SourceBundles) { bundle.Refresh(); } m_Controller.UpdateSelectedBundles(m_SourceBundles); } return(DragAndDropVisualMode.Copy);//Move; } return(DragAndDropVisualMode.Rejected); }
private void RemoveAssets(object userdata) { var selectedNodes = userdata as List <AssetTreeItem>; var assets = new List <AssetInfo>(); foreach (var node in selectedNodes) { if (node.asset.bundleName != string.Empty) { assets.Add(node.asset); } } BundleModel.MoveAssetToBundle(assets, string.Empty); foreach (var bundle in m_SourceBundles) { bundle.Refresh(); } m_Controller.UpdateSelectedBundles(m_SourceBundles); }
protected override void RenameEnded(RenameEndedArgs args) { base.RenameEnded(args); if (args.newName.Length > 0 && args.newName != args.originalName) { args.newName = args.newName.ToLower(); args.acceptedRename = true; var renamedItem = FindItem(args.itemID, rootItem) as BundleTreeItem; args.acceptedRename = BundleModel.HandleBundleRename(renamedItem, args.newName); if (renamedItem != null) { ReloadAndSelect(renamedItem.BundleData.nameHashCode, false); } } else { args.acceptedRename = false; } }
private void DragPathsToNewSpace(string[] paths, BundleDataInfo root, bool hasScene) { if (hasScene) { var hashCodes = new List <int>(); foreach (var assetPath in paths) { var newBundle = BundleModel.CreateEmptyBundle(root, System.IO.Path.GetFileNameWithoutExtension(assetPath).ToLower()); BundleModel.MoveAssetToBundle(assetPath, newBundle.m_Name); hashCodes.Add(newBundle.nameHashCode); } ReloadAndSelect(hashCodes); } else { var newBundle = BundleModel.CreateEmptyBundle(root); BundleModel.MoveAssetToBundle(paths, newBundle.m_Name); ReloadAndSelect(newBundle.nameHashCode, true); } }
private DragAndDropVisualMode HandleDragAndDropUpon(DragAndDropData data) { var visualMode = DragAndDropVisualMode.Copy; var targetDataBundle = data.targetNode.BundleData as BundleDataInfo; if (targetDataBundle != null) { if (targetDataBundle.isSceneBundle) { visualMode = DragAndDropVisualMode.Rejected; } else { if (data.hasScene && !targetDataBundle.IsEmpty()) { visualMode = DragAndDropVisualMode.Rejected; } else { if (data.args.performDrop) { if (data.draggedNodes != null) { BundleModel.HandleBundleMerge(data.draggedNodes, targetDataBundle); ReloadAndSelect(targetDataBundle.nameHashCode, false); } else if (data.paths != null) { BundleModel.MoveAssetToBundle(data.paths, targetDataBundle.m_Name); ReloadAndSelect(targetDataBundle.nameHashCode, false); } } } } } else { var root = data.targetNode.BundleData as BundleDataInfo; } return(visualMode); }
protected override TreeViewItem BuildRoot() { return(BundleModel.CreateAssetBundleTreeView()); }
public BundleTreeView(TreeViewState state, BundleManagerControl ctrl) : base(state) { BundleModel.Reload(); m_Controller = ctrl; showBorder = true; }
protected override TreeViewItem BuildRoot() { var root = BundleModel.CreateAssetListTreeView(m_SourceBundles); return(root); }