mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-10 00:58:43 +08:00
Revert "Formatting errors to test GH Action."
This reverts commit 1800b235458b331b87bed27ce5aee55575163fc7.
This commit is contained in:
parent
1800b23545
commit
0bf2fb6059
@ -52,7 +52,7 @@ typedef struct {
|
||||
_spUpdate *updateCache;
|
||||
} _spSkeleton;
|
||||
|
||||
spSkeleton *spSkeleton_create (spSkeletonData *data) {
|
||||
spSkeleton *spSkeleton_create(spSkeletonData *data) {
|
||||
int i;
|
||||
int *childrenCounts;
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
using namespace spine;
|
||||
|
||||
Skeleton::Skeleton (SkeletonData *skeletonData) : _data(skeletonData),
|
||||
Skeleton::Skeleton(SkeletonData *skeletonData) : _data(skeletonData),
|
||||
_skin(NULL),
|
||||
_color(1, 1, 1, 1),
|
||||
_time(0),
|
||||
|
||||
@ -31,7 +31,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Spine {
|
||||
public class Skeleton{
|
||||
public class Skeleton {
|
||||
internal SkeletonData data;
|
||||
internal ExposedList<Bone> bones;
|
||||
internal ExposedList<Slot> slots;
|
||||
|
||||
@ -62,7 +62,7 @@ public class Skeleton {
|
||||
float scaleX = 1, scaleY = 1;
|
||||
float x, y;
|
||||
|
||||
public Skeleton(SkeletonData data) {
|
||||
public Skeleton (SkeletonData data) {
|
||||
if (data == null) throw new IllegalArgumentException("data cannot be null.");
|
||||
this.data = data;
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ module spine {
|
||||
/** Stores the current pose for a skeleton.
|
||||
*
|
||||
* See [Instance objects](http://esotericsoftware.com/spine-runtime-architecture#Instance-objects) in the Spine Runtimes Guide. */
|
||||
export class Skeleton {
|
||||
export class Skeleton {
|
||||
/** The skeleton's setup pose data. */
|
||||
data: SkeletonData;
|
||||
|
||||
@ -69,11 +69,11 @@ module spine {
|
||||
time = 0;
|
||||
|
||||
/** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
|
||||
* inheritance. */
|
||||
* inheritance. */
|
||||
scaleX = 1;
|
||||
|
||||
/** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale
|
||||
* inheritance. */
|
||||
* inheritance. */
|
||||
scaleY = 1;
|
||||
|
||||
/** Sets the skeleton X position, which is added to the root bone worldX position. */
|
||||
@ -82,7 +82,7 @@ module spine {
|
||||
/** Sets the skeleton Y position, which is added to the root bone worldY position. */
|
||||
y = 0;
|
||||
|
||||
constructor(data: SkeletonData) {
|
||||
constructor (data: SkeletonData) {
|
||||
if (!data) throw new Error("data cannot be null.");
|
||||
this.data = data;
|
||||
|
||||
@ -134,7 +134,7 @@ module spine {
|
||||
|
||||
/** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,
|
||||
* constraints, or weighted path attachments are added or removed. */
|
||||
updateCache() {
|
||||
updateCache () {
|
||||
let updateCache = this._updateCache;
|
||||
updateCache.length = 0;
|
||||
|
||||
@ -193,7 +193,7 @@ module spine {
|
||||
this.sortBone(bones[i]);
|
||||
}
|
||||
|
||||
sortIkConstraint(constraint: IkConstraint) {
|
||||
sortIkConstraint (constraint: IkConstraint) {
|
||||
constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || (this.skin && Utils.contains(this.skin.constraints, constraint.data, true)));
|
||||
if (!constraint.active) return;
|
||||
|
||||
@ -218,7 +218,7 @@ module spine {
|
||||
}
|
||||
}
|
||||
|
||||
sortPathConstraint(constraint: PathConstraint) {
|
||||
sortPathConstraint (constraint: PathConstraint) {
|
||||
constraint.active = constraint.target.bone.isActive() && (!constraint.data.skinRequired || (this.skin && Utils.contains(this.skin.constraints, constraint.data, true)));
|
||||
if (!constraint.active) return;
|
||||
|
||||
@ -247,7 +247,7 @@ module spine {
|
||||
constrained[i].sorted = true;
|
||||
}
|
||||
|
||||
sortTransformConstraint(constraint: TransformConstraint) {
|
||||
sortTransformConstraint (constraint: TransformConstraint) {
|
||||
constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || (this.skin && Utils.contains(this.skin.constraints, constraint.data, true)));
|
||||
if (!constraint.active) return;
|
||||
|
||||
@ -275,7 +275,7 @@ module spine {
|
||||
constrained[i].sorted = true;
|
||||
}
|
||||
|
||||
sortPathConstraintAttachment(skin: Skin, slotIndex: number, slotBone: Bone) {
|
||||
sortPathConstraintAttachment (skin: Skin, slotIndex: number, slotBone: Bone) {
|
||||
let attachments = skin.attachments[slotIndex];
|
||||
if (!attachments) return;
|
||||
for (let key in attachments) {
|
||||
@ -283,7 +283,7 @@ module spine {
|
||||
}
|
||||
}
|
||||
|
||||
sortPathConstraintAttachmentWith(attachment: Attachment, slotBone: Bone) {
|
||||
sortPathConstraintAttachmentWith (attachment: Attachment, slotBone: Bone) {
|
||||
if (!(attachment instanceof PathAttachment)) return;
|
||||
let pathBones = (<PathAttachment>attachment).bones;
|
||||
if (!pathBones)
|
||||
@ -299,7 +299,7 @@ module spine {
|
||||
}
|
||||
}
|
||||
|
||||
sortBone(bone: Bone) {
|
||||
sortBone (bone: Bone) {
|
||||
if (bone.sorted) return;
|
||||
let parent = bone.parent;
|
||||
if (parent) this.sortBone(parent);
|
||||
@ -307,7 +307,7 @@ module spine {
|
||||
this._updateCache.push(bone);
|
||||
}
|
||||
|
||||
sortReset(bones: Array<Bone>) {
|
||||
sortReset (bones: Array<Bone>) {
|
||||
for (let i = 0, n = bones.length; i < n; i++) {
|
||||
let bone = bones[i];
|
||||
if (!bone.active) continue;
|
||||
@ -320,7 +320,7 @@ module spine {
|
||||
*
|
||||
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
||||
* Runtimes Guide. */
|
||||
updateWorldTransform() {
|
||||
updateWorldTransform () {
|
||||
let bones = this.bones;
|
||||
for (let i = 0, n = bones.length; i < n; i++) {
|
||||
let bone = bones[i];
|
||||
@ -338,7 +338,7 @@ module spine {
|
||||
updateCache[i].update();
|
||||
}
|
||||
|
||||
updateWorldTransformWith(parent: Bone) {
|
||||
updateWorldTransformWith (parent: Bone) {
|
||||
// Apply the parent bone transform to the root bone. The root bone always inherits scale, rotation and reflection.
|
||||
let rootBone = this.getRootBone();
|
||||
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
||||
@ -364,13 +364,13 @@ module spine {
|
||||
}
|
||||
|
||||
/** Sets the bones, constraints, and slots to their setup pose values. */
|
||||
setToSetupPose() {
|
||||
setToSetupPose () {
|
||||
this.setBonesToSetupPose();
|
||||
this.setSlotsToSetupPose();
|
||||
}
|
||||
|
||||
/** Sets the bones and constraints to their setup pose values. */
|
||||
setBonesToSetupPose() {
|
||||
setBonesToSetupPose () {
|
||||
let bones = this.bones;
|
||||
for (let i = 0, n = bones.length; i < n; i++)
|
||||
bones[i].setToSetupPose();
|
||||
@ -410,7 +410,7 @@ module spine {
|
||||
}
|
||||
|
||||
/** Sets the slots and draw order to their setup pose values. */
|
||||
setSlotsToSetupPose() {
|
||||
setSlotsToSetupPose () {
|
||||
let slots = this.slots;
|
||||
Utils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length);
|
||||
for (let i = 0, n = slots.length; i < n; i++)
|
||||
@ -418,13 +418,13 @@ module spine {
|
||||
}
|
||||
|
||||
/** @returns May return null. */
|
||||
getRootBone() {
|
||||
getRootBone () {
|
||||
if (this.bones.length == 0) return null;
|
||||
return this.bones[0];
|
||||
}
|
||||
|
||||
/** @returns May be null. */
|
||||
findBone(boneName: string) {
|
||||
findBone (boneName: string) {
|
||||
if (!boneName) throw new Error("boneName cannot be null.");
|
||||
let bones = this.bones;
|
||||
for (let i = 0, n = bones.length; i < n; i++) {
|
||||
@ -435,7 +435,7 @@ module spine {
|
||||
}
|
||||
|
||||
/** @returns -1 if the bone was not found. */
|
||||
findBoneIndex(boneName: string) {
|
||||
findBoneIndex (boneName: string) {
|
||||
if (!boneName) throw new Error("boneName cannot be null.");
|
||||
let bones = this.bones;
|
||||
for (let i = 0, n = bones.length; i < n; i++)
|
||||
@ -446,7 +446,7 @@ module spine {
|
||||
/** 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.
|
||||
* @returns May be null. */
|
||||
findSlot(slotName: string) {
|
||||
findSlot (slotName: string) {
|
||||
if (!slotName) throw new Error("slotName cannot be null.");
|
||||
let slots = this.slots;
|
||||
for (let i = 0, n = slots.length; i < n; i++) {
|
||||
@ -457,7 +457,7 @@ module spine {
|
||||
}
|
||||
|
||||
/** @returns -1 if the bone was not found. */
|
||||
findSlotIndex(slotName: string) {
|
||||
findSlotIndex (slotName: string) {
|
||||
if (!slotName) throw new Error("slotName cannot be null.");
|
||||
let slots = this.slots;
|
||||
for (let i = 0, n = slots.length; i < n; i++)
|
||||
@ -468,7 +468,7 @@ module spine {
|
||||
/** Sets a skin by name.
|
||||
*
|
||||
* See {@link #setSkin()}. */
|
||||
setSkinByName(skinName: string) {
|
||||
setSkinByName (skinName: string) {
|
||||
let skin = this.data.findSkin(skinName);
|
||||
if (!skin) throw new Error("Skin not found: " + skinName);
|
||||
this.setSkin(skin);
|
||||
@ -484,7 +484,7 @@ module spine {
|
||||
* {@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.
|
||||
* @param newSkin May be null. */
|
||||
setSkin(newSkin: Skin) {
|
||||
setSkin (newSkin: Skin) {
|
||||
if (newSkin == this.skin) return;
|
||||
if (newSkin) {
|
||||
if (this.skin)
|
||||
@ -511,7 +511,7 @@ module spine {
|
||||
*
|
||||
* See {@link #getAttachment()}.
|
||||
* @returns May be null. */
|
||||
getAttachmentByName(slotName: string, attachmentName: string): Attachment {
|
||||
getAttachmentByName (slotName: string, attachmentName: string): Attachment {
|
||||
return this.getAttachment(this.data.findSlotIndex(slotName), attachmentName);
|
||||
}
|
||||
|
||||
@ -520,7 +520,7 @@ module spine {
|
||||
*
|
||||
* See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
|
||||
* @returns May be null. */
|
||||
getAttachment(slotIndex: number, attachmentName: string): Attachment {
|
||||
getAttachment (slotIndex: number, attachmentName: string): Attachment {
|
||||
if (!attachmentName) throw new Error("attachmentName cannot be null.");
|
||||
if (this.skin) {
|
||||
let attachment: Attachment = this.skin.getAttachment(slotIndex, attachmentName);
|
||||
@ -533,7 +533,7 @@ module spine {
|
||||
/** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
|
||||
* {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
|
||||
* @param attachmentName May be null to clear the slot's attachment. */
|
||||
setAttachment(slotName: string, attachmentName: string) {
|
||||
setAttachment (slotName: string, attachmentName: string) {
|
||||
if (!slotName) throw new Error("slotName cannot be null.");
|
||||
let slots = this.slots;
|
||||
for (let i = 0, n = slots.length; i < n; i++) {
|
||||
@ -555,7 +555,7 @@ module spine {
|
||||
/** 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.
|
||||
* @return May be null. */
|
||||
findIkConstraint(constraintName: string) {
|
||||
findIkConstraint (constraintName: string) {
|
||||
if (!constraintName) throw new Error("constraintName cannot be null.");
|
||||
let ikConstraints = this.ikConstraints;
|
||||
for (let i = 0, n = ikConstraints.length; i < n; i++) {
|
||||
@ -568,7 +568,7 @@ module spine {
|
||||
/** 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.
|
||||
* @return May be null. */
|
||||
findTransformConstraint(constraintName: string) {
|
||||
findTransformConstraint (constraintName: string) {
|
||||
if (!constraintName) throw new Error("constraintName cannot be null.");
|
||||
let transformConstraints = this.transformConstraints;
|
||||
for (let i = 0, n = transformConstraints.length; i < n; i++) {
|
||||
@ -581,7 +581,7 @@ module spine {
|
||||
/** 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.
|
||||
* @return May be null. */
|
||||
findPathConstraint(constraintName: string) {
|
||||
findPathConstraint (constraintName: string) {
|
||||
if (!constraintName) throw new Error("constraintName cannot be null.");
|
||||
let pathConstraints = this.pathConstraints;
|
||||
for (let i = 0, n = pathConstraints.length; i < n; i++) {
|
||||
@ -595,7 +595,7 @@ module spine {
|
||||
* @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.
|
||||
* @param size An output value, the width and height of the AABB.
|
||||
* @param temp Working memory to temporarily store attachments' computed world vertices. */
|
||||
getBounds(offset: Vector2, size: Vector2, temp: Array<number> = new Array<number>(2)) {
|
||||
getBounds (offset: Vector2, size: Vector2, temp: Array<number> = new Array<number>(2)) {
|
||||
if (!offset) throw new Error("offset cannot be null.");
|
||||
if (!size) throw new Error("size cannot be null.");
|
||||
let drawOrder = this.drawOrder;
|
||||
@ -631,7 +631,7 @@ module spine {
|
||||
}
|
||||
|
||||
/** Increments the skeleton's {@link #time}. */
|
||||
update(delta: number) {
|
||||
update (delta: number) {
|
||||
this.time += delta;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user