Builtin Library
README.md
Mixer
N-input weighted-blend Node subclass. Combines N source nodes into a
single pose buffer via Blend.weightedInto using a slot layout
(translation lerp + rotation slerp + scale lerp by default). Inputs
with non-positive weights are skipped at evaluate time.
Exports
Mixer.new(layout: Layout, inputs: { MixerInput }) -> Mixer— construct a Mixer with N weighted inputs. Allocates an output pose buffer.Mixer:setWeight(i: number, w: number)— update an input's weight (no-op ifiis out of range).Mixer:update(dt: number)— cascadeupdate(dt)to every input source.Mixer:evaluate() -> TypedBuffer— blend inputs into the output buffer and return it. Caller must NOT destroy.Mixer:destroy()— free the output buffer and blend layout. Does not destroy child sources.
Types:
Layout = { boneOrder: { string }, stride: number?, slotLayout: { any }? }MixerInput = { source: any, weight: number }
Usage
local Mixer = require("@builtin::systems.anim.AnimGraph.Node.Mixer")
local mix = Mixer.new(layout, {
{ source = clipA, weight = 1.0 },
{ source = clipB, weight = 0.0 },
})
mix:setWeight(2, 0.5)
mix:update(dt)
local pose = mix:evaluate()
Notes
- The mixer owns its output buffer and
Blend.layouthandle. Child source nodes are owned by the surroundingAnimGraph, not the Mixer —Mixer:destroy()does not recurse into them. - Default slot layout assumes a 10-stride bone record:
translation.xyz(lerp),rotation.xyzw(slerp),scale.xyz(lerp). Override vialayout.slotLayout. - Inputs with
weight <= 0are silently skipped — there is no error for "no active input"; the output buffer is zeroed instead.