Refactoring: changed references to "bind pose" to "setup pose".

This better matches "setup mode" in the editor and we can be consistent in code and docs from now on.
This commit is contained in:
NathanSweet 2013-05-05 12:38:06 +02:00
parent 80fdba02a1
commit 7f69300bcc
35 changed files with 1203 additions and 98 deletions

View File

@ -27,7 +27,7 @@ public class Bone {
throw new ArgumentError("data cannot be null."); throw new ArgumentError("data cannot be null.");
_data = data; _data = data;
_parent = parent; _parent = parent;
setToBindPose(); setToSetupPose();
} }
/** Computes the world SRT using the parent bone and the local SRT. */ /** Computes the world SRT using the parent bone and the local SRT. */
@ -66,7 +66,7 @@ public class Bone {
} }
} }
public function setToBindPose () : void { public function setToSetupPose () : void {
x = _data.x; x = _data.x;
y = _data.y; y = _data.y;
rotation = _data.rotation; rotation = _data.rotation;

View File

@ -42,20 +42,20 @@ public class Skeleton {
bone.updateWorldTransform(flipX, flipY); bone.updateWorldTransform(flipX, flipY);
} }
/** Sets the bones and slots to their bind pose values. */ /** Sets the bones and slots to their setup pose values. */
public function setToBindPose () : void { public function setToSetupPose () : void {
setBonesToBindPose(); setBonesToSetupPose();
setSlotsToBindPose(); setSlotsToSetupPose();
} }
public function setBonesToBindPose () : void { public function setBonesToSetupPose () : void {
for each (var bone:Bone in _bones) for each (var bone:Bone in _bones)
bone.setToBindPose(); bone.setToSetupPose();
} }
public function setSlotsToBindPose () : void { public function setSlotsToSetupPose () : void {
for each (var slot:Slot in _slots) for each (var slot:Slot in _slots)
slot.setToBindPose(); slot.setToSetupPose();
} }
public function get data () : SkeletonData { public function get data () : SkeletonData {

View File

@ -4,7 +4,7 @@ import spine.animation.Animation;
public class SkeletonData { public class SkeletonData {
public var name:String; public var name:String;
public var bones:Vector.<BoneData> = new Vector.<BoneData>(); // Ordered parents first. public var bones:Vector.<BoneData> = new Vector.<BoneData>(); // Ordered parents first.
public var slots:Vector.<SlotData> = new Vector.<SlotData>(); // Bind pose draw order. public var slots:Vector.<SlotData> = new Vector.<SlotData>(); // Setup pose draw order.
public var skins:Vector.<Skin> = new Vector.<Skin>(); public var skins:Vector.<Skin> = new Vector.<Skin>();
public var defaultSkin:Skin; public var defaultSkin:Skin;
public var animations:Vector.<Animation> = new Vector.<Animation>(); public var animations:Vector.<Animation> = new Vector.<Animation>();

View File

@ -22,7 +22,7 @@ public class Slot {
_data = data; _data = data;
_skeleton = skeleton; _skeleton = skeleton;
_bone = bone; _bone = bone;
setToBindPose(); setToSetupPose();
} }
public function get data () : SlotData { public function get data () : SlotData {
@ -58,7 +58,7 @@ public class Slot {
return skeleton.time - _attachmentTime; return skeleton.time - _attachmentTime;
} }
public function setToBindPose () : void { public function setToSetupPose () : void {
var slotIndex:int = skeleton.data.slots.indexOf(data); var slotIndex:int = skeleton.data.slots.indexOf(data);
r = _data.r; r = _data.r;
g = _data.g; g = _data.g;

View File

@ -53,7 +53,7 @@ void Bone_setYDown (int/*bool*/yDown);
Bone* Bone_create (BoneData* data, Bone* parent); Bone* Bone_create (BoneData* data, Bone* parent);
void Bone_dispose (Bone* self); void Bone_dispose (Bone* self);
void Bone_setToBindPose (Bone* self); void Bone_setToSetupPose (Bone* self);
void Bone_updateWorldTransform (Bone* self, int/*bool*/flipX, int/*bool*/flipY); void Bone_updateWorldTransform (Bone* self, int/*bool*/flipX, int/*bool*/flipY);

View File

@ -58,9 +58,9 @@ void Skeleton_dispose (Skeleton* self);
void Skeleton_updateWorldTransform (const Skeleton* self); void Skeleton_updateWorldTransform (const Skeleton* self);
void Skeleton_setToBindPose (const Skeleton* self); void Skeleton_setToSetupPose (const Skeleton* self);
void Skeleton_setBonesToBindPose (const Skeleton* self); void Skeleton_setBonesToSetupPose (const Skeleton* self);
void Skeleton_setSlotsToBindPose (const Skeleton* self); void Skeleton_setSlotsToSetupPose (const Skeleton* self);
/* Returns 0 if the bone was not found. */ /* Returns 0 if the bone was not found. */
Bone* Skeleton_findBone (const Skeleton* self, const char* boneName); Bone* Skeleton_findBone (const Skeleton* self, const char* boneName);

View File

@ -54,7 +54,7 @@ void Slot_setAttachment (Slot* self, Attachment* attachment);
void Slot_setAttachmentTime (Slot* self, float time); void Slot_setAttachmentTime (Slot* self, float time);
float Slot_getAttachmentTime (const Slot* self); float Slot_getAttachmentTime (const Slot* self);
void Slot_setToBindPose (Slot* self); void Slot_setToSetupPose (Slot* self);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -43,7 +43,7 @@ typedef struct {
SlotData* SlotData_create (const char* name, BoneData* boneData); SlotData* SlotData_create (const char* name, BoneData* boneData);
void SlotData_dispose (SlotData* self); void SlotData_dispose (SlotData* self);
/* @param attachmentName May be 0 for no bind pose attachment. */ /* @param attachmentName May be 0 for no setup pose attachment. */
void SlotData_setAttachmentName (SlotData* self, const char* attachmentName); void SlotData_setAttachmentName (SlotData* self, const char* attachmentName);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -41,7 +41,7 @@ Bone* Bone_create (BoneData* data, Bone* parent) {
Bone* self = NEW(Bone); Bone* self = NEW(Bone);
CONST_CAST(BoneData*, self->data) = data; CONST_CAST(BoneData*, self->data) = data;
CONST_CAST(Bone*, self->parent) = parent; CONST_CAST(Bone*, self->parent) = parent;
Bone_setToBindPose(self); Bone_setToSetupPose(self);
return self; return self;
} }
@ -49,7 +49,7 @@ void Bone_dispose (Bone* self) {
FREE(self); FREE(self);
} }
void Bone_setToBindPose (Bone* self) { void Bone_setToSetupPose (Bone* self) {
self->x = self->data->x; self->x = self->data->x;
self->y = self->data->y; self->y = self->data->y;
self->rotation = self->data->rotation; self->rotation = self->data->rotation;

View File

@ -104,21 +104,21 @@ void Skeleton_updateWorldTransform (const Skeleton* self) {
Bone_updateWorldTransform(self->bones[i], self->flipX, self->flipY); Bone_updateWorldTransform(self->bones[i], self->flipX, self->flipY);
} }
void Skeleton_setToBindPose (const Skeleton* self) { void Skeleton_setToSetupPose (const Skeleton* self) {
Skeleton_setBonesToBindPose(self); Skeleton_setBonesToSetupPose(self);
Skeleton_setSlotsToBindPose(self); Skeleton_setSlotsToSetupPose(self);
} }
void Skeleton_setBonesToBindPose (const Skeleton* self) { void Skeleton_setBonesToSetupPose (const Skeleton* self) {
int i; int i;
for (i = 0; i < self->boneCount; ++i) for (i = 0; i < self->boneCount; ++i)
Bone_setToBindPose(self->bones[i]); Bone_setToSetupPose(self->bones[i]);
} }
void Skeleton_setSlotsToBindPose (const Skeleton* self) { void Skeleton_setSlotsToSetupPose (const Skeleton* self) {
int i; int i;
for (i = 0; i < self->slotCount; ++i) for (i = 0; i < self->slotCount; ++i)
Slot_setToBindPose(self->slots[i]); Slot_setToSetupPose(self->slots[i]);
} }
Bone* Skeleton_findBone (const Skeleton* self, const char* boneName) { Bone* Skeleton_findBone (const Skeleton* self, const char* boneName) {

View File

@ -41,7 +41,7 @@ Slot* Slot_create (SlotData* data, Skeleton* skeleton, Bone* bone) {
CONST_CAST(SlotData*, self->data) = data; CONST_CAST(SlotData*, self->data) = data;
CONST_CAST(Skeleton*, self->skeleton) = skeleton; CONST_CAST(Skeleton*, self->skeleton) = skeleton;
CONST_CAST(Bone*, self->bone) = bone; CONST_CAST(Bone*, self->bone) = bone;
Slot_setToBindPose(self); Slot_setToSetupPose(self);
return self; return self;
} }
@ -62,7 +62,7 @@ float Slot_getAttachmentTime (const Slot* self) {
return self->skeleton->time - SUB_CAST(_Internal, self) ->attachmentTime; return self->skeleton->time - SUB_CAST(_Internal, self) ->attachmentTime;
} }
void Slot_setToBindPose (Slot* self) { void Slot_setToSetupPose (Slot* self) {
Attachment* attachment = 0; Attachment* attachment = 0;
self->r = self->data->r; self->r = self->data->r;
self->g = self->data->g; self->g = self->data->g;

View File

@ -56,9 +56,9 @@ Draws a skeleton.
// --- Convenience methods for common Skeleton_* functions. // --- Convenience methods for common Skeleton_* functions.
- (void) updateWorldTransform; - (void) updateWorldTransform;
- (void) setToBindPose; - (void) setToSetupPose;
- (void) setBonesToBindPose; - (void) setBonesToSetupPose;
- (void) setSlotsToBindPose; - (void) setSlotsToSetupPose;
/* Returns 0 if the bone was not found. */ /* Returns 0 if the bone was not found. */
- (Bone*) findBone:(NSString*)boneName; - (Bone*) findBone:(NSString*)boneName;

View File

@ -240,14 +240,14 @@
Skeleton_updateWorldTransform(_skeleton); Skeleton_updateWorldTransform(_skeleton);
} }
- (void) setToBindPose { - (void) setToSetupPose {
Skeleton_setToBindPose(_skeleton); Skeleton_setToSetupPose(_skeleton);
} }
- (void) setBonesToBindPose { - (void) setBonesToSetupPose {
Skeleton_setBonesToBindPose(_skeleton); Skeleton_setBonesToSetupPose(_skeleton);
} }
- (void) setSlotsToBindPose { - (void) setSlotsToSetupPose {
Skeleton_setSlotsToBindPose(_skeleton); Skeleton_setSlotsToSetupPose(_skeleton);
} }
- (Bone*) findBone:(NSString*)boneName { - (Bone*) findBone:(NSString*)boneName {

View File

@ -229,14 +229,14 @@ void CCSkeleton::updateWorldTransform () {
Skeleton_updateWorldTransform(skeleton); Skeleton_updateWorldTransform(skeleton);
} }
void CCSkeleton::setToBindPose () { void CCSkeleton::setToSetupPose () {
Skeleton_setToBindPose(skeleton); Skeleton_setToSetupPose(skeleton);
} }
void CCSkeleton::setBonesToBindPose () { void CCSkeleton::setBonesToSetupPose () {
Skeleton_setBonesToBindPose(skeleton); Skeleton_setBonesToSetupPose(skeleton);
} }
void CCSkeleton::setSlotsToBindPose () { void CCSkeleton::setSlotsToSetupPose () {
Skeleton_setSlotsToBindPose(skeleton); Skeleton_setSlotsToSetupPose(skeleton);
} }
Bone* CCSkeleton::findBone (const char* boneName) const { Bone* CCSkeleton::findBone (const char* boneName) const {

View File

@ -59,9 +59,9 @@ public:
// --- Convenience methods for common Skeleton_* functions. // --- Convenience methods for common Skeleton_* functions.
void updateWorldTransform (); void updateWorldTransform ();
void setToBindPose (); void setToSetupPose ();
void setBonesToBindPose (); void setBonesToSetupPose ();
void setSlotsToBindPose (); void setSlotsToSetupPose ();
/* Returns 0 if the bone was not found. */ /* Returns 0 if the bone was not found. */
Bone* findBone (const char* boneName) const; Bone* findBone (const char* boneName) const;

View File

@ -20,7 +20,7 @@ skeleton.flipX = false
skeleton.flipY = false skeleton.flipY = false
skeleton.debug = true -- Omit or set to false to not draw debug lines on top of the images. skeleton.debug = true -- Omit or set to false to not draw debug lines on top of the images.
if name == "goblins" then skeleton:setSkin("goblingirl") end if name == "goblins" then skeleton:setSkin("goblingirl") end
skeleton:setToBindPose() skeleton:setToSetupPose()
local lastTime = 0 local lastTime = 0
local animationTime = 0 local animationTime = 0

View File

@ -52,7 +52,7 @@ namespace Spine {
if (data == null) throw new ArgumentNullException("data cannot be null."); if (data == null) throw new ArgumentNullException("data cannot be null.");
Data = data; Data = data;
Parent = parent; Parent = parent;
SetToBindPose(); SetToSetupPose();
} }
/** Computes the world SRT using the parent bone and the local SRT. */ /** Computes the world SRT using the parent bone and the local SRT. */
@ -92,7 +92,7 @@ namespace Spine {
} }
} }
public void SetToBindPose () { public void SetToSetupPose () {
BoneData data = Data; BoneData data = Data;
X = data.X; X = data.X;
Y = data.Y; Y = data.Y;

View File

@ -80,22 +80,22 @@ namespace Spine {
bones[i].UpdateWorldTransform(flipX, flipY); bones[i].UpdateWorldTransform(flipX, flipY);
} }
/** Sets the bones and slots to their bind pose values. */ /** Sets the bones and slots to their setup pose values. */
public void SetToBindPose () { public void SetToSetupPose () {
SetBonesToBindPose(); SetBonesToSetupPose();
SetSlotsToBindPose(); SetSlotsToSetupPose();
} }
public void SetBonesToBindPose () { public void SetBonesToSetupPose () {
List<Bone> bones = this.Bones; List<Bone> bones = this.Bones;
for (int i = 0, n = bones.Count; i < n; i++) for (int i = 0, n = bones.Count; i < n; i++)
bones[i].SetToBindPose(); bones[i].SetToSetupPose();
} }
public void SetSlotsToBindPose () { public void SetSlotsToSetupPose () {
List<Slot> slots = this.Slots; List<Slot> slots = this.Slots;
for (int i = 0, n = slots.Count; i < n; i++) for (int i = 0, n = slots.Count; i < n; i++)
slots[i].SetToBindPose(i); slots[i].SetToSetupPose(i);
} }
/** @return May be null. */ /** @return May be null. */

View File

@ -30,7 +30,7 @@ namespace Spine {
public class SkeletonData { public class SkeletonData {
public String Name { get; set; } public String Name { get; set; }
public List<BoneData> Bones { get; private set; } // Ordered parents first. public List<BoneData> Bones { get; private set; } // Ordered parents first.
public List<SlotData> Slots { get; private set; } // Bind pose draw order. public List<SlotData> Slots { get; private set; } // Setup pose draw order.
public List<Skin> Skins { get; private set; } public List<Skin> Skins { get; private set; }
/** May be null. */ /** May be null. */
public Skin DefaultSkin; public Skin DefaultSkin;

View File

@ -64,10 +64,10 @@ namespace Spine {
Data = data; Data = data;
Skeleton = skeleton; Skeleton = skeleton;
Bone = bone; Bone = bone;
SetToBindPose(); SetToSetupPose();
} }
internal void SetToBindPose (int slotIndex) { internal void SetToSetupPose (int slotIndex) {
R = Data.R; R = Data.R;
G = Data.G; G = Data.G;
B = Data.B; B = Data.B;
@ -75,8 +75,8 @@ namespace Spine {
Attachment = Data.AttachmentName == null ? null : Skeleton.GetAttachment(slotIndex, Data.AttachmentName); Attachment = Data.AttachmentName == null ? null : Skeleton.GetAttachment(slotIndex, Data.AttachmentName);
} }
public void SetToBindPose () { public void SetToSetupPose () {
SetToBindPose(Skeleton.Data.Slots.IndexOf(Data)); SetToSetupPose(Skeleton.Data.Slots.IndexOf(Data));
} }
override public String ToString () { override public String ToString () {

1
spine-js/index.html Normal file
View File

@ -0,0 +1 @@
<script src="spine.js"></script>

1104
spine-js/spine.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,7 @@ public class Bone {
if (data == null) throw new IllegalArgumentException("data cannot be null."); if (data == null) throw new IllegalArgumentException("data cannot be null.");
this.data = data; this.data = data;
this.parent = parent; this.parent = parent;
setToBindPose(); setToSetupPose();
} }
/** Copy constructor. /** Copy constructor.
@ -95,7 +95,7 @@ public class Bone {
} }
} }
public void setToBindPose () { public void setToSetupPose () {
BoneData data = this.data; BoneData data = this.data;
x = data.x; x = data.x;
y = data.y; y = data.y;

View File

@ -101,22 +101,22 @@ public class Skeleton {
bones.get(i).updateWorldTransform(flipX, flipY); bones.get(i).updateWorldTransform(flipX, flipY);
} }
/** Sets the bones and slots to their bind pose values. */ /** Sets the bones and slots to their setup pose values. */
public void setToBindPose () { public void setToSetupPose () {
setBonesToBindPose(); setBonesToSetupPose();
setSlotsToBindPose(); setSlotsToSetupPose();
} }
public void setBonesToBindPose () { public void setBonesToSetupPose () {
Array<Bone> bones = this.bones; Array<Bone> bones = this.bones;
for (int i = 0, n = bones.size; i < n; i++) for (int i = 0, n = bones.size; i < n; i++)
bones.get(i).setToBindPose(); bones.get(i).setToSetupPose();
} }
public void setSlotsToBindPose () { public void setSlotsToSetupPose () {
Array<Slot> slots = this.slots; Array<Slot> slots = this.slots;
for (int i = 0, n = slots.size; i < n; i++) for (int i = 0, n = slots.size; i < n; i++)
slots.get(i).setToBindPose(i); slots.get(i).setToSetupPose(i);
} }
public SkeletonData getData () { public SkeletonData getData () {

View File

@ -30,7 +30,7 @@ import com.badlogic.gdx.utils.Array;
public class SkeletonData { public class SkeletonData {
String name; String name;
final Array<BoneData> bones = new Array(); // Ordered parents first. final Array<BoneData> bones = new Array(); // Ordered parents first.
final Array<SlotData> slots = new Array(); // Bind pose draw order. final Array<SlotData> slots = new Array(); // Setup pose draw order.
final Array<Skin> skins = new Array(); final Array<Skin> skins = new Array();
Skin defaultSkin; Skin defaultSkin;
final Array<Animation> animations = new Array(); final Array<Animation> animations = new Array();

View File

@ -52,7 +52,7 @@ public class Slot {
this.skeleton = skeleton; this.skeleton = skeleton;
this.bone = bone; this.bone = bone;
color = new Color(); color = new Color();
setToBindPose(); setToSetupPose();
} }
/** Copy constructor. */ /** Copy constructor. */
@ -105,13 +105,13 @@ public class Slot {
return skeleton.time - attachmentTime; return skeleton.time - attachmentTime;
} }
void setToBindPose (int slotIndex) { void setToSetupPose (int slotIndex) {
color.set(data.color); color.set(data.color);
setAttachment(data.attachmentName == null ? null : skeleton.getAttachment(slotIndex, data.attachmentName)); setAttachment(data.attachmentName == null ? null : skeleton.getAttachment(slotIndex, data.attachmentName));
} }
public void setToBindPose () { public void setToSetupPose () {
setToBindPose(skeleton.data.slots.indexOf(data, true)); setToSetupPose(skeleton.data.slots.indexOf(data, true));
} }
public String toString () { public String toString () {

View File

@ -68,7 +68,7 @@ public class MixTest extends ApplicationAdapter {
jumpAnimation = skeletonData.findAnimation("jump"); jumpAnimation = skeletonData.findAnimation("jump");
skeleton = new Skeleton(skeletonData); skeleton = new Skeleton(skeletonData);
skeleton.setToBindPose(); skeleton.setToSetupPose();
final Bone root = skeleton.getRootBone(); final Bone root = skeleton.getRootBone();
root.x = -50; root.x = -50;

View File

@ -88,7 +88,7 @@ public class SkeletonTest extends ApplicationAdapter {
skeleton = new Skeleton(skeletonData); skeleton = new Skeleton(skeletonData);
if (name.equals("goblins")) skeleton.setSkin("goblin"); if (name.equals("goblins")) skeleton.setSkin("goblin");
skeleton.setToBindPose(); skeleton.setToSetupPose();
skeleton = new Skeleton(skeleton); skeleton = new Skeleton(skeleton);
Bone root = skeleton.getRootBone(); Bone root = skeleton.getRootBone();
@ -103,7 +103,7 @@ public class SkeletonTest extends ApplicationAdapter {
if (keycode == Keys.SPACE) { if (keycode == Keys.SPACE) {
if (name.equals("goblins")) { if (name.equals("goblins")) {
skeleton.setSkin(skeleton.getSkin().getName().equals("goblin") ? "goblingirl" : "goblin"); skeleton.setSkin(skeleton.getSkin().getName().equals("goblin") ? "goblingirl" : "goblin");
skeleton.setSlotsToBindPose(); skeleton.setSlotsToSetupPose();
} }
} }
return true; return true;

View File

@ -41,7 +41,7 @@ skeleton.flipX = false
skeleton.flipY = false skeleton.flipY = false
skeleton.debugBones = true -- Omit or set to false to not draw debug lines on top of the images. skeleton.debugBones = true -- Omit or set to false to not draw debug lines on top of the images.
skeleton.debugSlots = false skeleton.debugSlots = false
skeleton:setToBindPose() skeleton:setToSetupPose()
local animationTime = 0 local animationTime = 0
function love.update (delta) function love.update (delta)

View File

@ -65,7 +65,7 @@ function Bone.new (data, parent)
end end
end end
function self:setToBindPose () function self:setToSetupPose ()
local data = self.data local data = self.data
self.x = data.x self.x = data.x
self.y = data.y self.y = data.y

View File

@ -44,20 +44,20 @@ function Skeleton.new (skeletonData)
end end
end end
function self:setToBindPose () function self:setToSetupPose ()
self:setBonesToBindPose() self:setBonesToSetupPose()
self:setSlotsToBindPose() self:setSlotsToSetupPose()
end end
function self:setBonesToBindPose () function self:setBonesToSetupPose ()
for i,bone in ipairs(self.bones) do for i,bone in ipairs(self.bones) do
bone:setToBindPose() bone:setToSetupPose()
end end
end end
function self:setSlotsToBindPose () function self:setSlotsToSetupPose ()
for i,slot in ipairs(self.slots) do for i,slot in ipairs(self.slots) do
slot:setToBindPose() slot:setToSetupPose()
end end
end end

View File

@ -55,7 +55,7 @@ function Slot.new (slotData, skeleton, bone)
return self.skeleton.time - self.attachmentTime return self.skeleton.time - self.attachmentTime
end end
function self:setToBindPose () function self:setToSetupPose ()
local data = self.data local data = self.data
self:setColor(data.r, data.g, data.b, data.a) self:setColor(data.r, data.g, data.b, data.a)
@ -67,7 +67,7 @@ function Slot.new (slotData, skeleton, bone)
self:setAttachment(attachment) self:setAttachment(attachment)
end end
self:setToBindPose() self:setToSetupPose()
return self return self
end end

View File

@ -50,7 +50,7 @@ void spineboy () {
Skeleton* skeleton = drawable->skeleton; Skeleton* skeleton = drawable->skeleton;
skeleton->flipX = false; skeleton->flipX = false;
skeleton->flipY = false; skeleton->flipY = false;
Skeleton_setToBindPose(skeleton); Skeleton_setToSetupPose(skeleton);
skeleton->root->x = 320; skeleton->root->x = 320;
skeleton->root->y = 420; skeleton->root->y = 420;
@ -108,7 +108,7 @@ void goblins () {
skeleton->flipX = false; skeleton->flipX = false;
skeleton->flipY = false; skeleton->flipY = false;
Skeleton_setSkinByName(skeleton, "goblin"); Skeleton_setSkinByName(skeleton, "goblin");
Skeleton_setSlotsToBindPose(skeleton); Skeleton_setSlotsToSetupPose(skeleton);
// Skeleton_setAttachment(skeleton, "left hand item", "dagger"); // Skeleton_setAttachment(skeleton, "left hand item", "dagger");
skeleton->root->x = 320; skeleton->root->x = 320;

View File

@ -96,11 +96,11 @@ public class SkeletonComponent : MonoBehaviour {
if (skinName == null || skinName.Length == 0) { if (skinName == null || skinName.Length == 0) {
if (skeleton.Skin != null) { if (skeleton.Skin != null) {
skeleton.SetSkin((Skin)null); skeleton.SetSkin((Skin)null);
skeleton.SetSlotsToBindPose(); skeleton.SetSlotsToSetupPose();
} }
} else if (skeleton.Skin == null || skinName != skeleton.Skin.Name) { } else if (skeleton.Skin == null || skinName != skeleton.Skin.Name) {
skeleton.SetSkin(skinName); skeleton.SetSkin(skinName);
skeleton.SetSlotsToBindPose(); skeleton.SetSlotsToSetupPose();
} }
UpdateAnimation(); UpdateAnimation();

View File

@ -64,7 +64,7 @@ namespace Spine {
SkeletonJson json = new SkeletonJson(atlas); SkeletonJson json = new SkeletonJson(atlas);
skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json")); skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json"));
if (name == "goblins") skeleton.SetSkin("goblingirl"); if (name == "goblins") skeleton.SetSkin("goblingirl");
skeleton.SetSlotsToBindPose(); // Without this the skin attachments won't be attached. See SetSkin. skeleton.SetSlotsToSetupPose(); // Without this the skin attachments won't be attached. See SetSkin.
// Define mixing between animations. // Define mixing between animations.
AnimationStateData stateData = new AnimationStateData(skeleton.Data); AnimationStateData stateData = new AnimationStateData(skeleton.Data);