mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
Minor fixes.
This commit is contained in:
parent
f71fb43552
commit
cf41610f8a
@ -177,18 +177,21 @@ public class Skeleton {
|
|||||||
* each slot's setup mode attachment is attached from the new skin.
|
* each slot's setup mode attachment is attached from the new skin.
|
||||||
* @param newSkin May be null. */
|
* @param newSkin May be null. */
|
||||||
public function set skin (newSkin:Skin) : void {
|
public function set skin (newSkin:Skin) : void {
|
||||||
if (!skin) {
|
if (newSkin) {
|
||||||
var i:int = 0;
|
if (skin)
|
||||||
for each (var slot:Slot in _slots) {
|
newSkin.attachAll(this, skin);
|
||||||
var name:String = slot.data.attachmentName;
|
else {
|
||||||
if (name) {
|
var i:int = 0;
|
||||||
var attachment:Attachment = newSkin.getAttachment(i, name);
|
for each (var slot:Slot in _slots) {
|
||||||
if (attachment) slot.attachment = attachment;
|
var name:String = slot.data.attachmentName;
|
||||||
|
if (name) {
|
||||||
|
var attachment:Attachment = newSkin.getAttachment(i, name);
|
||||||
|
if (attachment) slot.attachment = attachment;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
} else if (newSkin)
|
}
|
||||||
newSkin.attachAll(this, skin);
|
|
||||||
_skin = newSkin;
|
_skin = newSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -411,7 +411,7 @@ public class SkeletonJson {
|
|||||||
}
|
}
|
||||||
if (attachment is MeshAttachment) {
|
if (attachment is MeshAttachment) {
|
||||||
var meshVertices:Vector.<Number> = (attachment as MeshAttachment).vertices;
|
var meshVertices:Vector.<Number> = (attachment as MeshAttachment).vertices;
|
||||||
for (i = 0, n = vertices.length; i < n; i++)
|
for (i = 0; i < vertexCount; i++)
|
||||||
vertices[i] += meshVertices[i];
|
vertices[i] += meshVertices[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -163,17 +163,21 @@ int spSkeleton_setSkinByName (spSkeleton* self, const char* skinName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void spSkeleton_setSkin (spSkeleton* self, spSkin* newSkin) {
|
void spSkeleton_setSkin (spSkeleton* self, spSkin* newSkin) {
|
||||||
if (!self->skin) {
|
if (newSkin) {
|
||||||
int i;
|
if (self->skin)
|
||||||
for (i = 0; i < self->slotCount; ++i) {
|
spSkin_attachAll(newSkin, self, self->skin);
|
||||||
spSlot* slot = self->slots[i];
|
else {
|
||||||
if (slot->data->attachmentName) {
|
/* No previous skin, attach setup pose attachments. */
|
||||||
spAttachment* attachment = spSkin_getAttachment(newSkin, i, slot->data->attachmentName);
|
int i;
|
||||||
if (attachment) spSlot_setAttachment(slot, attachment);
|
for (i = 0; i < self->slotCount; ++i) {
|
||||||
|
spSlot* slot = self->slots[i];
|
||||||
|
if (slot->data->attachmentName) {
|
||||||
|
spAttachment* attachment = spSkin_getAttachment(newSkin, i, slot->data->attachmentName);
|
||||||
|
if (attachment) spSlot_setAttachment(slot, attachment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (newSkin) /**/
|
}
|
||||||
spSkin_attachAll(newSkin, self, self->skin);
|
|
||||||
CONST_CAST(spSkin*, self->skin) = newSkin;
|
CONST_CAST(spSkin*, self->skin) = newSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -165,18 +165,21 @@ namespace Spine {
|
|||||||
/// setup mode attachment is attached from the new skin.</summary>
|
/// setup mode attachment is attached from the new skin.</summary>
|
||||||
/// <param name="newSkin">May be null.</param>
|
/// <param name="newSkin">May be null.</param>
|
||||||
public void SetSkin (Skin newSkin) {
|
public void SetSkin (Skin newSkin) {
|
||||||
if (skin == null) {
|
if (newSkin != null) {
|
||||||
List<Slot> slots = this.slots;
|
if (skin != null)
|
||||||
for (int i = 0, n = slots.Count; i < n; i++) {
|
newSkin.AttachAll(this, skin);
|
||||||
Slot slot = slots[i];
|
else {
|
||||||
String name = slot.data.attachmentName;
|
List<Slot> slots = this.slots;
|
||||||
if (name != null) {
|
for (int i = 0, n = slots.Count; i < n; i++) {
|
||||||
Attachment attachment = newSkin.GetAttachment(i, name);
|
Slot slot = slots[i];
|
||||||
if (attachment != null) slot.Attachment = attachment;
|
String name = slot.data.attachmentName;
|
||||||
|
if (name != null) {
|
||||||
|
Attachment attachment = newSkin.GetAttachment(i, name);
|
||||||
|
if (attachment != null) slot.Attachment = attachment;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (newSkin != null) //
|
}
|
||||||
newSkin.AttachAll(this, skin);
|
|
||||||
skin = newSkin;
|
skin = newSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -483,7 +483,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
if (attachment is MeshAttachment) {
|
if (attachment is MeshAttachment) {
|
||||||
float[] meshVertices = ((MeshAttachment)attachment).vertices;
|
float[] meshVertices = ((MeshAttachment)attachment).vertices;
|
||||||
for (int i = 0, n = vertices.Length; i < n; i++)
|
for (int i = 0; i < vertexCount; i++)
|
||||||
vertices[i] += meshVertices[i];
|
vertices[i] += meshVertices[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -828,18 +828,21 @@ spine.Skeleton.prototype = {
|
|||||||
* each slot's setup mode attachment is attached from the new skin.
|
* each slot's setup mode attachment is attached from the new skin.
|
||||||
* @param newSkin May be null. */
|
* @param newSkin May be null. */
|
||||||
setSkin: function (newSkin) {
|
setSkin: function (newSkin) {
|
||||||
if (!this.skin) {
|
if (newSkin) {
|
||||||
var slots = this.slots;
|
if (this.skin)
|
||||||
for (var i = 0, n = slots.length; i < n; i++) {
|
newSkin._attachAll(this, this.skin);
|
||||||
var slot = slots[i];
|
else {
|
||||||
var name = slot.data.attachmentName;
|
var slots = this.slots;
|
||||||
if (name) {
|
for (var i = 0, n = slots.length; i < n; i++) {
|
||||||
var attachment = newSkin.getAttachment(i, name);
|
var slot = slots[i];
|
||||||
if (attachment) slot.setAttachment(attachment);
|
var name = slot.data.attachmentName;
|
||||||
|
if (name) {
|
||||||
|
var attachment = newSkin.getAttachment(i, name);
|
||||||
|
if (attachment) slot.setAttachment(attachment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (newSkin)
|
}
|
||||||
newSkin._attachAll(this, this.skin);
|
|
||||||
this.skin = newSkin;
|
this.skin = newSkin;
|
||||||
},
|
},
|
||||||
/** @return May be null. */
|
/** @return May be null. */
|
||||||
@ -915,6 +918,8 @@ spine.RegionAttachment.prototype = {
|
|||||||
rotation: 0,
|
rotation: 0,
|
||||||
scaleX: 1, scaleY: 1,
|
scaleX: 1, scaleY: 1,
|
||||||
width: 0, height: 0,
|
width: 0, height: 0,
|
||||||
|
r: 1, g: 1, b: 1, a: 1,
|
||||||
|
path: null,
|
||||||
rendererObject: null,
|
rendererObject: null,
|
||||||
regionOffsetX: 0, regionOffsetY: 0,
|
regionOffsetX: 0, regionOffsetY: 0,
|
||||||
regionWidth: 0, regionHeight: 0,
|
regionWidth: 0, regionHeight: 0,
|
||||||
@ -1004,7 +1009,7 @@ spine.MeshAttachment.prototype = {
|
|||||||
regionOriginalWidth: 0, regionOriginalHeight: 0,
|
regionOriginalWidth: 0, regionOriginalHeight: 0,
|
||||||
edges: null,
|
edges: null,
|
||||||
width: 0, height: 0,
|
width: 0, height: 0,
|
||||||
updateUVs: function (u, v, u2, v2, rotate) {
|
updateUVs: function () {
|
||||||
var width = regionU2 - regionU, height = regionV2 - regionV;
|
var width = regionU2 - regionU, height = regionV2 - regionV;
|
||||||
var n = regionUVs.length;
|
var n = regionUVs.length;
|
||||||
if (!uvs || uvs.length != n) {
|
if (!uvs || uvs.length != n) {
|
||||||
|
|||||||
@ -209,18 +209,21 @@ public class Skeleton {
|
|||||||
* each slot's setup mode attachment is attached from the new skin.
|
* each slot's setup mode attachment is attached from the new skin.
|
||||||
* @param newSkin May be null. */
|
* @param newSkin May be null. */
|
||||||
public void setSkin (Skin newSkin) {
|
public void setSkin (Skin newSkin) {
|
||||||
if (skin == null) {
|
if (newSkin != null) {
|
||||||
Array<Slot> slots = this.slots;
|
if (skin != null)
|
||||||
for (int i = 0, n = slots.size; i < n; i++) {
|
newSkin.attachAll(this, skin);
|
||||||
Slot slot = slots.get(i);
|
else {
|
||||||
String name = slot.data.attachmentName;
|
Array<Slot> slots = this.slots;
|
||||||
if (name != null) {
|
for (int i = 0, n = slots.size; i < n; i++) {
|
||||||
Attachment attachment = newSkin.getAttachment(i, name);
|
Slot slot = slots.get(i);
|
||||||
if (attachment != null) slot.setAttachment(attachment);
|
String name = slot.data.attachmentName;
|
||||||
|
if (name != null) {
|
||||||
|
Attachment attachment = newSkin.getAttachment(i, name);
|
||||||
|
if (attachment != null) slot.setAttachment(attachment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (newSkin != null) //
|
}
|
||||||
newSkin.attachAll(this, skin);
|
|
||||||
skin = newSkin;
|
skin = newSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -390,7 +390,7 @@ public class SkeletonJson {
|
|||||||
}
|
}
|
||||||
if (attachment instanceof MeshAttachment) {
|
if (attachment instanceof MeshAttachment) {
|
||||||
float[] meshVertices = ((MeshAttachment)attachment).getVertices();
|
float[] meshVertices = ((MeshAttachment)attachment).getVertices();
|
||||||
for (int i = 0, n = vertices.length; i < n; i++)
|
for (int i = 0; i < vertexCount; i++)
|
||||||
vertices[i] += meshVertices[i];
|
vertices[i] += meshVertices[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user