Clipping
The clipping feature lets you define a polygonal area, similar to a bounding box attachment, that will mask other slots in the draw order. The clipping area can be any concave polygon without holes and self-intersection. You can also animate the clipping area vertices. Only one clipping area can be active at a time.
Clipping is implemented CPU-side in all runtimes, as most engines do not support direct stencil buffer access or masking. Clipping can be a very expensive operation, especially if you use dense mesh attachments. Always check the performance of your clipped animations on your target platforms.
Setup
To create a new clipping attachment, select a bone or slot in the tree, then choose New...
Clipping
in the properties at the bottom of the tree.
This will create a clipping polygon. Clippings are stored on a slot like any other attachment.
The new clipping attachment appears in the tree and Edit mode is automatically selected.
Edit mode
While in New
mode, clicking in the editor area will create new polygon vertices. Vertices can also be translated by dragging or deleted by double clicking. When the polygon is complete, exit New
mode by clicking the first vertex to close the shape or by clicking the New
button.
Edit
mode has two tools:
Create
allows new vertices to be created along the edges of the polygon by clicking.Delete
allows vertices or edges to be deleted by clicking.
With either tool, vertices can be translated by dragging or deleted by double clicking. Right click switches tools.
Edit
mode can be exited at any time by pressing spacebar
or escape
, by clicking the Edit
button in the properties at the bottom of the tree, or by closing the Edit Bounding Box
dialog.
Clipping start
To delimit the number of slots in a clipping attachment and define where the clipping should start, open Draw Order
and move the clipping to its start spot.
Clipping end
To delimit where a clipping should end, select the clipping attachment and set the End Slot
under its properties.
You can find an example of usage in the updated Spineboy project.
Transform tools
The clipping vertices can be edited outside of Edit
mode by using the transform tools. The entire clipping can be rotated, translated, and scaled like any other attachment.
Individual vertices can be translated with any transform tool by dragging. Multiple vertices can be selected by holding ctrl
(cmd
on Mac), then clicking or dragging to box select. The selected vertices can be deselected by pressing spacebar
or escape
, or by clicking in any empty space.
The origin used for rotation or scaling can be changed. Mouse over the small crosshair at the center of the Rotate
or Scale
tool until a circle appears, then drag the origin to the desired position. The origin will automatically snap to vertices.
Keying
Like keying meshes or bounding boxes, when a clipping attachment's vertices have been manipulated in animate mode, the clipping attachment can be keyed.
Weights
Clipping attachments can be automatically deformed when bones are transformed. See Weights for more information.