Chapter 3 · Reading a scene

3.5A health check

These are the silent set-ups that the toolbar's Cloth Doctor looks for: nothing reports an error, but the cloth does not do what the artist expects.

global tpaCheck
fn tpaCheck = (
    local s = ""
    for o in objects where (tpaFirst o Tnpix_Solver) != undefined do (
        local sv = tpaFirst o Tnpix_Solver
        local g = tpaFirst o Tnpix_Gravity
        if g == undefined then s += o.name + ": no Tnpix Gravity - it hangs in the air\n"
        else if not g.tnEnabled or not g.enabled do s += o.name + ": its Tnpix Gravity is switched off\n"
        local iG = tpaIndex o Tnpix_Garment
        if iG > 0 and iG < (tpaIndex o Tnpix_Solver) do s += o.name + ": Tnpix Garment sits above the Solver\n"
        if (tpaFirst o Tnpix_Collision) != undefined and (TnpixTool.colCount o) == 0 do s += o.name + ": Tnpix Collision lists no collider\n"
        local sc = tpaFirst o Tnpix_Self_Collision
        if sc != undefined and not sc.tnEnabled do s += o.name + ": Tnpix Self Collision is present but switched off\n"
        local hi = amax sv.iterations sv.stretchQuality
        if (hi >= 8 and sv.contactPasses < 7) or (hi >= 4 and sv.contactPasses < 4) do s += o.name + ": contact passes " + (sv.contactPasses as string) + " are below the rule (4 for iterations or stretch quality of 4 or more, 7 for 8 or more)\n"
        local cm = tpaFirst o Tnpix_Cache
        if cm != undefined and cm.playFromCache do s += o.name + ": plays from its cache - changes below the cache do nothing\n"
    )
    if s == "" then "Nothing found." else s
)

The report also shows garments that sit on separate Solvers: they never collide with each other. Mention it only if the artist expects them to touch. To let the artist fix findings in a window, open Cloth Doctor (7.7).