[ts] Updated builds.

This commit is contained in:
badlogic 2019-05-10 15:07:43 +02:00
parent 576c1da32f
commit 75ffb7b098
17 changed files with 12364 additions and 11174 deletions

View File

@ -771,12 +771,26 @@ declare module spine {
} }
} }
declare module spine { declare module spine {
class SkinEntry {
slotIndex: number;
name: string;
attachment: Attachment;
constructor(slotIndex: number, name: string, attachment: Attachment);
}
class Skin { class Skin {
name: string; name: string;
attachments: Map<Attachment>[]; attachments: Map<Attachment>[];
bones: BoneData[];
constraints: SlotData[];
constructor(name: string); constructor(name: string);
addAttachment(slotIndex: number, name: string, attachment: Attachment): void; setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
addSkin(skin: Skin): void;
copySkin(skin: Skin): void;
getAttachment(slotIndex: number, name: string): Attachment; getAttachment(slotIndex: number, name: string): Attachment;
removeAttachment(slotIndex: number, name: string): void;
getAttachments(): Array<SkinEntry>;
getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
clear(): void;
attachAll(skeleton: Skeleton, oldSkin: Skin): void; attachAll(skeleton: Skeleton, oldSkin: Skin): void;
} }
} }
@ -1081,6 +1095,7 @@ declare module spine {
abstract class Attachment { abstract class Attachment {
name: string; name: string;
constructor(name: string); constructor(name: string);
abstract copy(): Attachment;
} }
abstract class VertexAttachment extends Attachment { abstract class VertexAttachment extends Attachment {
private static nextID; private static nextID;
@ -1091,6 +1106,7 @@ declare module spine {
constructor(name: string); constructor(name: string);
computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void; computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
applyDeform(sourceAttachment: VertexAttachment): boolean; applyDeform(sourceAttachment: VertexAttachment): boolean;
copyTo(attachment: VertexAttachment): void;
} }
} }
declare module spine { declare module spine {
@ -1117,6 +1133,7 @@ declare module spine {
class BoundingBoxAttachment extends VertexAttachment { class BoundingBoxAttachment extends VertexAttachment {
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1124,6 +1141,7 @@ declare module spine {
endSlot: SlotData; endSlot: SlotData;
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1134,7 +1152,10 @@ declare module spine {
uvs: ArrayLike<number>; uvs: ArrayLike<number>;
triangles: Array<number>; triangles: Array<number>;
color: Color; color: Color;
width: number;
height: number;
hullLength: number; hullLength: number;
edges: Array<number>;
private parentMesh; private parentMesh;
inheritDeform: boolean; inheritDeform: boolean;
tempColor: Color; tempColor: Color;
@ -1143,6 +1164,7 @@ declare module spine {
applyDeform(sourceAttachment: VertexAttachment): boolean; applyDeform(sourceAttachment: VertexAttachment): boolean;
getParentMesh(): MeshAttachment; getParentMesh(): MeshAttachment;
setParentMesh(parentMesh: MeshAttachment): void; setParentMesh(parentMesh: MeshAttachment): void;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1152,6 +1174,7 @@ declare module spine {
constantSpeed: boolean; constantSpeed: boolean;
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1163,6 +1186,7 @@ declare module spine {
constructor(name: string); constructor(name: string);
computeWorldPosition(bone: Bone, point: Vector2): Vector2; computeWorldPosition(bone: Bone, point: Vector2): Vector2;
computeWorldRotation(bone: Bone): number; computeWorldRotation(bone: Bone): number;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1225,6 +1249,7 @@ declare module spine {
updateOffset(): void; updateOffset(): void;
setRegion(region: TextureRegion): void; setRegion(region: TextureRegion): void;
computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void; computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {

View File

@ -4675,7 +4675,7 @@ var spine;
for (var entryName in slotMap) { for (var entryName in slotMap) {
var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData); var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData);
if (attachment != null) if (attachment != null)
skin.addAttachment(slotIndex, entryName, attachment); skin.setAttachment(slotIndex, entryName, attachment);
} }
} }
skeletonData.skins.push(skin); skeletonData.skins.push(skin);
@ -4762,6 +4762,8 @@ var spine;
var color = this.getValue(map, "color", null); var color = this.getValue(map, "color", null);
if (color != null) if (color != null)
mesh.color.setFromString(color); mesh.color.setFromString(color);
mesh.width = this.getValue(map, "width", 0) * scale;
mesh.height = this.getValue(map, "height", 0) * scale;
var parent_4 = this.getValue(map, "parent", null); var parent_4 = this.getValue(map, "parent", null);
if (parent_4 != null) { if (parent_4 != null) {
mesh.inheritDeform = this.getValue(map, "deform", true); mesh.inheritDeform = this.getValue(map, "deform", true);
@ -4773,6 +4775,7 @@ var spine;
mesh.triangles = map.triangles; mesh.triangles = map.triangles;
mesh.regionUVs = uvs; mesh.regionUVs = uvs;
mesh.updateUVs(); mesh.updateUVs();
mesh.edges = this.getValue(map, "edges", null);
mesh.hullLength = this.getValue(map, "hull", 0) * 2; mesh.hullLength = this.getValue(map, "hull", 0) * 2;
return mesh; return mesh;
} }
@ -5241,14 +5244,25 @@ var spine;
})(spine || (spine = {})); })(spine || (spine = {}));
var spine; var spine;
(function (spine) { (function (spine) {
var SkinEntry = (function () {
function SkinEntry(slotIndex, name, attachment) {
this.slotIndex = slotIndex;
this.name = name;
this.attachment = attachment;
}
return SkinEntry;
}());
spine.SkinEntry = SkinEntry;
var Skin = (function () { var Skin = (function () {
function Skin(name) { function Skin(name) {
this.attachments = new Array(); this.attachments = new Array();
this.bones = Array();
this.constraints = new Array();
if (name == null) if (name == null)
throw new Error("name cannot be null."); throw new Error("name cannot be null.");
this.name = name; this.name = name;
} }
Skin.prototype.addAttachment = function (slotIndex, name, attachment) { Skin.prototype.setAttachment = function (slotIndex, name, attachment) {
if (attachment == null) if (attachment == null)
throw new Error("attachment cannot be null."); throw new Error("attachment cannot be null.");
var attachments = this.attachments; var attachments = this.attachments;
@ -5258,10 +5272,118 @@ var spine;
attachments[slotIndex] = {}; attachments[slotIndex] = {};
attachments[slotIndex][name] = attachment; attachments[slotIndex][name] = attachment;
}; };
Skin.prototype.addSkin = function (skin) {
for (var i = 0; i < skin.bones.length; i++) {
var bone = skin.bones[i];
var contained = false;
for (var j = 0; j < this.bones.length; j++) {
if (this.bones[j] == bone) {
contained = true;
break;
}
}
if (!contained)
this.bones.push(bone);
}
for (var i = 0; i < skin.constraints.length; i++) {
var constraint = skin.constraints[i];
var contained = false;
for (var j = 0; j < this.constraints.length; j++) {
if (this.constraints[j] == constraint) {
contained = true;
break;
}
}
if (!contained)
this.constraints.push(constraint);
}
var attachments = skin.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment = attachments[i];
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
}
};
Skin.prototype.copySkin = function (skin) {
for (var i = 0; i < skin.bones.length; i++) {
var bone = skin.bones[i];
var contained = false;
for (var j = 0; j < this.bones.length; j++) {
if (this.bones[j] == bone) {
contained = true;
break;
}
}
if (!contained)
this.bones.push(bone);
}
for (var i = 0; i < skin.constraints.length; i++) {
var constraint = skin.constraints[i];
var contained = false;
for (var j = 0; j < this.constraints.length; j++) {
if (this.constraints[j] == constraint) {
contained = true;
break;
}
}
if (!contained)
this.constraints.push(constraint);
}
var attachments = skin.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment = attachments[i];
attachment.attachment = attachment.attachment.copy();
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
}
attachments = this.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment_1 = attachments[i];
if (attachment_1.attachment instanceof spine.MeshAttachment) {
var mesh = attachment_1.attachment;
if (mesh.getParentMesh()) {
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
mesh.updateUVs();
}
}
}
};
Skin.prototype.getAttachment = function (slotIndex, name) { Skin.prototype.getAttachment = function (slotIndex, name) {
var dictionary = this.attachments[slotIndex]; var dictionary = this.attachments[slotIndex];
return dictionary ? dictionary[name] : null; return dictionary ? dictionary[name] : null;
}; };
Skin.prototype.removeAttachment = function (slotIndex, name) {
var dictionary = this.attachments[slotIndex];
if (dictionary)
dictionary[name] = null;
};
Skin.prototype.getAttachments = function () {
var entries = new Array();
for (var i = 0; i < this.attachments.length; i++) {
var slotAttachments = this.attachments[i];
if (slotAttachments) {
for (var name_2 in slotAttachments) {
var attachment = slotAttachments[name_2];
if (attachment)
entries.push(new SkinEntry(i, name_2, attachment));
}
}
}
return entries;
};
Skin.prototype.getAttachmentsForSlot = function (slotIndex, attachments) {
var slotAttachments = this.attachments[slotIndex];
if (slotAttachments) {
for (var name_3 in slotAttachments) {
var attachment = slotAttachments[name_3];
if (attachment)
attachments.push(new SkinEntry(slotIndex, name_3, attachment));
}
}
};
Skin.prototype.clear = function () {
this.attachments.length = 0;
this.bones.length = 0;
this.constraints.length = 0;
};
Skin.prototype.attachAll = function (skeleton, oldSkin) { Skin.prototype.attachAll = function (skeleton, oldSkin) {
var slotIndex = 0; var slotIndex = 0;
for (var i = 0; i < skeleton.slots.length; i++) { for (var i = 0; i < skeleton.slots.length; i++) {
@ -6533,6 +6655,21 @@ var spine;
VertexAttachment.prototype.applyDeform = function (sourceAttachment) { VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
return this == sourceAttachment; return this == sourceAttachment;
}; };
VertexAttachment.prototype.copyTo = function (attachment) {
if (this.bones != null) {
attachment.bones = new Array(this.bones.length);
spine.Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);
}
else
attachment.bones = null;
if (this.vertices != null) {
attachment.vertices = spine.Utils.newFloatArray(this.vertices.length);
spine.Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
}
else
attachment.vertices = null;
attachment.worldVerticesLength = this.worldVerticesLength;
};
VertexAttachment.nextID = 0; VertexAttachment.nextID = 0;
return VertexAttachment; return VertexAttachment;
}(Attachment)); }(Attachment));
@ -6559,6 +6696,12 @@ var spine;
_this.color = new spine.Color(1, 1, 1, 1); _this.color = new spine.Color(1, 1, 1, 1);
return _this; return _this;
} }
BoundingBoxAttachment.prototype.copy = function () {
var copy = new BoundingBoxAttachment(name);
this.copyTo(copy);
copy.color.setFromColor(this.color);
return copy;
};
return BoundingBoxAttachment; return BoundingBoxAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.BoundingBoxAttachment = BoundingBoxAttachment; spine.BoundingBoxAttachment = BoundingBoxAttachment;
@ -6572,6 +6715,13 @@ var spine;
_this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1); _this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1);
return _this; return _this;
} }
ClippingAttachment.prototype.copy = function () {
var copy = new ClippingAttachment(name);
this.copyTo(copy);
copy.endSlot = this.endSlot;
copy.color.setFromColor(this.color);
return copy;
};
return ClippingAttachment; return ClippingAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.ClippingAttachment = ClippingAttachment; spine.ClippingAttachment = ClippingAttachment;
@ -6665,6 +6815,34 @@ var spine;
this.worldVerticesLength = parentMesh.worldVerticesLength; this.worldVerticesLength = parentMesh.worldVerticesLength;
} }
}; };
MeshAttachment.prototype.copy = function () {
var copy = new MeshAttachment(name);
copy.region = this.region;
copy.path = this.path;
if (this.parentMesh == null) {
this.copyTo(copy);
copy.regionUVs = new Array(this.regionUVs.length);
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
copy.uvs = new Array(this.uvs.length);
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
copy.triangles = new Array(this.triangles.length);
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
copy.color.setFromColor(this.color);
copy.hullLength = this.hullLength;
copy.inheritDeform = this.inheritDeform;
if (this.edges != null) {
copy.edges = new Array(this.edges.length);
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
}
copy.width = this.width;
copy.height = this.height;
}
else {
copy.setParentMesh(this.parentMesh);
copy.updateUVs();
}
return copy;
};
return MeshAttachment; return MeshAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.MeshAttachment = MeshAttachment; spine.MeshAttachment = MeshAttachment;
@ -6680,6 +6858,16 @@ var spine;
_this.color = new spine.Color(1, 1, 1, 1); _this.color = new spine.Color(1, 1, 1, 1);
return _this; return _this;
} }
PathAttachment.prototype.copy = function () {
var copy = new PathAttachment(name);
this.copyTo(copy);
copy.lengths = new Array(this.lengths.length);
spine.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
copy.closed = closed;
copy.constantSpeed = this.constantSpeed;
copy.color.setFromColor(this.color);
return copy;
};
return PathAttachment; return PathAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.PathAttachment = PathAttachment; spine.PathAttachment = PathAttachment;
@ -6704,6 +6892,14 @@ var spine;
var y = cos * bone.c + sin * bone.d; var y = cos * bone.c + sin * bone.d;
return Math.atan2(y, x) * spine.MathUtils.radDeg; return Math.atan2(y, x) * spine.MathUtils.radDeg;
}; };
PointAttachment.prototype.copy = function () {
var copy = new PointAttachment(name);
copy.x = this.x;
copy.y = this.y;
copy.rotation = this.rotation;
copy.color.setFromColor(this.color);
return copy;
};
return PointAttachment; return PointAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.PointAttachment = PointAttachment; spine.PointAttachment = PointAttachment;
@ -6804,6 +7000,23 @@ var spine;
worldVertices[offset] = offsetX * a + offsetY * b + x; worldVertices[offset] = offsetX * a + offsetY * b + x;
worldVertices[offset + 1] = offsetX * c + offsetY * d + y; worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
}; };
RegionAttachment.prototype.copy = function () {
var copy = new RegionAttachment(name);
copy.region = this.region;
copy.rendererObject = this.rendererObject;
copy.path = this.path;
copy.x = this.x;
copy.y = this.y;
copy.scaleX = this.scaleX;
copy.scaleY = this.scaleY;
copy.rotation = this.rotation;
copy.width = this.width;
copy.height = this.height;
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);
spine.Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8);
copy.color.setFromColor(this.color);
return copy;
};
RegionAttachment.OX1 = 0; RegionAttachment.OX1 = 0;
RegionAttachment.OY1 = 1; RegionAttachment.OY1 = 1;
RegionAttachment.OX2 = 2; RegionAttachment.OX2 = 2;

