Stores the current pose for a skeleton.
See Instance objects in the Spine Runtimes Guide.
Constructor
Variables
finalbones:Array<Bone>
The skeleton's bones, sorted parent first. The root bone is always the first bone.
finaldrawOrder:Array<Slot>
The skeleton's slots in the order they should be drawn. The returned array may be modified to change the draw order.
scaleX:Float = 1.0
Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale inheritance.
scaleY:Float = 1.0
Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale inheritance.
time:Float = 0.0
Returns the skeleton's time. This can be used for tracking, such as with Slot Slot.getAttachmentTime
.
See also:
update
.
Methods
findIkConstraint(constraintName:String):Null<IkConstraint>
Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method than to call it repeatedly.
findPathConstraint(constraintName:String):Null<PathConstraint>
Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method than to call it repeatedly.
findSlot(slotName:String):Null<Slot>
Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it repeatedly.
findTransformConstraint(constraintName:String):Null<TransformConstraint>
Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of this method than to call it repeatedly.
getAttachment(slotIndex:Int, attachmentName:String):Null<Attachment>
Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
See Runtime skins in the Spine Runtimes Guide.
getAttachmentByName(slotName:String, attachmentName:String):Null<Attachment>
Finds an attachment by looking in the skin
and SkeletonData.defaultSkin
using the slot name and attachment name.
See also:
getAttachment
.
getBounds(offset:Vector2, size:Vector2, ?temp:Array<Float>):Void
Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.
Parameters:
offset | An output value, the distance from the skeleton origin to the bottom left corner of the AABB. |
---|---|
size | An output value, the width and height of the AABB. |
temp | Working memory to temporarily store attachments' computed world vertices. |
setAttachment(slotName:String, attachmentName:Null<String>):Void
A convenience method to set an attachment by finding the slot with findSlot
, finding the attachment with
getAttachment
, then setting the slot's Slot.setAttachment
.
Parameters:
attachmentName | May be null to clear the slot's attachment. |
---|
setSkin(newSkin:Null<Skin>):Void
Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the skin is changed, {@link #updateCache()} is called.
Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no old skin, each slot's setup mode attachment is attached from the new skin.
After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply()} is called before the next time the skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
updateCache():Void
Caches information about bones and constraints. Must be called if the skin
is modified or if bones,
constraints, or weighted path attachments are added or removed.
updateWorldTransform():Void
Updates the world transform for each bone and applies all constraints.
See World transforms in the Spine Runtimes Guide.