mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-19 00:06:42 +08:00
[Lua] Fixed path constraint sorting and type check in case attachment of target is null. [cocos2dx] Fixed samples.
This commit is contained in:
parent
9f569fef3b
commit
b443e6e609
@ -56,7 +56,7 @@ bool BatchingExample::init () {
|
||||
// Load the skeleton data.
|
||||
spSkeletonJson* json = spSkeletonJson_createWithLoader(_attachmentLoader);
|
||||
json->scale = 0.6f; // Resizes skeleton data to 60% of the size it was in Spine.
|
||||
_skeletonData = spSkeletonJson_readSkeletonDataFile(json, "spineboy.json");
|
||||
_skeletonData = spSkeletonJson_readSkeletonDataFile(json, "spineboy-ess.json");
|
||||
CCASSERT(_skeletonData, json->error ? json->error : "Error reading skeleton data file.");
|
||||
spSkeletonJson_dispose(json);
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ Scene* CoinExample::scene () {
|
||||
bool CoinExample::init () {
|
||||
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
||||
|
||||
skeletonNode = SkeletonAnimation::createWithJsonFile("coin.json", "coin.atlas", 1);
|
||||
skeletonNode = SkeletonAnimation::createWithJsonFile("coin-pro.json", "coin.atlas", 1);
|
||||
skeletonNode->setAnimation(0, "rotate", true);
|
||||
|
||||
skeletonNode->setPosition(Vec2(_contentSize.width / 2, 100));
|
||||
|
||||
@ -43,7 +43,7 @@ Scene* GoblinsExample::scene () {
|
||||
bool GoblinsExample::init () {
|
||||
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
||||
|
||||
skeletonNode = SkeletonAnimation::createWithJsonFile("goblins-mesh.json", "goblins.atlas", 1.5f);
|
||||
skeletonNode = SkeletonAnimation::createWithJsonFile("goblins-pro.json", "goblins.atlas", 1.5f);
|
||||
skeletonNode->setAnimation(0, "walk", true);
|
||||
skeletonNode->setSkin("goblin");
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ Scene* RaptorExample::scene () {
|
||||
bool RaptorExample::init () {
|
||||
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
||||
|
||||
skeletonNode = SkeletonAnimation::createWithJsonFile("raptor.json", "raptor.atlas", 0.5f);
|
||||
skeletonNode = SkeletonAnimation::createWithJsonFile("raptor-pro.json", "raptor.atlas", 0.5f);
|
||||
skeletonNode->setAnimation(0, "walk", true);
|
||||
skeletonNode->setAnimation(1, "empty", false);
|
||||
skeletonNode->addAnimation(1, "gungrab", false, 2);
|
||||
|
||||
@ -43,7 +43,7 @@ Scene* SpineboyExample::scene () {
|
||||
bool SpineboyExample::init () {
|
||||
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
||||
|
||||
skeletonNode = SkeletonAnimation::createWithJsonFile("spineboy.json", "spineboy.atlas", 0.6f);
|
||||
skeletonNode = SkeletonAnimation::createWithJsonFile("spineboy-ess.json", "spineboy.atlas", 0.6f);
|
||||
|
||||
skeletonNode->setStartListener( [] (spTrackEntry* entry) {
|
||||
log("%d start: %s", entry->trackIndex, entry->animation->name);
|
||||
|
||||
@ -43,7 +43,7 @@ Scene* TankExample::scene () {
|
||||
bool TankExample::init () {
|
||||
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
||||
|
||||
skeletonNode = SkeletonAnimation::createWithJsonFile("tank.json", "tank.atlas", 0.5f);
|
||||
skeletonNode = SkeletonAnimation::createWithJsonFile("tank-pro.json", "tank.atlas", 0.5f);
|
||||
skeletonNode->setAnimation(0, "drive", true);
|
||||
|
||||
skeletonNode->setPosition(Vec2(_contentSize.width / 2 + 400, 20));
|
||||
|
||||
@ -90,7 +90,7 @@ end
|
||||
|
||||
function PathConstraint:update ()
|
||||
local attachment = self.target.attachment
|
||||
if not (attachment.type == AttachmentType.path) then return end
|
||||
if not attachment or not (attachment.type == AttachmentType.path) then return end
|
||||
|
||||
local rotateMix = self.rotateMix
|
||||
local translateMix = self.translateMix
|
||||
|
||||
@ -211,7 +211,7 @@ function Skeleton:sortPathConstraint(constraint)
|
||||
end
|
||||
|
||||
local attachment = slot.attachment
|
||||
if attachment.type == AttachmentType.path then self:sortPathConstraintAttachmentWith(attachment, slotBone) end
|
||||
if attachment and attachment.type == AttachmentType.path then self:sortPathConstraintAttachmentWith(attachment, slotBone) end
|
||||
|
||||
local constrained = constraint.bones
|
||||
for i,bone in ipairs(constrained) do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user