File diff suppressed because one or more lines are too long

View File

@ -771,12 +771,26 @@ declare module spine {
} }
} }
declare module spine { declare module spine {
class SkinEntry {
slotIndex: number;
name: string;
attachment: Attachment;
constructor(slotIndex: number, name: string, attachment: Attachment);
}
class Skin { class Skin {
name: string; name: string;
attachments: Map<Attachment>[]; attachments: Map<Attachment>[];
bones: BoneData[];
constraints: SlotData[];
constructor(name: string); constructor(name: string);
addAttachment(slotIndex: number, name: string, attachment: Attachment): void; setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
addSkin(skin: Skin): void;
copySkin(skin: Skin): void;
getAttachment(slotIndex: number, name: string): Attachment; getAttachment(slotIndex: number, name: string): Attachment;
removeAttachment(slotIndex: number, name: string): void;
getAttachments(): Array<SkinEntry>;
getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
clear(): void;
attachAll(skeleton: Skeleton, oldSkin: Skin): void; attachAll(skeleton: Skeleton, oldSkin: Skin): void;
} }
} }
@ -1081,6 +1095,7 @@ declare module spine {
abstract class Attachment { abstract class Attachment {
name: string; name: string;
constructor(name: string); constructor(name: string);
abstract copy(): Attachment;
} }
abstract class VertexAttachment extends Attachment { abstract class VertexAttachment extends Attachment {
private static nextID; private static nextID;
@ -1091,6 +1106,7 @@ declare module spine {
constructor(name: string); constructor(name: string);
computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void; computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
applyDeform(sourceAttachment: VertexAttachment): boolean; applyDeform(sourceAttachment: VertexAttachment): boolean;
copyTo(attachment: VertexAttachment): void;
} }
} }
declare module spine { declare module spine {
@ -1117,6 +1133,7 @@ declare module spine {
class BoundingBoxAttachment extends VertexAttachment { class BoundingBoxAttachment extends VertexAttachment {
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1124,6 +1141,7 @@ declare module spine {
endSlot: SlotData; endSlot: SlotData;
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1134,7 +1152,10 @@ declare module spine {
uvs: ArrayLike<number>; uvs: ArrayLike<number>;
triangles: Array<number>; triangles: Array<number>;
color: Color; color: Color;
width: number;
height: number;
hullLength: number; hullLength: number;
edges: Array<number>;
private parentMesh; private parentMesh;
inheritDeform: boolean; inheritDeform: boolean;
tempColor: Color; tempColor: Color;
@ -1143,6 +1164,7 @@ declare module spine {
applyDeform(sourceAttachment: VertexAttachment): boolean; applyDeform(sourceAttachment: VertexAttachment): boolean;
getParentMesh(): MeshAttachment; getParentMesh(): MeshAttachment;
setParentMesh(parentMesh: MeshAttachment): void; setParentMesh(parentMesh: MeshAttachment): void;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1152,6 +1174,7 @@ declare module spine {
constantSpeed: boolean; constantSpeed: boolean;
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1163,6 +1186,7 @@ declare module spine {
constructor(name: string); constructor(name: string);
computeWorldPosition(bone: Bone, point: Vector2): Vector2; computeWorldPosition(bone: Bone, point: Vector2): Vector2;
computeWorldRotation(bone: Bone): number; computeWorldRotation(bone: Bone): number;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1225,6 +1249,7 @@ declare module spine {
updateOffset(): void; updateOffset(): void;
setRegion(region: TextureRegion): void; setRegion(region: TextureRegion): void;
computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void; computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {

View File

@ -4675,7 +4675,7 @@ var spine;
for (var entryName in slotMap) { for (var entryName in slotMap) {
var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData); var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData);
if (attachment != null) if (attachment != null)
skin.addAttachment(slotIndex, entryName, attachment); skin.setAttachment(slotIndex, entryName, attachment);
} }
} }
skeletonData.skins.push(skin); skeletonData.skins.push(skin);
@ -4762,6 +4762,8 @@ var spine;
var color = this.getValue(map, "color", null); var color = this.getValue(map, "color", null);
if (color != null) if (color != null)
mesh.color.setFromString(color); mesh.color.setFromString(color);
mesh.width = this.getValue(map, "width", 0) * scale;
mesh.height = this.getValue(map, "height", 0) * scale;
var parent_4 = this.getValue(map, "parent", null); var parent_4 = this.getValue(map, "parent", null);
if (parent_4 != null) { if (parent_4 != null) {
mesh.inheritDeform = this.getValue(map, "deform", true); mesh.inheritDeform = this.getValue(map, "deform", true);
@ -4773,6 +4775,7 @@ var spine;
mesh.triangles = map.triangles; mesh.triangles = map.triangles;
mesh.regionUVs = uvs; mesh.regionUVs = uvs;
mesh.updateUVs(); mesh.updateUVs();
mesh.edges = this.getValue(map, "edges", null);
mesh.hullLength = this.getValue(map, "hull", 0) * 2; mesh.hullLength = this.getValue(map, "hull", 0) * 2;
return mesh; return mesh;
} }
@ -5241,14 +5244,25 @@ var spine;
})(spine || (spine = {})); })(spine || (spine = {}));
var spine; var spine;
(function (spine) { (function (spine) {
var SkinEntry = (function () {
function SkinEntry(slotIndex, name, attachment) {
this.slotIndex = slotIndex;
this.name = name;
this.attachment = attachment;
}
return SkinEntry;
}());
spine.SkinEntry = SkinEntry;
var Skin = (function () { var Skin = (function () {
function Skin(name) { function Skin(name) {
this.attachments = new Array(); this.attachments = new Array();
this.bones = Array();
this.constraints = new Array();
if (name == null) if (name == null)
throw new Error("name cannot be null."); throw new Error("name cannot be null.");
this.name = name; this.name = name;
} }
Skin.prototype.addAttachment = function (slotIndex, name, attachment) { Skin.prototype.setAttachment = function (slotIndex, name, attachment) {
if (attachment == null) if (attachment == null)
throw new Error("attachment cannot be null."); throw new Error("attachment cannot be null.");
var attachments = this.attachments; var attachments = this.attachments;
@ -5258,10 +5272,118 @@ var spine;
attachments[slotIndex] = {}; attachments[slotIndex] = {};
attachments[slotIndex][name] = attachment; attachments[slotIndex][name] = attachment;
}; };
Skin.prototype.addSkin = function (skin) {
for (var i = 0; i < skin.bones.length; i++) {
var bone = skin.bones[i];
var contained = false;
for (var j = 0; j < this.bones.length; j++) {
if (this.bones[j] == bone) {
contained = true;
break;
}
}
if (!contained)
this.bones.push(bone);
}
for (var i = 0; i < skin.constraints.length; i++) {
var constraint = skin.constraints[i];
var contained = false;
for (var j = 0; j < this.constraints.length; j++) {
if (this.constraints[j] == constraint) {
contained = true;
break;
}
}
if (!contained)
this.constraints.push(constraint);
}
var attachments = skin.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment = attachments[i];
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
}
};
Skin.prototype.copySkin = function (skin) {
for (var i = 0; i < skin.bones.length; i++) {
var bone = skin.bones[i];
var contained = false;
for (var j = 0; j < this.bones.length; j++) {
if (this.bones[j] == bone) {
contained = true;
break;
}
}
if (!contained)
this.bones.push(bone);
}
for (var i = 0; i < skin.constraints.length; i++) {
var constraint = skin.constraints[i];
var contained = false;
for (var j = 0; j < this.constraints.length; j++) {
if (this.constraints[j] == constraint) {
contained = true;
break;
}
}
if (!contained)
this.constraints.push(constraint);
}
var attachments = skin.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment = attachments[i];
attachment.attachment = attachment.attachment.copy();
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
}
attachments = this.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment_1 = attachments[i];
if (attachment_1.attachment instanceof spine.MeshAttachment) {
var mesh = attachment_1.attachment;
if (mesh.getParentMesh()) {
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
mesh.updateUVs();
}
}
}
};
Skin.prototype.getAttachment = function (slotIndex, name) { Skin.prototype.getAttachment = function (slotIndex, name) {
var dictionary = this.attachments[slotIndex]; var dictionary = this.attachments[slotIndex];
return dictionary ? dictionary[name] : null; return dictionary ? dictionary[name] : null;
}; };
Skin.prototype.removeAttachment = function (slotIndex, name) {
var dictionary = this.attachments[slotIndex];
if (dictionary)
dictionary[name] = null;
};
Skin.prototype.getAttachments = function () {
var entries = new Array();
for (var i = 0; i < this.attachments.length; i++) {
var slotAttachments = this.attachments[i];
if (slotAttachments) {
for (var name_2 in slotAttachments) {
var attachment = slotAttachments[name_2];
if (attachment)
entries.push(new SkinEntry(i, name_2, attachment));
}
}
}
return entries;
};
Skin.prototype.getAttachmentsForSlot = function (slotIndex, attachments) {
var slotAttachments = this.attachments[slotIndex];
if (slotAttachments) {
for (var name_3 in slotAttachments) {
var attachment = slotAttachments[name_3];
if (attachment)
attachments.push(new SkinEntry(slotIndex, name_3, attachment));
}
}
};
Skin.prototype.clear = function () {
this.attachments.length = 0;
this.bones.length = 0;
this.constraints.length = 0;
};
Skin.prototype.attachAll = function (skeleton, oldSkin) { Skin.prototype.attachAll = function (skeleton, oldSkin) {
var slotIndex = 0; var slotIndex = 0;
for (var i = 0; i < skeleton.slots.length; i++) { for (var i = 0; i < skeleton.slots.length; i++) {
@ -6533,6 +6655,21 @@ var spine;
VertexAttachment.prototype.applyDeform = function (sourceAttachment) { VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
return this == sourceAttachment; return this == sourceAttachment;
}; };
VertexAttachment.prototype.copyTo = function (attachment) {
if (this.bones != null) {
attachment.bones = new Array(this.bones.length);
spine.Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);
}
else
attachment.bones = null;
if (this.vertices != null) {
attachment.vertices = spine.Utils.newFloatArray(this.vertices.length);
spine.Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
}
else
attachment.vertices = null;
attachment.worldVerticesLength = this.worldVerticesLength;
};
VertexAttachment.nextID = 0; VertexAttachment.nextID = 0;
return VertexAttachment; return VertexAttachment;
}(Attachment)); }(Attachment));
@ -6559,6 +6696,12 @@ var spine;
_this.color = new spine.Color(1, 1, 1, 1); _this.color = new spine.Color(1, 1, 1, 1);
return _this; return _this;
} }
BoundingBoxAttachment.prototype.copy = function () {
var copy = new BoundingBoxAttachment(name);
this.copyTo(copy);
copy.color.setFromColor(this.color);
return copy;
};
return BoundingBoxAttachment; return BoundingBoxAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.BoundingBoxAttachment = BoundingBoxAttachment; spine.BoundingBoxAttachment = BoundingBoxAttachment;
@ -6572,6 +6715,13 @@ var spine;
_this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1); _this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1);
return _this; return _this;
} }
ClippingAttachment.prototype.copy = function () {
var copy = new ClippingAttachment(name);
this.copyTo(copy);
copy.endSlot = this.endSlot;
copy.color.setFromColor(this.color);
return copy;
};
return ClippingAttachment; return ClippingAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.ClippingAttachment = ClippingAttachment; spine.ClippingAttachment = ClippingAttachment;
@ -6665,6 +6815,34 @@ var spine;
this.worldVerticesLength = parentMesh.worldVerticesLength; this.worldVerticesLength = parentMesh.worldVerticesLength;
} }
}; };
MeshAttachment.prototype.copy = function () {
var copy = new MeshAttachment(name);
copy.region = this.region;
copy.path = this.path;
if (this.parentMesh == null) {
this.copyTo(copy);
copy.regionUVs = new Array(this.regionUVs.length);
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
copy.uvs = new Array(this.uvs.length);
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
copy.triangles = new Array(this.triangles.length);
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
copy.color.setFromColor(this.color);
copy.hullLength = this.hullLength;
copy.inheritDeform = this.inheritDeform;
if (this.edges != null) {
copy.edges = new Array(this.edges.length);
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
}
copy.width = this.width;
copy.height = this.height;
}
else {
copy.setParentMesh(this.parentMesh);
copy.updateUVs();
}
return copy;
};
return MeshAttachment; return MeshAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.MeshAttachment = MeshAttachment; spine.MeshAttachment = MeshAttachment;
@ -6680,6 +6858,16 @@ var spine;
_this.color = new spine.Color(1, 1, 1, 1); _this.color = new spine.Color(1, 1, 1, 1);
return _this; return _this;
} }
PathAttachment.prototype.copy = function () {
var copy = new PathAttachment(name);
this.copyTo(copy);
copy.lengths = new Array(this.lengths.length);
spine.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
copy.closed = closed;
copy.constantSpeed = this.constantSpeed;
copy.color.setFromColor(this.color);
return copy;
};
return PathAttachment; return PathAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.PathAttachment = PathAttachment; spine.PathAttachment = PathAttachment;
@ -6704,6 +6892,14 @@ var spine;
var y = cos * bone.c + sin * bone.d; var y = cos * bone.c + sin * bone.d;
return Math.atan2(y, x) * spine.MathUtils.radDeg; return Math.atan2(y, x) * spine.MathUtils.radDeg;
}; };
PointAttachment.prototype.copy = function () {
var copy = new PointAttachment(name);
copy.x = this.x;
copy.y = this.y;
copy.rotation = this.rotation;
copy.color.setFromColor(this.color);
return copy;
};
return PointAttachment; return PointAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.PointAttachment = PointAttachment; spine.PointAttachment = PointAttachment;
@ -6804,6 +7000,23 @@ var spine;
worldVertices[offset] = offsetX * a + offsetY * b + x; worldVertices[offset] = offsetX * a + offsetY * b + x;
worldVertices[offset + 1] = offsetX * c + offsetY * d + y; worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
}; };
RegionAttachment.prototype.copy = function () {
var copy = new RegionAttachment(name);
copy.region = this.region;
copy.rendererObject = this.rendererObject;
copy.path = this.path;
copy.x = this.x;
copy.y = this.y;
copy.scaleX = this.scaleX;
copy.scaleY = this.scaleY;
copy.rotation = this.rotation;
copy.width = this.width;
copy.height = this.height;
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);
spine.Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8);
copy.color.setFromColor(this.color);
return copy;
};
RegionAttachment.OX1 = 0; RegionAttachment.OX1 = 0;
RegionAttachment.OY1 = 1; RegionAttachment.OY1 = 1;
RegionAttachment.OX2 = 2; RegionAttachment.OX2 = 2;

