Chapter 3 · Reading a scene

3.4What is on a garment part

When the artist names a part (section 5), find the channel that covers it with TnpixTool.chans, then list everything that reads that channel:

global tpaChannelUse
fn tpaChannelUse o ch = (
    local s = o.name + " / '" + ch + "': " + ((TnpixTool.chanCount o ch 0.5) as string) + " points at 0.5 or more, " + ((TnpixTool.chanCount o ch 0.001) as string) + " painted at all (-1 = no such channel)\n"
    for m in o.modifiers do (
        local c = classOf m
        local hit = false
        if c == Tnpix_Pin or c == Tnpix_Preserve or c == Tnpix_Stitch or c == Tnpix_Threads then hit = (m.channel == ch)
        else if c == Tnpix_Rigid then hit = (m.piecesFrom == 0 and m.channel == ch)
        else if c == Tnpix_Tear then hit = (m.channelName == ch)
        else if c == Tnpix_Volume then hit = (m.volumeChannel == ch)
        else if c == Tnpix_Soft_Body then hit = (m.softChannel == ch)
        else if c == Tnpix_Forces then hit = (m.forceChannel == ch)
        else if c == Tnpix_Post_Process then hit = (m.weightChannel == ch or m.detangleWeightChannel == ch)
        else if c == Tnpix_Wrap then hit = (m.weightChannel == ch)
        if hit do s += "  read by " + m.name + " <" + (c as string) + ">\n"
    )
    for k = 0 to (TnpixTool.goldCount o) - 1 do (
        local t = TnpixTool.goldAt o k
        if (findString t ("channel " + ch + " ")) != undefined do s += "  Material Standard " + (k as string) + ": " + t
    )
    for k = 0 to (TnpixTool.matCount o) - 1 do (
        local t = TnpixTool.matAt o k
        if (findString t ("channel " + ch + " ")) != undefined do s += "  Material Advanced " + (k as string) + ": " + t
    )
    s
)

Then check for a Tnpix Wrap, which rule 5b turns on. There are two cases:

-- the Tnpix Wrap on garment g itself (g follows its proxies), and the objects whose Tnpix Wrap uses g as a proxy (a detailed copy follows g)
(
    local g = $Shirt
    local own = tpaFirst g Tnpix_Wrap
    local driven = #()
    for o in objects do ( local w = tpaFirst o Tnpix_Wrap; if w != undefined and (findItem (w.proxies as array) g) > 0 do append driven o.name )
    "Wrap on " + g.name + ": " + (if own != undefined then ("yes, proxies " + ((for x in own.proxies where isValidNode x collect x.name) as string)) else "no") + "; Wraps that follow it: " + (driven as string)
)

Read the stack below the Solver as well (tpaStack). A Skin, Skin Wrap, Tnpix Wrap, Morpher, Point Cache or any other deformer below the Solver is animation that a Tnpix Preserve can follow.