protected override TreeViewItem BuildRoot() { var root = new TreeViewItem(0, -1, "Root"); foreach (var asset in AssetEnumerator.GetAllReferencedAssets(m_Project) .Where(x => x.Parent == null && MatchFilter(x)) .OrderBy(x => x.Name)) { root.AddChild(new AssetItem(asset)); } if (!root.hasChildren) { if (!string.IsNullOrEmpty(m_Filter)) { root.AddChild(new TreeViewItem { displayName = "no match for : " + m_Filter }); } else { root.AddChild(new TreeViewItem { displayName = "no assets to display" }); } } return(root); }
public IReadOnlyDictionary <AssetInfo, Entity> EnumerateAssets(Project project) { var assetInfos = AssetEnumerator.GetAllReferencedAssets(project); var assetEntities = new Dictionary <AssetInfo, Entity>(); foreach (var assetInfo in assetInfos) { assetEntities.Add(assetInfo, GetEntity(assetInfo.Object)); } return(assetEntities); }
public bool Run(BuildPipeline.BuildContext context) { using (var tmpWorld = new World(ConfigurationScene.Guid.ToString("N"))) { var configEntity = CopyEntity(context.WorldManager.GetConfigEntity(), context.World, tmpWorld); // Insert asset scene before all other startup scenes, if there's any asset if (AssetEnumerator.GetAllReferencedAssets(context.Project).Count > 0) { Assert.IsTrue(tmpWorld.EntityManager.HasComponent <StartupScenes>(configEntity)); var startupScenes = tmpWorld.EntityManager.GetBuffer <StartupScenes>(configEntity).Reinterpret <Guid>(); if (startupScenes.Length == 0) { Debug.LogWarning($"Project {context.Project.Name} contains no startup scenes."); } startupScenes.Insert(0, AssetsScene.Guid); } // Make sure components not owned by the users are removed if their assemblies are missing var configArchetype = context.Session.GetManager <IArchetypeManager>().Config; var componentsToRemove = GetAllComponentTypes(configArchetype).Where(t => !DomainCache.IsIncludedInProject(context.Project, t.GetManagedType())); tmpWorld.EntityManager.RemoveComponent(tmpWorld.EntityManager.UniversalQuery, new ComponentTypes(componentsToRemove.ToArray())); // Export configuration scene var outputFile = context.DataDirectory.GetFile(tmpWorld.Name); if (!ExportWorld(outputFile, context.Project, ConfigurationScene.Path, tmpWorld)) { return(false); } // Update manifest context.Manifest.Add(ConfigurationScene.Guid, ConfigurationScene.Path, outputFile.AsEnumerable()); // Dump debug file var debugFile = context.DataDirectory.GetFile(".debug.txt"); var debugLines = context.Manifest.Assets.OrderBy(x => x.Value).Select(x => $"{x.Key.ToString("N")} = {x.Value.DoubleQuoted()}"); debugFile.WriteAllLines(debugLines.ToArray()); } return(true); }