File diff suppressed because one or more lines are too long

View File

@ -771,12 +771,26 @@ declare module spine {
} }
} }
declare module spine { declare module spine {
class SkinEntry {
slotIndex: number;
name: string;
attachment: Attachment;
constructor(slotIndex: number, name: string, attachment: Attachment);
}
class Skin { class Skin {
name: string; name: string;
attachments: Map<Attachment>[]; attachments: Map<Attachment>[];
bones: BoneData[];
constraints: SlotData[];
constructor(name: string); constructor(name: string);
addAttachment(slotIndex: number, name: string, attachment: Attachment): void; setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
addSkin(skin: Skin): void;
copySkin(skin: Skin): void;
getAttachment(slotIndex: number, name: string): Attachment; getAttachment(slotIndex: number, name: string): Attachment;
removeAttachment(slotIndex: number, name: string): void;
getAttachments(): Array<SkinEntry>;
getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
clear(): void;
attachAll(skeleton: Skeleton, oldSkin: Skin): void; attachAll(skeleton: Skeleton, oldSkin: Skin): void;
} }
} }
@ -1081,6 +1095,7 @@ declare module spine {
abstract class Attachment { abstract class Attachment {
name: string; name: string;
constructor(name: string); constructor(name: string);
abstract copy(): Attachment;
} }
abstract class VertexAttachment extends Attachment { abstract class VertexAttachment extends Attachment {
private static nextID; private static nextID;
@ -1091,6 +1106,7 @@ declare module spine {
constructor(name: string); constructor(name: string);
computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void; computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
applyDeform(sourceAttachment: VertexAttachment): boolean; applyDeform(sourceAttachment: VertexAttachment): boolean;
copyTo(attachment: VertexAttachment): void;
} }
} }
declare module spine { declare module spine {
@ -1117,6 +1133,7 @@ declare module spine {
class BoundingBoxAttachment extends VertexAttachment { class BoundingBoxAttachment extends VertexAttachment {
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1124,6 +1141,7 @@ declare module spine {
endSlot: SlotData; endSlot: SlotData;
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1134,7 +1152,10 @@ declare module spine {
uvs: ArrayLike<number>; uvs: ArrayLike<number>;
triangles: Array<number>; triangles: Array<number>;
color: Color; color: Color;
width: number;
height: number;
hullLength: number; hullLength: number;
edges: Array<number>;
private parentMesh; private parentMesh;
inheritDeform: boolean; inheritDeform: boolean;
tempColor: Color; tempColor: Color;
@ -1143,6 +1164,7 @@ declare module spine {
applyDeform(sourceAttachment: VertexAttachment): boolean; applyDeform(sourceAttachment: VertexAttachment): boolean;
getParentMesh(): MeshAttachment; getParentMesh(): MeshAttachment;
setParentMesh(parentMesh: MeshAttachment): void; setParentMesh(parentMesh: MeshAttachment): void;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1152,6 +1174,7 @@ declare module spine {
constantSpeed: boolean; constantSpeed: boolean;
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1163,6 +1186,7 @@ declare module spine {
constructor(name: string); constructor(name: string);
computeWorldPosition(bone: Bone, point: Vector2): Vector2; computeWorldPosition(bone: Bone, point: Vector2): Vector2;
computeWorldRotation(bone: Bone): number; computeWorldRotation(bone: Bone): number;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1225,6 +1249,7 @@ declare module spine {
updateOffset(): void; updateOffset(): void;
setRegion(region: TextureRegion): void; setRegion(region: TextureRegion): void;
computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void; computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {

View File

@ -4675,7 +4675,7 @@ var spine;
for (var entryName in slotMap) { for (var entryName in slotMap) {
var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData); var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData);
if (attachment != null) if (attachment != null)
skin.addAttachment(slotIndex, entryName, attachment); skin.setAttachment(slotIndex, entryName, attachment);
} }
} }
skeletonData.skins.push(skin); skeletonData.skins.push(skin);
@ -4762,6 +4762,8 @@ var spine;
var color = this.getValue(map, "color", null); var color = this.getValue(map, "color", null);
if (color != null) if (color != null)
mesh.color.setFromString(color); mesh.color.setFromString(color);
mesh.width = this.getValue(map, "width", 0) * scale;
mesh.height = this.getValue(map, "height", 0) * scale;
var parent_4 = this.getValue(map, "parent", null); var parent_4 = this.getValue(map, "parent", null);
if (parent_4 != null) { if (parent_4 != null) {
mesh.inheritDeform = this.getValue(map, "deform", true); mesh.inheritDeform = this.getValue(map, "deform", true);
@ -4773,6 +4775,7 @@ var spine;
mesh.triangles = map.triangles; mesh.triangles = map.triangles;
mesh.regionUVs = uvs; mesh.regionUVs = uvs;
mesh.updateUVs(); mesh.updateUVs();
mesh.edges = this.getValue(map, "edges", null);
mesh.hullLength = this.getValue(map, "hull", 0) * 2; mesh.hullLength = this.getValue(map, "hull", 0) * 2;
return mesh; return mesh;
} }
@ -5241,14 +5244,25 @@ var spine;
})(spine || (spine = {})); })(spine || (spine = {}));
var spine; var spine;
(function (spine) { (function (spine) {
var SkinEntry = (function () {
function SkinEntry(slotIndex, name, attachment) {
this.slotIndex = slotIndex;
this.name = name;
this.attachment = attachment;
}
return SkinEntry;
}());
spine.SkinEntry = SkinEntry;
var Skin = (function () { var Skin = (function () {
function Skin(name) { function Skin(name) {
this.attachments = new Array(); this.attachments = new Array();
this.bones = Array();
this.constraints = new Array();
if (name == null) if (name == null)
throw new Error("name cannot be null."); throw new Error("name cannot be null.");
this.name = name; this.name = name;
} }
Skin.prototype.addAttachment = function (slotIndex, name, attachment) { Skin.prototype.setAttachment = function (slotIndex, name, attachment) {
if (attachment == null) if (attachment == null)
throw new Error("attachment cannot be null."); throw new Error("attachment cannot be null.");
var attachments = this.attachments; var attachments = this.attachments;
@ -5258,10 +5272,118 @@ var spine;
attachments[slotIndex] = {}; attachments[slotIndex] = {};
attachments[slotIndex][name] = attachment; attachments[slotIndex][name] = attachment;
}; };
Skin.prototype.addSkin = function (skin) {
for (var i = 0; i < skin.bones.length; i++) {
var bone = skin.bones[i];
var contained = false;
for (var j = 0; j < this.bones.length; j++) {
if (this.bones[j] == bone) {
contained = true;
break;
}
}
if (!contained)
this.bones.push(bone);
}
for (var i = 0; i < skin.constraints.length; i++) {
var constraint = skin.constraints[i];
var contained = false;
for (var j = 0; j < this.constraints.length; j++) {
if (this.constraints[j] == constraint) {
contained = true;
break;
}
}
if (!contained)
this.constraints.push(constraint);
}
var attachments = skin.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment = attachments[i];
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
}
};
Skin.prototype.copySkin = function (skin) {
for (var i = 0; i < skin.bones.length; i++) {
var bone = skin.bones[i];
var contained = false;
for (var j = 0; j < this.bones.length; j++) {
if (this.bones[j] == bone) {
contained = true;
break;
}
}
if (!contained)
this.bones.push(bone);
}
for (var i = 0; i < skin.constraints.length; i++) {
var constraint = skin.constraints[i];
var contained = false;
for (var j = 0; j < this.constraints.length; j++) {
if (this.constraints[j] == constraint) {
contained = true;
break;
}
}
if (!contained)
this.constraints.push(constraint);
}
var attachments = skin.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment = attachments[i];
attachment.attachment = attachment.attachment.copy();
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
}
attachments = this.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment_1 = attachments[i];
if (attachment_1.attachment instanceof spine.MeshAttachment) {
var mesh = attachment_1.attachment;
if (mesh.getParentMesh()) {
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
mesh.updateUVs();
}
}
}
};
Skin.prototype.getAttachment = function (slotIndex, name) { Skin.prototype.getAttachment = function (slotIndex, name) {
var dictionary = this.attachments[slotIndex]; var dictionary = this.attachments[slotIndex];
return dictionary ? dictionary[name] : null; return dictionary ? dictionary[name] : null;
}; };
Skin.prototype.removeAttachment = function (slotIndex, name) {
var dictionary = this.attachments[slotIndex];
if (dictionary)
dictionary[name] = null;
};
Skin.prototype.getAttachments = function () {
var entries = new Array();
for (var i = 0; i < this.attachments.length; i++) {
var slotAttachments = this.attachments[i];
if (slotAttachments) {
for (var name_2 in slotAttachments) {
var attachment = slotAttachments[name_2];
if (attachment)
entries.push(new SkinEntry(i, name_2, attachment));
}
}
}
return entries;
};
Skin.prototype.getAttachmentsForSlot = function (slotIndex, attachments) {
var slotAttachments = this.attachments[slotIndex];
if (slotAttachments) {
for (var name_3 in slotAttachments) {
var attachment = slotAttachments[name_3];
if (attachment)
attachments.push(new SkinEntry(slotIndex, name_3, attachment));
}
}
};
Skin.prototype.clear = function () {
this.attachments.length = 0;
this.bones.length = 0;
this.constraints.length = 0;
};
Skin.prototype.attachAll = function (skeleton, oldSkin) { Skin.prototype.attachAll = function (skeleton, oldSkin) {
var slotIndex = 0; var slotIndex = 0;
for (var i = 0; i < skeleton.slots.length; i++) { for (var i = 0; i < skeleton.slots.length; i++) {
@ -6533,6 +6655,21 @@ var spine;
VertexAttachment.prototype.applyDeform = function (sourceAttachment) { VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
return this == sourceAttachment; return this == sourceAttachment;
}; };
VertexAttachment.prototype.copyTo = function (attachment) {
if (this.bones != null) {
attachment.bones = new Array(this.bones.length);
spine.Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);
}
else
attachment.bones = null;
if (this.vertices != null) {
attachment.vertices = spine.Utils.newFloatArray(this.vertices.length);
spine.Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
}
else
attachment.vertices = null;
attachment.worldVerticesLength = this.worldVerticesLength;
};
VertexAttachment.nextID = 0; VertexAttachment.nextID = 0;
return VertexAttachment; return VertexAttachment;
}(Attachment)); }(Attachment));
@ -6559,6 +6696,12 @@ var spine;
_this.color = new spine.Color(1, 1, 1, 1); _this.color = new spine.Color(1, 1, 1, 1);
return _this; return _this;
} }
BoundingBoxAttachment.prototype.copy = function () {
var copy = new BoundingBoxAttachment(name);
this.copyTo(copy);
copy.color.setFromColor(this.color);
return copy;
};
return BoundingBoxAttachment; return BoundingBoxAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.BoundingBoxAttachment = BoundingBoxAttachment; spine.BoundingBoxAttachment = BoundingBoxAttachment;
@ -6572,6 +6715,13 @@ var spine;
_this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1); _this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1);
return _this; return _this;
} }
ClippingAttachment.prototype.copy = function () {
var copy = new ClippingAttachment(name);
this.copyTo(copy);
copy.endSlot = this.endSlot;
copy.color.setFromColor(this.color);
return copy;
};
return ClippingAttachment; return ClippingAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.ClippingAttachment = ClippingAttachment; spine.ClippingAttachment = ClippingAttachment;
@ -6665,6 +6815,34 @@ var spine;
this.worldVerticesLength = parentMesh.worldVerticesLength; this.worldVerticesLength = parentMesh.worldVerticesLength;
} }
}; };
MeshAttachment.prototype.copy = function () {
var copy = new MeshAttachment(name);
copy.region = this.region;
copy.path = this.path;
if (this.parentMesh == null) {
this.copyTo(copy);
copy.regionUVs = new Array(this.regionUVs.length);
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
copy.uvs = new Array(this.uvs.length);
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
copy.triangles = new Array(this.triangles.length);
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
copy.color.setFromColor(this.color);
copy.hullLength = this.hullLength;
copy.inheritDeform = this.inheritDeform;
if (this.edges != null) {
copy.edges = new Array(this.edges.length);
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
}
copy.width = this.width;
copy.height = this.height;
}
else {
copy.setParentMesh(this.parentMesh);
copy.updateUVs();
}
return copy;
};
return MeshAttachment; return MeshAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.MeshAttachment = MeshAttachment; spine.MeshAttachment = MeshAttachment;
@ -6680,6 +6858,16 @@ var spine;
_this.color = new spine.Color(1, 1, 1, 1); _this.color = new spine.Color(1, 1, 1, 1);
return _this; return _this;
} }
PathAttachment.prototype.copy = function () {
var copy = new PathAttachment(name);
this.copyTo(copy);
copy.lengths = new Array(this.lengths.length);
spine.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
copy.closed = closed;
copy.constantSpeed = this.constantSpeed;
copy.color.setFromColor(this.color);
return copy;
};
return PathAttachment; return PathAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.PathAttachment = PathAttachment; spine.PathAttachment = PathAttachment;
@ -6704,6 +6892,14 @@ var spine;
var y = cos * bone.c + sin * bone.d; var y = cos * bone.c + sin * bone.d;
return Math.atan2(y, x) * spine.MathUtils.radDeg; return Math.atan2(y, x) * spine.MathUtils.radDeg;
}; };
PointAttachment.prototype.copy = function () {
var copy = new PointAttachment(name);
copy.x = this.x;
copy.y = this.y;
copy.rotation = this.rotation;
copy.color.setFromColor(this.color);
return copy;
};
return PointAttachment; return PointAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.PointAttachment = PointAttachment; spine.PointAttachment = PointAttachment;
@ -6804,6 +7000,23 @@ var spine;
worldVertices[offset] = offsetX * a + offsetY * b + x; worldVertices[offset] = offsetX * a + offsetY * b + x;
worldVertices[offset + 1] = offsetX * c + offsetY * d + y; worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
}; };
RegionAttachment.prototype.copy = function () {
var copy = new RegionAttachment(name);
copy.region = this.region;
copy.rendererObject = this.rendererObject;
copy.path = this.path;
copy.x = this.x;
copy.y = this.y;
copy.scaleX = this.scaleX;
copy.scaleY = this.scaleY;
copy.rotation = this.rotation;
copy.width = this.width;
copy.height = this.height;
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);
spine.Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8);
copy.color.setFromColor(this.color);
return copy;
};
RegionAttachment.OX1 = 0; RegionAttachment.OX1 = 0;
RegionAttachment.OY1 = 1; RegionAttachment.OY1 = 1;
RegionAttachment.OX2 = 2; RegionAttachment.OX2 = 2;

