HammeriteNotableSizes
Editor. Inherits RefCounted
The measurements a game finds worth naming, so a dimension being dragged can say what it is.
An author sizing a doorway is really asking "will someone fit through this", and the answer is a number they have to remember. A measurement that says 108 (door height) answers it while the drag is still happening. Hammerite registers nothing itself: what is notable is a fact about a game - how tall its people are, how high it hangs its doors - and a level editor that guessed would be wrong for every game but one. A game registers its own from the constants it already has, each on the axes it is a size along:
HammeriteNotableSizes.register(72.0, "player height", HammeriteNotableSizes.VERTICAL)
HammeriteNotableSizes.register(48.0, "door width", HammeriteNotableSizes.HORIZONTAL)Editor-only, unlike the brush property and fill registries: this exists to be read while dragging, and a shipped game with no editor in it never asks.
Methods
| Returns | Method |
|---|---|
void | register(units: float, label: String, axes: int = 7) static |
void | unregister(units: float, axes: int = 7) static |
String | name_for(units: float, axis: int = -1) static |
float[] | get_sizes() static |
Constants
X
const X = 1
Axes a size is named along, combined with |. A door's height is a size up the wall and its width one across the floor, and a 48 dragged upwards is not a door's width.
Y
const Y = 2
Along Y, which is up. See X.
Z
const Z = 4
Along Z. See X.
VERTICAL
const VERTICAL = 2
Up and down: a height.
HORIZONTAL
const HORIZONTAL = 5
Across the floor, either way: a width or a length.
ANY_AXIS
const ANY_AXIS = 7
Along every axis: what register() names when it is given none.
Method descriptions
register()
static func register(units: float, label: String, axes: int = 7) -> void
Name units label along axes. Registering a size again on an axis replaces its name there, so a game re-initializing does not have to care whether it has run before - and so two things the same size along the same axis are one name, which the game should say in the name ("wall / hallway height") rather than leaving the viewport to pick one. The same size can be one thing upright and another lying down.
unregister()
static func unregister(units: float, axes: int = 7) -> void
Forget the name for units along axes, if it has one there.
name_for()
static func name_for(units: float, axis: int = -1) -> String
What units measured along axis (a Vector3.Axis) is called, or "" when it is not a size anything named there. A measurement along no one axis, axis -1, is only named by a size that is the same thing along all three. Sign is ignored: 72 units up is a player's height whichever way it was dragged.
get_sizes()
static func get_sizes() -> float[]
Every named size, smallest first, for anything that wants to show the table; name_for() says what each is along each axis.