Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit65083fe8f2

README.md

prefab (nodebox)

Prefabs: the entity records a spawned hierarchy is made of, as record and list values. prefab.empty makes a root, prefab.entity, prefab.parent, prefab.add_component, prefab.link and prefab.place shape the hierarchy (each calls prefab.edit, which holds the record-list edits and the name lookup that prefab.find answers), and prefab.from_geometry, prefab.from_geometries, prefab.from_instances, prefab.from_population and prefab.from_asset make prefabs from what a graph built. The output node shows a prefab and the export node saves it as a bundle.

prefab.record is one entity record, which prefab.empty, prefab.from_geometry, prefab.from_geometries, prefab.from_population and prefab.from_asset build their records from; prefab.find answers the id of an entity by name.

A prefab value is { records = { ... } }: the root record first (id "0"), then every entity added, each { name, original_id, parent_id, components, ecs, position, rotation, scale } with its components as { type, data } and its native components (ecs, present when it carries any) as { type, data }, type the name under ecs and data the row a saved record states; a mesh, material or texture field of a row holds a graph value (a Geometry, a Material record) or an asset reference until a spawn or an export makes it the asset the component holds. prefab.from_geometry and prefab.from_geometries draw with Mesh and Material rows. prefab.place puts a whole prefab under an entity of another at a local pose, renumbering its records. Every node that changes a prefab answers a new value and leaves the prefab wired in as it was. A name that says which entity to point at, hang under or look up resolves to the first record carrying it.