File diff suppressed because one or more lines are too long

View File

@ -771,12 +771,26 @@ declare module spine {
} }
} }
declare module spine { declare module spine {
class SkinEntry {
slotIndex: number;
name: string;
attachment: Attachment;
constructor(slotIndex: number, name: string, attachment: Attachment);
}
class Skin { class Skin {
name: string; name: string;
attachments: Map<Attachment>[]; attachments: Map<Attachment>[];
bones: BoneData[];
constraints: SlotData[];
constructor(name: string); constructor(name: string);
addAttachment(slotIndex: number, name: string, attachment: Attachment): void; setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
addSkin(skin: Skin): void;
copySkin(skin: Skin): void;
getAttachment(slotIndex: number, name: string): Attachment; getAttachment(slotIndex: number, name: string): Attachment;
removeAttachment(slotIndex: number, name: string): void;
getAttachments(): Array<SkinEntry>;
getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
clear(): void;
attachAll(skeleton: Skeleton, oldSkin: Skin): void; attachAll(skeleton: Skeleton, oldSkin: Skin): void;
} }
} }
@ -1081,6 +1095,7 @@ declare module spine {
abstract class Attachment { abstract class Attachment {
name: string; name: string;
constructor(name: string); constructor(name: string);
abstract copy(): Attachment;
} }
abstract class VertexAttachment extends Attachment { abstract class VertexAttachment extends Attachment {
private static nextID; private static nextID;
@ -1091,6 +1106,7 @@ declare module spine {
constructor(name: string); constructor(name: string);
computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void; computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
applyDeform(sourceAttachment: VertexAttachment): boolean; applyDeform(sourceAttachment: VertexAttachment): boolean;
copyTo(attachment: VertexAttachment): void;
} }
} }
declare module spine { declare module spine {
@ -1117,6 +1133,7 @@ declare module spine {
class BoundingBoxAttachment extends VertexAttachment { class BoundingBoxAttachment extends VertexAttachment {
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1124,6 +1141,7 @@ declare module spine {
endSlot: SlotData; endSlot: SlotData;
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1134,7 +1152,10 @@ declare module spine {
uvs: ArrayLike<number>; uvs: ArrayLike<number>;
triangles: Array<number>; triangles: Array<number>;
color: Color; color: Color;
width: number;
height: number;
hullLength: number; hullLength: number;
edges: Array<number>;
private parentMesh; private parentMesh;
inheritDeform: boolean; inheritDeform: boolean;
tempColor: Color; tempColor: Color;
@ -1143,6 +1164,7 @@ declare module spine {
applyDeform(sourceAttachment: VertexAttachment): boolean; applyDeform(sourceAttachment: VertexAttachment): boolean;
getParentMesh(): MeshAttachment; getParentMesh(): MeshAttachment;
setParentMesh(parentMesh: MeshAttachment): void; setParentMesh(parentMesh: MeshAttachment): void;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1152,6 +1174,7 @@ declare module spine {
constantSpeed: boolean; constantSpeed: boolean;
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1163,6 +1186,7 @@ declare module spine {
constructor(name: string); constructor(name: string);
computeWorldPosition(bone: Bone, point: Vector2): Vector2; computeWorldPosition(bone: Bone, point: Vector2): Vector2;
computeWorldRotation(bone: Bone): number; computeWorldRotation(bone: Bone): number;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1225,6 +1249,7 @@ declare module spine {
updateOffset(): void; updateOffset(): void;
setRegion(region: TextureRegion): void; setRegion(region: TextureRegion): void;
computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void; computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {

View File

@ -4675,7 +4675,7 @@ var spine;
for (var entryName in slotMap) { for (var entryName in slotMap) {
var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData); var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData);
if (attachment != null) if (attachment != null)
skin.addAttachment(slotIndex, entryName, attachment); skin.setAttachment(slotIndex, entryName, attachment);
} }
} }
skeletonData.skins.push(skin); skeletonData.skins.push(skin);
@ -4762,6 +4762,8 @@ var spine;
var color = this.getValue(map, "color", null); var color = this.getValue(map, "color", null);
if (color != null) if (color != null)
mesh.color.setFromString(color); mesh.color.setFromString(color);
mesh.width = this.getValue(map, "width", 0) * scale;
mesh.height = this.getValue(map, "height", 0) * scale;
var parent_4 = this.getValue(map, "parent", null); var parent_4 = this.getValue(map, "parent", null);
if (parent_4 != null) { if (parent_4 != null) {
mesh.inheritDeform = this.getValue(map, "deform", true); mesh.inheritDeform = this.getValue(map, "deform", true);
@ -4773,6 +4775,7 @@ var spine;
mesh.triangles = map.triangles; mesh.triangles = map.triangles;
mesh.regionUVs = uvs; mesh.regionUVs = uvs;
mesh.updateUVs(); mesh.updateUVs();
mesh.edges = this.getValue(map, "edges", null);
mesh.hullLength = this.getValue(map, "hull", 0) * 2; mesh.hullLength = this.getValue(map, "hull", 0) * 2;
return mesh; return mesh;
} }
@ -5241,14 +5244,25 @@ var spine;
})(spine || (spine = {})); })(spine || (spine = {}));
var spine; var spine;
(function (spine) { (function (spine) {
var SkinEntry = (function () {
function SkinEntry(slotIndex, name, attachment) {
this.slotIndex = slotIndex;
this.name = name;
this.attachment = attachment;
}
return SkinEntry;
}());
spine.SkinEntry = SkinEntry;
var Skin = (function () { var Skin = (function () {
function Skin(name) { function Skin(name) {
this.attachments = new Array(); this.attachments = new Array();
this.bones = Array();
this.constraints = new Array();
if (name == null) if (name == null)
throw new Error("name cannot be null."); throw new Error("name cannot be null.");
this.name = name; this.name = name;
} }
Skin.prototype.addAttachment = function (slotIndex, name, attachment) { Skin.prototype.setAttachment = function (slotIndex, name, attachment) {
if (attachment == null) if (attachment == null)
throw new Error("attachment cannot be null."); throw new Error("attachment cannot be null.");
var attachments = this.attachments; var attachments = this.attachments;
@ -5258,10 +5272,118 @@ var spine;
attachments[slotIndex] = {}; attachments[slotIndex] = {};
attachments[slotIndex][name] = attachment; attachments[slotIndex][name] = attachment;
}; };
Skin.prototype.addSkin = function (skin) {
for (var i = 0; i < skin.bones.length; i++) {
var bone = skin.bones[i];
var contained = false;
for (var j = 0; j < this.bones.length; j++) {
if (this.bones[j] == bone) {
contained = true;
break;
}
}
if (!contained)
this.bones.push(bone);
}
for (var i = 0; i < skin.constraints.length; i++) {
var constraint = skin.constraints[i];
var contained = false;
for (var j = 0; j < this.constraints.length; j++) {
if (this.constraints[j] == constraint) {
contained = true;
break;
}
}
if (!contained)
this.constraints.push(constraint);
}
var attachments = skin.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment = attachments[i];
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
}
};
Skin.prototype.copySkin = function (skin) {
for (var i = 0; i < skin.bones.length; i++) {
var bone = skin.bones[i];
var contained = false;
for (var j = 0; j < this.bones.length; j++) {
if (this.bones[j] == bone) {
contained = true;
break;
}
}
if (!contained)
this.bones.push(bone);
}
for (var i = 0; i < skin.constraints.length; i++) {
var constraint = skin.constraints[i];
var contained = false;
for (var j = 0; j < this.constraints.length; j++) {
if (this.constraints[j] == constraint) {
contained = true;
break;
}
}
if (!contained)
this.constraints.push(constraint);
}
var attachments = skin.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment = attachments[i];
attachment.attachment = attachment.attachment.copy();
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
}
attachments = this.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment_1 = attachments[i];
if (attachment_1.attachment instanceof spine.MeshAttachment) {
var mesh = attachment_1.attachment;
if (mesh.getParentMesh()) {
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
mesh.updateUVs();
}
}
}
};
Skin.prototype.getAttachment = function (slotIndex, name) { Skin.prototype.getAttachment = function (slotIndex, name) {
var dictionary = this.attachments[slotIndex]; var dictionary = this.attachments[slotIndex];
return dictionary ? dictionary[name] : null; return dictionary ? dictionary[name] : null;
}; };
Skin.prototype.removeAttachment = function (slotIndex, name) {
var dictionary = this.attachments[slotIndex];
if (dictionary)
dictionary[name] = null;
};
Skin.prototype.getAttachments = function () {
var entries = new Array();
for (var i = 0; i < this.attachments.length; i++) {
var slotAttachments = this.attachments[i];
if (slotAttachments) {
for (var name_2 in slotAttachments) {
var attachment = slotAttachments[name_2];
if (attachment)
entries.push(new SkinEntry(i, name_2, attachment));
}
}
}
return entries;
};
Skin.prototype.getAttachmentsForSlot = function (slotIndex, attachments) {
var slotAttachments = this.attachments[slotIndex];
if (slotAttachments) {
for (var name_3 in slotAttachments) {
var attachment = slotAttachments[name_3];
if (attachment)
attachments.push(new SkinEntry(slotIndex, name_3, attachment));
}
}
};
Skin.prototype.clear = function () {
this.attachments.length = 0;
this.bones.length = 0;
this.constraints.length = 0;
};
Skin.prototype.attachAll = function (skeleton, oldSkin) { Skin.prototype.attachAll = function (skeleton, oldSkin) {
var slotIndex = 0; var slotIndex = 0;
for (var i = 0; i < skeleton.slots.length; i++) { for (var i = 0; i < skeleton.slots.length; i++) {
@ -6533,6 +6655,21 @@ var spine;
VertexAttachment.prototype.applyDeform = function (sourceAttachment) { VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
return this == sourceAttachment; return this == sourceAttachment;
}; };
VertexAttachment.prototype.copyTo = function (attachment) {
if (this.bones != null) {
attachment.bones = new Array(this.bones.length);
spine.Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);
}
else
attachment.bones = null;
if (this.vertices != null) {
attachment.vertices = spine.Utils.newFloatArray(this.vertices.length);
spine.Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
}
else
attachment.vertices = null;
attachment.worldVerticesLength = this.worldVerticesLength;
};
VertexAttachment.nextID = 0; VertexAttachment.nextID = 0;
return VertexAttachment; return VertexAttachment;
}(Attachment)); }(Attachment));
@ -6559,6 +6696,12 @@ var spine;
_this.color = new spine.Color(1, 1, 1, 1); _this.color = new spine.Color(1, 1, 1, 1);
return _this; return _this;
} }
BoundingBoxAttachment.prototype.copy = function () {
var copy = new BoundingBoxAttachment(name);
this.copyTo(copy);
copy.color.setFromColor(this.color);
return copy;
};
return BoundingBoxAttachment; return BoundingBoxAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.BoundingBoxAttachment = BoundingBoxAttachment; spine.BoundingBoxAttachment = BoundingBoxAttachment;
@ -6572,6 +6715,13 @@ var spine;
_this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1); _this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1);
return _this; return _this;
} }
ClippingAttachment.prototype.copy = function () {
var copy = new ClippingAttachment(name);
this.copyTo(copy);
copy.endSlot = this.endSlot;
copy.color.setFromColor(this.color);
return copy;
};
return ClippingAttachment; return ClippingAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.ClippingAttachment = ClippingAttachment; spine.ClippingAttachment = ClippingAttachment;
@ -6665,6 +6815,34 @@ var spine;
this.worldVerticesLength = parentMesh.worldVerticesLength; this.worldVerticesLength = parentMesh.worldVerticesLength;
} }
}; };
MeshAttachment.prototype.copy = function () {
var copy = new MeshAttachment(name);
copy.region = this.region;
copy.path = this.path;
if (this.parentMesh == null) {
this.copyTo(copy);
copy.regionUVs = new Array(this.regionUVs.length);
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
copy.uvs = new Array(this.uvs.length);
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
copy.triangles = new Array(this.triangles.length);
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
copy.color.setFromColor(this.color);
copy.hullLength = this.hullLength;
copy.inheritDeform = this.inheritDeform;
if (this.edges != null) {
copy.edges = new Array(this.edges.length);
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
}
copy.width = this.width;
copy.height = this.height;
}
else {
copy.setParentMesh(this.parentMesh);
copy.updateUVs();
}
return copy;
};
return MeshAttachment; return MeshAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.MeshAttachment = MeshAttachment; spine.MeshAttachment = MeshAttachment;
@ -6680,6 +6858,16 @@ var spine;
_this.color = new spine.Color(1, 1, 1, 1); _this.color = new spine.Color(1, 1, 1, 1);
return _this; return _this;
} }
PathAttachment.prototype.copy = function () {
var copy = new PathAttachment(name);
this.copyTo(copy);
copy.lengths = new Array(this.lengths.length);
spine.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
copy.closed = closed;
copy.constantSpeed = this.constantSpeed;
copy.color.setFromColor(this.color);
return copy;
};
return PathAttachment; return PathAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.PathAttachment = PathAttachment; spine.PathAttachment = PathAttachment;
@ -6704,6 +6892,14 @@ var spine;
var y = cos * bone.c + sin * bone.d; var y = cos * bone.c + sin * bone.d;
return Math.atan2(y, x) * spine.MathUtils.radDeg; return Math.atan2(y, x) * spine.MathUtils.radDeg;
}; };
PointAttachment.prototype.copy = function () {
var copy = new PointAttachment(name);
copy.x = this.x;
copy.y = this.y;
copy.rotation = this.rotation;
copy.color.setFromColor(this.color);
return copy;
};
return PointAttachment; return PointAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.PointAttachment = PointAttachment; spine.PointAttachment = PointAttachment;
@ -6804,6 +7000,23 @@ var spine;
worldVertices[offset] = offsetX * a + offsetY * b + x; worldVertices[offset] = offsetX * a + offsetY * b + x;
worldVertices[offset + 1] = offsetX * c + offsetY * d + y; worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
}; };
RegionAttachment.prototype.copy = function () {
var copy = new RegionAttachment(name);
copy.region = this.region;
copy.rendererObject = this.rendererObject;
copy.path = this.path;
copy.x = this.x;
copy.y = this.y;
copy.scaleX = this.scaleX;
copy.scaleY = this.scaleY;
copy.rotation = this.rotation;
copy.width = this.width;
copy.height = this.height;
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);
spine.Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8);
copy.color.setFromColor(this.color);
return copy;
};
RegionAttachment.OX1 = 0; RegionAttachment.OX1 = 0;
RegionAttachment.OY1 = 1; RegionAttachment.OY1 = 1;
RegionAttachment.OX2 = 2; RegionAttachment.OX2 = 2;

