Prechádzať zdrojové kódy

[Lua] Fixed path constraint sorting and type check in case attachment of target is null. [cocos2dx] Fixed samples.

badlogic 8 rokov pred
rodič
commit
b443e6e609

+ 1 - 1
spine-cocos2dx/example/Classes/BatchingExample.cpp

@@ -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);
 

+ 1 - 1
spine-cocos2dx/example/Classes/CoinExample.cpp

@@ -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));

+ 1 - 1
spine-cocos2dx/example/Classes/GoblinsExample.cpp

@@ -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");
 

+ 1 - 1
spine-cocos2dx/example/Classes/RaptorExample.cpp

@@ -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);	

+ 1 - 1
spine-cocos2dx/example/Classes/SpineboyExample.cpp

@@ -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);

+ 1 - 1
spine-cocos2dx/example/Classes/TankExample.cpp

@@ -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));

+ 1 - 1
spine-lua/PathConstraint.lua

@@ -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

+ 1 - 1
spine-lua/Skeleton.lua

@@ -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