Vixen
dd8b0a81
csharp
public sealed class ProjectMeshSource

The geometry a scene's mesh references name, read out of the project's own import cache.

Read the guide page for this →

Remarks

AssetMeshSource's editor twin, and the reason IMeshSource is an interface. A game resolves a reference through a catalog and a bundle; the editor has neither and does not want them — it has the chunks the last import wrote, in a store on disk beside the project. Same question, two places to look, and everything above the interface is identical.

⚠ Why the editor cannot simply use the game's, and it is not the reason this paragraph used to give. It said a ContentCatalog is built by a content build and that waiting for one would make the viewport a function of the build rather than of the files. That is not true of the catalog the editor would actually use: LooseContent.Write needs no build — no packing, no copying — and it reads this very import cache. It is sub-asset granular too, because BuildPlanner emits one entry per sub-asset.

⚠ The real reason is that a catalog is what ships and a viewport has to draw what is in the project. BuildPlanner.AddressOf gives an excluded asset no address — AddressableInfo.Excluded being the designed way to keep "a reference FBX kept beside the one that ships" out of a build — so the catalog has no entry for it and AssetMeshSource throws ReferenceNotFoundException, while the lookup below finds it by id and reads it. The same goes for a sub-asset the .meta does not name and for two sub-assets whose names collide, both of which refuse the whole asset. Every one of those is silent — the catalog is written successfully and the asset is simply not in it — so a viewport moved onto that path would stop drawing part of a project with nothing anywhere saying which part.

⚠ Synchronous, unlike every other source. The chunk is on local disk and already decompressed by the object database, so there is no load to be in flight — and an editor frame that skipped a mesh would have to re-ask, which for a viewport redrawn on demand means a mesh that appears when something else happens to cause a repaint. The protocol still allows it to answer false, which is what a missing or unreadable chunk is.

Fields and properties (3)

  • public int Requested

    How many distinct meshes have been asked for.

  • public int Loaded

    How many of them were read.

  • public int Revision

    How many times this source has been invalidated.

Methods (4)

  • public ProjectMeshSource(ProjectWorkspace workspace)

    Builds a source over a project.

  • public void Invalidate()

    Forgets what has been read, so a re-import is picked up.

  • public bool TryGet(AssetReference reference, out MeshData mesh)

    The mesh a reference names, if it is here yet.

  • public static IReadOnlyList<SubAssetEntry> Declared(string assetFile)

    What a model asset's last import declared its meshes to be, in declaration order.

Used by (6)

  • ContentTasksVixen.Editor.App
  • EditorApplicationVixen.Editor.App
  • LayerStackBindingTestsVixen.Editor.Texturing.Tests
  • LayerStackImportedMeshTestsVixen.Editor.Texturing.Tests
  • LayerStackMeshVixen.Editor.Texturing
  • TexturingModuleVixen.Editor.Texturing