Skip to content
Shapemetry

@huukhanhnguyen/model / registry/Registry

registry/Registry

Registry

Constructors

Constructor

new Registry(input): Registry

Parameters

input

RegistryInput

Returns

Registry

builtinMaterials

readonly builtinMaterials: Material[] = []

Named material records a node set's own generators stamp by name but that live in no document's materials[] lane (e.g. the tree node's bark/leaf textures). Model.ts's collectMaterials merges these UNDER the doc lane — a doc record with the same name always wins.

builtinParameterMethods

readonly builtinParameterMethods: Map<string, string>

For each builtinParameters/catalogParameters key, the value METHOD required to legitimately claim it (e.g. lengthX -> "length", lengthY -> "length"). A key absent here is reserved outright — no node may ever take it.

builtinParameters

readonly builtinParameters: Set<string>

Reserved parameter keys auto-seeded per model (e.g. lengthX/lengthY/lengthZ).

catalogParameters

readonly catalogParameters: Set<string>

Reserved COMMERCE-metadata parameter keys (manufacturer/sku/price/ currency/productUrl) — same key↔method reservation as builtinParameters but NOT auto-seeded and NOT hidden from host-facing parameter lists (see contract.ts's RegistryInput doc for the full split).

namespaces

readonly namespaces: FunctionNamespaces = {}

Merged PascalCase expression namespaces (Point., Vector., …).

nodes

readonly nodes: OperationDefinition[] = []

All definitions in registration order (engine builtins first, then the caller's own nodes).

reservedNames

readonly reservedNames: Set<string>

Names a node key can never take: JS globals/keywords + namespace names.

types

readonly types: TypeDef[] = []

Merged type registry: core types first, then the caller's extra types.

Methods

argDefs()

argDefs(method): ArgDef[]

Parameters

method

string

Returns

ArgDef[]

argKeys()

argKeys(method): string[]

Parameters

method

string

Returns

string[]

argTypes()

argTypes(method): Record<string, string>

Parameters

method

string

Returns

Record<string, string>

dataMethod()

dataMethod(method): DataDefinition | undefined

ObjectData-lane definition (scene body producer/transform) or undefined.

Parameters

method

string | undefined

Returns

DataDefinition | undefined

defaultKeyOf()

defaultKeyOf(method): string | null

Friendly short base for auto-generated node keys.

Parameters

method

string | undefined

Returns

string | null

has()

has(method): boolean

Parameters

method

string

Returns

boolean

isReservedKey()

isReservedKey(key): boolean

True when key may not be used as a node key.

Parameters

key

string

Returns

boolean

methods()

methods(lane?): string[]

All method names, optionally filtered by lane.

Parameters

lane?

"value" | "data"

Returns

string[]

operation()

operation(method): OperationDefinition | undefined

The definition backing a method, any lane.

Parameters

method

string | undefined

Returns

OperationDefinition | undefined

typeOf()

typeOf(name): TypeDef | undefined

Parameters

name

string

Returns

TypeDef | undefined

value()

value(method): ValueDefinition | undefined

Value-lane definition (parameters header) or undefined.

Parameters

method

string | undefined

Returns

ValueDefinition | undefined


createRegistry()

createRegistry(input?): Registry

Merge the engine's own builtins + the given RegistryInput into a validated Registry. registry.nodes (OperationDefinition[]) is itself the serializable view docs/UI menus render from — nothing to strip, create/compute are just unused function properties for a consumer that only reads attributes/args.

Parameters

input?

RegistryInput = {}

Returns

Registry

Last updated: 📖 3 min readEdit on GitHub