natiny.render.tag

Lua
natiny.render.tag(tag_or_tags [, sort])

Draws every visible model whose own material has the requested tag or all requested tags. Per-part materials and a material bound with natiny.material.bind do not affect selection.

Parameters

Name Type Default Description
tag_or_tags string or table One tag name or a list of distinct tag names
sort integer natiny.render.SORT_MATERIAL Draw order; one of the constants below

Constants

Constant Description
natiny.render.SORT_MATERIAL Group by model material, then mesh
natiny.render.SORT_NONE Keep model storage order without sorting
natiny.render.SORT_BACK_TO_FRONT Sort model bounds centers from farthest to nearest
natiny.render.SORT_FRONT_TO_BACK Sort model bounds centers from nearest to farthest

Example

Lua
natiny.render.tag({ "world", "transparent" }, natiny.render.SORT_BACK_TO_FRONT)

Notes

  • A model must be visible and have a valid, non-empty mesh. Hidden models are skipped; see natiny.model.set_visible.
  • A model using the built-in material matches only the "model" tag. A custom material matches tags added at creation or with natiny.material.add_tag.
  • A bound material controls how selected models are drawn, but selection still reads each model's own material.
  • Distance sorts use the world-space center of each mesh's bounds. Without a bound camera every distance is equal, so the original selection order is preserved.
  • A table must contain 1–8 tag names. Lua raises an error for an empty list, more than eight entries, or an entry that cannot be converted to a string.
  • An unknown tag selects nothing and does not raise an error.