SceneSetup.component
- README.md1.9 KB
- init.luau34.1 KB
- inspector.luau10.4 KB
This package holds more than this page lists. See all of its files in its world.
README.md
SceneSetup
The per-instance state of a placed scene setup. A setup's instantiate adds it
to the placed root beside the Asset component whose source is the setup. It
holds this placement's overrides, by parameter path, and applies the setup with
them; the setup's members are applications of their assets, so the scene records
the root, its Asset and these overrides alone.
local setup = entity(root).component.get("SceneSetup")
setup:members() -- { [path]: { source, state } }, every depth
setup:get("fog/density") -- { value, origin, definedBy?, desc }
setup:set("fog/density", 0.05) -- this placement's override
setup:set("ao/@enabled", false) -- turns a member off here
setup:reset("fog/density") -- back to what the setup says
setup:orphans() -- overrides that address nothing
It applies the setup when it wakes and when it is enabled, applies a change of
overrides, turns the setup off when it is disabled and drops it when it is
removed; removing the Asset removes it. While it is disabled, a change of its
overrides applies the setup off. Across an edit/play flip the setup
stays applied: the instance that ends hands its application to the one that
wakes on the same root, so no frame is drawn without its sky, sun or fog. It
runs nothing per frame. A system
API's write of a parameter this placement states (fog.set) becomes this
placement's override.
Its application is one of the scene's applications: the effects that hold one
at a time (the sun, the ambient term, the sky, each render feature's settings)
go to the newest application standing. Another setup applied from code
(setupRef:as("applicable"):apply(owner)) holds them over this placement
until it is dropped, across flips, and its drop hands them back to this
placement. audition(setup) shows another setup in this placement's place as a
preview for the session; endAudition(), a flip or a reload ends it.