Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

instances.unpack (procNode)

Take a population (the copies instances.to_points made) or a piece set (the points instances.pack and geometry.merge made) apart. op "geometry" answers loose geometry: a population merged into one shape with every point attribute stamped on each point of its copy (instances.realize), or one piece of a piece set, wearing its material. op "elements" answers points that each carry their own loose Mesh record, which stand as entities: one per copy, or one per piece. Empty takes "geometry" for a population and "elements" for a piece set. A value that is neither is refused.

Inputs

  • value (Points). A population or a piece set.
  • op (String, default "", one of "", "geometry", "elements"). What comes back: "geometry" (loose geometry) or "elements" (points carrying a loose Mesh). Empty is "geometry" for a population and "elements" for a piece set.
  • attribute (String, default "variant"). With a piece set and op "geometry": the attribute name is looked up in.
  • name (String, default ""). With a piece set and op "geometry": the piece whose attribute holds this value (compared as text). Empty takes the piece at index, or the only piece.
  • index (Float, default 0, at least 0). With a piece set and op "geometry": the piece's place in the set, counted from 0, when name is empty. A place past the set is refused.

Outputs

  • value (Geometry or Points). The loose geometry or the points carrying their own Mesh.
  • report (List). What a loose geometry cannot hold, as { attribute, note } rows: for a piece set, every piece point attribute besides Mesh, Material, id and P; for a population, ShaderData lanes and pieces that wear different materials.
local kit = g.geometry.merge({ a = g.mesh.box({}), b = g.mesh.sphere({}), pack = true, names = { "crate", "ball" } }).value
local ball = g.instances.unpack({ value = kit, op = "geometry", name = "ball" }).value