Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

scene.query (procNode)

Entity ids out of the live scene: by name, by a component they carry, as the children, descendants or parent of other entities, or the camera the scene is seen through. Queries compose: of and within take another query's ids. Wire the ids into scene.fetch to bring the entities into the graph as points.

Inputs

  • by (String, default "name"): how entities are found: "name" by name; "component" by the component component names; "children", "descendants" or "parent" of the entities in of; "camera" the camera the scene is seen through (no ids when there is none).
  • name (String, default ""): the Name to find, or a glob over Names (* any run, ? any one character). Read when by is "name"; empty there is refused.
  • component (String, default ""): the component the entities carry, native ("Light") or script. Read when by is "component"; empty there is refused.
  • of (List<Entity>, optional): the entities whose children, descendants or parent are found: ids, Names, or another query's ids. A single reference is a list of one. Read, and required non-empty, when by is "children", "descendants" or "parent".
  • within (List<Entity>, optional): keep only these entities of what is found, so one query narrows another.
  • order (String, default "scene"): "scene" keeps the order the scene holds them in; "name" sorts them by Name, ties by id.

A reference in of or within that names no entity in the scene is refused, naming it. An entity found twice (the same child of two parents) is listed once.

Outputs

A call answers a record by output name.

  • ids (Entity[]): the entity ids found.
  • count (Int): how many.

Example

local lamps = g.scene.query({ by = "component", component = "Light", order = "name" })
local points = g.scene.fetch({ ids = lamps.ids, components = { "Light" } })