Vixen
feb85697
csharp
public interface IContentLibrary

Doc 50 § D2's Content Library service: what a person can do to the project's assets.

Read the guide page for this →

Remarks

A use case is a method here, and a menu line is only a name for one. Import, package export and the browser's collections and saved filters used to be private methods of EditorApplication closed over its fields — so the Assets menu, the browser's OS drop and the harness each reached them through the application, and a plugin could not reach them at all. The editor publishes this through PluginServices, so a module asks for it with Require<IContentLibrary>() exactly as it asks for IMeshBaker.

⚠ One API for collections and saved filters, and still two files — on purpose. A collection is a set of AssetIds, which mean nothing in another project, so it is a settings asset under ProjectSettings/; a saved filter is a query, which is meaningful in every project, so it is a user preference. Doc 50 § F1 called that "same feature, two stores"; the storage split is the documented decision of both types, and what was actually doubled was the API — the application re-declared AssetCollections's three verbs to add the save, and kept the filters' two in another file. This is where both now are.

Fields and properties (5)

  • EditorProject Project

    The project whose assets these are.

  • ShownContent Shown

    What the content browser is showing, which outlives the panel that shows it.

  • bool IsImporting

    Whether an import or a build is running, so another should wait.

  • IReadOnlyList<SavedAssetSet> Collections

    The project's collections, in the order they were made.

  • IReadOnlyList<SavedAssetFilter> Filters

    The user's saved filters, in the order they were saved.

Events (3)

  • Action? CollectionsChanged

    Raised after the collections changed and were written.

  • Action? Arrived

    Raised after an import or a Create put something in and the database has been rescanned.

  • Action? Rearranged

    Raised after a Rename, CreateFolder, Move or Delete — refused or not — once the database agrees with the disk.

Methods (16)

  • int Import(IReadOnlyList<string> paths, string folder)

    Copies files and folders from the user's disk into the project, then scans and imports.

  • AssetId? Create(NewAssetKind kind)

    Makes a new asset of a kind in the selected folder, scans it in and says so.

  • AssetOperation Rename(AssetId asset, string name)

    Gives an asset a new name in the folder it is in, its sidecar with it, and says why not if it could not.

  • AssetId? CreateFolder(string parent, string name)

    Makes an empty folder inside another one, and says why not if it could not.

  • int Move(IReadOnlyList<AssetId> assets, string folder)

    Moves assets into a folder of the project, each with its sidecar.

  • int Delete(IReadOnlyList<AssetId> assets)

    Deletes assets and the sidecars that carry their identities, without asking.

  • void ReimportAll()

    Imports every asset in the project again, on the content tasks' worker.

  • IReadOnlyList<AssetId> Referrers(IEnumerable<AssetId> assets)

    Everything that points at some assets, one step back along the reference graph.

  • IReadOnlyList<AssetId> Dependencies(IEnumerable<AssetId> assets)

    Everything some assets point at, one step forward along the reference graph.

  • IReadOnlyList<AssetId> Closure(IEnumerable<AssetId> roots)

    Everything some assets reach through the reference graph, themselves included.

  • int ExportPackage(string path, IReadOnlyList<AssetId> assets)

    Writes assets into a package archive, each under its project-relative path with its sidecar.

  • void AddToCollection(string name, IReadOnlyList<AssetId> assets)

    Puts assets into a collection, making it if it is not there yet, and writes the file.

  • void RemoveFromCollection(string name, IReadOnlyList<AssetId> assets)

    Takes assets out of a collection, leaving the collection.

  • void ForgetCollection(string name)

    Forgets a whole collection, which touches no file it named.

  • void SaveFilter(string name, string query, string kind)

    Keeps one named filter, replacing a saved one of the same name.

  • void ForgetFilter(string name)

    Forgets a saved filter.

Used by (14)

  • BrowserShownTestsVixen.Editor.App.Tests
  • ContentBrowsingVixen.Editor.App
  • ContentLibraryVixen.Editor.App
  • ContentLibraryTestsVixen.Editor.App.Tests
  • EditorApplicationVixen.Editor.App
  • EditorSessionVixen.Editor.Testing
  • EditorWriteEchoTestsVixen.Editor.App.Tests
  • ExpiredRefusalTestsVixen.Editor.App.Tests
  • FixtureVixen.Editor.App.Tests
  • LibraryModuleVixen.Editor.App
  • LibraryModuleTestsVixen.Editor.App.Tests
  • LibraryQuestionsVixen.Editor.App
  • ProjectBrowserVixen.Editor.App
  • ServiceReachTestsVixen.Editor.App.Tests