Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

prefab

Entity prefabs and bundles: the records a spawned hierarchy is made of, and the asset they persist as.

The definitions live in proc.ops.prefabs; this pack is what puts them in the op registry, so procgen.searchNodes("", { pack = "prefab" }) lists the family and procgen.describeNode("op.<id>") describes any one of them. Each op whose id carries prefab also answers to the same id with template in place of prefab (template.empty, bundle.from_template).

Ops

  • prefab.empty — An empty entity prefab (a single root entity)
  • prefab.add_component — Add a component (type + data) to a prefab's root entity
  • prefab.from_geometry — A prefab: a root entity with a Model component referencing a Geometry
  • prefab.from_geometries — A prefab: one root with a materialed Model child per geometry part (grouped multi-material object)
  • prefab.from_instances — A prefab: a root with one child entity per instance (each a Model at the instance transform)
  • prefab.from_population — A prefab: a root plus ONE child carrying a Population as an Asset reference (constant record count at any instance count)
  • prefab.from_asset — A prefab: a root plus ONE child carrying a durable asset reference as an Asset component — the asset's own type decides what the child becomes when it instantiates
  • bundle.from_population — A Bundle carrying a Population as one asset reference (constant record count at any instance count)
  • bundle.from_asset — A Bundle carrying a durable asset reference as one Asset child — the asset's own type decides what it becomes on instantiation
  • bundle.from_prefab — Wrap a Prefab as a persistable Bundle
  • bundle.from_instances — A Bundle with one entity per instance of a population (points carrying a Mesh)
  • bundle.join — Concatenate two Bundles into one flat group under a shared root
  • bundle.write — Persist a Bundle as a .bundle asset (realizing Geometry-valued Model components to .mesh first)
  • bundle.spawn — Instantiate a Prefab/Bundle's records as durable live scene entities (play-surviving direct spawn)
  • prefab.entity — Add a child entity to a prefab (parented to the root or a named entity)
  • prefab.parent — Set a prefab entity's parent (child + parent identified by name)
  • prefab.link — Reference one prefab entity from another via a component field (by stable id)
  • scene_fragment.write — Persist a Prefab/Bundle's entities as a loadable .scene fragment
  • part.merge — Pack several parts into ONE part, each piece keeping what it is: a terrain stays a terrain, instanced rocks stay instances, a mesh stays its own mesh, particles stay on the device, points carrying components stay thos...
  • part.unpack — One piece of a part part.merge made, by its name, as the value it was merged as — the terrain, the instances, the particles — to work on alone or to realize on its own