diff --git a/spine-corona/spine/Animation.lua b/spine-corona/spine/Animation.lua
index 7897931da..2b740cd06 100644
--- a/spine-corona/spine/Animation.lua
+++ b/spine-corona/spine/Animation.lua
@@ -138,6 +138,7 @@ function Animation.RotateTimeline.new ()
local self = Animation.CurveTimeline.new()
self.frames = {}
+ self.boneIndex = -1
function self:getDuration ()
return self.frames[#self.frames - 1]
@@ -207,6 +208,7 @@ function Animation.TranslateTimeline.new ()
local self = Animation.CurveTimeline.new()
self.frames = {}
+ self.boneIndex = -1
function self:getDuration ()
return self.frames[#self.frames - 2]
@@ -297,6 +299,7 @@ function Animation.ColorTimeline.new ()
local self = Animation.CurveTimeline.new()
self.frames = {}
+ self.slotIndex = -1
function self:getDuration ()
return self.frames[#self.frames - 4]
@@ -360,6 +363,7 @@ function Animation.AttachmentTimeline.new ()
local self = Animation.CurveTimeline.new()
self.frames = {}
self.attachmentNames = {}
+ self.slotName = nil
function self:getDuration ()
return self.frames[#self.frames]
diff --git a/spine-corona/spine/Skeleton.lua b/spine-corona/spine/Skeleton.lua
index 0dbe95ec4..d3a2ba00d 100644
--- a/spine-corona/spine/Skeleton.lua
+++ b/spine-corona/spine/Skeleton.lua
@@ -143,11 +143,11 @@ function Skeleton.new (skeletonData, group)
if not attachmentName then error("attachmentName cannot be nil.", 2) end
local slotIndex = self.data:findSlotIndex(slotName)
if slotIndex == -1 then error("Slot not found: " .. slotName, 2) end
+ if self.skin then return self.skin:getAttachment(slotIndex, attachmentName) end
if self.data.defaultSkin then
local attachment = self.data.defaultSkin:getAttachment(slotIndex, attachmentName)
if attachment then return attachment end
end
- if self.skin then return self.skin:getAttachment(slotIndex, attachmentName) end
return nil
end
diff --git a/spine-corona/spine/Slot.lua b/spine-corona/spine/Slot.lua
index 64c712cb5..9a1b754f4 100644
--- a/spine-corona/spine/Slot.lua
+++ b/spine-corona/spine/Slot.lua
@@ -47,7 +47,7 @@ function Slot.new (slotData, skeleton, bone)
self:setAttachment(attachment)
end
- self:setColor(255, 255, 255, 255)
+ self:setToBindPose()
return self
end
diff --git a/spine-cpp/.cproject b/spine-cpp/.cproject
index 3a8e10aed..b47094f53 100644
--- a/spine-cpp/.cproject
+++ b/spine-cpp/.cproject
@@ -31,7 +31,7 @@
-
+
diff --git a/spine-cpp/data/spineboy-walk.json b/spine-cpp/data/spineboy-walk.json
index efb640cbb..b40e53a95 100644
--- a/spine-cpp/data/spineboy-walk.json
+++ b/spine-cpp/data/spineboy-walk.json
@@ -274,27 +274,5 @@
{ "time": 1.0666, "angle": 3.6 }
]
}
-},
-"slots": {
- "torso": {
- "attachment": [
- { "time": 0.4333, "name": null },
- { "time": 0.8, "name": "torso" }
- ]
- },
- "head": {
- "color": [
- { "time": 0.1666, "color": "ffffffff" },
- { "time": 0.9333, "color": "ff0f00c1" }
- ]
- },
- "eyes": {
- "attachment": [
- { "time": 0.2, "name": "eyes-closed" },
- { "time": 0.3, "name": "eyes" },
- { "time": 0.7, "name": "eyes-closed" },
- { "time": 0.8333, "name": "eyes" }
- ]
- }
}
}
\ No newline at end of file
diff --git a/spine-cpp/includes/spine-sfml/Atlas.h b/spine-cpp/includes/spine-sfml/Atlas.h
index 14417152f..0d66f3521 100644
--- a/spine-cpp/includes/spine-sfml/Atlas.h
+++ b/spine-cpp/includes/spine-sfml/Atlas.h
@@ -8,9 +8,7 @@ namespace spine {
class AtlasPage: public BaseAtlasPage {
public:
- ~AtlasPage(){
- delete texture;
- }
+ ~AtlasPage ();
sf::Texture *texture;
};
@@ -34,7 +32,7 @@ public:
AtlasRegion* findRegion (const std::string &name);
private:
- virtual BaseAtlasPage* newAtlasPage (std::string name);
+ virtual BaseAtlasPage* newAtlasPage (const std::string &name);
virtual BaseAtlasRegion* newAtlasRegion (BaseAtlasPage* page);
};
diff --git a/spine-cpp/includes/spine-sfml/Skeleton.h b/spine-cpp/includes/spine-sfml/Skeleton.h
index 522e0d03b..f3aff4318 100644
--- a/spine-cpp/includes/spine-sfml/Skeleton.h
+++ b/spine-cpp/includes/spine-sfml/Skeleton.h
@@ -9,7 +9,7 @@ namespace spine {
class Skeleton: public BaseSkeleton, public sf::Drawable {
public:
sf::VertexArray vertexArray;
- sf::Texture *texture; // BOZO - This is ugly. Support multiple textures?
+ sf::Texture *texture; // This is a bit ugly and means all region attachments must use the same textures.
Skeleton (SkeletonData *skeletonData);
diff --git a/spine-cpp/includes/spine-sfml/SkeletonJson.h b/spine-cpp/includes/spine-sfml/SkeletonJson.h
index fc01e0623..5d848bb43 100644
--- a/spine-cpp/includes/spine-sfml/SkeletonJson.h
+++ b/spine-cpp/includes/spine-sfml/SkeletonJson.h
@@ -10,6 +10,7 @@ class Atlas;
class SkeletonJson: public BaseSkeletonJson {
public:
SkeletonJson (Atlas *atlas);
+ /** The SkeletonJson owns the attachmentLoader */
SkeletonJson (BaseAttachmentLoader *attachmentLoader);
};
diff --git a/spine-cpp/includes/spine/Animation.h b/spine-cpp/includes/spine/Animation.h
index acaa69958..5d134ccee 100644
--- a/spine-cpp/includes/spine/Animation.h
+++ b/spine-cpp/includes/spine/Animation.h
@@ -15,10 +15,10 @@ public:
float duration;
Animation (const std::vector &timelines, float duration);
- ~Animation();
+ ~Animation ();
- void apply (BaseSkeleton *skeleton, float time, bool loop);
- void mix (BaseSkeleton *skeleton, float time, bool loop, float alpha);
+ void apply (BaseSkeleton *skeleton, float time, bool loop) const;
+ void mix (BaseSkeleton *skeleton, float time, bool loop, float alpha) const;
};
//
@@ -28,11 +28,11 @@ public:
virtual ~Timeline () {
}
- virtual float getDuration () = 0;
+ virtual float getDuration () const = 0;
- virtual int getKeyframeCount () = 0;
+ virtual int getKeyframeCount () const = 0;
- virtual void apply (BaseSkeleton *skeleton, float time, float alpha) = 0;
+ virtual void apply (BaseSkeleton *skeleton, float time, float alpha) const = 0;
};
//
@@ -53,7 +53,7 @@ public:
* the difference between the keyframe's values. */
void setCurve (int keyframeIndex, float cx1, float cy1, float cx2, float cy2);
- float getCurvePercent (int keyframeIndex, float percent);
+ float getCurvePercent (int keyframeIndex, float percent) const;
};
//
@@ -67,9 +67,9 @@ public:
RotateTimeline (int keyframeCount);
virtual ~RotateTimeline ();
- virtual float getDuration ();
- virtual int getKeyframeCount ();
- virtual void apply (BaseSkeleton *skeleton, float time, float alpha);
+ virtual float getDuration () const;
+ virtual int getKeyframeCount () const;
+ virtual void apply (BaseSkeleton *skeleton, float time, float alpha) const;
void setKeyframe (int keyframeIndex, float time, float value);
};
@@ -85,9 +85,9 @@ public:
TranslateTimeline (int keyframeCount);
virtual ~TranslateTimeline ();
- virtual float getDuration ();
- virtual int getKeyframeCount ();
- virtual void apply (BaseSkeleton *skeleton, float time, float alpha);
+ virtual float getDuration () const;
+ virtual int getKeyframeCount () const;
+ virtual void apply (BaseSkeleton *skeleton, float time, float alpha) const;
void setKeyframe (int keyframeIndex, float time, float x, float y);
};
@@ -98,7 +98,7 @@ class ScaleTimeline: public TranslateTimeline {
public:
ScaleTimeline (int keyframeCount);
- virtual void apply (BaseSkeleton *skeleton, float time, float alpha);
+ virtual void apply (BaseSkeleton *skeleton, float time, float alpha) const;
};
//
@@ -112,9 +112,9 @@ public:
ColorTimeline (int keyframeCount);
virtual ~ColorTimeline ();
- virtual float getDuration ();
- virtual int getKeyframeCount ();
- virtual void apply (BaseSkeleton *skeleton, float time, float alpha);
+ virtual float getDuration () const;
+ virtual int getKeyframeCount () const;
+ virtual void apply (BaseSkeleton *skeleton, float time, float alpha) const;
void setKeyframe (int keyframeIndex, float time, float r, float g, float b, float a);
};
@@ -131,12 +131,13 @@ public:
AttachmentTimeline (int keyframeCount);
virtual ~AttachmentTimeline ();
- virtual float getDuration ();
- virtual int getKeyframeCount ();
- virtual void apply (BaseSkeleton *skeleton, float time, float alpha);
+ virtual float getDuration () const;
+ virtual int getKeyframeCount () const;
+ virtual void apply (BaseSkeleton *skeleton, float time, float alpha) const;
- /** @param attachmentName Pass an empty string to clear the image for a slot. */
- void setKeyframe (int keyframeIndex, float time, const std::string &attachmentName);
+ /** The AttachmentTimeline owns the attachmentName.
+ * @param attachmentName May be null to clear the image for a slot. */
+ void setKeyframe (int keyframeIndex, float time, std::string *attachmentName);
};
} /* namespace spine */
diff --git a/spine-cpp/includes/spine/BaseAtlas.h b/spine-cpp/includes/spine/BaseAtlas.h
index 46b677470..ff78bb612 100644
--- a/spine-cpp/includes/spine/BaseAtlas.h
+++ b/spine-cpp/includes/spine/BaseAtlas.h
@@ -4,7 +4,6 @@
#include
#include
#include
-#include