@huukhanhnguyen/model / nodes/ParameterNode
nodes/ParameterNode
ParameterNode
Runtime node for a VALUE operation in the model's parameters header (registry return: "value") — a scalar value (method = "length"/ "number"/"text"/"url"/etc., with numeric constraints on .constraint — see that field's own doc comment). Materials are LANE nodes (materials[], { key, method, args } evaluated per lane), not this class; header GROUPING is the Group form (ContainerNode, lane "parameters").
Extends
Constructors
Constructor
new ParameterNode(
key,method,expr?,label?):ParameterNode
Parameters
key
string
method
string
expr?
string
label?
string
Returns
Overrides
_dependents
_dependents:
Set<BaseNode>
Inherited from
_epoch
_epoch:
number=0
Bumped on every dirty (see setDirty/markDirty) — a stale async settle compares its captured epoch against the current one and discards itself on mismatch (a newer edit superseded it while it was in flight).
Inherited from
_hooks?
optional_hooks?:NodeHooks
Lifecycle observers attached to THIS node — see nodes/hooks.ts. Also carried by an DataDefinition, the declaration surface a node's hooks can be attached to before the node exists.
Inherited from
_reads
_reads:
Set<BaseNode>
Reverse index of nodes this node currently reads (static expression refs + dynamic dependOn edges). Cleared at the start of every dirty recompute and on dispose so a dropped Table.get/sampleTexture edge stops cascading markDirty (and a disposed node is not retained).
Inherited from
_valueType
_valueType:
string
animation
animation:
AnimationBinding|null=null
Track.key reference (numeric parameters only) — the track that drives this parameter's value over time, and the terms it plays on. The key is plain, not an expression (same "just the id" convention as skin.skeleton). loop rides here rather than on the track because two parameters may share one curve and disagree about it — see AnimationBinding.
args
args:
ArgumentNode[] =[]
Static extra args beyond the primary input. Wired from the registry definition like operation args.
attributes
attributes:
Record<string,unknown> ={}
Inherited from
collection
collection:
BaseCollection
Inherited from
constraint
constraint:
ArgumentNode
The primary arg's constraints (min/max/step for numeric parameters, options for enum-style ones) — ArgumentNode is the ONE class that owns this shape (see ArgumentNode.ts); this instance's own .expression is unused, only .min/.max/.step/.options/.newOptionDraft() matter.
editorExpanded
editorExpanded:
boolean=true
error?
optionalerror?:string=""
Last error message; empty string when valid, undefined after a successful eval.
Inherited from
expanded
expanded:
boolean=false
flat
flat:
boolean=false
Declared-flat marker (Operation.flat) — inert on a value node (no chain steps to run 2D); preserved verbatim for the ModelJSON round-trip.
id
id:
string
Inherited from
input
input:
ExpressionNode
Expression node holding the parameter's default value.
isDirty
isDirty:
boolean=true
True when the node needs re-evaluation before its value can be trusted.
Inherited from
key
key:
string
Identifier used to reference this parameter in expressions (e.g. width).
label
label:
ExpressionNode
Expression node whose value becomes the parameter's display label.
method
method:
string
Persisted registry method (e.g. "arrayLength") — distinct from _valueType when the method has a PARAM_METHOD_VALUE_TYPE alias; equal to it otherwise.
parent?
optionalparent?:any
Inherited from
pending
pending:
boolean=false
True while an async compute() is in flight (its result hasn't settled yet).
Inherited from
sourceId
sourceId:
string=""
Inherited from
value
value:
unknown=undefined
Cached evaluated value; undefined when the node is in an error state.
Inherited from
Accessors
dependents
Get Signature
get dependents():
Set<any>
Returns
Set<any>
Overrides
errorLogPrefix
Get Signature
get
protectederrorLogPrefix():string
console.error prefix on a compute failure — override to match a subclass's existing log message (includes node-specific context).
Returns
string
Inherited from
globalKey
Get Signature
get globalKey():
string
Returns
string
model
Get Signature
get model():
any
Returns
any
Inherited from
owner
Get Signature
get owner():
any
Walk up to the nearest owner that has a nodes collection (ModelScope).
Returns
any
Inherited from
symbol
Get Signature
get symbol():
string
Returns
string
Inherited from
valueType
Get Signature
get valueType():
string
Returns
string
Overrides
Methods
_commit()
protected_commit(raw,isAsync,settle?):void
Protected (not private): ExpressionNode/ContainerNode's evaluate() overrides call this directly to reuse the exact same commit path for a volatile step that bypasses the isDirty gate.
Parameters
raw
unknown
isAsync
boolean
settle?
Returns
void
Inherited from
_dispose()
_dispose():
void
Returns
void
Inherited from
_fail()
protected_fail(err,isAsync,settle?):void
Protected (not private) — see _commit's doc.
Parameters
err
unknown
isAsync
boolean
settle?
Returns
void
Inherited from
addListener()
addListener(
event,listener): () =>void
Parameters
event
string
listener
Returns
() => void
Inherited from
compute()
compute():
unknown
Compute the raw value for this node; override in subclasses to produce actual output.
Returns
unknown
Overrides
copy()
copy():
ParameterNode|null
Duplicate this node in its collection, inserting it right after the original.
Returns
ParameterNode | null
Overrides
display()
display(
listener?):string
Return the human-readable display string for this node's value (or its error message).
Parameters
listener?
() => void
Returns
string
Inherited from
errorValue()
protectederrorValue():unknown
Value to fall back to when compute()/postCompute() throws. Override for a node whose "empty" isn't undefined (ContainerNode: []).
Returns
unknown
Inherited from
evaluate()
evaluate(
listener?):unknown
Evaluate this node, cache the result, and notify dependents; returns the cached value. When compute() returns a thenable, this returns the prior (stale) value synchronously and settles later — see core/maybeAsync.ts.
Parameters
listener?
() => void
Returns
unknown
Inherited from
finishInit()
finishInit():
void
Assembly is complete: this node has its full structure and its children. Every assembly path calls it at the point wiring is genuinely done, which is NOT one line:
- the classes that take everything as constructor parameters (the LaneNode family, ExpressionNode, OptionNode, ArgumentNode) call it at the end of their own constructor;
DataNodecalls it after its args are pushed —fromRegistryandcopy, never its constructor, which sets only method+definition;ContainerNodeafter its children are attached,ParameterNodeafter its args are wired (NodeCollection: createFromJSON, addContainer, addEntry).
Guarded to fire at most once. That is what makes NESTED assembly safe — createFromJSON delegates to fromRegistry, and one node must see one init, not two — and makes a redundant call harmless rather than wrong.
Returns
void
Inherited from
getError()
getError(
listener?):string|undefined
Parameters
listener?
() => void
Returns
string | undefined
Inherited from
getInput()
getInput(
listener?):string
Get the raw input expression string, with optional change listener.
Parameters
listener?
(...args) => void
Returns
string
isPending()
isPending(
listener?):boolean
True while an async compute() is still settling (see pending).
Parameters
listener?
() => void
Returns
boolean
Inherited from
isValid()
isValid(
listener?):boolean
Parameters
listener?
() => void
Returns
boolean
Inherited from
notify()
notify(
event, ...args):void
Parameters
event
string
args
...unknown[]
Returns
void
Inherited from
postCompute()
protectedpostCompute(raw):unknown
Post-process compute()'s raw result into this.value; throw to signal a failure (caught by evaluate()'s template, same as a compute() throw). Override for a node whose value isn't a sanitizer-typed scalar: ContainerNode returns the data list as-is; ArgumentNode routes through the domain coercion pipeline (nodeMethods/parameter.ts + data/ asset resolution) instead of convert/validate.
Parameters
raw
unknown
Returns
unknown
Overrides
remove()
remove():
void
The removal door. BaseObject.remove() detaches from the collection and notifies "remove"; the pair brackets that, so beforeRemove still sees the node in its collection with its read edges intact.
afterRemove means "AFTER THE NODE LEFT ITS COLLECTION" — it does NOT promise the node's read edges are gone. Deliberately does not retractReads(): removing a node does not retract its edges today, only the disposal call sites do (tables.ts), and adding it here would be a behaviour change rather than an observation point.
Not anchored at retractReads() — that runs on EVERY dirty recompute (3 of its 6 call sites: evaluate, LaneNode.pull, evaluateStep), so hooks there would report a live node as removed on every evaluate.
Returns
void
Inherited from
removeListener()
removeListener(
event,listener):void
Parameters
event
string
listener
Returns
void
Inherited from
retractReads()
retractReads():
void
Drop every reverse read edge recorded in _reads.
Returns
void
Inherited from
setError()
setError(
message):void
Set an error message on this node and notify listeners. Fires "error" (specific) and "change" (the universal event — see ParameterNode.setKey's doc).
Parameters
message
string
Returns
void
Inherited from
setInput()
setInput(
value):void
Set the raw input expression; marks this node and its transitive dependents dirty.
Parameters
value
string
Returns
void
setKey()
setKey(
key):void
Parameters
key
string
Returns
void
toJSON()
toJSON():
ParameterNodeJSON
Returns
Overrides
isAssetParameter()
isAssetParameter(
node):boolean
True when a node (or its JSON) is an ATTACHED-FILE parameter — its value method is url (the value IS a URL string; assetTypeOf in schema/model.ts classifies it as font/image/file). Such a parameter is an ordinary graph node in the parameters lane — references to its key are ordinary dependency edges.
Parameters
node
method?
string
Returns
boolean