@modoki/engine / index / PaintWeightsOptions
Interface: PaintWeightsOptions
Weight painting for 2D skinning rigs — brush a bone's influence onto mesh vertices near a point, preserving the relative proportions of other bones and renormalizing to <=4 influences per vertex. This is the computational core of the (planned) weight- paint UI: the panel supplies a brush position/radius/strength + target bone, this returns updated skinIndices/skinWeights. Pure + deterministic.
"Add" semantics (like Blender's Add weight-paint): each affected vertex's target weight moves toward 1 by t = strength·falloff, and its OTHER weights are scaled so the four still sum to 1 — so painting a bone in grows it without wiping the blend.
Skinning
boneIndex
boneIndex:
number
bonePositions?
optionalbonePositions?: readonly readonlynumber[][]
Per-bone bind position [x,y] (same space as verts). Used by the eraser to hand the freed weight to the NEAREST other bone when the target is a vertex's SOLE influence — otherwise erasing there renormalizes straight back to 1.
center
center: readonly [
number,number]
falloff?
optionalfalloff?:"constant"|"smooth"
Brush profile across the radius: 'smooth' (smoothstep falloff, default) or 'constant' (hard edge).
mode?
optionalmode?:"add"|"subtract"|"set"
'add' (default) grows the target bone's weight toward 1; 'subtract' shrinks it toward 0; 'set' blends it toward strength (used as the TARGET weight, not an intensity). Other bones rebalance to keep each vertex summing to 1.
radius
radius:
number
skinIndices
skinIndices: readonly
number[]
skinWeights
skinWeights: readonly
number[]
strength
strength:
number
verts
verts: readonly readonly
number[][]