Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit61a33237e0

README.md

renderLayer.set

Put entities on render layers, by name.

renderLayer.set("frontWall", "shell")
renderLayer.set({ "marker_a", "marker_b" }, "debug")
renderLayer.set({ name = { "wall" } }, "shell")
renderLayer.set("building", "shell", { tree = true })

Targets take a name or id, a list of them, scene.find records, or a query resolved for you — so you can re-layer everything matching { name = { "wall" } } without looking the entities up first.

Layers are named: a single name, an array, or a space-separated string ("shell debug"). Setting replaces membership rather than adding to it.

tree = true applies to the entity and every descendant — the form you want when re-layering a hierarchy.

An option key outside the documented set is an error that names it and lists the accepted keys, so a mistyped treee is reported instead of returning a successful-looking read of a subtree that was never touched.

Referencing a layer name that does not exist yet creates it, so "shel" instead of "shell" produces a real but empty layer that renders nothing and reports no error. renderLayer.list is how you see that.

Returns { id, name, layers, moved, skipped } per target: the layers that entity now carries, how many entities the call wrote through it, and how many of its descendants it left where they were.

renderLayer.set("Mansion", "ui")
-- { id = "ent_7be0…", name = "Mansion", layers = { "ui" }, moved = 1, skipped = 46 }

renderLayer.set("Mansion", "ui", { tree = true })
-- { id = "ent_7be0…", name = "Mansion", layers = { "ui" }, moved = 47, skipped = 0 }

So the size of the write is in the reply: a skipped above zero is the part of the hierarchy still drawing where it was, and a subtree write says how many entities it moved without a follow-up read. An entity two targets both span is written and counted once, so the moved counts add up to the entities the call moved.