Scripting API
Scripting API
PrefabExpansion
Class in Abyss.Core.Scenes, from Abyss.Core.
Replacing every prefab instance in a document with the entities it stands for.
public static class PrefabExpansionRemarks
A document-to-document transformation, and that is the whole design. Nothing here touches a world, spawns anything, or knows what a component id is — it takes a scene with instances in it and produces the same scene with none, which is a thing SceneFile.Apply already knew how to build. So prefabs cost the loader one line and cost the engine nothing at all.
Nesting falls out rather than being built. A prefab is a scene, so a prefab containing an instance is a document containing an instance, and expanding it is the same call one level down. What has to be built is only what stops it: a prefab that contains itself, directly or round a ring of three, and a chain deep enough to be a mistake rather than a design.
Methods
Expand
public static SceneExpansion Expand(SceneDocument document, IPrefabSource prefabs)Expands every instance in a document, recursively.
Parameters
document: The scene to expand.prefabs: Where the documents instances refer to come from.
Returns The flattened scene, which of its entities are instance roots, and any notes.
HasInstances
public static bool HasInstances(SceneDocument document)Whether a document refers to any prefab at all.
Parameters
document: The scene to look at.
Constants
MaximumDepth
public const int MaximumDepth = 16How deep instances may nest before it is treated as a mistake rather than a design.
A ring is caught exactly, by the stack of what is already being expanded, so this is not the cycle guard — it is the guard against a chain that is merely absurd. Sixteen because a real one is two or three and nobody has ever wanted ten.
MeshName
public const string MeshName = "Mesh3d"What a file says it took off, when the mesh is: the component a mesh is drawn by; see SceneOverride.Removed.
MaterialName
public const string MaterialName = "MeshMaterial3d"What a file says it took off, when the material is: what the name of the component a material is drawn by starts with.
