Types - Block
API reference for ./evaluate/block on @huukhanhnguyen/types.
See the Guide for the package's role.
API reference
Signatures are generated from the live package .d.ts - not hand-written.
BlockBehaviors
type
System attributes of a block — things that automatically happen once the block is in the scene, run as a named phase AFTER evaluation has settled (model's applyBlockBehaviors).
Each behavior carries its OWN data and PRESENCE MEANS ENABLED: there is no boolean flag beside a payload. Blender's actual shape — Object.rigid_body / soft_body / collision are nullable pointers to their own settings structs, and having one IS the switch.
Block tier, so it follows the PLACEMENT: copy a door onto a second wall and the second wall gets a hole too (SketchUp's per-instance semantics).
type BlockBehaviors
// = {
/** Cut volume, in the definition's OWN local space (each placement
* transforms it by its own `transformation`). Watertight solids —
* validation already requires it (schema/references.ts's VOID branch:
* "Result must be watertight Face[] solids — eval-time check, named
* error"). */
opening?: ShellEntity[];
}BlockDefinition
type
type BlockDefinition
// = {
id: string;
/** Shared child entities (the definition's content), stored ONCE. */
entities: Entity[];
/** What this block DOES once placed — see {@link BlockBehaviors}. A
* definition with no behaviors simply has none of this field. */
behaviors?: BlockBehaviors;
/** Set ONLY for a definition created by `placeComponent` (EntitiesNode's
* `sharedComponentDefinition`) — the components[] key + placement args
* signature this definition renders — the join key back to the
* components[] entry a render-frame group came from. A
* `makeBlock`/`array`/`looseToBlock` definition (no component behind it)
* simply has no tag. */
sourceComponent?: {
key: string;
args?: Record<string, string>;
};
}BlockEntity
type
Block placement: one placement OF a shared BlockDefinition (the definition itself lives in the model's runtime definitions map and is NOT a scene entity). This is the one envelope with NO geometry slot — it carries the definition's id plus a placement transform. Sniff: a definition string field instead of geometry.
type BlockEntity
// = EntityBase & { /** Id of the BlockDefinition this placement uses (in the model definitions map). */ definition: string; /** Column-major 4x4 placement transform (translation at indices 12,13,14). */ transformation: Transformation; }DefinitionMap
type
The model's definition registry (id -> shared geometry).
type DefinitionMap
// = Map<string, BlockDefinition>Inherited
type
The placement props a BlockEntity hands down to the entities it places, when those do not carry their own.
type Inherited
// = {
material?: string;
layer?: string;
name?: string;
/** View-family membership (EntityBase.view) inherited from a BlockEntity placement. */
view?: ViewFamily;
}