public void AddTreeViewItems(int parentId, ConformObjectTreeViewItem parent, AssetsTreeViewItem assetsTreeItem, int depth, int arrayIndex = -1) { int activePath = parentId + (Name.GetHashCode() * 31); ConformObjectTreeViewItem conformObjectTree = new ConformObjectTreeViewItem(activePath, depth, this) { AssetsTreeViewItem = assetsTreeItem }; parent.AddChild(conformObjectTree); for (int i = 0; i < SubObjects.Count; ++i) { SubObjects[i].AddTreeViewItems(activePath, conformObjectTree, assetsTreeItem, depth + 1); } }
private static void GenerateTreeElements(AssetsTreeViewItem assetsTreeItem, TreeViewItem root) { string activePath = assetsTreeItem.displayName + ":"; // create root object for the Asset ConformObjectTreeViewItem conformObjectAssetRoot = new ConformObjectTreeViewItem(activePath.GetHashCode(), 0, activePath, true) { icon = assetsTreeItem.icon }; if (conformObjectAssetRoot.children == null) { conformObjectAssetRoot.children = new List <TreeViewItem>(); } root.AddChild(conformObjectAssetRoot); List <ConformData> data = assetsTreeItem.conformData; for (int i = 0; i < data.Count; ++i) { if (data[i].ConformObjects.Count == 0) { continue; } int moduleHash = data[i].ImportTask.GetHashCode() + i; ConformObjectTreeViewItem conformObjectModuleRoot = new ConformObjectTreeViewItem(moduleHash, 1, data[i].ImportTask.GetType().Name, true); if (conformObjectModuleRoot.children == null) { conformObjectModuleRoot.children = new List <TreeViewItem>(); } conformObjectAssetRoot.AddChild(conformObjectModuleRoot); if (data[i].Conforms == false) { conformObjectModuleRoot.conforms = false; conformObjectAssetRoot.conforms = false; } foreach (var conformObject in data[i].ConformObjects) { conformObject.AddTreeViewItems(moduleHash, conformObjectModuleRoot, assetsTreeItem, 2); } } }
public void AddTreeViewItems(int parentId, ConformObjectTreeViewItem parent, AssetsTreeViewItem assetsTreeItem, int depth, int arrayIndex = -1) { string extra = arrayIndex >= 0 ? arrayIndex.ToString() : ""; int hashCodeForID = parentId + (Name + extra).GetHashCode() * 31; ConformObjectTreeViewItem conformObjectTree = new ConformObjectTreeViewItem(hashCodeForID, depth, this) { AssetsTreeViewItem = assetsTreeItem }; parent.AddChild(conformObjectTree); for (int i = 0; i < SubObjects.Count; ++i) { // TODO will this be slow? , need to see if there is a better way to cache object type if (SubObjects[i] is PropertyConformObject) { SubObjects[i].AddTreeViewItems(hashCodeForID, conformObjectTree, assetsTreeItem, depth + 1, AssetSerializedProperty.isArray ? i : -1); } } }