mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ts] Ported all skin API changes, see #841.
This commit is contained in:
parent
40e6b026bd
commit
f9e4fd495d
5
spine-ts/build/spine-all.d.ts
vendored
5
spine-ts/build/spine-all.d.ts
vendored
@ -1103,9 +1103,9 @@ declare module spine {
|
|||||||
bones: Array<number>;
|
bones: Array<number>;
|
||||||
vertices: ArrayLike<number>;
|
vertices: ArrayLike<number>;
|
||||||
worldVerticesLength: number;
|
worldVerticesLength: number;
|
||||||
|
deformAttachment: VertexAttachment;
|
||||||
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;
|
|
||||||
copyTo(attachment: VertexAttachment): void;
|
copyTo(attachment: VertexAttachment): void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1157,14 +1157,13 @@ declare module spine {
|
|||||||
hullLength: number;
|
hullLength: number;
|
||||||
edges: Array<number>;
|
edges: Array<number>;
|
||||||
private parentMesh;
|
private parentMesh;
|
||||||
inheritDeform: boolean;
|
|
||||||
tempColor: Color;
|
tempColor: Color;
|
||||||
constructor(name: string);
|
constructor(name: string);
|
||||||
updateUVs(): void;
|
updateUVs(): void;
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
getParentMesh(): MeshAttachment;
|
getParentMesh(): MeshAttachment;
|
||||||
setParentMesh(parentMesh: MeshAttachment): void;
|
setParentMesh(parentMesh: MeshAttachment): void;
|
||||||
copy(): Attachment;
|
copy(): Attachment;
|
||||||
|
newLinkedMesh(): MeshAttachment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module spine {
|
declare module spine {
|
||||||
|
|||||||
@ -698,7 +698,7 @@ var spine;
|
|||||||
DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
||||||
var slot = skeleton.slots[this.slotIndex];
|
var slot = skeleton.slots[this.slotIndex];
|
||||||
var slotAttachment = slot.getAttachment();
|
var slotAttachment = slot.getAttachment();
|
||||||
if (!(slotAttachment instanceof spine.VertexAttachment) || !slotAttachment.applyDeform(this.attachment))
|
if (!(slotAttachment instanceof spine.VertexAttachment) || !(slotAttachment.deformAttachment == this.attachment))
|
||||||
return;
|
return;
|
||||||
var deformArray = slot.deform;
|
var deformArray = slot.deform;
|
||||||
if (deformArray.length == 0)
|
if (deformArray.length == 0)
|
||||||
@ -4694,6 +4694,7 @@ var spine;
|
|||||||
var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
||||||
if (parent_3 == null)
|
if (parent_3 == null)
|
||||||
throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
||||||
|
linkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? parent_3 : linkedMesh.mesh;
|
||||||
linkedMesh.mesh.setParentMesh(parent_3);
|
linkedMesh.mesh.setParentMesh(parent_3);
|
||||||
linkedMesh.mesh.updateUVs();
|
linkedMesh.mesh.updateUVs();
|
||||||
}
|
}
|
||||||
@ -4769,8 +4770,7 @@ var spine;
|
|||||||
mesh.height = this.getValue(map, "height", 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);
|
this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_4, this.getValue(map, "deform", true)));
|
||||||
this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_4));
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
var uvs = map.uvs;
|
var uvs = map.uvs;
|
||||||
@ -5236,11 +5236,12 @@ var spine;
|
|||||||
}());
|
}());
|
||||||
spine.SkeletonJson = SkeletonJson;
|
spine.SkeletonJson = SkeletonJson;
|
||||||
var LinkedMesh = (function () {
|
var LinkedMesh = (function () {
|
||||||
function LinkedMesh(mesh, skin, slotIndex, parent) {
|
function LinkedMesh(mesh, skin, slotIndex, parent, inheritDeform) {
|
||||||
this.mesh = mesh;
|
this.mesh = mesh;
|
||||||
this.skin = skin;
|
this.skin = skin;
|
||||||
this.slotIndex = slotIndex;
|
this.slotIndex = slotIndex;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
this.inheritDeform = inheritDeform;
|
||||||
}
|
}
|
||||||
return LinkedMesh;
|
return LinkedMesh;
|
||||||
}());
|
}());
|
||||||
@ -5334,18 +5335,15 @@ var spine;
|
|||||||
var attachments = skin.getAttachments();
|
var attachments = skin.getAttachments();
|
||||||
for (var i = 0; i < attachments.length; i++) {
|
for (var i = 0; i < attachments.length; i++) {
|
||||||
var attachment = attachments[i];
|
var attachment = attachments[i];
|
||||||
attachment.attachment = attachment.attachment.copy();
|
if (attachment.attachment == null)
|
||||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
continue;
|
||||||
}
|
if (attachment.attachment instanceof spine.MeshAttachment) {
|
||||||
attachments = this.getAttachments();
|
attachment.attachment = attachment.attachment.newLinkedMesh();
|
||||||
for (var i = 0; i < attachments.length; i++) {
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
var attachment_1 = attachments[i];
|
}
|
||||||
if (attachment_1.attachment instanceof spine.MeshAttachment) {
|
else {
|
||||||
var mesh = attachment_1.attachment;
|
attachment.attachment = attachment.attachment.copy();
|
||||||
if (mesh.getParentMesh()) {
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
|
|
||||||
mesh.updateUVs();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -6594,6 +6592,7 @@ var spine;
|
|||||||
var _this = _super.call(this, name) || this;
|
var _this = _super.call(this, name) || this;
|
||||||
_this.id = (VertexAttachment.nextID++ & 65535) << 11;
|
_this.id = (VertexAttachment.nextID++ & 65535) << 11;
|
||||||
_this.worldVerticesLength = 0;
|
_this.worldVerticesLength = 0;
|
||||||
|
_this.deformAttachment = _this;
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) {
|
VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) {
|
||||||
@ -6655,9 +6654,6 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment;
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.copyTo = function (attachment) {
|
VertexAttachment.prototype.copyTo = function (attachment) {
|
||||||
if (this.bones != null) {
|
if (this.bones != null) {
|
||||||
attachment.bones = new Array(this.bones.length);
|
attachment.bones = new Array(this.bones.length);
|
||||||
@ -6672,6 +6668,7 @@ var spine;
|
|||||||
else
|
else
|
||||||
attachment.vertices = null;
|
attachment.vertices = null;
|
||||||
attachment.worldVerticesLength = this.worldVerticesLength;
|
attachment.worldVerticesLength = this.worldVerticesLength;
|
||||||
|
attachment.deformAttachment = this.deformAttachment;
|
||||||
};
|
};
|
||||||
VertexAttachment.nextID = 0;
|
VertexAttachment.nextID = 0;
|
||||||
return VertexAttachment;
|
return VertexAttachment;
|
||||||
@ -6736,7 +6733,6 @@ var spine;
|
|||||||
function MeshAttachment(name) {
|
function MeshAttachment(name) {
|
||||||
var _this = _super.call(this, name) || this;
|
var _this = _super.call(this, name) || this;
|
||||||
_this.color = new spine.Color(1, 1, 1, 1);
|
_this.color = new spine.Color(1, 1, 1, 1);
|
||||||
_this.inheritDeform = false;
|
|
||||||
_this.tempColor = new spine.Color(0, 0, 0, 0);
|
_this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
@ -6800,9 +6796,6 @@ var spine;
|
|||||||
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.getParentMesh = function () {
|
MeshAttachment.prototype.getParentMesh = function () {
|
||||||
return this.parentMesh;
|
return this.parentMesh;
|
||||||
};
|
};
|
||||||
@ -6819,31 +6812,36 @@ var spine;
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
MeshAttachment.prototype.copy = function () {
|
MeshAttachment.prototype.copy = function () {
|
||||||
var copy = new MeshAttachment(name);
|
if (this.parentMesh != null)
|
||||||
|
return this.newLinkedMesh();
|
||||||
|
var copy = new MeshAttachment(this.name);
|
||||||
copy.region = this.region;
|
copy.region = this.region;
|
||||||
copy.path = this.path;
|
copy.path = this.path;
|
||||||
if (this.parentMesh == null) {
|
copy.color.setFromColor(this.color);
|
||||||
this.copyTo(copy);
|
this.copyTo(copy);
|
||||||
copy.regionUVs = new Array(this.regionUVs.length);
|
copy.regionUVs = new Array(this.regionUVs.length);
|
||||||
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
||||||
copy.uvs = new Array(this.uvs.length);
|
copy.uvs = new Array(this.uvs.length);
|
||||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
||||||
copy.triangles = new Array(this.triangles.length);
|
copy.triangles = new Array(this.triangles.length);
|
||||||
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, 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.hullLength = this.hullLength;
|
if (this.edges != null) {
|
||||||
copy.inheritDeform = this.inheritDeform;
|
copy.edges = new Array(this.edges.length);
|
||||||
if (this.edges != null) {
|
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
copy.width = this.width;
|
||||||
|
copy.height = this.height;
|
||||||
|
return copy;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.newLinkedMesh = function () {
|
||||||
|
var copy = new MeshAttachment(this.name);
|
||||||
|
copy.region = this.region;
|
||||||
|
copy.path = this.path;
|
||||||
|
copy.color.setFromColor(this.color);
|
||||||
|
copy.deformAttachment = this.deformAttachment;
|
||||||
|
copy.setParentMesh(this.parentMesh != null ? this.parentMesh : this);
|
||||||
|
copy.updateUVs();
|
||||||
return copy;
|
return copy;
|
||||||
};
|
};
|
||||||
return MeshAttachment;
|
return MeshAttachment;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
5
spine-ts/build/spine-canvas.d.ts
vendored
5
spine-ts/build/spine-canvas.d.ts
vendored
@ -1103,9 +1103,9 @@ declare module spine {
|
|||||||
bones: Array<number>;
|
bones: Array<number>;
|
||||||
vertices: ArrayLike<number>;
|
vertices: ArrayLike<number>;
|
||||||
worldVerticesLength: number;
|
worldVerticesLength: number;
|
||||||
|
deformAttachment: VertexAttachment;
|
||||||
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;
|
|
||||||
copyTo(attachment: VertexAttachment): void;
|
copyTo(attachment: VertexAttachment): void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1157,14 +1157,13 @@ declare module spine {
|
|||||||
hullLength: number;
|
hullLength: number;
|
||||||
edges: Array<number>;
|
edges: Array<number>;
|
||||||
private parentMesh;
|
private parentMesh;
|
||||||
inheritDeform: boolean;
|
|
||||||
tempColor: Color;
|
tempColor: Color;
|
||||||
constructor(name: string);
|
constructor(name: string);
|
||||||
updateUVs(): void;
|
updateUVs(): void;
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
getParentMesh(): MeshAttachment;
|
getParentMesh(): MeshAttachment;
|
||||||
setParentMesh(parentMesh: MeshAttachment): void;
|
setParentMesh(parentMesh: MeshAttachment): void;
|
||||||
copy(): Attachment;
|
copy(): Attachment;
|
||||||
|
newLinkedMesh(): MeshAttachment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module spine {
|
declare module spine {
|
||||||
|
|||||||
@ -698,7 +698,7 @@ var spine;
|
|||||||
DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
||||||
var slot = skeleton.slots[this.slotIndex];
|
var slot = skeleton.slots[this.slotIndex];
|
||||||
var slotAttachment = slot.getAttachment();
|
var slotAttachment = slot.getAttachment();
|
||||||
if (!(slotAttachment instanceof spine.VertexAttachment) || !slotAttachment.applyDeform(this.attachment))
|
if (!(slotAttachment instanceof spine.VertexAttachment) || !(slotAttachment.deformAttachment == this.attachment))
|
||||||
return;
|
return;
|
||||||
var deformArray = slot.deform;
|
var deformArray = slot.deform;
|
||||||
if (deformArray.length == 0)
|
if (deformArray.length == 0)
|
||||||
@ -4694,6 +4694,7 @@ var spine;
|
|||||||
var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
||||||
if (parent_3 == null)
|
if (parent_3 == null)
|
||||||
throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
||||||
|
linkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? parent_3 : linkedMesh.mesh;
|
||||||
linkedMesh.mesh.setParentMesh(parent_3);
|
linkedMesh.mesh.setParentMesh(parent_3);
|
||||||
linkedMesh.mesh.updateUVs();
|
linkedMesh.mesh.updateUVs();
|
||||||
}
|
}
|
||||||
@ -4769,8 +4770,7 @@ var spine;
|
|||||||
mesh.height = this.getValue(map, "height", 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);
|
this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_4, this.getValue(map, "deform", true)));
|
||||||
this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_4));
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
var uvs = map.uvs;
|
var uvs = map.uvs;
|
||||||
@ -5236,11 +5236,12 @@ var spine;
|
|||||||
}());
|
}());
|
||||||
spine.SkeletonJson = SkeletonJson;
|
spine.SkeletonJson = SkeletonJson;
|
||||||
var LinkedMesh = (function () {
|
var LinkedMesh = (function () {
|
||||||
function LinkedMesh(mesh, skin, slotIndex, parent) {
|
function LinkedMesh(mesh, skin, slotIndex, parent, inheritDeform) {
|
||||||
this.mesh = mesh;
|
this.mesh = mesh;
|
||||||
this.skin = skin;
|
this.skin = skin;
|
||||||
this.slotIndex = slotIndex;
|
this.slotIndex = slotIndex;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
this.inheritDeform = inheritDeform;
|
||||||
}
|
}
|
||||||
return LinkedMesh;
|
return LinkedMesh;
|
||||||
}());
|
}());
|
||||||
@ -5334,18 +5335,15 @@ var spine;
|
|||||||
var attachments = skin.getAttachments();
|
var attachments = skin.getAttachments();
|
||||||
for (var i = 0; i < attachments.length; i++) {
|
for (var i = 0; i < attachments.length; i++) {
|
||||||
var attachment = attachments[i];
|
var attachment = attachments[i];
|
||||||
attachment.attachment = attachment.attachment.copy();
|
if (attachment.attachment == null)
|
||||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
continue;
|
||||||
}
|
if (attachment.attachment instanceof spine.MeshAttachment) {
|
||||||
attachments = this.getAttachments();
|
attachment.attachment = attachment.attachment.newLinkedMesh();
|
||||||
for (var i = 0; i < attachments.length; i++) {
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
var attachment_1 = attachments[i];
|
}
|
||||||
if (attachment_1.attachment instanceof spine.MeshAttachment) {
|
else {
|
||||||
var mesh = attachment_1.attachment;
|
attachment.attachment = attachment.attachment.copy();
|
||||||
if (mesh.getParentMesh()) {
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
|
|
||||||
mesh.updateUVs();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -6594,6 +6592,7 @@ var spine;
|
|||||||
var _this = _super.call(this, name) || this;
|
var _this = _super.call(this, name) || this;
|
||||||
_this.id = (VertexAttachment.nextID++ & 65535) << 11;
|
_this.id = (VertexAttachment.nextID++ & 65535) << 11;
|
||||||
_this.worldVerticesLength = 0;
|
_this.worldVerticesLength = 0;
|
||||||
|
_this.deformAttachment = _this;
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) {
|
VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) {
|
||||||
@ -6655,9 +6654,6 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment;
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.copyTo = function (attachment) {
|
VertexAttachment.prototype.copyTo = function (attachment) {
|
||||||
if (this.bones != null) {
|
if (this.bones != null) {
|
||||||
attachment.bones = new Array(this.bones.length);
|
attachment.bones = new Array(this.bones.length);
|
||||||
@ -6672,6 +6668,7 @@ var spine;
|
|||||||
else
|
else
|
||||||
attachment.vertices = null;
|
attachment.vertices = null;
|
||||||
attachment.worldVerticesLength = this.worldVerticesLength;
|
attachment.worldVerticesLength = this.worldVerticesLength;
|
||||||
|
attachment.deformAttachment = this.deformAttachment;
|
||||||
};
|
};
|
||||||
VertexAttachment.nextID = 0;
|
VertexAttachment.nextID = 0;
|
||||||
return VertexAttachment;
|
return VertexAttachment;
|
||||||
@ -6736,7 +6733,6 @@ var spine;
|
|||||||
function MeshAttachment(name) {
|
function MeshAttachment(name) {
|
||||||
var _this = _super.call(this, name) || this;
|
var _this = _super.call(this, name) || this;
|
||||||
_this.color = new spine.Color(1, 1, 1, 1);
|
_this.color = new spine.Color(1, 1, 1, 1);
|
||||||
_this.inheritDeform = false;
|
|
||||||
_this.tempColor = new spine.Color(0, 0, 0, 0);
|
_this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
@ -6800,9 +6796,6 @@ var spine;
|
|||||||
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.getParentMesh = function () {
|
MeshAttachment.prototype.getParentMesh = function () {
|
||||||
return this.parentMesh;
|
return this.parentMesh;
|
||||||
};
|
};
|
||||||
@ -6819,31 +6812,36 @@ var spine;
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
MeshAttachment.prototype.copy = function () {
|
MeshAttachment.prototype.copy = function () {
|
||||||
var copy = new MeshAttachment(name);
|
if (this.parentMesh != null)
|
||||||
|
return this.newLinkedMesh();
|
||||||
|
var copy = new MeshAttachment(this.name);
|
||||||
copy.region = this.region;
|
copy.region = this.region;
|
||||||
copy.path = this.path;
|
copy.path = this.path;
|
||||||
if (this.parentMesh == null) {
|
copy.color.setFromColor(this.color);
|
||||||
this.copyTo(copy);
|
this.copyTo(copy);
|
||||||
copy.regionUVs = new Array(this.regionUVs.length);
|
copy.regionUVs = new Array(this.regionUVs.length);
|
||||||
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
||||||
copy.uvs = new Array(this.uvs.length);
|
copy.uvs = new Array(this.uvs.length);
|
||||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
||||||
copy.triangles = new Array(this.triangles.length);
|
copy.triangles = new Array(this.triangles.length);
|
||||||
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, 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.hullLength = this.hullLength;
|
if (this.edges != null) {
|
||||||
copy.inheritDeform = this.inheritDeform;
|
copy.edges = new Array(this.edges.length);
|
||||||
if (this.edges != null) {
|
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
copy.width = this.width;
|
||||||
|
copy.height = this.height;
|
||||||
|
return copy;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.newLinkedMesh = function () {
|
||||||
|
var copy = new MeshAttachment(this.name);
|
||||||
|
copy.region = this.region;
|
||||||
|
copy.path = this.path;
|
||||||
|
copy.color.setFromColor(this.color);
|
||||||
|
copy.deformAttachment = this.deformAttachment;
|
||||||
|
copy.setParentMesh(this.parentMesh != null ? this.parentMesh : this);
|
||||||
|
copy.updateUVs();
|
||||||
return copy;
|
return copy;
|
||||||
};
|
};
|
||||||
return MeshAttachment;
|
return MeshAttachment;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
5
spine-ts/build/spine-core.d.ts
vendored
5
spine-ts/build/spine-core.d.ts
vendored
@ -1103,9 +1103,9 @@ declare module spine {
|
|||||||
bones: Array<number>;
|
bones: Array<number>;
|
||||||
vertices: ArrayLike<number>;
|
vertices: ArrayLike<number>;
|
||||||
worldVerticesLength: number;
|
worldVerticesLength: number;
|
||||||
|
deformAttachment: VertexAttachment;
|
||||||
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;
|
|
||||||
copyTo(attachment: VertexAttachment): void;
|
copyTo(attachment: VertexAttachment): void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1157,14 +1157,13 @@ declare module spine {
|
|||||||
hullLength: number;
|
hullLength: number;
|
||||||
edges: Array<number>;
|
edges: Array<number>;
|
||||||
private parentMesh;
|
private parentMesh;
|
||||||
inheritDeform: boolean;
|
|
||||||
tempColor: Color;
|
tempColor: Color;
|
||||||
constructor(name: string);
|
constructor(name: string);
|
||||||
updateUVs(): void;
|
updateUVs(): void;
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
getParentMesh(): MeshAttachment;
|
getParentMesh(): MeshAttachment;
|
||||||
setParentMesh(parentMesh: MeshAttachment): void;
|
setParentMesh(parentMesh: MeshAttachment): void;
|
||||||
copy(): Attachment;
|
copy(): Attachment;
|
||||||
|
newLinkedMesh(): MeshAttachment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module spine {
|
declare module spine {
|
||||||
|
|||||||
@ -698,7 +698,7 @@ var spine;
|
|||||||
DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
||||||
var slot = skeleton.slots[this.slotIndex];
|
var slot = skeleton.slots[this.slotIndex];
|
||||||
var slotAttachment = slot.getAttachment();
|
var slotAttachment = slot.getAttachment();
|
||||||
if (!(slotAttachment instanceof spine.VertexAttachment) || !slotAttachment.applyDeform(this.attachment))
|
if (!(slotAttachment instanceof spine.VertexAttachment) || !(slotAttachment.deformAttachment == this.attachment))
|
||||||
return;
|
return;
|
||||||
var deformArray = slot.deform;
|
var deformArray = slot.deform;
|
||||||
if (deformArray.length == 0)
|
if (deformArray.length == 0)
|
||||||
@ -4694,6 +4694,7 @@ var spine;
|
|||||||
var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
||||||
if (parent_3 == null)
|
if (parent_3 == null)
|
||||||
throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
||||||
|
linkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? parent_3 : linkedMesh.mesh;
|
||||||
linkedMesh.mesh.setParentMesh(parent_3);
|
linkedMesh.mesh.setParentMesh(parent_3);
|
||||||
linkedMesh.mesh.updateUVs();
|
linkedMesh.mesh.updateUVs();
|
||||||
}
|
}
|
||||||
@ -4769,8 +4770,7 @@ var spine;
|
|||||||
mesh.height = this.getValue(map, "height", 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);
|
this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_4, this.getValue(map, "deform", true)));
|
||||||
this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_4));
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
var uvs = map.uvs;
|
var uvs = map.uvs;
|
||||||
@ -5236,11 +5236,12 @@ var spine;
|
|||||||
}());
|
}());
|
||||||
spine.SkeletonJson = SkeletonJson;
|
spine.SkeletonJson = SkeletonJson;
|
||||||
var LinkedMesh = (function () {
|
var LinkedMesh = (function () {
|
||||||
function LinkedMesh(mesh, skin, slotIndex, parent) {
|
function LinkedMesh(mesh, skin, slotIndex, parent, inheritDeform) {
|
||||||
this.mesh = mesh;
|
this.mesh = mesh;
|
||||||
this.skin = skin;
|
this.skin = skin;
|
||||||
this.slotIndex = slotIndex;
|
this.slotIndex = slotIndex;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
this.inheritDeform = inheritDeform;
|
||||||
}
|
}
|
||||||
return LinkedMesh;
|
return LinkedMesh;
|
||||||
}());
|
}());
|
||||||
@ -5334,18 +5335,15 @@ var spine;
|
|||||||
var attachments = skin.getAttachments();
|
var attachments = skin.getAttachments();
|
||||||
for (var i = 0; i < attachments.length; i++) {
|
for (var i = 0; i < attachments.length; i++) {
|
||||||
var attachment = attachments[i];
|
var attachment = attachments[i];
|
||||||
attachment.attachment = attachment.attachment.copy();
|
if (attachment.attachment == null)
|
||||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
continue;
|
||||||
}
|
if (attachment.attachment instanceof spine.MeshAttachment) {
|
||||||
attachments = this.getAttachments();
|
attachment.attachment = attachment.attachment.newLinkedMesh();
|
||||||
for (var i = 0; i < attachments.length; i++) {
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
var attachment_1 = attachments[i];
|
}
|
||||||
if (attachment_1.attachment instanceof spine.MeshAttachment) {
|
else {
|
||||||
var mesh = attachment_1.attachment;
|
attachment.attachment = attachment.attachment.copy();
|
||||||
if (mesh.getParentMesh()) {
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
|
|
||||||
mesh.updateUVs();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -6594,6 +6592,7 @@ var spine;
|
|||||||
var _this = _super.call(this, name) || this;
|
var _this = _super.call(this, name) || this;
|
||||||
_this.id = (VertexAttachment.nextID++ & 65535) << 11;
|
_this.id = (VertexAttachment.nextID++ & 65535) << 11;
|
||||||
_this.worldVerticesLength = 0;
|
_this.worldVerticesLength = 0;
|
||||||
|
_this.deformAttachment = _this;
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) {
|
VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) {
|
||||||
@ -6655,9 +6654,6 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment;
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.copyTo = function (attachment) {
|
VertexAttachment.prototype.copyTo = function (attachment) {
|
||||||
if (this.bones != null) {
|
if (this.bones != null) {
|
||||||
attachment.bones = new Array(this.bones.length);
|
attachment.bones = new Array(this.bones.length);
|
||||||
@ -6672,6 +6668,7 @@ var spine;
|
|||||||
else
|
else
|
||||||
attachment.vertices = null;
|
attachment.vertices = null;
|
||||||
attachment.worldVerticesLength = this.worldVerticesLength;
|
attachment.worldVerticesLength = this.worldVerticesLength;
|
||||||
|
attachment.deformAttachment = this.deformAttachment;
|
||||||
};
|
};
|
||||||
VertexAttachment.nextID = 0;
|
VertexAttachment.nextID = 0;
|
||||||
return VertexAttachment;
|
return VertexAttachment;
|
||||||
@ -6736,7 +6733,6 @@ var spine;
|
|||||||
function MeshAttachment(name) {
|
function MeshAttachment(name) {
|
||||||
var _this = _super.call(this, name) || this;
|
var _this = _super.call(this, name) || this;
|
||||||
_this.color = new spine.Color(1, 1, 1, 1);
|
_this.color = new spine.Color(1, 1, 1, 1);
|
||||||
_this.inheritDeform = false;
|
|
||||||
_this.tempColor = new spine.Color(0, 0, 0, 0);
|
_this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
@ -6800,9 +6796,6 @@ var spine;
|
|||||||
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.getParentMesh = function () {
|
MeshAttachment.prototype.getParentMesh = function () {
|
||||||
return this.parentMesh;
|
return this.parentMesh;
|
||||||
};
|
};
|
||||||
@ -6819,31 +6812,36 @@ var spine;
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
MeshAttachment.prototype.copy = function () {
|
MeshAttachment.prototype.copy = function () {
|
||||||
var copy = new MeshAttachment(name);
|
if (this.parentMesh != null)
|
||||||
|
return this.newLinkedMesh();
|
||||||
|
var copy = new MeshAttachment(this.name);
|
||||||
copy.region = this.region;
|
copy.region = this.region;
|
||||||
copy.path = this.path;
|
copy.path = this.path;
|
||||||
if (this.parentMesh == null) {
|
copy.color.setFromColor(this.color);
|
||||||
this.copyTo(copy);
|
this.copyTo(copy);
|
||||||
copy.regionUVs = new Array(this.regionUVs.length);
|
copy.regionUVs = new Array(this.regionUVs.length);
|
||||||
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
||||||
copy.uvs = new Array(this.uvs.length);
|
copy.uvs = new Array(this.uvs.length);
|
||||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
||||||
copy.triangles = new Array(this.triangles.length);
|
copy.triangles = new Array(this.triangles.length);
|
||||||
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, 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.hullLength = this.hullLength;
|
if (this.edges != null) {
|
||||||
copy.inheritDeform = this.inheritDeform;
|
copy.edges = new Array(this.edges.length);
|
||||||
if (this.edges != null) {
|
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
copy.width = this.width;
|
||||||
|
copy.height = this.height;
|
||||||
|
return copy;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.newLinkedMesh = function () {
|
||||||
|
var copy = new MeshAttachment(this.name);
|
||||||
|
copy.region = this.region;
|
||||||
|
copy.path = this.path;
|
||||||
|
copy.color.setFromColor(this.color);
|
||||||
|
copy.deformAttachment = this.deformAttachment;
|
||||||
|
copy.setParentMesh(this.parentMesh != null ? this.parentMesh : this);
|
||||||
|
copy.updateUVs();
|
||||||
return copy;
|
return copy;
|
||||||
};
|
};
|
||||||
return MeshAttachment;
|
return MeshAttachment;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
5
spine-ts/build/spine-player.d.ts
vendored
5
spine-ts/build/spine-player.d.ts
vendored
@ -1103,9 +1103,9 @@ declare module spine {
|
|||||||
bones: Array<number>;
|
bones: Array<number>;
|
||||||
vertices: ArrayLike<number>;
|
vertices: ArrayLike<number>;
|
||||||
worldVerticesLength: number;
|
worldVerticesLength: number;
|
||||||
|
deformAttachment: VertexAttachment;
|
||||||
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;
|
|
||||||
copyTo(attachment: VertexAttachment): void;
|
copyTo(attachment: VertexAttachment): void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1157,14 +1157,13 @@ declare module spine {
|
|||||||
hullLength: number;
|
hullLength: number;
|
||||||
edges: Array<number>;
|
edges: Array<number>;
|
||||||
private parentMesh;
|
private parentMesh;
|
||||||
inheritDeform: boolean;
|
|
||||||
tempColor: Color;
|
tempColor: Color;
|
||||||
constructor(name: string);
|
constructor(name: string);
|
||||||
updateUVs(): void;
|
updateUVs(): void;
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
getParentMesh(): MeshAttachment;
|
getParentMesh(): MeshAttachment;
|
||||||
setParentMesh(parentMesh: MeshAttachment): void;
|
setParentMesh(parentMesh: MeshAttachment): void;
|
||||||
copy(): Attachment;
|
copy(): Attachment;
|
||||||
|
newLinkedMesh(): MeshAttachment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module spine {
|
declare module spine {
|
||||||
|
|||||||
@ -698,7 +698,7 @@ var spine;
|
|||||||
DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
||||||
var slot = skeleton.slots[this.slotIndex];
|
var slot = skeleton.slots[this.slotIndex];
|
||||||
var slotAttachment = slot.getAttachment();
|
var slotAttachment = slot.getAttachment();
|
||||||
if (!(slotAttachment instanceof spine.VertexAttachment) || !slotAttachment.applyDeform(this.attachment))
|
if (!(slotAttachment instanceof spine.VertexAttachment) || !(slotAttachment.deformAttachment == this.attachment))
|
||||||
return;
|
return;
|
||||||
var deformArray = slot.deform;
|
var deformArray = slot.deform;
|
||||||
if (deformArray.length == 0)
|
if (deformArray.length == 0)
|
||||||
@ -4694,6 +4694,7 @@ var spine;
|
|||||||
var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
||||||
if (parent_3 == null)
|
if (parent_3 == null)
|
||||||
throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
||||||
|
linkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? parent_3 : linkedMesh.mesh;
|
||||||
linkedMesh.mesh.setParentMesh(parent_3);
|
linkedMesh.mesh.setParentMesh(parent_3);
|
||||||
linkedMesh.mesh.updateUVs();
|
linkedMesh.mesh.updateUVs();
|
||||||
}
|
}
|
||||||
@ -4769,8 +4770,7 @@ var spine;
|
|||||||
mesh.height = this.getValue(map, "height", 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);
|
this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_4, this.getValue(map, "deform", true)));
|
||||||
this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_4));
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
var uvs = map.uvs;
|
var uvs = map.uvs;
|
||||||
@ -5236,11 +5236,12 @@ var spine;
|
|||||||
}());
|
}());
|
||||||
spine.SkeletonJson = SkeletonJson;
|
spine.SkeletonJson = SkeletonJson;
|
||||||
var LinkedMesh = (function () {
|
var LinkedMesh = (function () {
|
||||||
function LinkedMesh(mesh, skin, slotIndex, parent) {
|
function LinkedMesh(mesh, skin, slotIndex, parent, inheritDeform) {
|
||||||
this.mesh = mesh;
|
this.mesh = mesh;
|
||||||
this.skin = skin;
|
this.skin = skin;
|
||||||
this.slotIndex = slotIndex;
|
this.slotIndex = slotIndex;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
this.inheritDeform = inheritDeform;
|
||||||
}
|
}
|
||||||
return LinkedMesh;
|
return LinkedMesh;
|
||||||
}());
|
}());
|
||||||
@ -5334,18 +5335,15 @@ var spine;
|
|||||||
var attachments = skin.getAttachments();
|
var attachments = skin.getAttachments();
|
||||||
for (var i = 0; i < attachments.length; i++) {
|
for (var i = 0; i < attachments.length; i++) {
|
||||||
var attachment = attachments[i];
|
var attachment = attachments[i];
|
||||||
attachment.attachment = attachment.attachment.copy();
|
if (attachment.attachment == null)
|
||||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
continue;
|
||||||
}
|
if (attachment.attachment instanceof spine.MeshAttachment) {
|
||||||
attachments = this.getAttachments();
|
attachment.attachment = attachment.attachment.newLinkedMesh();
|
||||||
for (var i = 0; i < attachments.length; i++) {
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
var attachment_1 = attachments[i];
|
}
|
||||||
if (attachment_1.attachment instanceof spine.MeshAttachment) {
|
else {
|
||||||
var mesh = attachment_1.attachment;
|
attachment.attachment = attachment.attachment.copy();
|
||||||
if (mesh.getParentMesh()) {
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
|
|
||||||
mesh.updateUVs();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -6594,6 +6592,7 @@ var spine;
|
|||||||
var _this = _super.call(this, name) || this;
|
var _this = _super.call(this, name) || this;
|
||||||
_this.id = (VertexAttachment.nextID++ & 65535) << 11;
|
_this.id = (VertexAttachment.nextID++ & 65535) << 11;
|
||||||
_this.worldVerticesLength = 0;
|
_this.worldVerticesLength = 0;
|
||||||
|
_this.deformAttachment = _this;
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) {
|
VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) {
|
||||||
@ -6655,9 +6654,6 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment;
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.copyTo = function (attachment) {
|
VertexAttachment.prototype.copyTo = function (attachment) {
|
||||||
if (this.bones != null) {
|
if (this.bones != null) {
|
||||||
attachment.bones = new Array(this.bones.length);
|
attachment.bones = new Array(this.bones.length);
|
||||||
@ -6672,6 +6668,7 @@ var spine;
|
|||||||
else
|
else
|
||||||
attachment.vertices = null;
|
attachment.vertices = null;
|
||||||
attachment.worldVerticesLength = this.worldVerticesLength;
|
attachment.worldVerticesLength = this.worldVerticesLength;
|
||||||
|
attachment.deformAttachment = this.deformAttachment;
|
||||||
};
|
};
|
||||||
VertexAttachment.nextID = 0;
|
VertexAttachment.nextID = 0;
|
||||||
return VertexAttachment;
|
return VertexAttachment;
|
||||||
@ -6736,7 +6733,6 @@ var spine;
|
|||||||
function MeshAttachment(name) {
|
function MeshAttachment(name) {
|
||||||
var _this = _super.call(this, name) || this;
|
var _this = _super.call(this, name) || this;
|
||||||
_this.color = new spine.Color(1, 1, 1, 1);
|
_this.color = new spine.Color(1, 1, 1, 1);
|
||||||
_this.inheritDeform = false;
|
|
||||||
_this.tempColor = new spine.Color(0, 0, 0, 0);
|
_this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
@ -6800,9 +6796,6 @@ var spine;
|
|||||||
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.getParentMesh = function () {
|
MeshAttachment.prototype.getParentMesh = function () {
|
||||||
return this.parentMesh;
|
return this.parentMesh;
|
||||||
};
|
};
|
||||||
@ -6819,31 +6812,36 @@ var spine;
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
MeshAttachment.prototype.copy = function () {
|
MeshAttachment.prototype.copy = function () {
|
||||||
var copy = new MeshAttachment(name);
|
if (this.parentMesh != null)
|
||||||
|
return this.newLinkedMesh();
|
||||||
|
var copy = new MeshAttachment(this.name);
|
||||||
copy.region = this.region;
|
copy.region = this.region;
|
||||||
copy.path = this.path;
|
copy.path = this.path;
|
||||||
if (this.parentMesh == null) {
|
copy.color.setFromColor(this.color);
|
||||||
this.copyTo(copy);
|
this.copyTo(copy);
|
||||||
copy.regionUVs = new Array(this.regionUVs.length);
|
copy.regionUVs = new Array(this.regionUVs.length);
|
||||||
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
||||||
copy.uvs = new Array(this.uvs.length);
|
copy.uvs = new Array(this.uvs.length);
|
||||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
||||||
copy.triangles = new Array(this.triangles.length);
|
copy.triangles = new Array(this.triangles.length);
|
||||||
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, 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.hullLength = this.hullLength;
|
if (this.edges != null) {
|
||||||
copy.inheritDeform = this.inheritDeform;
|
copy.edges = new Array(this.edges.length);
|
||||||
if (this.edges != null) {
|
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
copy.width = this.width;
|
||||||
|
copy.height = this.height;
|
||||||
|
return copy;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.newLinkedMesh = function () {
|
||||||
|
var copy = new MeshAttachment(this.name);
|
||||||
|
copy.region = this.region;
|
||||||
|
copy.path = this.path;
|
||||||
|
copy.color.setFromColor(this.color);
|
||||||
|
copy.deformAttachment = this.deformAttachment;
|
||||||
|
copy.setParentMesh(this.parentMesh != null ? this.parentMesh : this);
|
||||||
|
copy.updateUVs();
|
||||||
return copy;
|
return copy;
|
||||||
};
|
};
|
||||||
return MeshAttachment;
|
return MeshAttachment;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
5
spine-ts/build/spine-threejs.d.ts
vendored
5
spine-ts/build/spine-threejs.d.ts
vendored
@ -1103,9 +1103,9 @@ declare module spine {
|
|||||||
bones: Array<number>;
|
bones: Array<number>;
|
||||||
vertices: ArrayLike<number>;
|
vertices: ArrayLike<number>;
|
||||||
worldVerticesLength: number;
|
worldVerticesLength: number;
|
||||||
|
deformAttachment: VertexAttachment;
|
||||||
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;
|
|
||||||
copyTo(attachment: VertexAttachment): void;
|
copyTo(attachment: VertexAttachment): void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1157,14 +1157,13 @@ declare module spine {
|
|||||||
hullLength: number;
|
hullLength: number;
|
||||||
edges: Array<number>;
|
edges: Array<number>;
|
||||||
private parentMesh;
|
private parentMesh;
|
||||||
inheritDeform: boolean;
|
|
||||||
tempColor: Color;
|
tempColor: Color;
|
||||||
constructor(name: string);
|
constructor(name: string);
|
||||||
updateUVs(): void;
|
updateUVs(): void;
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
getParentMesh(): MeshAttachment;
|
getParentMesh(): MeshAttachment;
|
||||||
setParentMesh(parentMesh: MeshAttachment): void;
|
setParentMesh(parentMesh: MeshAttachment): void;
|
||||||
copy(): Attachment;
|
copy(): Attachment;
|
||||||
|
newLinkedMesh(): MeshAttachment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module spine {
|
declare module spine {
|
||||||
|
|||||||
@ -698,7 +698,7 @@ var spine;
|
|||||||
DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
||||||
var slot = skeleton.slots[this.slotIndex];
|
var slot = skeleton.slots[this.slotIndex];
|
||||||
var slotAttachment = slot.getAttachment();
|
var slotAttachment = slot.getAttachment();
|
||||||
if (!(slotAttachment instanceof spine.VertexAttachment) || !slotAttachment.applyDeform(this.attachment))
|
if (!(slotAttachment instanceof spine.VertexAttachment) || !(slotAttachment.deformAttachment == this.attachment))
|
||||||
return;
|
return;
|
||||||
var deformArray = slot.deform;
|
var deformArray = slot.deform;
|
||||||
if (deformArray.length == 0)
|
if (deformArray.length == 0)
|
||||||
@ -4694,6 +4694,7 @@ var spine;
|
|||||||
var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
||||||
if (parent_3 == null)
|
if (parent_3 == null)
|
||||||
throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
||||||
|
linkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? parent_3 : linkedMesh.mesh;
|
||||||
linkedMesh.mesh.setParentMesh(parent_3);
|
linkedMesh.mesh.setParentMesh(parent_3);
|
||||||
linkedMesh.mesh.updateUVs();
|
linkedMesh.mesh.updateUVs();
|
||||||
}
|
}
|
||||||
@ -4769,8 +4770,7 @@ var spine;
|
|||||||
mesh.height = this.getValue(map, "height", 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);
|
this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_4, this.getValue(map, "deform", true)));
|
||||||
this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_4));
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
var uvs = map.uvs;
|
var uvs = map.uvs;
|
||||||
@ -5236,11 +5236,12 @@ var spine;
|
|||||||
}());
|
}());
|
||||||
spine.SkeletonJson = SkeletonJson;
|
spine.SkeletonJson = SkeletonJson;
|
||||||
var LinkedMesh = (function () {
|
var LinkedMesh = (function () {
|
||||||
function LinkedMesh(mesh, skin, slotIndex, parent) {
|
function LinkedMesh(mesh, skin, slotIndex, parent, inheritDeform) {
|
||||||
this.mesh = mesh;
|
this.mesh = mesh;
|
||||||
this.skin = skin;
|
this.skin = skin;
|
||||||
this.slotIndex = slotIndex;
|
this.slotIndex = slotIndex;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
this.inheritDeform = inheritDeform;
|
||||||
}
|
}
|
||||||
return LinkedMesh;
|
return LinkedMesh;
|
||||||
}());
|
}());
|
||||||
@ -5334,18 +5335,15 @@ var spine;
|
|||||||
var attachments = skin.getAttachments();
|
var attachments = skin.getAttachments();
|
||||||
for (var i = 0; i < attachments.length; i++) {
|
for (var i = 0; i < attachments.length; i++) {
|
||||||
var attachment = attachments[i];
|
var attachment = attachments[i];
|
||||||
attachment.attachment = attachment.attachment.copy();
|
if (attachment.attachment == null)
|
||||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
continue;
|
||||||
}
|
if (attachment.attachment instanceof spine.MeshAttachment) {
|
||||||
attachments = this.getAttachments();
|
attachment.attachment = attachment.attachment.newLinkedMesh();
|
||||||
for (var i = 0; i < attachments.length; i++) {
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
var attachment_1 = attachments[i];
|
}
|
||||||
if (attachment_1.attachment instanceof spine.MeshAttachment) {
|
else {
|
||||||
var mesh = attachment_1.attachment;
|
attachment.attachment = attachment.attachment.copy();
|
||||||
if (mesh.getParentMesh()) {
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
|
|
||||||
mesh.updateUVs();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -6594,6 +6592,7 @@ var spine;
|
|||||||
var _this = _super.call(this, name) || this;
|
var _this = _super.call(this, name) || this;
|
||||||
_this.id = (VertexAttachment.nextID++ & 65535) << 11;
|
_this.id = (VertexAttachment.nextID++ & 65535) << 11;
|
||||||
_this.worldVerticesLength = 0;
|
_this.worldVerticesLength = 0;
|
||||||
|
_this.deformAttachment = _this;
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) {
|
VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) {
|
||||||
@ -6655,9 +6654,6 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment;
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.copyTo = function (attachment) {
|
VertexAttachment.prototype.copyTo = function (attachment) {
|
||||||
if (this.bones != null) {
|
if (this.bones != null) {
|
||||||
attachment.bones = new Array(this.bones.length);
|
attachment.bones = new Array(this.bones.length);
|
||||||
@ -6672,6 +6668,7 @@ var spine;
|
|||||||
else
|
else
|
||||||
attachment.vertices = null;
|
attachment.vertices = null;
|
||||||
attachment.worldVerticesLength = this.worldVerticesLength;
|
attachment.worldVerticesLength = this.worldVerticesLength;
|
||||||
|
attachment.deformAttachment = this.deformAttachment;
|
||||||
};
|
};
|
||||||
VertexAttachment.nextID = 0;
|
VertexAttachment.nextID = 0;
|
||||||
return VertexAttachment;
|
return VertexAttachment;
|
||||||
@ -6736,7 +6733,6 @@ var spine;
|
|||||||
function MeshAttachment(name) {
|
function MeshAttachment(name) {
|
||||||
var _this = _super.call(this, name) || this;
|
var _this = _super.call(this, name) || this;
|
||||||
_this.color = new spine.Color(1, 1, 1, 1);
|
_this.color = new spine.Color(1, 1, 1, 1);
|
||||||
_this.inheritDeform = false;
|
|
||||||
_this.tempColor = new spine.Color(0, 0, 0, 0);
|
_this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
@ -6800,9 +6796,6 @@ var spine;
|
|||||||
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.getParentMesh = function () {
|
MeshAttachment.prototype.getParentMesh = function () {
|
||||||
return this.parentMesh;
|
return this.parentMesh;
|
||||||
};
|
};
|
||||||
@ -6819,31 +6812,36 @@ var spine;
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
MeshAttachment.prototype.copy = function () {
|
MeshAttachment.prototype.copy = function () {
|
||||||
var copy = new MeshAttachment(name);
|
if (this.parentMesh != null)
|
||||||
|
return this.newLinkedMesh();
|
||||||
|
var copy = new MeshAttachment(this.name);
|
||||||
copy.region = this.region;
|
copy.region = this.region;
|
||||||
copy.path = this.path;
|
copy.path = this.path;
|
||||||
if (this.parentMesh == null) {
|
copy.color.setFromColor(this.color);
|
||||||
this.copyTo(copy);
|
this.copyTo(copy);
|
||||||
copy.regionUVs = new Array(this.regionUVs.length);
|
copy.regionUVs = new Array(this.regionUVs.length);
|
||||||
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
||||||
copy.uvs = new Array(this.uvs.length);
|
copy.uvs = new Array(this.uvs.length);
|
||||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
||||||
copy.triangles = new Array(this.triangles.length);
|
copy.triangles = new Array(this.triangles.length);
|
||||||
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, 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.hullLength = this.hullLength;
|
if (this.edges != null) {
|
||||||
copy.inheritDeform = this.inheritDeform;
|
copy.edges = new Array(this.edges.length);
|
||||||
if (this.edges != null) {
|
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
copy.width = this.width;
|
||||||
|
copy.height = this.height;
|
||||||
|
return copy;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.newLinkedMesh = function () {
|
||||||
|
var copy = new MeshAttachment(this.name);
|
||||||
|
copy.region = this.region;
|
||||||
|
copy.path = this.path;
|
||||||
|
copy.color.setFromColor(this.color);
|
||||||
|
copy.deformAttachment = this.deformAttachment;
|
||||||
|
copy.setParentMesh(this.parentMesh != null ? this.parentMesh : this);
|
||||||
|
copy.updateUVs();
|
||||||
return copy;
|
return copy;
|
||||||
};
|
};
|
||||||
return MeshAttachment;
|
return MeshAttachment;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
5
spine-ts/build/spine-webgl.d.ts
vendored
5
spine-ts/build/spine-webgl.d.ts
vendored
@ -1103,9 +1103,9 @@ declare module spine {
|
|||||||
bones: Array<number>;
|
bones: Array<number>;
|
||||||
vertices: ArrayLike<number>;
|
vertices: ArrayLike<number>;
|
||||||
worldVerticesLength: number;
|
worldVerticesLength: number;
|
||||||
|
deformAttachment: VertexAttachment;
|
||||||
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;
|
|
||||||
copyTo(attachment: VertexAttachment): void;
|
copyTo(attachment: VertexAttachment): void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1157,14 +1157,13 @@ declare module spine {
|
|||||||
hullLength: number;
|
hullLength: number;
|
||||||
edges: Array<number>;
|
edges: Array<number>;
|
||||||
private parentMesh;
|
private parentMesh;
|
||||||
inheritDeform: boolean;
|
|
||||||
tempColor: Color;
|
tempColor: Color;
|
||||||
constructor(name: string);
|
constructor(name: string);
|
||||||
updateUVs(): void;
|
updateUVs(): void;
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
getParentMesh(): MeshAttachment;
|
getParentMesh(): MeshAttachment;
|
||||||
setParentMesh(parentMesh: MeshAttachment): void;
|
setParentMesh(parentMesh: MeshAttachment): void;
|
||||||
copy(): Attachment;
|
copy(): Attachment;
|
||||||
|
newLinkedMesh(): MeshAttachment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module spine {
|
declare module spine {
|
||||||
|
|||||||
@ -698,7 +698,7 @@ var spine;
|
|||||||
DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
||||||
var slot = skeleton.slots[this.slotIndex];
|
var slot = skeleton.slots[this.slotIndex];
|
||||||
var slotAttachment = slot.getAttachment();
|
var slotAttachment = slot.getAttachment();
|
||||||
if (!(slotAttachment instanceof spine.VertexAttachment) || !slotAttachment.applyDeform(this.attachment))
|
if (!(slotAttachment instanceof spine.VertexAttachment) || !(slotAttachment.deformAttachment == this.attachment))
|
||||||
return;
|
return;
|
||||||
var deformArray = slot.deform;
|
var deformArray = slot.deform;
|
||||||
if (deformArray.length == 0)
|
if (deformArray.length == 0)
|
||||||
@ -4694,6 +4694,7 @@ var spine;
|
|||||||
var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
||||||
if (parent_3 == null)
|
if (parent_3 == null)
|
||||||
throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
||||||
|
linkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? parent_3 : linkedMesh.mesh;
|
||||||
linkedMesh.mesh.setParentMesh(parent_3);
|
linkedMesh.mesh.setParentMesh(parent_3);
|
||||||
linkedMesh.mesh.updateUVs();
|
linkedMesh.mesh.updateUVs();
|
||||||
}
|
}
|
||||||
@ -4769,8 +4770,7 @@ var spine;
|
|||||||
mesh.height = this.getValue(map, "height", 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);
|
this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_4, this.getValue(map, "deform", true)));
|
||||||
this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_4));
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
var uvs = map.uvs;
|
var uvs = map.uvs;
|
||||||
@ -5236,11 +5236,12 @@ var spine;
|
|||||||
}());
|
}());
|
||||||
spine.SkeletonJson = SkeletonJson;
|
spine.SkeletonJson = SkeletonJson;
|
||||||
var LinkedMesh = (function () {
|
var LinkedMesh = (function () {
|
||||||
function LinkedMesh(mesh, skin, slotIndex, parent) {
|
function LinkedMesh(mesh, skin, slotIndex, parent, inheritDeform) {
|
||||||
this.mesh = mesh;
|
this.mesh = mesh;
|
||||||
this.skin = skin;
|
this.skin = skin;
|
||||||
this.slotIndex = slotIndex;
|
this.slotIndex = slotIndex;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
this.inheritDeform = inheritDeform;
|
||||||
}
|
}
|
||||||
return LinkedMesh;
|
return LinkedMesh;
|
||||||
}());
|
}());
|
||||||
@ -5334,18 +5335,15 @@ var spine;
|
|||||||
var attachments = skin.getAttachments();
|
var attachments = skin.getAttachments();
|
||||||
for (var i = 0; i < attachments.length; i++) {
|
for (var i = 0; i < attachments.length; i++) {
|
||||||
var attachment = attachments[i];
|
var attachment = attachments[i];
|
||||||
attachment.attachment = attachment.attachment.copy();
|
if (attachment.attachment == null)
|
||||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
continue;
|
||||||
}
|
if (attachment.attachment instanceof spine.MeshAttachment) {
|
||||||
attachments = this.getAttachments();
|
attachment.attachment = attachment.attachment.newLinkedMesh();
|
||||||
for (var i = 0; i < attachments.length; i++) {
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
var attachment_1 = attachments[i];
|
}
|
||||||
if (attachment_1.attachment instanceof spine.MeshAttachment) {
|
else {
|
||||||
var mesh = attachment_1.attachment;
|
attachment.attachment = attachment.attachment.copy();
|
||||||
if (mesh.getParentMesh()) {
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
|
|
||||||
mesh.updateUVs();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -6594,6 +6592,7 @@ var spine;
|
|||||||
var _this = _super.call(this, name) || this;
|
var _this = _super.call(this, name) || this;
|
||||||
_this.id = (VertexAttachment.nextID++ & 65535) << 11;
|
_this.id = (VertexAttachment.nextID++ & 65535) << 11;
|
||||||
_this.worldVerticesLength = 0;
|
_this.worldVerticesLength = 0;
|
||||||
|
_this.deformAttachment = _this;
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) {
|
VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) {
|
||||||
@ -6655,9 +6654,6 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment;
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.copyTo = function (attachment) {
|
VertexAttachment.prototype.copyTo = function (attachment) {
|
||||||
if (this.bones != null) {
|
if (this.bones != null) {
|
||||||
attachment.bones = new Array(this.bones.length);
|
attachment.bones = new Array(this.bones.length);
|
||||||
@ -6672,6 +6668,7 @@ var spine;
|
|||||||
else
|
else
|
||||||
attachment.vertices = null;
|
attachment.vertices = null;
|
||||||
attachment.worldVerticesLength = this.worldVerticesLength;
|
attachment.worldVerticesLength = this.worldVerticesLength;
|
||||||
|
attachment.deformAttachment = this.deformAttachment;
|
||||||
};
|
};
|
||||||
VertexAttachment.nextID = 0;
|
VertexAttachment.nextID = 0;
|
||||||
return VertexAttachment;
|
return VertexAttachment;
|
||||||
@ -6736,7 +6733,6 @@ var spine;
|
|||||||
function MeshAttachment(name) {
|
function MeshAttachment(name) {
|
||||||
var _this = _super.call(this, name) || this;
|
var _this = _super.call(this, name) || this;
|
||||||
_this.color = new spine.Color(1, 1, 1, 1);
|
_this.color = new spine.Color(1, 1, 1, 1);
|
||||||
_this.inheritDeform = false;
|
|
||||||
_this.tempColor = new spine.Color(0, 0, 0, 0);
|
_this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
@ -6800,9 +6796,6 @@ var spine;
|
|||||||
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.getParentMesh = function () {
|
MeshAttachment.prototype.getParentMesh = function () {
|
||||||
return this.parentMesh;
|
return this.parentMesh;
|
||||||
};
|
};
|
||||||
@ -6819,31 +6812,36 @@ var spine;
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
MeshAttachment.prototype.copy = function () {
|
MeshAttachment.prototype.copy = function () {
|
||||||
var copy = new MeshAttachment(name);
|
if (this.parentMesh != null)
|
||||||
|
return this.newLinkedMesh();
|
||||||
|
var copy = new MeshAttachment(this.name);
|
||||||
copy.region = this.region;
|
copy.region = this.region;
|
||||||
copy.path = this.path;
|
copy.path = this.path;
|
||||||
if (this.parentMesh == null) {
|
copy.color.setFromColor(this.color);
|
||||||
this.copyTo(copy);
|
this.copyTo(copy);
|
||||||
copy.regionUVs = new Array(this.regionUVs.length);
|
copy.regionUVs = new Array(this.regionUVs.length);
|
||||||
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
||||||
copy.uvs = new Array(this.uvs.length);
|
copy.uvs = new Array(this.uvs.length);
|
||||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
||||||
copy.triangles = new Array(this.triangles.length);
|
copy.triangles = new Array(this.triangles.length);
|
||||||
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, 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.hullLength = this.hullLength;
|
if (this.edges != null) {
|
||||||
copy.inheritDeform = this.inheritDeform;
|
copy.edges = new Array(this.edges.length);
|
||||||
if (this.edges != null) {
|
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
copy.width = this.width;
|
||||||
|
copy.height = this.height;
|
||||||
|
return copy;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.newLinkedMesh = function () {
|
||||||
|
var copy = new MeshAttachment(this.name);
|
||||||
|
copy.region = this.region;
|
||||||
|
copy.path = this.path;
|
||||||
|
copy.color.setFromColor(this.color);
|
||||||
|
copy.deformAttachment = this.deformAttachment;
|
||||||
|
copy.setParentMesh(this.parentMesh != null ? this.parentMesh : this);
|
||||||
|
copy.updateUVs();
|
||||||
return copy;
|
return copy;
|
||||||
};
|
};
|
||||||
return MeshAttachment;
|
return MeshAttachment;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -755,7 +755,7 @@ module spine {
|
|||||||
apply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {
|
apply (skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {
|
||||||
let slot: Slot = skeleton.slots[this.slotIndex];
|
let slot: Slot = skeleton.slots[this.slotIndex];
|
||||||
let slotAttachment: Attachment = slot.getAttachment();
|
let slotAttachment: Attachment = slot.getAttachment();
|
||||||
if (!(slotAttachment instanceof VertexAttachment) || !(<VertexAttachment>slotAttachment).applyDeform(this.attachment)) return;
|
if (!(slotAttachment instanceof VertexAttachment) || !((<VertexAttachment>slotAttachment).deformAttachment == this.attachment)) return;
|
||||||
|
|
||||||
let deformArray: Array<number> = slot.deform;
|
let deformArray: Array<number> = slot.deform;
|
||||||
if (deformArray.length == 0) blend = MixBlend.setup;
|
if (deformArray.length == 0) blend = MixBlend.setup;
|
||||||
|
|||||||
@ -229,6 +229,7 @@ module spine {
|
|||||||
if (skin == null) throw new Error("Skin not found: " + linkedMesh.skin);
|
if (skin == null) throw new Error("Skin not found: " + linkedMesh.skin);
|
||||||
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
||||||
if (parent == null) throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
if (parent == null) throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
||||||
|
linkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? <VertexAttachment>parent : <VertexAttachment>linkedMesh.mesh;
|
||||||
linkedMesh.mesh.setParentMesh(<MeshAttachment> parent);
|
linkedMesh.mesh.setParentMesh(<MeshAttachment> parent);
|
||||||
linkedMesh.mesh.updateUVs();
|
linkedMesh.mesh.updateUVs();
|
||||||
}
|
}
|
||||||
@ -311,8 +312,7 @@ module spine {
|
|||||||
|
|
||||||
let parent: string = this.getValue(map, "parent", null);
|
let parent: string = this.getValue(map, "parent", null);
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
mesh.inheritDeform = this.getValue(map, "deform", true);
|
this.linkedMeshes.push(new LinkedMesh(mesh, <string> this.getValue(map, "skin", null), slotIndex, parent, this.getValue(map, "deform", true)));
|
||||||
this.linkedMeshes.push(new LinkedMesh(mesh, <string> this.getValue(map, "skin", null), slotIndex, parent));
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,12 +794,14 @@ module spine {
|
|||||||
parent: string; skin: string;
|
parent: string; skin: string;
|
||||||
slotIndex: number;
|
slotIndex: number;
|
||||||
mesh: MeshAttachment;
|
mesh: MeshAttachment;
|
||||||
|
inheritDeform: boolean;
|
||||||
|
|
||||||
constructor (mesh: MeshAttachment, skin: string, slotIndex: number, parent: string) {
|
constructor (mesh: MeshAttachment, skin: string, slotIndex: number, parent: string, inheritDeform: boolean) {
|
||||||
this.mesh = mesh;
|
this.mesh = mesh;
|
||||||
this.skin = skin;
|
this.skin = skin;
|
||||||
this.slotIndex = slotIndex;
|
this.slotIndex = slotIndex;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
this.inheritDeform = inheritDeform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,19 +111,13 @@ module spine {
|
|||||||
let attachments = skin.getAttachments();
|
let attachments = skin.getAttachments();
|
||||||
for (let i = 0; i < attachments.length; i++) {
|
for (let i = 0; i < attachments.length; i++) {
|
||||||
var attachment = attachments[i];
|
var attachment = attachments[i];
|
||||||
attachment.attachment = attachment.attachment.copy();
|
if (attachment.attachment == null) continue;
|
||||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
|
||||||
}
|
|
||||||
|
|
||||||
attachments = this.getAttachments();
|
|
||||||
for (let i = 0; i < attachments.length; i++) {
|
|
||||||
let attachment = attachments[i];
|
|
||||||
if (attachment.attachment instanceof MeshAttachment) {
|
if (attachment.attachment instanceof MeshAttachment) {
|
||||||
let mesh = attachment.attachment as MeshAttachment;
|
attachment.attachment = attachment.attachment.newLinkedMesh();
|
||||||
if (mesh.getParentMesh()) {
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
mesh.setParentMesh(this.getAttachment(attachment.slotIndex, mesh.getParentMesh().name) as MeshAttachment);
|
} else {
|
||||||
mesh.updateUVs();
|
attachment.attachment = attachment.attachment.copy();
|
||||||
}
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,7 @@ module spine {
|
|||||||
bones: Array<number>;
|
bones: Array<number>;
|
||||||
vertices: ArrayLike<number>;
|
vertices: ArrayLike<number>;
|
||||||
worldVerticesLength = 0;
|
worldVerticesLength = 0;
|
||||||
|
deformAttachment: VertexAttachment = this;
|
||||||
|
|
||||||
constructor (name: string) {
|
constructor (name: string) {
|
||||||
super(name);
|
super(name);
|
||||||
@ -114,11 +115,6 @@ module spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if a deform originally applied to the specified attachment should be applied to this attachment. */
|
|
||||||
applyDeform (sourceAttachment: VertexAttachment) {
|
|
||||||
return this == sourceAttachment;
|
|
||||||
}
|
|
||||||
|
|
||||||
copyTo (attachment: VertexAttachment) {
|
copyTo (attachment: VertexAttachment) {
|
||||||
if (this.bones != null) {
|
if (this.bones != null) {
|
||||||
attachment.bones = new Array<number>(this.bones.length);
|
attachment.bones = new Array<number>(this.bones.length);
|
||||||
@ -133,6 +129,7 @@ module spine {
|
|||||||
attachment.vertices = null;
|
attachment.vertices = null;
|
||||||
|
|
||||||
attachment.worldVerticesLength = this.worldVerticesLength;
|
attachment.worldVerticesLength = this.worldVerticesLength;
|
||||||
|
attachment.deformAttachment = this.deformAttachment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,6 @@ module spine {
|
|||||||
hullLength: number;
|
hullLength: number;
|
||||||
edges: Array<number>;
|
edges: Array<number>;
|
||||||
private parentMesh: MeshAttachment;
|
private parentMesh: MeshAttachment;
|
||||||
inheritDeform = false;
|
|
||||||
tempColor = new Color(0, 0, 0, 0);
|
tempColor = new Color(0, 0, 0, 0);
|
||||||
|
|
||||||
constructor (name: string) {
|
constructor (name: string) {
|
||||||
@ -105,10 +104,6 @@ module spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
applyDeform (sourceAttachment: VertexAttachment): boolean {
|
|
||||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
|
||||||
}
|
|
||||||
|
|
||||||
getParentMesh () {
|
getParentMesh () {
|
||||||
return this.parentMesh;
|
return this.parentMesh;
|
||||||
}
|
}
|
||||||
@ -128,37 +123,43 @@ module spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy (): Attachment {
|
copy (): Attachment {
|
||||||
let copy = new MeshAttachment(name);
|
if (this.parentMesh != null) return this.newLinkedMesh();
|
||||||
|
|
||||||
|
let copy = new MeshAttachment(this.name);
|
||||||
copy.region = this.region;
|
copy.region = this.region;
|
||||||
copy.path = this.path;
|
copy.path = this.path;
|
||||||
|
copy.color.setFromColor(this.color);
|
||||||
|
|
||||||
if (this.parentMesh == null) {
|
this.copyTo(copy);
|
||||||
this.copyTo(copy);
|
copy.regionUVs = new Array<number>(this.regionUVs.length);
|
||||||
copy.regionUVs = new Array<number>(this.regionUVs.length);
|
Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
||||||
Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
copy.uvs = new Array<number>(this.uvs.length);
|
||||||
copy.uvs = new Array<number>(this.uvs.length);
|
Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
||||||
Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
copy.triangles = new Array<number>(this.triangles.length);
|
||||||
copy.triangles = new Array<number>(this.triangles.length);
|
Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
|
||||||
Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
|
copy.hullLength = this.hullLength;
|
||||||
copy.color.setFromColor(this.color);
|
|
||||||
copy.hullLength = this.hullLength;
|
|
||||||
|
|
||||||
copy.inheritDeform = this.inheritDeform;
|
// Nonessential.
|
||||||
|
if (this.edges != null) {
|
||||||
// Nonessential.
|
copy.edges = new Array<number>(this.edges.length);
|
||||||
if (this.edges != null) {
|
Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
|
||||||
copy.edges = new Array<number>(this.edges.length);
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
copy.width = this.width;
|
||||||
|
copy.height = this.height;
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newLinkedMesh (): MeshAttachment {
|
||||||
|
let copy = new MeshAttachment(this.name);
|
||||||
|
copy.region = this.region;
|
||||||
|
copy.path = this.path;
|
||||||
|
copy.color.setFromColor(this.color);
|
||||||
|
copy.deformAttachment = this.deformAttachment;
|
||||||
|
copy.setParentMesh(this.parentMesh != null ? this.parentMesh : this);
|
||||||
|
copy.updateUVs();
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
108
spine-ts/webgl/tests/test-skins.html
Normal file
108
spine-ts/webgl/tests/test-skins.html
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<html>
|
||||||
|
<script src="../../build/spine-webgl.js"></script>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
|
||||||
|
<style>
|
||||||
|
* { margin: 0; padding: 0; }
|
||||||
|
body, html { height: 100% }
|
||||||
|
canvas { position: absolute; width: 100% ;height: 100%; }
|
||||||
|
</style>
|
||||||
|
<body>
|
||||||
|
<div id="label" style="position: absolute; top: 0; left: 0; color: #fff; z-index: 10"></div>
|
||||||
|
<canvas id="canvas" style="background: red;"></canvas>
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var FILE = "goblins-pro";
|
||||||
|
var ANIMATION = "walk";
|
||||||
|
var SCALE = 0.5;
|
||||||
|
|
||||||
|
var canvas, context, gl, renderer, input, assetManager;
|
||||||
|
var skeletons = [];
|
||||||
|
var timeKeeper;
|
||||||
|
var label = document.getElementById("label");
|
||||||
|
var updateMean = new spine.WindowedMean();
|
||||||
|
var renderMean = new spine.WindowedMean();
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
canvas = document.getElementById("canvas");
|
||||||
|
canvas.width = canvas.clientWidth; canvas.height = canvas.clientHeight;
|
||||||
|
context = new spine.webgl.ManagedWebGLRenderingContext(canvas, { alpha: false });
|
||||||
|
gl = context.gl;
|
||||||
|
|
||||||
|
renderer = new spine.webgl.SceneRenderer(canvas, context);
|
||||||
|
assetManager = new spine.webgl.AssetManager(context, "../example/assets/");
|
||||||
|
input = new spine.webgl.Input(canvas);
|
||||||
|
|
||||||
|
assetManager.loadTextureAtlas(FILE.replace("-pro", "").replace("-ess", "") + "-pma.atlas");
|
||||||
|
assetManager.loadText(FILE + ".json");
|
||||||
|
|
||||||
|
timeKeeper = new spine.TimeKeeper();
|
||||||
|
requestAnimationFrame(load);
|
||||||
|
}
|
||||||
|
|
||||||
|
var run = true;
|
||||||
|
|
||||||
|
function load() {
|
||||||
|
timeKeeper.update();
|
||||||
|
if (assetManager.isLoadingComplete()) {
|
||||||
|
var atlas = assetManager.get(FILE.replace("-pro", "").replace("-ess", "") + "-pma.atlas");
|
||||||
|
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||||
|
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||||
|
skeletonJson.scale = SCALE;
|
||||||
|
var skeletonData = skeletonJson.readSkeletonData(JSON.parse(assetManager.get(FILE + ".json")));
|
||||||
|
|
||||||
|
skeleton = new spine.Skeleton(skeletonData);
|
||||||
|
var stateData = new spine.AnimationStateData(skeleton.data);
|
||||||
|
state = new spine.AnimationState(stateData);
|
||||||
|
stateData.defaultMix = 0;
|
||||||
|
|
||||||
|
var originalSkin = skeleton.data.findSkin("goblingirl");
|
||||||
|
var copy = new spine.Skin("test");
|
||||||
|
copy.copySkin(originalSkin);
|
||||||
|
skeleton.setSkin(copy);
|
||||||
|
skeleton.setSlotsToSetupPose();
|
||||||
|
|
||||||
|
state.setAnimation(0, ANIMATION, true);
|
||||||
|
skeletons.push({ skeleton: skeleton, state: state });
|
||||||
|
|
||||||
|
requestAnimationFrame(render);
|
||||||
|
} else {
|
||||||
|
requestAnimationFrame(load);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function render() {
|
||||||
|
var start = Date.now()
|
||||||
|
timeKeeper.update();
|
||||||
|
var delta = timeKeeper.delta;
|
||||||
|
|
||||||
|
for (var i = 0; i < skeletons.length; i++) {
|
||||||
|
var state = skeletons[i].state;
|
||||||
|
var skeleton = skeletons[i].skeleton;
|
||||||
|
state.update(delta);
|
||||||
|
state.apply(skeleton);
|
||||||
|
skeleton.updateWorldTransform();
|
||||||
|
}
|
||||||
|
updateMean.addValue(Date.now() - start);
|
||||||
|
start = Date.now();
|
||||||
|
|
||||||
|
gl.clearColor(0.2, 0.2, 0.2, 1);
|
||||||
|
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
renderer.resize(spine.webgl.ResizeMode.Fit);
|
||||||
|
renderer.begin();
|
||||||
|
for (var i = 0; i < skeletons.length; i++) {
|
||||||
|
var skeleton = skeletons[i].skeleton;
|
||||||
|
renderer.drawSkeleton(skeleton, true);
|
||||||
|
}
|
||||||
|
renderer.end();
|
||||||
|
|
||||||
|
requestAnimationFrame(render)
|
||||||
|
renderMean.addValue(Date.now() - start);
|
||||||
|
label.innerHTML = ("Update time: " + Number(updateMean.getMean()).toFixed(2) + " ms\n" +
|
||||||
|
"Render time: " + Number(renderMean.getMean()).toFixed(2) + " ms\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
init();
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user