Ligamen

Attachments

Clipping

A clipping attachment is a polygon that works as a mask. Everything drawn inside the polygon stays visible, and everything outside it is cut away, but only for a chosen run of slots. This is how you keep an eye inside the socket, show a liquid only inside a glass, or slide a texture along a body without it spilling over the outline. The mask draws nothing itself. It lives in a slot like any other attachment, follows its bone, and can be reshaped and keyed. This article explains how to create a clipping, how the range of masked slots is defined, how to edit the polygon, what the flags do, and how a clipping behaves in an animation.

Edit Clipping

Creating a clipping#

In the Tree, open the New... menu on a bone and choose Clipping. A dialog asks for a name, and the suggestion starts with the bone name. Press Create and Ligamen adds a new slot under the bone, puts the clipping in it as the slot's attachment and selects it. The slot and the clipping share a name. You can also right-click an existing slot and choose New Clipping to add the polygon to that slot (see Slots).

The new polygon is a square of 100 by 100 pixels centred on the bone's origin. Its vertices are stored in the local space of the slot's bone (see Bones), so moving or rotating the bone moves the mask with it. A mask has to come before the art it cuts, so when you create a clipping from a bone, its new slot is placed first in the draw order, and the order of all other slots stays as it was. If you add a clipping to a slot that is already in the middle of the draw order, it masks what comes after that slot. Creating a clipping is one undo step.

The masked range#

A clipping affects the slots that are drawn after its own slot, up to and including its End slot. By default End slot is the clipping's own slot, and in that case the mask reaches the end of the draw order: every slot below the clipping is cut by the polygon. To limit the mask, choose a later slot as the end. The mask then covers the slots between the clipping and that slot, the end slot included, and the slots after it are drawn whole. Slots drawn before the clipping are never touched.

The range follows the draw order, not the bone hierarchy. If you drag slots in the Tree to a new place, or key a different draw order in Animate (see Animating), the set of masked slots changes with it. If the chosen end slot ends up above the clipping, the mask reaches the last slot. The End slot field is in the card of the Tree and in the Range section of Properties, where it is called To. Both do the same thing, and each change is one undo step.

The viewport shows the result at once. Slots in the range are cut by the polygon, and the rest is drawn normally. While you choose the end, keep an eye on neighbouring slots that you did not mean to mask. The usual fix is to put the end on the last slot that should be cut.

Editing the polygon#

A new clipping opens in Edit Clipping immediately. For an existing one, select its row in the Tree and press Edit Clipping in the card or in the toolbar at the bottom of the viewport. The polygon is edited in Setup mode, with the same tools as a bounding box (see Bounding box). Drag a handle to move a vertex, and the whole drag is one undo step. Double-click an edge to insert a vertex, and double-click a vertex to delete it. Create turns on the mode where each click on empty space appends a vertex, and Delete removes the vertex you picked last. A clipping needs at least three vertices.

Like a bounding box, a clipping answers a click only on its outline, so the art inside stays selectable. A click on the outline selects the slot, and the cursor shows the icon and name of the clipping. In the card, Display has a Select toggle that turns picking off once the polygon is placed. Options has an Export toggle that leaves the clipping out of exported files, and Color sets the colour of the outline in the editor, which is a red by default. The colour never reaches the game.

Leave the mode with the cross in the card, with Esc, or by pressing Edit Clipping again. Selecting something else in the Tree or switching to Animate also leaves it. The polygon can be concave, but a mask with few vertices is cheaper for the game to draw.

Inverse and Convex#

The Range section of Properties has two switches that follow the Spine 4.3 clipping format. They are available in Setup only, and each is one undo step.

Inverse flips the mask. Instead of keeping what is inside the polygon, Ligamen draws only what is outside it, so the polygon becomes a hole. This is handy for a window cut out of a wall or a spotlight that hides the area around a character. Convex is a hint for runtimes: you declare that the polygon is convex, and a game may then clip faster with a simpler algorithm. Ligamen does not check the claim. Switch it on only when the polygon really has no dent, because a runtime that trusts the flag can draw a concave mask incorrectly.

What the panels show#

The Properties panel (see User interface) has a Clipping section with the Name and the Slot, and a Range section. From is the slot that owns the clipping, To is the end slot, and Slots lists the slots the mask currently covers: the first three names, then three dots if there are more, or none when the range is empty. The list is read from the current draw order, so it is a good way to check a range without looking at the viewport.

The card at the top of the Tree repeats the End slot field, the Display and Options toggles and the Color plate, and has the Edit Clipping button. The Tree draws the clipping in its own row under the slot with a scissors icon, and the type filter has a Clipping entry to show or hide these rows.

Weights and animation#

A clipping can be weighted to several bones, like a mesh or a bounding box (see Weights). Select the slot, open the Weights panel and use Auto, Smooth and the brushes with the vertices of the polygon. This makes the mask bend with an arm instead of following one rigid bone. The vertices of a weighted clipping stay editable in Setup: a dragged vertex keeps its weights and is rebound at the new place.

In Animate mode, the clipping follows its bone. To change the shape itself, select the clipping and drag one of its vertices, which records a deform key (see Keys). Between keys the shape is interpolated, and the viewport mask follows the animated polygon, so the cut always matches what you see. Keep the setup shape as the resting state and key only the changes. Weighted clippings and their deform keys are written to Spine JSON, to the binary skeleton and to the Unity package, and a clipping with Export off is left out of all of them.