Chapter 4 · The TnpixTool Interface

4.2Start Shape (Live at Frame 0)

The Start shape group of the Tnpix Solver panel, from a script. Live at frame 0 drapes the Solver group's garments at frame 0, and the shape it shows can become the start of the simulation. node is any garment of the Solver group. One Solver is Live at a time: starting Live on another Solver stops the first. In the demo (no activated licence), liveGrab holds nothing and "keep" keeps nothing: their line begins *** and says that a licence is needed.

FunctionReturnsWhat it does
live node op argstringDoes what op names (below) and returns a status line; a line beginning *** says why nothing was done, for example no Tnpix Solver on the node. arg is read by "start" and "step"; pass 0 with the others.
liveGrab node vertex target radiusstringHolds the cloth while Live runs, as the mouse does: vertex vertex of the node, counted from 1, and the cloth within radius around it are pulled toward target, a world position, and stay held until "release" or until Live stops. vertex 0 moves the hold already taken to a new target. target and radius are in system units. Needs Live on; returns a status line, or a line beginning ***.
opWhat it does
"start"Starts Live at frame 0: the playback stops, the time slider goes to the start frame, and the simulated frames are cleared, as Reset Simulation does. arg 0 runs the Solver's own settings; a number from 2 to 64 runs Fast preview, each Live step solved in that many steps (the panel's Fast preview box uses 8). Started by script, Live advances only when the script calls "step". A torn garment, a hidden one or one that plays from a cache cannot run Live.
"step"Advances Live by arg steps (1 when arg is 0).
"keep"Stop and keep shape: the shape Live shows becomes the start of the simulation, and Live stops. One undo step.
"stop"Stops Live and keeps nothing, as Esc does: the start shape stays as it was.
"release"Lets go of the hold liveGrab took.
"info"The status line of Live, or Live off.
"shape"What the garments start from: the modelled mesh, a kept shape, or the frame it was kept from.
"clear"Clear: the modelled mesh is the start again, for every garment of the Solver group. Live, if it runs, stops first and keeps nothing. One undo step.
"keepframe"Keep this frame: the cloth as shown at the time slider's frame becomes the start of the simulation for every garment of the Solver group, and the time slider goes to the start frame. One undo step. Refused at the start frame, on a frame not simulated yet, after the cloth has torn, while Live runs and while a garment plays from a saved cache.

"step", "keep", "stop" and "release" need Live on; with Live off they return a line beginning ***.

TnpixTool.live $Shirt "start" 8                      -- Live in Fast preview
for i = 1 to 30 do TnpixTool.live $Shirt "step" 1    -- the garments drape at frame 0
TnpixTool.liveGrab $Shirt 120 [0,-10,140] 4.0        -- hold vertex 120 and the cloth around it
TnpixTool.live $Shirt "step" 10
TnpixTool.live $Shirt "release" 0
TnpixTool.live $Shirt "keep" 0                       -- the drape becomes the start of the simulation
TnpixTool.live $Shirt "shape" 0