Builtin Library
README.md
previewRecipe (module)
How a type makes its instances' pictures. A type declares it in its
type.yaml, under preview:, and every instance's preview.png is produced
by the recipe named there.
preview:
kind: surface # instantiate | image | surface | custom
mesh: sphere # surface: the builtin mesh the asset is painted on
kind | The picture is | Needs |
|---|---|---|
instantiate | the asset stood in the studio through its own instantiate | — |
image | a file the instance already holds, fitted to the frame | source.file or source.files |
surface | the asset painted on a builtin mesh | mesh |
custom | whatever the type's behavior.luau ref.preview returns | — |
angle: [yaw, pitch] (degrees) states the bearing the camera looks from, for
any kind that renders.
The preview: block says how the picture is PRODUCED. Whether search embeds
that picture is a separate declaration — an image chunk under
indexing.content naming preview.png — so a type states both, and a type
that states one without the other gets exactly what it stated.
Exports
M.of(typeName) -> PreviewRecipe?— the recipetypeNamedeclares, or nil when it declares none or no type answers to that name. Read once and held; a block naming an unknownkind, or missing what its kind needs, is refused with a warning naming the type.M.forget()— drop every held recipe. The change dispatcher calls it, withdeclaration.forget(), for every write inside an.assetTypefolder and for every removed type, so an editedtype.yamlis read again.