File diff suppressed because one or more lines are too long

View File

@ -771,12 +771,26 @@ declare module spine {
} }
} }
declare module spine { declare module spine {
class SkinEntry {
slotIndex: number;
name: string;
attachment: Attachment;
constructor(slotIndex: number, name: string, attachment: Attachment);
}
class Skin { class Skin {
name: string; name: string;
attachments: Map<Attachment>[]; attachments: Map<Attachment>[];
bones: BoneData[];
constraints: SlotData[];
constructor(name: string); constructor(name: string);
addAttachment(slotIndex: number, name: string, attachment: Attachment): void; setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
addSkin(skin: Skin): void;
copySkin(skin: Skin): void;
getAttachment(slotIndex: number, name: string): Attachment; getAttachment(slotIndex: number, name: string): Attachment;
removeAttachment(slotIndex: number, name: string): void;
getAttachments(): Array<SkinEntry>;
getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
clear(): void;
attachAll(skeleton: Skeleton, oldSkin: Skin): void; attachAll(skeleton: Skeleton, oldSkin: Skin): void;
} }
} }
@ -1081,6 +1095,7 @@ declare module spine {
abstract class Attachment { abstract class Attachment {
name: string; name: string;
constructor(name: string); constructor(name: string);
abstract copy(): Attachment;
} }
abstract class VertexAttachment extends Attachment { abstract class VertexAttachment extends Attachment {
private static nextID; private static nextID;
@ -1091,6 +1106,7 @@ declare module spine {
constructor(name: string); constructor(name: string);
computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void; computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
applyDeform(sourceAttachment: VertexAttachment): boolean; applyDeform(sourceAttachment: VertexAttachment): boolean;
copyTo(attachment: VertexAttachment): void;
} }
} }
declare module spine { declare module spine {
@ -1117,6 +1133,7 @@ declare module spine {
class BoundingBoxAttachment extends VertexAttachment { class BoundingBoxAttachment extends VertexAttachment {
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1124,6 +1141,7 @@ declare module spine {
endSlot: SlotData; endSlot: SlotData;
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1134,7 +1152,10 @@ declare module spine {
uvs: ArrayLike<number>; uvs: ArrayLike<number>;
triangles: Array<number>; triangles: Array<number>;
color: Color; color: Color;
width: number;
height: number;
hullLength: number; hullLength: number;
edges: Array<number>;
private parentMesh; private parentMesh;
inheritDeform: boolean; inheritDeform: boolean;
tempColor: Color; tempColor: Color;
@ -1143,6 +1164,7 @@ declare module spine {
applyDeform(sourceAttachment: VertexAttachment): boolean; applyDeform(sourceAttachment: VertexAttachment): boolean;
getParentMesh(): MeshAttachment; getParentMesh(): MeshAttachment;
setParentMesh(parentMesh: MeshAttachment): void; setParentMesh(parentMesh: MeshAttachment): void;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1152,6 +1174,7 @@ declare module spine {
constantSpeed: boolean; constantSpeed: boolean;
color: Color; color: Color;
constructor(name: string); constructor(name: string);
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1163,6 +1186,7 @@ declare module spine {
constructor(name: string); constructor(name: string);
computeWorldPosition(bone: Bone, point: Vector2): Vector2; computeWorldPosition(bone: Bone, point: Vector2): Vector2;
computeWorldRotation(bone: Bone): number; computeWorldRotation(bone: Bone): number;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {
@ -1225,6 +1249,7 @@ declare module spine {
updateOffset(): void; updateOffset(): void;
setRegion(region: TextureRegion): void; setRegion(region: TextureRegion): void;
computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void; computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
copy(): Attachment;
} }
} }
declare module spine { declare module spine {

View File

@ -4675,7 +4675,7 @@ var spine;
for (var entryName in slotMap) { for (var entryName in slotMap) {
var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData); var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData);
if (attachment != null) if (attachment != null)
skin.addAttachment(slotIndex, entryName, attachment); skin.setAttachment(slotIndex, entryName, attachment);
} }
} }
skeletonData.skins.push(skin); skeletonData.skins.push(skin);
@ -4762,6 +4762,8 @@ var spine;
var color = this.getValue(map, "color", null); var color = this.getValue(map, "color", null);
if (color != null) if (color != null)
mesh.color.setFromString(color); mesh.color.setFromString(color);
mesh.width = this.getValue(map, "width", 0) * scale;
mesh.height = this.getValue(map, "height", 0) * scale;
var parent_4 = this.getValue(map, "parent", null); var parent_4 = this.getValue(map, "parent", null);
if (parent_4 != null) { if (parent_4 != null) {
mesh.inheritDeform = this.getValue(map, "deform", true); mesh.inheritDeform = this.getValue(map, "deform", true);
@ -4773,6 +4775,7 @@ var spine;
mesh.triangles = map.triangles; mesh.triangles = map.triangles;
mesh.regionUVs = uvs; mesh.regionUVs = uvs;
mesh.updateUVs(); mesh.updateUVs();
mesh.edges = this.getValue(map, "edges", null);
mesh.hullLength = this.getValue(map, "hull", 0) * 2; mesh.hullLength = this.getValue(map, "hull", 0) * 2;
return mesh; return mesh;
} }
@ -5241,14 +5244,25 @@ var spine;
})(spine || (spine = {})); })(spine || (spine = {}));
var spine; var spine;
(function (spine) { (function (spine) {
var SkinEntry = (function () {
function SkinEntry(slotIndex, name, attachment) {
this.slotIndex = slotIndex;
this.name = name;
this.attachment = attachment;
}
return SkinEntry;
}());
spine.SkinEntry = SkinEntry;
var Skin = (function () { var Skin = (function () {
function Skin(name) { function Skin(name) {
this.attachments = new Array(); this.attachments = new Array();
this.bones = Array();
this.constraints = new Array();
if (name == null) if (name == null)
throw new Error("name cannot be null."); throw new Error("name cannot be null.");
this.name = name; this.name = name;
} }
Skin.prototype.addAttachment = function (slotIndex, name, attachment) { Skin.prototype.setAttachment = function (slotIndex, name, attachment) {
if (attachment == null) if (attachment == null)
throw new Error("attachment cannot be null."); throw new Error("attachment cannot be null.");
var attachments = this.attachments; var attachments = this.attachments;
@ -5258,10 +5272,118 @@ var spine;
attachments[slotIndex] = {}; attachments[slotIndex] = {};
attachments[slotIndex][name] = attachment; attachments[slotIndex][name] = attachment;
}; };
Skin.prototype.addSkin = function (skin) {
for (var i = 0; i < skin.bones.length; i++) {
var bone = skin.bones[i];
var contained = false;
for (var j = 0; j < this.bones.length; j++) {
if (this.bones[j] == bone) {
contained = true;
break;
}
}
if (!contained)
this.bones.push(bone);
}
for (var i = 0; i < skin.constraints.length; i++) {
var constraint = skin.constraints[i];
var contained = false;
for (var j = 0; j < this.constraints.length; j++) {
if (this.constraints[j] == constraint) {
contained = true;
break;
}
}
if (!contained)
this.constraints.push(constraint);
}
var attachments = skin.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment = attachments[i];
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
}
};
Skin.prototype.copySkin = function (skin) {
for (var i = 0; i < skin.bones.length; i++) {
var bone = skin.bones[i];
var contained = false;
for (var j = 0; j < this.bones.length; j++) {
if (this.bones[j] == bone) {
contained = true;
break;
}
}
if (!contained)
this.bones.push(bone);
}
for (var i = 0; i < skin.constraints.length; i++) {
var constraint = skin.constraints[i];
var contained = false;
for (var j = 0; j < this.constraints.length; j++) {
if (this.constraints[j] == constraint) {
contained = true;
break;
}
}
if (!contained)
this.constraints.push(constraint);
}
var attachments = skin.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment = attachments[i];
attachment.attachment = attachment.attachment.copy();
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
}
attachments = this.getAttachments();
for (var i = 0; i < attachments.length; i++) {
var attachment_1 = attachments[i];
if (attachment_1.attachment instanceof spine.MeshAttachment) {
var mesh = attachment_1.attachment;
if (mesh.getParentMesh()) {
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
mesh.updateUVs();
}
}
}
};
Skin.prototype.getAttachment = function (slotIndex, name) { Skin.prototype.getAttachment = function (slotIndex, name) {
var dictionary = this.attachments[slotIndex]; var dictionary = this.attachments[slotIndex];
return dictionary ? dictionary[name] : null; return dictionary ? dictionary[name] : null;
}; };
Skin.prototype.removeAttachment = function (slotIndex, name) {
var dictionary = this.attachments[slotIndex];
if (dictionary)
dictionary[name] = null;
};
Skin.prototype.getAttachments = function () {
var entries = new Array();
for (var i = 0; i < this.attachments.length; i++) {
var slotAttachments = this.attachments[i];
if (slotAttachments) {
for (var name_2 in slotAttachments) {
var attachment = slotAttachments[name_2];
if (attachment)
entries.push(new SkinEntry(i, name_2, attachment));
}
}
}
return entries;
};
Skin.prototype.getAttachmentsForSlot = function (slotIndex, attachments) {
var slotAttachments = this.attachments[slotIndex];
if (slotAttachments) {
for (var name_3 in slotAttachments) {
var attachment = slotAttachments[name_3];
if (attachment)
attachments.push(new SkinEntry(slotIndex, name_3, attachment));
}
}
};
Skin.prototype.clear = function () {
this.attachments.length = 0;
this.bones.length = 0;
this.constraints.length = 0;
};
Skin.prototype.attachAll = function (skeleton, oldSkin) { Skin.prototype.attachAll = function (skeleton, oldSkin) {
var slotIndex = 0; var slotIndex = 0;
for (var i = 0; i < skeleton.slots.length; i++) { for (var i = 0; i < skeleton.slots.length; i++) {
@ -6533,6 +6655,21 @@ var spine;
VertexAttachment.prototype.applyDeform = function (sourceAttachment) { VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
return this == sourceAttachment; return this == sourceAttachment;
}; };
VertexAttachment.prototype.copyTo = function (attachment) {
if (this.bones != null) {
attachment.bones = new Array(this.bones.length);
spine.Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);
}
else
attachment.bones = null;
if (this.vertices != null) {
attachment.vertices = spine.Utils.newFloatArray(this.vertices.length);
spine.Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
}
else
attachment.vertices = null;
attachment.worldVerticesLength = this.worldVerticesLength;
};
VertexAttachment.nextID = 0; VertexAttachment.nextID = 0;
return VertexAttachment; return VertexAttachment;
}(Attachment)); }(Attachment));
@ -6559,6 +6696,12 @@ var spine;
_this.color = new spine.Color(1, 1, 1, 1); _this.color = new spine.Color(1, 1, 1, 1);
return _this; return _this;
} }
BoundingBoxAttachment.prototype.copy = function () {
var copy = new BoundingBoxAttachment(name);
this.copyTo(copy);
copy.color.setFromColor(this.color);
return copy;
};
return BoundingBoxAttachment; return BoundingBoxAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.BoundingBoxAttachment = BoundingBoxAttachment; spine.BoundingBoxAttachment = BoundingBoxAttachment;
@ -6572,6 +6715,13 @@ var spine;
_this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1); _this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1);
return _this; return _this;
} }
ClippingAttachment.prototype.copy = function () {
var copy = new ClippingAttachment(name);
this.copyTo(copy);
copy.endSlot = this.endSlot;
copy.color.setFromColor(this.color);
return copy;
};
return ClippingAttachment; return ClippingAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.ClippingAttachment = ClippingAttachment; spine.ClippingAttachment = ClippingAttachment;
@ -6665,6 +6815,34 @@ var spine;
this.worldVerticesLength = parentMesh.worldVerticesLength; this.worldVerticesLength = parentMesh.worldVerticesLength;
} }
}; };
MeshAttachment.prototype.copy = function () {
var copy = new MeshAttachment(name);
copy.region = this.region;
copy.path = this.path;
if (this.parentMesh == null) {
this.copyTo(copy);
copy.regionUVs = new Array(this.regionUVs.length);
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
copy.uvs = new Array(this.uvs.length);
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
copy.triangles = new Array(this.triangles.length);
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
copy.color.setFromColor(this.color);
copy.hullLength = this.hullLength;
copy.inheritDeform = this.inheritDeform;
if (this.edges != null) {
copy.edges = new Array(this.edges.length);
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
}
copy.width = this.width;
copy.height = this.height;
}
else {
copy.setParentMesh(this.parentMesh);
copy.updateUVs();
}
return copy;
};
return MeshAttachment; return MeshAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.MeshAttachment = MeshAttachment; spine.MeshAttachment = MeshAttachment;
@ -6680,6 +6858,16 @@ var spine;
_this.color = new spine.Color(1, 1, 1, 1); _this.color = new spine.Color(1, 1, 1, 1);
return _this; return _this;
} }
PathAttachment.prototype.copy = function () {
var copy = new PathAttachment(name);
this.copyTo(copy);
copy.lengths = new Array(this.lengths.length);
spine.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
copy.closed = closed;
copy.constantSpeed = this.constantSpeed;
copy.color.setFromColor(this.color);
return copy;
};
return PathAttachment; return PathAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.PathAttachment = PathAttachment; spine.PathAttachment = PathAttachment;
@ -6704,6 +6892,14 @@ var spine;
var y = cos * bone.c + sin * bone.d; var y = cos * bone.c + sin * bone.d;
return Math.atan2(y, x) * spine.MathUtils.radDeg; return Math.atan2(y, x) * spine.MathUtils.radDeg;
}; };
PointAttachment.prototype.copy = function () {
var copy = new PointAttachment(name);
copy.x = this.x;
copy.y = this.y;
copy.rotation = this.rotation;
copy.color.setFromColor(this.color);
return copy;
};
return PointAttachment; return PointAttachment;
}(spine.VertexAttachment)); }(spine.VertexAttachment));
spine.PointAttachment = PointAttachment; spine.PointAttachment = PointAttachment;
@ -6804,6 +7000,23 @@ var spine;
worldVertices[offset] = offsetX * a + offsetY * b + x; worldVertices[offset] = offsetX * a + offsetY * b + x;
worldVertices[offset + 1] = offsetX * c + offsetY * d + y; worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
}; };
RegionAttachment.prototype.copy = function () {
var copy = new RegionAttachment(name);
copy.region = this.region;
copy.rendererObject = this.rendererObject;
copy.path = this.path;
copy.x = this.x;
copy.y = this.y;
copy.scaleX = this.scaleX;
copy.scaleY = this.scaleY;
copy.rotation = this.rotation;
copy.width = this.width;
copy.height = this.height;
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);
spine.Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8);
copy.color.setFromColor(this.color);
return copy;
};
RegionAttachment.OX1 = 0; RegionAttachment.OX1 = 0;
RegionAttachment.OY1 = 1; RegionAttachment.OY1 = 1;
RegionAttachment.OX2 = 2; RegionAttachment.OX2 = 2;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long