Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

procRecord: a kind of record a graph makes and saves

A .procRecord defines a kind of value a procedural graph moves that becomes an asset when it is saved: a material, a mesh, a texture, or a kind a world defines for its own asset type. Its init.luau returns proc.record({ ... }):

Glow.procRecord/
  init.luau     -- returns proc.record({ ... })
  README.md     -- what a record holds and the asset it saves as
  .metadata     -- description and tags

What a kind states

  • name: the kind's display name. A kind is identified by its guid, so two kinds may share a name.
  • asset: the asset type a record saves as ("material").
  • applies: { component, field }, the component a record stands in live and the field it feeds ({ component = "Material", field = "material" }).
  • fields: the record's own fields by name, each with a short description.
  • live(record, key): the runtime value the applied field takes, filed under key.
  • release(value, key): lets go of what a runtime value live answered holds. Left out, the kind holds nothing to let go of.
  • save(record, name, place): writes the record as its asset and answers the reference. Left out, the asset type's own graph.write writes it.
  • load(ref, options): the record an asset of the kind holds. Left out, the asset type's own graph.read reads it.

name and asset are required; a key outside these is refused, naming the keys a kind states.

How records travel

A record carries its kind's guid as kind. The node that writes a record holds it on an element, in the attribute named after the component the kind applies to (Material = { material = <record> }), and states the kind on the geometry's detail attribute records: { [<kind guid>] = <reference to the .procRecord> }. io.output stands the element with the runtime value the kind's live answers, io.export saves the record through the kind, and io.import reads an asset back as the same element: an asset type names the kind its assets load as in its graph conversion (graph.record).

A node references a kind by a literal reference, asset.resolve("<identity>", "procRecord"), and proc.records.stamp(ref) gives the records map that names it.

io.import of a .procRecord answers the kind itself, { kind, name, asset, applies }: the guid a record of it carries and what it saves as and applies to.