Scripting API

Scripting API

SceneAsset

Class in Abyss.Core.Scenes, from Abyss.Core.

Something the scene's entities refer to, under a key that is local to the file.

public sealed class SceneAsset

Remarks

The three kinds are here because the three are genuinely different, and the difference is how much of the asset a file can hold:

  • An image is a path. The file says where it is and the engine reads it, so the scene carries a reference and none of the bytes.
  • A material is either. One somebody described is numbers and texture references, so the scene carries all of it; one read out of a model has a path and travels like an image, which keeps it tied to the file it came from rather than to a copy of what that file said last time.
  • A mesh is either, for the same reason. Geometry loaded from a file has a path; geometry a program generated is in no file and cannot be written down usefully, so the scene carries only the name and whoever loads it supplies the shape. A name nobody supplies is reported rather than guessed at.

Properties

Name

public required string Name { get; init; }

The key entities refer to this by, unique within the document.

Kind

public required SceneAssetKind Kind { get; init; }

Which of the three kinds this is.

Path

public string? Path { get; init; }

Where the file is, relative to the asset root, or null for something that came from no file.

Always set for an image, which is nothing but a path. Set for a mesh or a material that was loaded and absent for one a program built or described, which is the difference between a scene anybody can open and one only its own game can.

Guid

public AssetGuid Guid { get; init; }

What the file is called, as opposed to where it is.

The identity is what makes a scene survive somebody tidying their folders. A SceneAsset.Path says where a file was when the scene was written, and moving or renaming it silently empties every scene that named it — the entities load, the meshes do not, and nothing reports it. This is the same file's own name, minted once and written in a sidecar beside it, so the path becomes a hint rather than the whole of the reference.

Both are written, and the identity wins. The path stays because it is readable, and because it is the only thing that answers for a project with no database behind it, a file whose sidecar has been lost, or a scene written by a build from before any of this existed. None of those is an error; they are what every scene looked like until now.

The label a container path carries — #Mesh0/Primitive0 — belongs to the SceneAsset.Path rather than here, because the identity names the file and the label names which piece of it. Only the file can be moved.

Material

public SceneMaterial? Material { get; init; }

What the surface looks like, for a SceneAssetKind.Material somebody described. null for one that came from a file, which carries a SceneAsset.Path instead.