Chapter 4 · The TnpixTool Interface

4.7Material Advanced

FunctionReturnsWhat it does
matCount nodeintegerHow many Advanced materials the stack carries.
matAt node indexstringThe material's values and ticks, as text.
matSetAt node index field valuebooleanSets one value by name (Appendix A) and ticks it. Out-of-range values are refused, not clamped.
matSetPairAt node index family coeff magIdxbooleanSets a stiffness as coefficient and multiplier row in one call: family is "stretch" or "bend", magIdx a row of the × Multiplier list (Appendix A).
matSetBendModelAt node index modelbooleanThe bend type: 0 Basic, 1 Shape Memory, 3 Shape Memory (Even). 2 is refused.
matPresetAt node index presetRowbooleanApplies a row of the Preset list: 1 Ultra Light, 2 Light, 3 Medium, 4 Heavy, 5 Leather (Debug); 0 (Custom) writes nothing. An override: every dial is reset first.
matAuthoredAt node index onbooleanThe Authored switch: 0 runs pure defaults, 1 your values again.
matShearKClearAt node indexbooleanWithdraws the shear stiffness (value kept).
matChanAt node index channelbooleanBinds the material to a channel.
TnpixTool.matPresetAt  $Shirt 0 4                  -- Heavy Fabric onto material 0
TnpixTool.matSetPairAt $Shirt 0 "bend" 1.0 7       -- bend stiffness 1.0 x 1 000
TnpixTool.matSetAt     $Shirt 0 "maxStretch" 8.0   -- percent, as on the panel
TnpixTool.matSetBendModelAt $Shirt 0 1             -- Shape Memory
TnpixTool.matChanAt    $Shirt 0 "body_all"
TnpixTool.matAt        $Shirt 0

The single-material forms mat, matBind, matMul, matBendK, matBendKClear, matMembraneK and matMembraneKClear still work and always address the first Advanced material on the stack.

An Advanced material whose channel is empty (matChanAt node index "") is the default material of its own garment: it covers every vertex of that garment that no material bound to a channel claims. Give a garment only one such material; with two, only the one created last acts.